mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 07:28:53 +00:00
matroskademux: Use GstVideoInfo helper to create caps for raw video
This way we do not miss mandatory fields in caps. At the same time use the gst_pb_utils_get_codec_description helper to get codec description. https://bugzilla.gnome.org/show_bug.cgi?id=712328
This commit is contained in:
parent
1fc591238b
commit
6ff7522ba2
2 changed files with 14 additions and 13 deletions
|
@ -32,6 +32,7 @@ libgstmatroska_la_LIBADD = \
|
||||||
$(GST_PLUGINS_BASE_LIBS) \
|
$(GST_PLUGINS_BASE_LIBS) \
|
||||||
-lgstriff-@GST_API_VERSION@ \
|
-lgstriff-@GST_API_VERSION@ \
|
||||||
-lgstaudio-@GST_API_VERSION@ \
|
-lgstaudio-@GST_API_VERSION@ \
|
||||||
|
-lgstvideo-@GST_API_VERSION@ \
|
||||||
-lgsttag-@GST_API_VERSION@ \
|
-lgsttag-@GST_API_VERSION@ \
|
||||||
-lgstpbutils-@GST_API_VERSION@ \
|
-lgstpbutils-@GST_API_VERSION@ \
|
||||||
$(GST_BASE_LIBS) \
|
$(GST_BASE_LIBS) \
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
#include <gst/audio/audio.h>
|
#include <gst/audio/audio.h>
|
||||||
#include <gst/tag/tag.h>
|
#include <gst/tag/tag.h>
|
||||||
#include <gst/pbutils/pbutils.h>
|
#include <gst/pbutils/pbutils.h>
|
||||||
|
#include <gst/video/video.h>
|
||||||
|
|
||||||
#include "matroska-demux.h"
|
#include "matroska-demux.h"
|
||||||
#include "matroska-ids.h"
|
#include "matroska-ids.h"
|
||||||
|
@ -5021,28 +5022,25 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *
|
||||||
g_free (vids);
|
g_free (vids);
|
||||||
}
|
}
|
||||||
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED)) {
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED)) {
|
||||||
const gchar *format = NULL;
|
GstVideoInfo info;
|
||||||
|
GstVideoFormat format;
|
||||||
|
|
||||||
|
gst_video_info_init (&info);
|
||||||
switch (videocontext->fourcc) {
|
switch (videocontext->fourcc) {
|
||||||
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
|
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
|
||||||
*codec_name = g_strdup ("Raw planar YUV 4:2:0");
|
format = GST_VIDEO_FORMAT_I420;
|
||||||
format = "I420";
|
|
||||||
break;
|
break;
|
||||||
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
|
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
|
||||||
*codec_name = g_strdup ("Raw packed YUV 4:2:2");
|
format = GST_VIDEO_FORMAT_YUY2;
|
||||||
format = "YUY2";
|
|
||||||
break;
|
break;
|
||||||
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
|
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
|
||||||
*codec_name = g_strdup ("Raw packed YUV 4:2:0");
|
format = GST_VIDEO_FORMAT_YV12;
|
||||||
format = "YV12";
|
|
||||||
break;
|
break;
|
||||||
case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
|
case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
|
||||||
*codec_name = g_strdup ("Raw packed YUV 4:2:2");
|
format = GST_VIDEO_FORMAT_UYVY;
|
||||||
format = "UYVY";
|
|
||||||
break;
|
break;
|
||||||
case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
|
case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
|
||||||
*codec_name = g_strdup ("Raw packed YUV 4:4:4 with alpha channel");
|
format = GST_VIDEO_FORMAT_AYUV;
|
||||||
format = "AYUV";
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -5051,8 +5049,10 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("video/x-raw",
|
gst_video_info_set_format (&info, format, videocontext->pixel_width,
|
||||||
"format", G_TYPE_STRING, format, NULL);
|
videocontext->pixel_height);
|
||||||
|
caps = gst_video_info_to_caps (&info);
|
||||||
|
*codec_name = gst_pb_utils_get_codec_description (caps);
|
||||||
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP)) {
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP)) {
|
||||||
caps = gst_caps_new_simple ("video/x-divx",
|
caps = gst_caps_new_simple ("video/x-divx",
|
||||||
"divxversion", G_TYPE_INT, 4, NULL);
|
"divxversion", G_TYPE_INT, 4, NULL);
|
||||||
|
|
Loading…
Reference in a new issue