@ -2032,7 +2032,8 @@ static int mov_write_minf_tag(AVIOContext *pb, MOVTrack *track)
return update_size ( pb , pos ) ;
}
static int mov_write_mdhd_tag ( AVIOContext * pb , MOVTrack * track )
static int mov_write_mdhd_tag ( AVIOContext * pb , MOVMuxContext * mov ,
MOVTrack * track )
{
int version = track - > track_duration < INT32_MAX ? 0 : 1 ;
@ -2051,8 +2052,10 @@ static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32 ( pb , track - > time ) ; /* modification time */
}
avio_wb32 ( pb , track - > timescale ) ; /* time scale (sample rate for audio) */
if ( ! track - > entry )
if ( ! track - > entry & & mov - > mode = = MODE_ISM )
( version = = 1 ) ? avio_wb64 ( pb , UINT64_C ( 0xffffffffffffffff ) ) : avio_wb32 ( pb , 0xffffffff ) ;
else if ( ! track - > entry )
( version = = 1 ) ? avio_wb64 ( pb , 0 ) : avio_wb32 ( pb , 0 ) ;
else
( version = = 1 ) ? avio_wb64 ( pb , track - > track_duration ) : avio_wb32 ( pb , track - > track_duration ) ; /* duration */
avio_wb16 ( pb , track - > language ) ; /* language */
@ -2068,12 +2071,13 @@ static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track)
return 32 ;
}
static int mov_write_mdia_tag ( AVIOContext * pb , MOVTrack * track )
static int mov_write_mdia_tag ( AVIOContext * pb , MOVMuxContext * mov ,
MOVTrack * track )
{
int64_t pos = avio_tell ( pb ) ;
avio_wb32 ( pb , 0 ) ; /* size */
ffio_wfourcc ( pb , " mdia " ) ;
mov_write_mdhd_tag ( pb , track ) ;
mov_write_mdhd_tag ( pb , mov , track ) ;
mov_write_hdlr_tag ( pb , track ) ;
mov_write_minf_tag ( pb , track ) ;
return update_size ( pb , pos ) ;
@ -2134,8 +2138,10 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov,
}
avio_wb32 ( pb , track - > track_id ) ; /* track-id */
avio_wb32 ( pb , 0 ) ; /* reserved */
if ( ! track - > entry )
if ( ! track - > entry & & mov - > mode = = MODE_ISM )
( version = = 1 ) ? avio_wb64 ( pb , UINT64_C ( 0xffffffffffffffff ) ) : avio_wb32 ( pb , 0xffffffff ) ;
else if ( ! track - > entry )
( version = = 1 ) ? avio_wb64 ( pb , 0 ) : avio_wb32 ( pb , 0 ) ;
else
( version = = 1 ) ? avio_wb64 ( pb , duration ) : avio_wb32 ( pb , duration ) ;
@ -2389,7 +2395,7 @@ static int mov_write_trak_tag(AVIOContext *pb, MOVMuxContext *mov,
mov_write_edts_tag ( pb , mov , track ) ; // PSP Movies and several other cases require edts box
if ( track - > tref_tag )
mov_write_tref_tag ( pb , track ) ;
mov_write_mdia_tag ( pb , track ) ;
mov_write_mdia_tag ( pb , mov , track ) ;
if ( track - > mode = = MODE_PSP )
mov_write_uuid_tag_psp ( pb , track ) ; // PSP Movies require this uuid box
if ( track - > tag = = MKTAG ( ' r ' , ' t ' , ' p ' , ' ' ) )