@ -814,10 +814,10 @@ static int mov_get_dv_codec_tag(AVFormatContext *s, MOVTrack *track)
else if ( track - > enc - > pix_fmt = = AV_PIX_FMT_YUV420P ) tag = MKTAG ( ' d ' , ' v ' , ' c ' , ' p ' ) ;
else if ( track - > enc - > pix_fmt = = AV_PIX_FMT_YUV420P ) tag = MKTAG ( ' d ' , ' v ' , ' c ' , ' p ' ) ;
else tag = MKTAG ( ' d ' , ' v ' , ' p ' , ' p ' ) ;
else tag = MKTAG ( ' d ' , ' v ' , ' p ' , ' p ' ) ;
else if ( track - > enc - > height = = 720 ) /* HD 720 line */
else if ( track - > enc - > height = = 720 ) /* HD 720 line */
if ( track - > enc - > time_base . den = = 50 ) tag = MKTAG ( ' d ' , ' v ' , ' h ' , ' q ' ) ;
if ( track - > st - > time_base . den = = 50 ) tag = MKTAG ( ' d ' , ' v ' , ' h ' , ' q ' ) ;
else tag = MKTAG ( ' d ' , ' v ' , ' h ' , ' p ' ) ;
else tag = MKTAG ( ' d ' , ' v ' , ' h ' , ' p ' ) ;
else if ( track - > enc - > height = = 1080 ) /* HD 1080 line */
else if ( track - > enc - > height = = 1080 ) /* HD 1080 line */
if ( track - > enc - > time_base . den = = 25 ) tag = MKTAG ( ' d ' , ' v ' , ' h ' , ' 5 ' ) ;
if ( track - > st - > time_base . den = = 25 ) tag = MKTAG ( ' d ' , ' v ' , ' h ' , ' 5 ' ) ;
else tag = MKTAG ( ' d ' , ' v ' , ' h ' , ' 6 ' ) ;
else tag = MKTAG ( ' d ' , ' v ' , ' h ' , ' 6 ' ) ;
else {
else {
av_log ( s , AV_LOG_ERROR , " unsupported height for dv codec \n " ) ;
av_log ( s , AV_LOG_ERROR , " unsupported height for dv codec \n " ) ;
@ -2656,10 +2656,12 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
static void mov_write_uuidprof_tag ( AVIOContext * pb , AVFormatContext * s )
static void mov_write_uuidprof_tag ( AVIOContext * pb , AVFormatContext * s )
{
{
AVStream * video_st = s - > streams [ 0 ] ;
AVCodecContext * video_codec = s - > streams [ 0 ] - > codec ;
AVCodecContext * video_codec = s - > streams [ 0 ] - > codec ;
AVCodecContext * audio_codec = s - > streams [ 1 ] - > codec ;
AVCodecContext * audio_codec = s - > streams [ 1 ] - > codec ;
int audio_rate = audio_codec - > sample_rate ;
int audio_rate = audio_codec - > sample_rate ;
int frame_rate = ( ( video_codec - > time_base . den ) * ( 0x10000 ) ) / ( video_codec - > time_base . num ) ;
// TODO: should be avg_frame_rate
int frame_rate = ( ( video_st - > time_base . den ) * ( 0x10000 ) ) / ( video_st - > time_base . num ) ;
int audio_kbitrate = audio_codec - > bit_rate / 1000 ;
int audio_kbitrate = audio_codec - > bit_rate / 1000 ;
int video_kbitrate = FFMIN ( video_codec - > bit_rate / 1000 , 800 - audio_kbitrate ) ;
int video_kbitrate = FFMIN ( video_codec - > bit_rate / 1000 , 800 - audio_kbitrate ) ;
@ -3400,7 +3402,7 @@ static int mov_write_header(AVFormatContext *s)
}
}
track - > height = track - > tag > > 24 = = ' n ' ? 486 : 576 ;
track - > height = track - > tag > > 24 = = ' n ' ? 486 : 576 ;
}
}
track - > timescale = st - > codec - > time_base . den ;
track - > timescale = st - > time_base . den ;
if ( track - > mode = = MODE_MOV & & track - > timescale > 100000 )
if ( track - > mode = = MODE_MOV & & track - > timescale > 100000 )
av_log ( s , AV_LOG_WARNING ,
av_log ( s , AV_LOG_WARNING ,
" WARNING codec timebase is very high. If duration is too long, \n "
" WARNING codec timebase is very high. If duration is too long, \n "
@ -3428,9 +3430,9 @@ static int mov_write_header(AVFormatContext *s)
goto error ;
goto error ;
}
}
} else if ( st - > codec - > codec_type = = AVMEDIA_TYPE_SUBTITLE ) {
} else if ( st - > codec - > codec_type = = AVMEDIA_TYPE_SUBTITLE ) {
track - > timescale = st - > codec - > time_base . den ;
track - > timescale = st - > time_base . den ;
} else if ( st - > codec - > codec_type = = AVMEDIA_TYPE_DATA ) {
} else if ( st - > codec - > codec_type = = AVMEDIA_TYPE_DATA ) {
track - > timescale = st - > codec - > time_base . den ;
track - > timescale = st - > time_base . den ;
}
}
if ( ! track - > height )
if ( ! track - > height )
track - > height = st - > codec - > height ;
track - > height = st - > codec - > height ;