Hi,
I used the deepstream-appsrc-test sample from DeepStream sample apps in C, where the GStreamer pipeline uses a appsrc element. This deepstream sample takes data from raw video file and transform it to GstBuffer.
However, my goal is to take AVFrame from libav (ffmpeg) and transform it to GstBuffer, but I can not find any solution.
Here is part of code from the deepstream-appsrc-test pushing the buffers from video file to appsrc:
typedef struct _AppSrcData
{
GstElement *app_source;
long frame_size;
FILE *file;
gint appsrc_frame_num;
guint fps;
guint sourceid;
} AppSrcData;static gboolean read_data (AppSrcData * data)
{
GstBuffer *buffer;
GstFlowReturn gstret;size_t ret = 0;
GstMapInfo map;
buffer = gst_buffer_new_allocate (NULL, data->frame_size, NULL);gst_buffer_map (buffer, &map, GST_MAP_WRITE);
// Read frame from raw video file.
ret = fread (map.data, 1, data->frame_size, data->file);
map.size = ret;gst_buffer_unmap (buffer, &map);
// Push buffer to appsrc element.
gstret = gst_app_src_push_buffer ((GstAppSrc *) data->app_source, buffer);data->appsrc_frame_num++;
return TRUE;
}
My question is, how to tranform data from AVFrame to GstBuffer, instead of video file to GstBuffer.
Setup:
• DeepStream Version 5.0