lavf: make av_interleave_packet() return meaningful error codes
authorStefano Sabatini <stefano.sabatini-lala@poste.it>
Tue, 15 Mar 2011 12:03:03 +0000 (13:03 +0100)
committerReinhard Tartler <siretart@tauware.de>
Thu, 17 Mar 2011 06:30:09 +0000 (07:30 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c5dcb3d493a6bb73efeb8bfae24f5cc31908201f)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
libavformat/utils.c

index 38ff809..ad00ce8 100644 (file)
@@ -3088,6 +3088,7 @@ static int av_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in,
 
 int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){
     AVStream *st= s->streams[ pkt->stream_index];
 
 int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){
     AVStream *st= s->streams[ pkt->stream_index];
+    int ret;
 
     //FIXME/XXX/HACK drop zero sized packets
     if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO && pkt->size==0)
 
     //FIXME/XXX/HACK drop zero sized packets
     if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO && pkt->size==0)
@@ -3095,11 +3096,11 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){
 
     av_dlog(s, "av_interleaved_write_frame size:%d dts:%"PRId64" pts:%"PRId64"\n",
             pkt->size, pkt->dts, pkt->pts);
 
     av_dlog(s, "av_interleaved_write_frame size:%d dts:%"PRId64" pts:%"PRId64"\n",
             pkt->size, pkt->dts, pkt->pts);
-    if(compute_pkt_fields2(s, st, pkt) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
-        return -1;
+    if((ret = compute_pkt_fields2(s, st, pkt)) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
+        return ret;
 
     if(pkt->dts == AV_NOPTS_VALUE && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
 
     if(pkt->dts == AV_NOPTS_VALUE && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
-        return -1;
+        return AVERROR(EINVAL);
 
     for(;;){
         AVPacket opkt;
 
     for(;;){
         AVPacket opkt;