diff utils.c @ 554:e1f17fcfb92c libavformat

write error handling
author michael
date Fri, 08 Oct 2004 20:09:52 +0000
parents b832a27355ec
children 0a997108f384
line wrap: on
line diff
--- a/utils.c	Thu Oct 07 21:11:08 2004 +0000
+++ b/utils.c	Fri Oct 08 20:09:52 2004 +0000
@@ -1996,11 +1996,16 @@
  */
 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 @@
         
         if(ret<0)
             return ret;
+        if(url_ferror(&s->pb))
+            return url_ferror(&s->pb);
     }
 }
 
@@ -2139,10 +2146,14 @@
         
         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);