mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 09:41:07 +00:00
video-info-dma: add gst_video_info_dma_drm_to_video_info()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4883>
This commit is contained in:
parent
6accb7a1f5
commit
a10e05000d
3 changed files with 78 additions and 0 deletions
|
@ -11394,6 +11394,28 @@ info in @drm_info.</doc>
|
|||
</instance-parameter>
|
||||
</parameters>
|
||||
</method>
|
||||
<method name="to_video_info" c:identifier="gst_video_info_dma_drm_to_video_info" version="1.24">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/video-info-dma.c">Convert the #GstVideoInfoDmaDrm into a traditional #GstVideoInfo with
|
||||
recognized video format. For DMA kind memory, the non linear DMA format
|
||||
should be recognized as #GST_VIDEO_FORMAT_ENCODED. This helper function
|
||||
sets @info's video format into the default value according to @drm_info's
|
||||
drm_fourcc field.</doc>
|
||||
<source-position filename="../subprojects/gst-plugins-base/gst-libs/gst/video/video-info-dma.h"/>
|
||||
<return-value transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/video-info-dma.c">%TRUE if @info is converted correctly.</doc>
|
||||
<type name="gboolean" c:type="gboolean"/>
|
||||
</return-value>
|
||||
<parameters>
|
||||
<instance-parameter name="drm_info" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/video-info-dma.c">a #GstVideoInfoDmaDrm</doc>
|
||||
<type name="VideoInfoDmaDrm" c:type="const GstVideoInfoDmaDrm*"/>
|
||||
</instance-parameter>
|
||||
<parameter name="info" direction="out" caller-allocates="1" transfer-ownership="none">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/video-info-dma.c">#GstVideoInfo</doc>
|
||||
<type name="VideoInfo" c:type="GstVideoInfo*"/>
|
||||
</parameter>
|
||||
</parameters>
|
||||
</method>
|
||||
<function name="from_caps" c:identifier="gst_video_info_dma_drm_from_caps" version="1.24">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-base/gst-libs/gst/video/video-info-dma.c">Parse @caps and update @info. Please note that the @caps should be
|
||||
a dma drm caps. The gst_video_is_dma_drm_caps() can be used to verify
|
||||
|
|
|
@ -442,6 +442,57 @@ gst_video_info_dma_drm_from_video_info (GstVideoInfoDmaDrm * drm_info,
|
|||
GST_VIDEO_INFO_WIDTH (info), GST_VIDEO_INFO_HEIGHT (info));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_video_info_dma_drm_to_video_info:
|
||||
* @drm_info: a #GstVideoInfoDmaDrm
|
||||
* @info: (out caller-allocates): #GstVideoInfo
|
||||
*
|
||||
* Convert the #GstVideoInfoDmaDrm into a traditional #GstVideoInfo with
|
||||
* recognized video format. For DMA kind memory, the non linear DMA format
|
||||
* should be recognized as #GST_VIDEO_FORMAT_ENCODED. This helper function
|
||||
* sets @info's video format into the default value according to @drm_info's
|
||||
* drm_fourcc field.
|
||||
*
|
||||
* Returns: %TRUE if @info is converted correctly.
|
||||
*
|
||||
* Since: 1.24
|
||||
*/
|
||||
gboolean
|
||||
gst_video_info_dma_drm_to_video_info (const GstVideoInfoDmaDrm * drm_info,
|
||||
GstVideoInfo * info)
|
||||
{
|
||||
GstVideoFormat video_format;
|
||||
GstVideoInfo tmp_info;
|
||||
guint i;
|
||||
|
||||
g_return_val_if_fail (drm_info, FALSE);
|
||||
g_return_val_if_fail (info, FALSE);
|
||||
|
||||
if (GST_VIDEO_INFO_FORMAT (&drm_info->vinfo) != GST_VIDEO_FORMAT_ENCODED) {
|
||||
*info = drm_info->vinfo;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
video_format = gst_video_dma_drm_fourcc_to_format (drm_info->drm_fourcc);
|
||||
if (video_format == GST_VIDEO_FORMAT_UNKNOWN)
|
||||
return FALSE;
|
||||
|
||||
if (!gst_video_info_set_format (&tmp_info, video_format,
|
||||
GST_VIDEO_INFO_WIDTH (&drm_info->vinfo),
|
||||
GST_VIDEO_INFO_HEIGHT (&drm_info->vinfo)))
|
||||
return FALSE;
|
||||
|
||||
*info = drm_info->vinfo;
|
||||
info->finfo = tmp_info.finfo;
|
||||
for (i = 0; i < GST_VIDEO_MAX_PLANES; i++)
|
||||
info->stride[i] = tmp_info.stride[i];
|
||||
for (i = 0; i < GST_VIDEO_MAX_PLANES; i++)
|
||||
info->offset[i] = tmp_info.offset[i];
|
||||
info->size = tmp_info.size;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_video_dma_drm_fourcc_from_string:
|
||||
* @format_str: a drm format string
|
||||
|
|
|
@ -75,6 +75,11 @@ gboolean gst_video_info_dma_drm_from_video_info
|
|||
(GstVideoInfoDmaDrm * drm_info,
|
||||
const GstVideoInfo * info,
|
||||
guint64 modifier);
|
||||
|
||||
GST_VIDEO_API
|
||||
gboolean gst_video_info_dma_drm_to_video_info (const GstVideoInfoDmaDrm * drm_info,
|
||||
GstVideoInfo * info);
|
||||
|
||||
GST_VIDEO_API
|
||||
GstVideoInfoDmaDrm * gst_video_info_dma_drm_new_from_caps (const GstCaps * caps);
|
||||
|
||||
|
|
Loading…
Reference in a new issue