diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-10-08 20:09:52 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-10-08 20:09:52 +0000 |
commit | 576ae256a404ceba6527e6042d500e04b3f489a3 (patch) | |
tree | 64fab60a142a1897bd8c1801bfb8eb6ffeb0b5d1 /libavformat/utils.c | |
parent | 125af022434fbb6a61ba8244eb19d3a43f9687e9 (diff) | |
download | ffmpeg-576ae256a404ceba6527e6042d500e04b3f489a3.tar.gz |
write error handling
Originally committed as revision 3572 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 7129b39b76..788f4ab2c9 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1996,11 +1996,16 @@ static void truncate_ts(AVStream *st, AVPacket *pkt){ */ int av_write_frame(AVFormatContext *s, AVPacket *pkt) { + int ret; + compute_pkt_fields2(s->streams[pkt->stream_index], pkt); truncate_ts(s->streams[pkt->stream_index], pkt); - return s->oformat->write_packet(s, pkt); + ret= s->oformat->write_packet(s, pkt); + if(!ret) + ret= url_ferror(&s->pb); + return ret; } /** @@ -2111,6 +2116,8 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){ if(ret<0) return ret; + if(url_ferror(&s->pb)) + return url_ferror(&s->pb); } } @@ -2139,10 +2146,14 @@ int av_write_trailer(AVFormatContext *s) if(ret<0) goto fail; + if(url_ferror(&s->pb)) + goto fail; } ret = s->oformat->write_trailer(s); fail: + if(ret == 0) + ret=url_ferror(&s->pb); for(i=0;i<s->nb_streams;i++) av_freep(&s->streams[i]->priv_data); av_freep(&s->priv_data); |