diff options
author | Kirill Gavrilov <gavr.mail@gmail.com> | 2011-05-21 17:14:14 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-05-21 17:23:30 +0200 |
commit | e6ec9212c543c77ab3ddab90ac52021cfbbdac17 (patch) | |
tree | 1ba4103f406b5cb0e8213d9b625f16ca0b7bad79 /libavformat/matroskaenc.c | |
parent | 69a83da5d40833e20da07830eda8ecbc31735116 (diff) | |
download | ffmpeg-e6ec9212c543c77ab3ddab90ac52021cfbbdac17.tar.gz |
matroska: switch stereo mode from int to string and add support in the demuxer too
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r-- | libavformat/matroskaenc.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 564b7509c1..0fe760b684 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -586,10 +586,45 @@ 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); + + if ((tag = av_metadata_get(st->metadata, "STEREO_MODE", NULL, 0)) || + (tag = av_metadata_get( s->metadata, "STEREO_MODE", NULL, 0))) { + // save stereomode flag + uint64_t stereo_fmt = -1; int valid_fmt = 0; + if (!strcmp(tag->value, "mono")) { + stereo_fmt = MATROSKA_VIDEO_STEREOMODE_MONO; + } else if (!strcmp(tag->value, "left_right")) { + stereo_fmt = MATROSKA_VIDEO_STEREOMODE_LEFT_RIGHT; + } else if (!strcmp(tag->value, "bottom_top")) { + stereo_fmt = MATROSKA_VIDEO_STEREOMODE_BOTTOM_TOP; + } else if (!strcmp(tag->value, "top_bottom")) { + stereo_fmt = MATROSKA_VIDEO_STEREOMODE_TOP_BOTTOM; + } else if (!strcmp(tag->value, "checkerboard_rl")) { + stereo_fmt = MATROSKA_VIDEO_STEREOMODE_CHECKERBOARD_RL; + } else if (!strcmp(tag->value, "checkerboard_lr")) { + stereo_fmt = MATROSKA_VIDEO_STEREOMODE_CHECKERBOARD_LR; + } else if (!strcmp(tag->value, "row_interleaved_rl")) { + stereo_fmt = MATROSKA_VIDEO_STEREOMODE_ROW_INTERLEAVED_RL; + } else if (!strcmp(tag->value, "row_interleaved_lr")) { + stereo_fmt = MATROSKA_VIDEO_STEREOMODE_ROW_INTERLEAVED_LR; + } else if (!strcmp(tag->value, "col_interleaved_rl")) { + stereo_fmt = MATROSKA_VIDEO_STEREOMODE_COL_INTERLEAVED_RL; + } else if (!strcmp(tag->value, "col_interleaved_lr")) { + stereo_fmt = MATROSKA_VIDEO_STEREOMODE_COL_INTERLEAVED_LR; + } else if (!strcmp(tag->value, "anaglyph_cyan_red")) { + stereo_fmt = MATROSKA_VIDEO_STEREOMODE_ANAGLYPH_CYAN_RED; + } else if (!strcmp(tag->value, "right_left")) { + stereo_fmt = MATROSKA_VIDEO_STEREOMODE_RIGHT_LEFT; + } else if (!strcmp(tag->value, "anaglyph_green_magenta")) { + stereo_fmt = MATROSKA_VIDEO_STEREOMODE_ANAGLYPH_GREEN_MAG; + } else if (!strcmp(tag->value, "block_lr")) { + stereo_fmt = MATROSKA_VIDEO_STEREOMODE_BOTH_EYES_BLOCK_LR; + } else if (!strcmp(tag->value, "block_rl")) { + stereo_fmt = MATROSKA_VIDEO_STEREOMODE_BOTH_EYES_BLOCK_RL; + } + switch (mkv->mode) { case MODE_WEBM: if (stereo_fmt <= MATROSKA_VIDEO_STEREOMODE_TOP_BOTTOM |