Hi Guys,
I am trying to run deepstream-app using RTSP. I am trying to access the frame in the tracking probe function in deepstream-app. I referred an earlier post :
https://devtalk.nvidia.com/default/topic/1058086/deepstream-sdk/how-to-run-rtp-camera-in-deepstream-on-nano/post/5374027/#5374027
From this post, I could understand that the color format of the frame is NvBufferColorFormat_NV12_709_ER which is YUV420 multi-planar.However, I am unable to understand the dataSize, pitch, width and height values got from NvBufSurfaceParams.
/**
* Buffer probe function after tracker.
*/
static GstPadProbeReturn
tracking_done_buf_prob (GstPad * pad, GstPadProbeInfo * info, gpointer u_data)
{
NvDsInstanceBin *bin = (NvDsInstanceBin *) u_data;
guint index = bin->index;
AppCtx *appCtx = bin->appCtx;
GstBuffer *buf = (GstBuffer *) info->data;
NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta (buf);
if (!batch_meta) {
NVGSTDS_WARN_MSG_V ("Batch meta not found for buffer %p", buf);
return GST_PAD_PROBE_OK;
}
GstMapInfo in_map_info;
NvBufSurface *surface = NULL;
memset (&in_map_info, 0, sizeof (in_map_info));
if (!gst_buffer_map (buf, &in_map_info, GST_MAP_READ)) {
g_print ("Error: Failed to map gst buffer\n");
}
surface = (NvBufSurface *) in_map_info.data;
int batch_size= surface->batchSize;
for(int i=0; i<batch_size; ++i)
{
uint32_t data_size = surface->surfaceList[i].dataSize;
uint32_t pitch = surface->surfaceList[i].pitch;
uint32_t width = surface->surfaceList[i].width;
uint32_t height = surface->surfaceList[i].height;
void *dataPtr = surface->surfaceList[i].dataPtr;
printf("Size of the frame buffer : %d\n",data_size);
printf("Pitch of the frame buffer : %d\n",pitch);
printf("width of the frame buffer : %d\n",width);
printf("height of the frame buffer : %d\n",height);
NvBufSurfaceColorFormat color_format= surface->surfaceList[i].colorFormat;
if (color_format == NVBUF_COLOR_FORMAT_NV12)
printf("color_format: NVBUF_COLOR_FORMAT_NV12 \n");
else if (color_format == NVBUF_COLOR_FORMAT_NV12_ER)
printf("color_format: NVBUF_COLOR_FORMAT_NV12_ER \n");
else if (color_format == NVBUF_COLOR_FORMAT_NV12_709)
printf("color_format: NVBUF_COLOR_FORMAT_NV12_709 \n");
else if (color_format == NVBUF_COLOR_FORMAT_NV12_709_ER)
printf("color_format: NVBUF_COLOR_FORMAT_NV12_709_ER \n");
}
/*
* Output KITTI labels with tracking ID if configured to do so.
*/
write_kitti_track_output(appCtx, batch_meta);
if (appCtx->primary_bbox_generated_cb)
appCtx->primary_bbox_generated_cb (appCtx, buf, batch_meta, index);
return GST_PAD_PROBE_OK;
}
Following is the output :
Size of the frame buffer : 1572864
Pitch of the frame buffer : 1280
width of the frame buffer : 1280
height of the frame buffer : 720
I am unable to comprehend what is going on. Kindly let me know where I am going wrong or is there any information which I am missing out on.
Thanks.