mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
matroskademux: Advertise codec-alpha in caps
This will be used to select the appropriate decoders. We also only attach the GstVideoCodecAlphaMeta if the AlphaMode element is set, this is to stay on the safe side and mimic what browsers (verified in Firefox and Chromium code) do. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/968>
This commit is contained in:
parent
b2e857efc6
commit
d877f7f816
3 changed files with 27 additions and 1 deletions
|
@ -1123,6 +1123,22 @@ gst_matroska_demux_parse_stream (GstMatroskaDemux * demux, GstEbmlRead * ebml,
|
|||
break;
|
||||
}
|
||||
|
||||
case GST_MATROSKA_ID_VIDEOALPHAMODE:
|
||||
{
|
||||
guint64 num;
|
||||
|
||||
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
||||
break;
|
||||
|
||||
GST_DEBUG_OBJECT (demux, "AlphaMode: %" G_GUINT64_FORMAT, num);
|
||||
|
||||
if (num == 1)
|
||||
videocontext->alpha_mode = TRUE;
|
||||
else
|
||||
videocontext->alpha_mode = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
GST_WARNING_OBJECT (demux,
|
||||
"Unknown TrackVideo subelement 0x%x - ignoring", id);
|
||||
|
@ -4982,7 +4998,9 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
|
|||
GST_FIXME_OBJECT (demux, "Fix block additions with laced buffers");
|
||||
|
||||
while ((blockadd = g_queue_pop_head (&additions))) {
|
||||
if (blockadd->id == 1
|
||||
GstMatroskaTrackVideoContext *videocontext =
|
||||
(GstMatroskaTrackVideoContext *) stream;
|
||||
if (blockadd->id == 1 && videocontext->alpha_mode
|
||||
&& (!strcmp (stream->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP8)
|
||||
|| !strcmp (stream->codec_id,
|
||||
GST_MATROSKA_CODEC_ID_VIDEO_VP9))) {
|
||||
|
@ -6577,9 +6595,13 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *
|
|||
*codec_name = g_strdup_printf ("Dirac");
|
||||
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP8)) {
|
||||
caps = gst_caps_new_empty_simple ("video/x-vp8");
|
||||
if (videocontext->alpha_mode)
|
||||
gst_caps_set_simple (caps, "codec-alpha", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||
*codec_name = g_strdup_printf ("On2 VP8");
|
||||
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP9)) {
|
||||
caps = gst_caps_new_empty_simple ("video/x-vp9");
|
||||
if (videocontext->alpha_mode)
|
||||
gst_caps_set_simple (caps, "codec-alpha", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||
*codec_name = g_strdup_printf ("On2 VP9");
|
||||
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_AV1)) {
|
||||
caps = gst_caps_new_empty_simple ("video/x-av1");
|
||||
|
|
|
@ -65,6 +65,7 @@ gst_matroska_track_init_video_context (GstMatroskaTrackContext ** p_context)
|
|||
video_context->earliest_time = GST_CLOCK_TIME_NONE;
|
||||
video_context->multiview_mode = GST_VIDEO_MULTIVIEW_MODE_NONE;
|
||||
video_context->multiview_flags = GST_VIDEO_MULTIVIEW_FLAGS_NONE;
|
||||
video_context->alpha_mode = FALSE;
|
||||
video_context->colorimetry.range = GST_VIDEO_COLOR_RANGE_UNKNOWN;
|
||||
video_context->colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_UNKNOWN;
|
||||
video_context->colorimetry.transfer = GST_VIDEO_TRANSFER_UNKNOWN;
|
||||
|
|
|
@ -135,6 +135,7 @@
|
|||
#define GST_MATROSKA_ID_VIDEOFIELDORDER 0x9D
|
||||
/* semi-draft */
|
||||
#define GST_MATROSKA_ID_VIDEOSTEREOMODE 0x53B8
|
||||
#define GST_MATROSKA_ID_VIDEOALPHAMODE 0x53C0
|
||||
#define GST_MATROSKA_ID_VIDEOASPECTRATIOTYPE 0x54B3
|
||||
#define GST_MATROSKA_ID_VIDEOCOLOURSPACE 0x2EB524
|
||||
/* semi-draft */
|
||||
|
@ -638,6 +639,8 @@ typedef struct _GstMatroskaTrackVideoContext {
|
|||
GstVideoMultiviewMode multiview_mode;
|
||||
GstVideoMultiviewFlags multiview_flags;
|
||||
|
||||
gboolean alpha_mode;
|
||||
|
||||
/* QoS */
|
||||
GstClockTime earliest_time;
|
||||
|
||||
|
|
Loading…
Reference in a new issue