allow NULL write_header() and write_trailer()

Originally committed as revision 4675 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2005-11-04 23:50:11 +00:00
parent ed57bb79e8
commit 31e11451f7
1 changed files with 7 additions and 4 deletions

View File

@ -2253,9 +2253,11 @@ int av_write_header(AVFormatContext *s)
}
}
ret = s->oformat->write_header(s);
if (ret < 0)
return ret;
if(s->oformat->write_header){
ret = s->oformat->write_header(s);
if (ret < 0)
return ret;
}
/* init PTS generation */
for(i=0;i<s->nb_streams;i++) {
@ -2540,7 +2542,8 @@ int av_write_trailer(AVFormatContext *s)
goto fail;
}
ret = s->oformat->write_trailer(s);
if(s->oformat->write_trailer)
ret = s->oformat->write_trailer(s);
fail:
if(ret == 0)
ret=url_ferror(&s->pb);