mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
video: Fix gst_video_info_to_caps
And use the 0.10 caps style
This commit is contained in:
parent
a744c98985
commit
4f1e7eec40
1 changed files with 2 additions and 16 deletions
|
@ -1578,32 +1578,18 @@ GstCaps *
|
||||||
gst_video_info_to_caps (GstVideoInfo * info)
|
gst_video_info_to_caps (GstVideoInfo * info)
|
||||||
{
|
{
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
const gchar *capsname = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, NULL);
|
g_return_val_if_fail (info != NULL, NULL);
|
||||||
g_return_val_if_fail (info->finfo != NULL, NULL);
|
g_return_val_if_fail (info->finfo != NULL, NULL);
|
||||||
g_return_val_if_fail (info->finfo->format != GST_VIDEO_FORMAT_UNKNOWN, NULL);
|
g_return_val_if_fail (info->finfo->format != GST_VIDEO_FORMAT_UNKNOWN, NULL);
|
||||||
|
|
||||||
if (GST_VIDEO_INFO_IS_YUV (info))
|
caps = gst_video_format_new_caps_raw (GST_VIDEO_INFO_FORMAT (info));
|
||||||
capsname = "video/x-raw-yuv";
|
|
||||||
else if (GST_VIDEO_INFO_IS_RGB (info))
|
|
||||||
capsname = "video/x-raw-rgb";
|
|
||||||
else if (GST_VIDEO_INFO_IS_GRAY (info))
|
|
||||||
capsname = "video/x-raw-gray";
|
|
||||||
|
|
||||||
caps = gst_caps_new_simple (capsname,
|
gst_caps_set_simple (caps,
|
||||||
"width", G_TYPE_INT, info->width,
|
"width", G_TYPE_INT, info->width,
|
||||||
"height", G_TYPE_INT, info->height,
|
"height", G_TYPE_INT, info->height,
|
||||||
"pixel-aspect-ratio", GST_TYPE_FRACTION, info->par_n, info->par_d, NULL);
|
"pixel-aspect-ratio", GST_TYPE_FRACTION, info->par_n, info->par_d, NULL);
|
||||||
|
|
||||||
if (GST_VIDEO_INFO_IS_YUV (info))
|
|
||||||
gst_caps_set_simple (caps, "format", GST_TYPE_FOURCC,
|
|
||||||
gst_video_format_to_fourcc (info->finfo->format), NULL);
|
|
||||||
else if (GST_VIDEO_INFO_IS_RGB (info) || GST_VIDEO_INFO_IS_GRAY (info))
|
|
||||||
gst_caps_set_simple (caps, "depth", G_TYPE_INT,
|
|
||||||
info->finfo->bits * GST_VIDEO_INFO_N_COMPONENTS (info), NULL);
|
|
||||||
|
|
||||||
|
|
||||||
gst_caps_set_simple (caps, "interlaced", G_TYPE_BOOLEAN,
|
gst_caps_set_simple (caps, "interlaced", G_TYPE_BOOLEAN,
|
||||||
GST_VIDEO_INFO_IS_INTERLACED (info), NULL);
|
GST_VIDEO_INFO_IS_INTERLACED (info), NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue