diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index a1e5d1c9e4..ca74c86c63 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -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"); diff --git a/gst/matroska/matroska-ids.c b/gst/matroska/matroska-ids.c index 3722822b19..633171fa10 100644 --- a/gst/matroska/matroska-ids.c +++ b/gst/matroska/matroska-ids.c @@ -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; diff --git a/gst/matroska/matroska-ids.h b/gst/matroska/matroska-ids.h index 8d4a685a91..ba44f104b0 100644 --- a/gst/matroska/matroska-ids.h +++ b/gst/matroska/matroska-ids.h @@ -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;