@ -128,31 +128,31 @@ typedef struct MatroskaMuxContext {
ebml_stored_master tags ;
int64_t segment_offset ;
AVIOContext * cluster_bc ;
int64_t cluster_pos ; ///< file offset of the current c luster
int64_t cluster_pos ; ///< file offset of the current C luster
int64_t cluster_pts ;
int64_t duration_offset ;
int64_t duration ;
mkv_track * tracks ;
mkv_seekhead seekhead ;
mkv_cues cues ;
mkv_track * track s;
int64_t cues_po s;
AVPacket cur_audio_pkt ;
unsigned nb_attachments ;
int have_video ;
uint32_t chapter_id_offset ;
int wrote_chapters ;
int reserve_cues_space ;
int cluster_size_limit ;
int64_t cues_pos ;
int64_t cluster_time_limit ;
int is_dash ;
int dash_track_number ;
int is_live ;
int write_crc ;
int is_live ;
uint32_t chapter_id_offset ;
int wrote_chapters ;
int is_dash ;
int dash_track_number ;
int allow_raw_vfw ;
int default_mode ;
@ -418,7 +418,7 @@ static int end_ebml_master_crc32_tentatively(AVIOContext *pb,
ebml_stored_master * elem ,
MatroskaMuxContext * mkv , uint32_t id )
{
if ( ( pb - > seekable & AVIO_SEEKABLE_NORMAL ) & & ! mkv - > is_live ) {
if ( IS_SEEKABLE ( pb , mkv ) ) {
uint8_t * buf ;
int size = avio_get_dyn_buf ( elem - > bc , & buf ) ;
@ -827,8 +827,8 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb,
return ret ;
}
static void mkv_write_video_color ( AVIOContext * pb , const AVCodecParameters * par ,
const AVStream * st )
static void mkv_write_video_color ( AVIOContext * pb , const AVStream * st ,
const AVCodecParameters * par )
{
/* 18 Elements with two bytes ID, one byte length field, 8 bytes payload
* a master element with two bytes ID and one byte length field
@ -911,9 +911,8 @@ static void mkv_write_video_color(AVIOContext *pb, const AVCodecParameters *par,
}
colorinfo_size = avio_tell ( dyn_cp ) ;
if ( colorinfo_size ) {
if ( colorinfo_size )
put_ebml_binary ( pb , MATROSKA_ID_VIDEOCOLOR , colour , colorinfo_size ) ;
}
}
static int mkv_write_video_projection ( AVFormatContext * s , AVIOContext * pb ,
@ -1306,7 +1305,7 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
uint32_t color_space = av_le2ne32 ( par - > codec_tag ) ;
put_ebml_binary ( pb , MATROSKA_ID_VIDEOCOLORSPACE , & color_space , sizeof ( color_space ) ) ;
}
mkv_write_video_color ( pb , par , st ) ;
mkv_write_video_color ( pb , st , par ) ;
ret = mkv_write_video_projection ( s , pb , st ) ;
if ( ret < 0 )
@ -1616,7 +1615,7 @@ static int mkv_check_tag(const AVDictionary *m, uint32_t elementid)
static int mkv_write_tags ( AVFormatContext * s )
{
MatroskaMuxContext * mkv = s - > priv_data ;
ebml_master tag , * tagp ;
ebml_master tag , * tagp = IS_SEEKABLE ( s - > pb , mkv ) ? & tag : NULL ;
int i , ret ;
ff_metadata_conv_ctx ( s , ff_mkv_metadata_conv , NULL ) ;
@ -1627,7 +1626,6 @@ static int mkv_write_tags(AVFormatContext *s)
return ret ;
}
tagp = ( s - > pb - > seekable & AVIO_SEEKABLE_NORMAL ) & & ! mkv - > is_live ? & tag : NULL ;
for ( i = 0 ; i < s - > nb_streams ; i + + ) {
const AVStream * st = s - > streams [ i ] ;
mkv_track * track = & mkv - > tracks [ i ] ;
@ -1820,7 +1818,7 @@ static int mkv_write_header(AVFormatContext *s)
put_ebml_size_unknown ( pb , 8 ) ;
mkv - > segment_offset = avio_tell ( pb ) ;
// we write a seek h ead at the beginning to point to all other level
// We write a SeekH ead at the beginning to point to all other level
// one elements (except Clusters).
mkv_start_seekhead ( mkv , pb ) ;
@ -1898,7 +1896,7 @@ static int mkv_write_header(AVFormatContext *s)
if ( ret < 0 )
return ret ;
if ( ! ( s - > pb - > seekable & AVIO_SEEKABLE_NORMAL ) | | mkv - > is_live ) {
if ( ! IS_SEEKABLE ( pb , mkv ) ) {
ret = mkv_write_seekhead ( pb , mkv , 0 , avio_tell ( pb ) ) ;
if ( ret < 0 )
return ret ;
@ -2512,7 +2510,6 @@ static int mkv_write_trailer(AVFormatContext *s)
" %d < % " PRIu64 " . No Cues will be output. \n " ,
mkv - > reserve_cues_space , size ) ;
ret2 = AVERROR ( EINVAL ) ;
ffio_free_dyn_buf ( & cues ) ;
goto after_cues ;
} else {
if ( ( ret64 = avio_seek ( pb , mkv - > cues_pos , SEEK_SET ) ) < 0 ) {
@ -2541,7 +2538,7 @@ static int mkv_write_trailer(AVFormatContext *s)
endpos = avio_tell ( pb ) ;
}
after_cues :
after_cues :
/* Lengths greater than (1ULL << 56) - 1 can't be represented
* via an EBML number , so leave the unknown length field . */
if ( endpos - mkv - > segment_offset < ( 1ULL < < 56 ) - 1 ) {