mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
gl: use gst_video_meta_set_alignment()
This commit is contained in:
parent
f9617bf3f4
commit
b418b4b6ec
3 changed files with 19 additions and 3 deletions
|
@ -314,12 +314,14 @@ _try_export_dmabuf (GstGLDownloadElement * download, GstBuffer * inbuf)
|
||||||
GstCaps *src_caps;
|
GstCaps *src_caps;
|
||||||
GstVideoInfo out_info;
|
GstVideoInfo out_info;
|
||||||
gsize total_offset;
|
gsize total_offset;
|
||||||
|
GstVideoAlignment *alig = NULL;
|
||||||
|
|
||||||
glmem = GST_GL_MEMORY_CAST (gst_buffer_peek_memory (inbuf, 0));
|
glmem = GST_GL_MEMORY_CAST (gst_buffer_peek_memory (inbuf, 0));
|
||||||
if (glmem) {
|
if (glmem) {
|
||||||
GstGLContext *context = GST_GL_BASE_MEMORY_CAST (glmem)->context;
|
GstGLContext *context = GST_GL_BASE_MEMORY_CAST (glmem)->context;
|
||||||
if (gst_gl_context_get_gl_platform (context) != GST_GL_PLATFORM_EGL)
|
if (gst_gl_context_get_gl_platform (context) != GST_GL_PLATFORM_EGL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
alig = &glmem->valign;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer = gst_buffer_new ();
|
buffer = gst_buffer_new ();
|
||||||
|
@ -361,9 +363,14 @@ _try_export_dmabuf (GstGLDownloadElement * download, GstBuffer * inbuf)
|
||||||
gst_video_info_from_caps (&out_info, src_caps);
|
gst_video_info_from_caps (&out_info, src_caps);
|
||||||
|
|
||||||
if (download->add_videometa) {
|
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->format, out_info.width, out_info.height,
|
||||||
out_info.finfo->n_planes, offset, stride);
|
out_info.finfo->n_planes, offset, stride);
|
||||||
|
|
||||||
|
if (alig)
|
||||||
|
gst_video_meta_set_alignment (meta, *alig);
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
gboolean match = TRUE;
|
gboolean match = TRUE;
|
||||||
|
|
|
@ -1470,6 +1470,8 @@ gst_gl_memory_setup_buffer (GstGLMemoryAllocator * allocator,
|
||||||
|| n_mem * views == n_wrapped_pointers, FALSE);
|
|| n_mem * views == n_wrapped_pointers, FALSE);
|
||||||
|
|
||||||
for (v = 0; v < views; v++) {
|
for (v = 0; v < views; v++) {
|
||||||
|
GstVideoMeta *meta;
|
||||||
|
|
||||||
for (i = 0; i < n_mem; i++) {
|
for (i = 0; i < n_mem; i++) {
|
||||||
GstGLMemory *gl_mem;
|
GstGLMemory *gl_mem;
|
||||||
|
|
||||||
|
@ -1498,11 +1500,14 @@ gst_gl_memory_setup_buffer (GstGLMemoryAllocator * allocator,
|
||||||
gst_buffer_append_memory (buffer, (GstMemory *) gl_mem);
|
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_FORMAT (params->v_info),
|
||||||
GST_VIDEO_INFO_WIDTH (params->v_info),
|
GST_VIDEO_INFO_WIDTH (params->v_info),
|
||||||
GST_VIDEO_INFO_HEIGHT (params->v_info), n_mem, params->v_info->offset,
|
GST_VIDEO_INFO_HEIGHT (params->v_info), n_mem, params->v_info->offset,
|
||||||
params->v_info->stride);
|
params->v_info->stride);
|
||||||
|
|
||||||
|
if (params->valign)
|
||||||
|
gst_video_meta_set_alignment (meta, *params->valign);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -1943,6 +1943,7 @@ _gen_buffer (GstGLViewConvert * viewconvert, GstBuffer ** target)
|
||||||
GstGLVideoAllocationParams *params;
|
GstGLVideoAllocationParams *params;
|
||||||
GstGLMemoryAllocator *mem_allocator;
|
GstGLMemoryAllocator *mem_allocator;
|
||||||
GstAllocator *allocator;
|
GstAllocator *allocator;
|
||||||
|
GstVideoMeta *meta;
|
||||||
|
|
||||||
*target = gst_buffer_new ();
|
*target = gst_buffer_new ();
|
||||||
|
|
||||||
|
@ -1962,13 +1963,16 @@ _gen_buffer (GstGLViewConvert * viewconvert, GstBuffer ** target)
|
||||||
gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
|
gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
|
||||||
gst_object_unref (allocator);
|
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_FORMAT (&viewconvert->out_info),
|
||||||
GST_VIDEO_INFO_WIDTH (&viewconvert->out_info),
|
GST_VIDEO_INFO_WIDTH (&viewconvert->out_info),
|
||||||
GST_VIDEO_INFO_HEIGHT (&viewconvert->out_info),
|
GST_VIDEO_INFO_HEIGHT (&viewconvert->out_info),
|
||||||
GST_VIDEO_INFO_N_PLANES (&viewconvert->out_info),
|
GST_VIDEO_INFO_N_PLANES (&viewconvert->out_info),
|
||||||
viewconvert->out_info.offset, viewconvert->out_info.stride);
|
viewconvert->out_info.offset, viewconvert->out_info.stride);
|
||||||
|
|
||||||
|
if (params->valign)
|
||||||
|
gst_video_meta_set_alignment (meta, *params->valign);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue