This way, the caller doesn't need to coordinate setting the option
after the moov atom has been written. The downside is that it is
no longer possible to use the option for checking whether the moov
atom already has been written, but a caller is able to keep track
of that by other means anyway.
Signed-off-by: Martin Storsjö <martin@martin.st>
{"ism_lookahead","Number of lookahead entries for ISM files",offsetof(MOVMuxContext,ism_lookahead),AV_OPT_TYPE_INT,{.i64=0},0,INT_MAX,AV_OPT_FLAG_ENCODING_PARAM},
{"brand","Override major brand",offsetof(MOVMuxContext,major_brand),AV_OPT_TYPE_STRING,{.str=NULL},.flags=AV_OPT_FLAG_ENCODING_PARAM},
{"fragment_index","Fragment number of the next fragment",offsetof(MOVMuxContext,fragments),AV_OPT_TYPE_INT,{.i64=0},0,INT_MAX,AV_OPT_FLAG_ENCODING_PARAM},
{"fragment_index","Fragment number of the next fragment",offsetof(MOVMuxContext,fragments),AV_OPT_TYPE_INT,{.i64=1},1,INT_MAX,AV_OPT_FLAG_ENCODING_PARAM},
{NULL},
};
@ -3119,7 +3119,7 @@ static int mov_flush_fragment(AVFormatContext *s)
if(!(mov->flags&FF_MOV_FLAG_FRAGMENT))
return0;
if(mov->fragments==0){
if(!mov->moov_written){
int64_tpos=avio_tell(s->pb);
intret;
AVIOContext*moov_buf;
@ -3148,7 +3148,7 @@ static int mov_flush_fragment(AVFormatContext *s)
if(mov->flags&FF_MOV_FLAG_FASTSTART)
mov->reserved_moov_pos=avio_tell(s->pb);
avio_flush(s->pb);
mov->fragments++;
mov->moov_written=1;
return0;
}
@ -3159,7 +3159,7 @@ static int mov_flush_fragment(AVFormatContext *s)
avio_write(s->pb,buf,buf_size);
av_free(buf);
mov->fragments++;
mov->moov_written=1;
mov->mdat_size=0;
for(i=0;i<mov->nb_streams;i++){
if(mov->tracks[i].entry)
@ -3237,12 +3237,13 @@ static int mov_flush_fragment(AVFormatContext *s)