diff options
author | Alok Ahuja | 2011-04-23 22:29:13 -0700 |
---|---|---|
committer | Michael Niedermayer | 2011-05-21 17:23:29 +0200 |
commit | 8dd12b077b9f6c8437f387195feaefa806f93957 (patch) | |
tree | 1f99af5a956dfd0029d889d8d9555e675cfa4757 /libavformat/matroskaenc.c | |
parent | a38a00eddf200e18c6cf3ba090beaa3b224bd114 (diff) |
Create a stereo_mode metadata tag to specify the stereo 3d video layout using the StereoMode tag in a matroska/webm video track.
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r-- | libavformat/matroskaenc.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 387cead8cd..5ac2fd4896 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -586,6 +586,25 @@ static int mkv_write_tracks(AVFormatContext *s) // XXX: interlace flag? put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELWIDTH , codec->width); put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELHEIGHT, codec->height); + if ((tag = av_metadata_get(s->metadata, "stereo_mode", NULL, 0))) { + uint8_t stereo_fmt = atoi(tag->value); + int valid_fmt = 0; + + switch (mkv->mode) { + case MODE_WEBM: + if (stereo_fmt <= MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM + || stereo_fmt == MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT) + valid_fmt = 1; + break; + case MODE_MATROSKAv2: + if (stereo_fmt <= MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_RL) + valid_fmt = 1; + break; + } + + if (valid_fmt) + put_ebml_uint (pb, MATROSKA_ID_VIDEOSTEREOMODE, stereo_fmt); + } if (st->sample_aspect_ratio.num) { int d_width = codec->width*av_q2d(st->sample_aspect_ratio); put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYWIDTH , d_width); |