downloadelement: support dma_drm caps in try_export_dmabuf

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6792>
This commit is contained in:
Jakub Adam 2024-09-07 01:11:35 +02:00 committed by Nicolas Dufresne
parent 188b626ffc
commit 533d115659

View file

@ -1221,6 +1221,7 @@ _try_export_dmabuf (GstGLDownloadElement * download, GstBuffer * inbuf)
gsize offset[GST_VIDEO_MAX_PLANES];
gint stride[GST_VIDEO_MAX_PLANES];
GstCaps *src_caps;
GstVideoInfoDmaDrm out_info_drm;
GstVideoInfo out_info;
gsize total_offset;
GstVideoAlignment *alig = NULL;
@ -1233,6 +1234,11 @@ _try_export_dmabuf (GstGLDownloadElement * download, GstBuffer * inbuf)
alig = &glmem->valign;
}
src_caps = gst_pad_get_current_caps (GST_BASE_TRANSFORM (download)->srcpad);
if (!gst_video_info_dma_drm_from_caps (&out_info_drm, src_caps) ||
!gst_video_info_dma_drm_to_video_info (&out_info_drm, &out_info))
goto export_complete;
buffer = gst_buffer_new ();
total_offset = 0;
@ -1268,10 +1274,6 @@ _try_export_dmabuf (GstGLDownloadElement * download, GstBuffer * inbuf)
}
}
src_caps = gst_pad_get_current_caps (GST_BASE_TRANSFORM (download)->srcpad);
gst_video_info_from_caps (&out_info, src_caps);
gst_caps_unref (src_caps);
if (download->add_videometa) {
GstVideoMeta *meta;
@ -1298,6 +1300,7 @@ _try_export_dmabuf (GstGLDownloadElement * download, GstBuffer * inbuf)
}
export_complete:
gst_clear_caps (&src_caps);
return buffer;
}