diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2021-03-22 16:58:26 -0400 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2021-05-11 16:06:44 -0400 |
commit | b2e857efc67c474862c8ce3c5aa2dffbfec31015 (patch) | |
tree | 629af50515233adaa013d6fa781a4ce289da4b26 /gst | |
parent | b84bad6ac35d72810cc48f1a76206fcfc7baeedc (diff) |
matroskademux: Store alpha stream in VideoCodecAlphaMeta
This generalize the feature over using mini object quark data. If
that feature was Matroska specifc, using the new CustomMeta would have
been enough and arguably cleaner then QData, though it seems that
similar technique is use with AV1 Image Format (AVIF).
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/968>
Diffstat (limited to 'gst')
-rw-r--r-- | gst/matroska/matroska-demux.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index 05266a11b..a1e5d1c9e 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -64,6 +64,7 @@ #include <gst/audio/audio.h> #include <gst/tag/tag.h> #include <gst/pbutils/pbutils.h> +#include <gst/video/gstvideocodecalphameta.h> #include <gst/video/video.h> #include "gstmatroskaelements.h" @@ -4982,14 +4983,20 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux, while ((blockadd = g_queue_pop_head (&additions))) { if (blockadd->id == 1 - && !strcmp (stream->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP8)) { - GST_TRACE_OBJECT (demux, "adding block addition %u as VP8 alpha " - "qdata to buffer %p, %u bytes", (guint) blockadd->id, buf, + && (!strcmp (stream->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP8) + || !strcmp (stream->codec_id, + GST_MATROSKA_CODEC_ID_VIDEO_VP9))) { + GstBuffer *alpha_buffer; + + GST_TRACE_OBJECT (demux, "adding block addition %u as VP8/VP9 " + "alpha meta to buffer %p, %u bytes", (guint) blockadd->id, buf, (guint) blockadd->size); - gst_mini_object_set_qdata (GST_MINI_OBJECT (sub), - matroska_block_additional_quark, - g_bytes_new_take (blockadd->data, blockadd->size), - (GDestroyNotify) g_bytes_unref); + + alpha_buffer = gst_buffer_new_wrapped (blockadd->data, + blockadd->size); + gst_buffer_copy_into (alpha_buffer, sub, + GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1); + gst_buffer_add_video_codec_alpha_meta (sub, alpha_buffer); } else { g_free (blockadd->data); } |