aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/matroskaenc.c
diff options
context:
space:
mode:
authorAlok Ahuja <waveletcoeff@gmail.com>2011-05-28 08:12:22 +0200
committerReinhard Tartler <siretart@tauware.de>2011-05-28 12:15:55 +0200
commit945dda41a2085b3c8fb5cf99026c224aa3d2cbfa (patch)
tree4946dfc597cff0b5c2e8a599d933d629070d065a /libavformat/matroskaenc.c
parentf91ccb1df6fe6d043bd88eabc916be1093b6677b (diff)
downloadffmpeg-945dda41a2085b3c8fb5cf99026c224aa3d2cbfa.tar.gz
webm: support stereo videos in matroska/webm muxer
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.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 1bbabc9ff4..ba2ce28e17 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);