@ -1025,8 +1025,6 @@ static void mkv_write_field_order(AVIOContext *pb, int mode,
static int mkv_write_stereo_mode ( AVFormatContext * s , AVIOContext * pb ,
AVStream * st , int mode , int * h_width , int * h_height )
{
int i ;
int ret = 0 ;
const AVDictionaryEntry * tag ;
MatroskaVideoStereoModeType format = MATROSKA_VIDEO_STEREOMODE_TYPE_NB ;
const AVStereo3D * stereo ;
@ -1039,7 +1037,7 @@ static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb,
( tag = av_dict_get ( s - > metadata , " stereo_mode " , NULL , 0 ) ) ) {
int stereo_mode = atoi ( tag - > value ) ;
for ( i = 0 ; i < MATROSKA_VIDEO_STEREOMODE_TYPE_NB ; i + + )
for ( int i = 0 ; i < MATROSKA_VIDEO_STEREOMODE_TYPE_NB ; i + + )
if ( ! strcmp ( tag - > value , ff_matroska_video_stereo_mode [ i ] ) ) {
stereo_mode = i ;
break ;
@ -1056,49 +1054,49 @@ static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb,
stereo = ( const AVStereo3D * ) av_stream_get_side_data ( st , AV_PKT_DATA_STEREO3D ,
& side_data_size ) ;
if ( side_data_size > = sizeof ( AVStereo3D ) ) {
switch ( stereo - > type ) {
case AV_STEREO3D_2D :
format = MATROSKA_VIDEO_STEREOMODE_TYPE_MONO ;
break ;
case AV_STEREO3D_SIDEBYSIDE :
format = ( stereo - > flags & AV_STEREO3D_FLAG_INVERT )
? MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT
: MATROSKA_VIDEO_STEREOMODE_TYPE_LEFT_RIGHT ;
* h_width = 2 ;
break ;
case AV_STEREO3D_TOPBOTTOM :
format = MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM ;
if ( stereo - > flags & AV_STEREO3D_FLAG_INVERT )
format - - ;
* h_height = 2 ;
break ;
case AV_STEREO3D_CHECKERBOARD :
format = MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_LR ;
if ( stereo - > flags & AV_STEREO3D_FLAG_INVERT )
format - - ;
break ;
case AV_STEREO3D_LINES :
format = MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_LR ;
if ( stereo - > flags & AV_STEREO3D_FLAG_INVERT )
format - - ;
* h_height = 2 ;
break ;
case AV_STEREO3D_COLUMNS :
format = MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_LR ;
if ( stereo - > flags & AV_STEREO3D_FLAG_INVERT )
format - - ;
* h_width = 2 ;
break ;
case AV_STEREO3D_FRAMESEQUENCE :
format = MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_LR ;
if ( stereo - > flags & AV_STEREO3D_FLAG_INVERT )
format + + ;
break ;
}
switch ( stereo - > type ) {
case AV_STEREO3D_2D :
format = MATROSKA_VIDEO_STEREOMODE_TYPE_MONO ;
break ;
case AV_STEREO3D_SIDEBYSIDE :
format = ( stereo - > flags & AV_STEREO3D_FLAG_INVERT )
? MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT
: MATROSKA_VIDEO_STEREOMODE_TYPE_LEFT_RIGHT ;
* h_width = 2 ;
break ;
case AV_STEREO3D_TOPBOTTOM :
format = MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM ;
if ( stereo - > flags & AV_STEREO3D_FLAG_INVERT )
format - - ;
* h_height = 2 ;
break ;
case AV_STEREO3D_CHECKERBOARD :
format = MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_LR ;
if ( stereo - > flags & AV_STEREO3D_FLAG_INVERT )
format - - ;
break ;
case AV_STEREO3D_LINES :
format = MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_LR ;
if ( stereo - > flags & AV_STEREO3D_FLAG_INVERT )
format - - ;
* h_height = 2 ;
break ;
case AV_STEREO3D_COLUMNS :
format = MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_LR ;
if ( stereo - > flags & AV_STEREO3D_FLAG_INVERT )
format - - ;
* h_width = 2 ;
break ;
case AV_STEREO3D_FRAMESEQUENCE :
format = MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_LR ;
if ( stereo - > flags & AV_STEREO3D_FLAG_INVERT )
format + + ;
break ;
}
}
if ( format = = MATROSKA_VIDEO_STEREOMODE_TYPE_NB )
return ret ;
return 0 ;
// if webm, do not write unsupported modes
if ( ( mode = = MODE_WEBM & &
@ -1107,14 +1105,13 @@ static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb,
| | format > = MATROSKA_VIDEO_STEREOMODE_TYPE_NB ) {
av_log ( s , AV_LOG_ERROR ,
" The specified stereo mode is not valid. \n " ) ;
format = MATROSKA_VIDEO_STEREOMODE_TYPE_NB ;
return AVERROR ( EINVAL ) ;
}
// write StereoMode if format is valid
put_ebml_uint ( pb , MATROSKA_ID_VIDEOSTEREOMODE , format ) ;
return ret ;
return 0 ;
}
static int mkv_write_track ( AVFormatContext * s , MatroskaMuxContext * mkv ,