DeepStream--调试代码

发布时间:2024年01月09日

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);

未完待续。。。。。。

文章来源:https://blog.csdn.net/evsqiezi/article/details/135474551
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。