mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-24 12:09:55 +00:00
Create a stereo_mode metadata tag to specify the stereo 3d video layout using the StereoMode tag in a matroska/webm video track.
This commit is contained in:
parent
a38a00eddf
commit
8dd12b077b
@ -111,7 +111,7 @@
|
||||
#define MATROSKA_ID_VIDEOPIXELCROPR 0x54DD
|
||||
#define MATROSKA_ID_VIDEODISPLAYUNIT 0x54B2
|
||||
#define MATROSKA_ID_VIDEOFLAGINTERLACED 0x9A
|
||||
#define MATROSKA_ID_VIDEOSTEREOMODE 0x53B9
|
||||
#define MATROSKA_ID_VIDEOSTEREOMODE 0x53B8
|
||||
#define MATROSKA_ID_VIDEOASPECTRATIO 0x54B3
|
||||
#define MATROSKA_ID_VIDEOCOLORSPACE 0x2EB524
|
||||
|
||||
@ -218,6 +218,24 @@ typedef enum {
|
||||
MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP = 3,
|
||||
} MatroskaTrackEncodingCompAlgo;
|
||||
|
||||
typedef enum {
|
||||
MATROSKA_VIDEO_STEREOMODE_TYPE_MONO = 0,
|
||||
MATROSKA_VIDEO_STEREOMODE_TYPE_LEFT_RIGHT = 1,
|
||||
MATROSKA_VIDEO_STEREOMODE_TYPE_BOTTOM_TOP = 2,
|
||||
MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM = 3,
|
||||
MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_RL = 4,
|
||||
MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_LR = 5,
|
||||
MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_RL = 6,
|
||||
MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_LR = 7,
|
||||
MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_RL = 8,
|
||||
MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_LR = 9,
|
||||
MATROSKA_VIDEO_STEREOMODE_TYPE_ANAGLYPH_CYAN_RED = 10,
|
||||
MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT = 11,
|
||||
MATROSKA_VIDEO_STEREOMODE_TYPE_ANAGLYPH_GREEN_MAG = 12,
|
||||
MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_LR = 13,
|
||||
MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_RL = 14,
|
||||
} MatroskaVideoStereoModeType;
|
||||
|
||||
/*
|
||||
* Matroska Codec IDs, strings
|
||||
*/
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user