1. 加probe
//回调函数
static GstPadProbeReturn
osd_sink_pad_buffer_probe (GstPad * pad, GstPadProbeInfo * info,
gpointer u_data)
{
GstBuffer *buf = (GstBuffer *) info->data;
guint num_rects = 0;
NvDsObjectMeta *obj_meta = NULL;
guint vehicle_count = 0;
guint person_count = 0;
NvDsMetaList * l_frame = NULL;
NvDsMetaList * l_obj = NULL;
NvDsDisplayMeta *display_meta = NULL;
printf("in osd_sink_pad_buffer_probe\n");
NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta (buf);
printf("in cb, frame size:%d\n", g_list_length(batch_meta->frame_meta_list));
for (l_frame = batch_meta->frame_meta_list; l_frame != NULL;
l_frame = l_frame->next) {
NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) (l_frame->data);
printf("srcid:%d\n", frame_meta->source_id);
}
}
//设置probe函数
GstPad * osd_sink_pad = gst_element_get_static_pad (pipeline->instance_bins[0].sink_bin.sub_bins[0].encoder, "src");
if (!osd_sink_pad)
g_print ("Unable to get sink pad\n");
else
gst_pad_add_probe (osd_sink_pad, GST_PAD_PROBE_TYPE_BUFFER,
osd_sink_pad_buffer_probe, NULL, NULL);
gst_object_unref (osd_sink_pad);
未完待续。。。。。。