|
|
|
@ -2163,6 +2163,62 @@ static void mkv_stereo_mode_display_mul(int stereo_mode, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int mkv_stereo3d_conv(AVStream *st, MatroskaVideoStereoModeType stereo_mode) |
|
|
|
|
{ |
|
|
|
|
AVStereo3D *stereo; |
|
|
|
|
int ret; |
|
|
|
|
|
|
|
|
|
stereo = av_stereo3d_alloc(); |
|
|
|
|
if (!stereo) |
|
|
|
|
return AVERROR(ENOMEM); |
|
|
|
|
|
|
|
|
|
// note: the missing breaks are intentional
|
|
|
|
|
switch (stereo_mode) { |
|
|
|
|
case MATROSKA_VIDEO_STEREOMODE_TYPE_MONO: |
|
|
|
|
stereo->type = AV_STEREO3D_2D; |
|
|
|
|
break; |
|
|
|
|
case MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT: |
|
|
|
|
stereo->flags |= AV_STEREO3D_FLAG_INVERT; |
|
|
|
|
case MATROSKA_VIDEO_STEREOMODE_TYPE_LEFT_RIGHT: |
|
|
|
|
stereo->type = AV_STEREO3D_SIDEBYSIDE; |
|
|
|
|
break; |
|
|
|
|
case MATROSKA_VIDEO_STEREOMODE_TYPE_BOTTOM_TOP: |
|
|
|
|
stereo->flags |= AV_STEREO3D_FLAG_INVERT; |
|
|
|
|
case MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM: |
|
|
|
|
stereo->type = AV_STEREO3D_TOPBOTTOM; |
|
|
|
|
break; |
|
|
|
|
case MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_RL: |
|
|
|
|
stereo->flags |= AV_STEREO3D_FLAG_INVERT; |
|
|
|
|
case MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_LR: |
|
|
|
|
stereo->type = AV_STEREO3D_CHECKERBOARD; |
|
|
|
|
break; |
|
|
|
|
case MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_RL: |
|
|
|
|
stereo->flags |= AV_STEREO3D_FLAG_INVERT; |
|
|
|
|
case MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_LR: |
|
|
|
|
stereo->type = AV_STEREO3D_LINES; |
|
|
|
|
break; |
|
|
|
|
case MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_RL: |
|
|
|
|
stereo->flags |= AV_STEREO3D_FLAG_INVERT; |
|
|
|
|
case MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_LR: |
|
|
|
|
stereo->type = AV_STEREO3D_COLUMNS; |
|
|
|
|
break; |
|
|
|
|
case MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_RL: |
|
|
|
|
stereo->flags |= AV_STEREO3D_FLAG_INVERT; |
|
|
|
|
case MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_LR: |
|
|
|
|
stereo->type = AV_STEREO3D_FRAMESEQUENCE; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ret = av_stream_add_side_data(st, AV_PKT_DATA_STEREO3D, (uint8_t *)stereo, |
|
|
|
|
sizeof(*stereo)); |
|
|
|
|
if (ret < 0) { |
|
|
|
|
av_freep(&stereo); |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int mkv_parse_video_color(AVStream *st, const MatroskaTrack *track) { |
|
|
|
|
const MatroskaTrackVideoColor *color = track->video.color.elem; |
|
|
|
|
const MatroskaMasteringMeta *mastering_meta; |
|
|
|
@ -3008,7 +3064,7 @@ static int matroska_parse_tracks(AVFormatContext *s) |
|
|
|
|
// add stream level stereo3d side data if it is a supported format
|
|
|
|
|
if (track->video.stereo_mode < MATROSKA_VIDEO_STEREOMODE_TYPE_NB && |
|
|
|
|
track->video.stereo_mode != 10 && track->video.stereo_mode != 12) { |
|
|
|
|
int ret = ff_mkv_stereo3d_conv(st, track->video.stereo_mode); |
|
|
|
|
int ret = mkv_stereo3d_conv(st, track->video.stereo_mode); |
|
|
|
|
if (ret < 0) |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|