gl: use gst_video_meta_set_alignment()

This commit is contained in:
Guillaume Desmottes 2019-07-23 11:49:07 +05:30
parent f9617bf3f4
commit b418b4b6ec
3 changed files with 19 additions and 3 deletions

View file

@ -314,12 +314,14 @@ _try_export_dmabuf (GstGLDownloadElement * download, GstBuffer * inbuf)
GstCaps *src_caps;
GstVideoInfo out_info;
gsize total_offset;
GstVideoAlignment *alig = NULL;
glmem = GST_GL_MEMORY_CAST (gst_buffer_peek_memory (inbuf, 0));
if (glmem) {
GstGLContext *context = GST_GL_BASE_MEMORY_CAST (glmem)->context;
if (gst_gl_context_get_gl_platform (context) != GST_GL_PLATFORM_EGL)
return NULL;
alig = &glmem->valign;
}
buffer = gst_buffer_new ();
@ -361,9 +363,14 @@ _try_export_dmabuf (GstGLDownloadElement * download, GstBuffer * inbuf)
gst_video_info_from_caps (&out_info, src_caps);
if (download->add_videometa) {
gst_buffer_add_video_meta_full (buffer, GST_VIDEO_FRAME_FLAG_NONE,
GstVideoMeta *meta;
meta = gst_buffer_add_video_meta_full (buffer, GST_VIDEO_FRAME_FLAG_NONE,
out_info.finfo->format, out_info.width, out_info.height,
out_info.finfo->n_planes, offset, stride);
if (alig)
gst_video_meta_set_alignment (meta, *alig);
} else {
int i;
gboolean match = TRUE;

View file

@ -1470,6 +1470,8 @@ gst_gl_memory_setup_buffer (GstGLMemoryAllocator * allocator,
|| n_mem * views == n_wrapped_pointers, FALSE);
for (v = 0; v < views; v++) {
GstVideoMeta *meta;
for (i = 0; i < n_mem; i++) {
GstGLMemory *gl_mem;
@ -1498,11 +1500,14 @@ gst_gl_memory_setup_buffer (GstGLMemoryAllocator * allocator,
gst_buffer_append_memory (buffer, (GstMemory *) gl_mem);
}
gst_buffer_add_video_meta_full (buffer, v,
meta = gst_buffer_add_video_meta_full (buffer, v,
GST_VIDEO_INFO_FORMAT (params->v_info),
GST_VIDEO_INFO_WIDTH (params->v_info),
GST_VIDEO_INFO_HEIGHT (params->v_info), n_mem, params->v_info->offset,
params->v_info->stride);
if (params->valign)
gst_video_meta_set_alignment (meta, *params->valign);
}
return TRUE;

View file

@ -1943,6 +1943,7 @@ _gen_buffer (GstGLViewConvert * viewconvert, GstBuffer ** target)
GstGLVideoAllocationParams *params;
GstGLMemoryAllocator *mem_allocator;
GstAllocator *allocator;
GstVideoMeta *meta;
*target = gst_buffer_new ();
@ -1962,13 +1963,16 @@ _gen_buffer (GstGLViewConvert * viewconvert, GstBuffer ** target)
gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
gst_object_unref (allocator);
gst_buffer_add_video_meta_full (*target, 0,
meta = gst_buffer_add_video_meta_full (*target, 0,
GST_VIDEO_INFO_FORMAT (&viewconvert->out_info),
GST_VIDEO_INFO_WIDTH (&viewconvert->out_info),
GST_VIDEO_INFO_HEIGHT (&viewconvert->out_info),
GST_VIDEO_INFO_N_PLANES (&viewconvert->out_info),
viewconvert->out_info.offset, viewconvert->out_info.stride);
if (params->valign)
gst_video_meta_set_alignment (meta, *params->valign);
return TRUE;
}