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@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Vignesh Venkatasubramanian 2013-02-04 15:17:52 -08:00 committed by Michael Niedermayer
parent 2f3bc51228
commit ce6a8e5947
2 changed files with 7 additions and 0 deletions

View File

@ -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

View File

@ -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];