[FFmpeg-cvslog] Adding AlphaMode element to Matroska Parser

Vignesh Venkatasubramanian git at videolan.org
Thu Feb 14 21:42:56 CET 2013


ffmpeg | branch: master | Vignesh Venkatasubramanian <vigneshv at google.com> | Mon Feb  4 15:17:52 2013 -0800| [ce6a8e5947cabf90720fe0763301e1657252dbec] | committer: Michael Niedermayer

Adding AlphaMode element to Matroska Parser

Adding support for parsing AlphaMode element in the Track header
and export that information as a metadata tag. This flag indicates
presence of alpha channel data in BlockAdditional element.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv at google.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ce6a8e5947cabf90720fe0763301e1657252dbec
---

 libavformat/matroska.h    |    1 +
 libavformat/matroskadec.c |    6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 769fe54..8e6f8cc 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -118,6 +118,7 @@
 #define MATROSKA_ID_VIDEODISPLAYUNIT 0x54B2
 #define MATROSKA_ID_VIDEOFLAGINTERLACED 0x9A
 #define MATROSKA_ID_VIDEOSTEREOMODE 0x53B8
+#define MATROSKA_ID_VIDEOALPHAMODE 0x53C0
 #define MATROSKA_ID_VIDEOASPECTRATIO 0x54B3
 #define MATROSKA_ID_VIDEOCOLORSPACE 0x2EB524
 
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 3519a13..d2e5329 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -116,6 +116,7 @@ typedef struct {
     uint64_t pixel_height;
     EbmlBin color_space;
     uint64_t stereo_mode;
+    uint64_t alpha_mode;
 } MatroskaTrackVideo;
 
 typedef struct {
@@ -320,6 +321,7 @@ static EbmlSyntax matroska_track_video[] = {
     { MATROSKA_ID_VIDEOPIXELHEIGHT,   EBML_UINT, 0, offsetof(MatroskaTrackVideo,pixel_height) },
     { MATROSKA_ID_VIDEOCOLORSPACE,    EBML_BIN,  0, offsetof(MatroskaTrackVideo,color_space) },
     { MATROSKA_ID_VIDEOSTEREOMODE,    EBML_UINT, 0, offsetof(MatroskaTrackVideo,stereo_mode) },
+    { MATROSKA_ID_VIDEOALPHAMODE,     EBML_UINT, 0, offsetof(MatroskaTrackVideo,alpha_mode) },
     { MATROSKA_ID_VIDEOPIXELCROPB,    EBML_NONE },
     { MATROSKA_ID_VIDEOPIXELCROPT,    EBML_NONE },
     { MATROSKA_ID_VIDEOPIXELCROPL,    EBML_NONE },
@@ -1786,6 +1788,10 @@ static int matroska_read_header(AVFormatContext *s)
             if (track->video.stereo_mode && track->video.stereo_mode < MATROSKA_VIDEO_STEREO_MODE_COUNT)
                 av_dict_set(&st->metadata, "stereo_mode", ff_matroska_video_stereo_mode[track->video.stereo_mode], 0);
 
+            /* export alpha mode flag as metadata tag  */
+            if (track->video.alpha_mode)
+                av_dict_set(&st->metadata, "alpha_mode", "1", 0);
+
             /* if we have virtual track, mark the real tracks */
             for (j=0; j < track->operation.combine_planes.nb_elem; j++) {
                 char buf[32];



More information about the ffmpeg-cvslog mailing list