[FFmpeg-cvslog] avio: deprecate url_ferror

Anton Khirnov git
Tue Mar 15 16:55:28 CET 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Mar 14 20:38:55 2011 +0100| [3e68b3ba7b015cf2154ad2023781eedd47f0f4bb] | committer: Ronald S. Bultje

avio: deprecate url_ferror

AVIOContext.error should be used directly instead.

Signed-off-by: Ronald S. Bultje <rsbultje at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3e68b3ba7b015cf2154ad2023781eedd47f0f4bb
---

 ffplay.c              |    2 +-
 libavformat/asfdec.c  |    2 +-
 libavformat/avio.h    |    3 +--
 libavformat/aviobuf.c |    6 +++---
 libavformat/dsicin.c  |    2 +-
 libavformat/mxg.c     |    2 +-
 libavformat/wtv.c     |    2 +-
 7 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index 6019437..fe04487 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2570,7 +2570,7 @@ static int decode_thread(void *arg)
         if (ret < 0) {
             if (ret == AVERROR_EOF || ic->pb->eof_reached)
                 eof=1;
-            if (url_ferror(ic->pb))
+            if (ic->pb->error)
                 break;
             SDL_Delay(100); /* wait for user event */
             continue;
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 10d3449..cbcd576 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -743,7 +743,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
          * imply complete -EAGAIN handling support at random positions in
          * the stream.
          */
-        if (url_ferror(pb) == AVERROR(EAGAIN))
+        if (pb->error == AVERROR(EAGAIN))
             return AVERROR(EAGAIN);
         if (!pb->eof_reached)
             av_log(s, AV_LOG_ERROR, "ff asf bad header %x  at:%"PRId64"\n", c, avio_tell(pb));
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 2949629..b8f9c58 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -437,6 +437,7 @@ attribute_deprecated int url_fgetc(AVIOContext *s);
  * @deprecated use AVIOContext.eof_reached
  */
 attribute_deprecated int url_feof(AVIOContext *s);
+attribute_deprecated int url_ferror(AVIOContext *s);
 #endif
 
 AVIOContext *avio_alloc_context(
@@ -499,8 +500,6 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
  */
 int64_t avio_size(AVIOContext *s);
 
-int url_ferror(AVIOContext *s);
-
 int av_url_read_fpause(AVIOContext *h, int pause);
 int64_t av_url_read_fseek(AVIOContext *h, int stream_index,
                           int64_t timestamp, int flags);
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index d0f63df..4f39fe3 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -272,7 +272,6 @@ int url_feof(AVIOContext *s)
         return 0;
     return s->eof_reached;
 }
-#endif
 
 int url_ferror(AVIOContext *s)
 {
@@ -280,6 +279,7 @@ int url_ferror(AVIOContext *s)
         return 0;
     return s->error;
 }
+#endif
 
 void avio_wl32(AVIOContext *s, unsigned int val)
 {
@@ -599,7 +599,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size)
         }
     }
     if (size1 == size) {
-        if (url_ferror(s)) return url_ferror(s);
+        if (s->error)         return s->error;
         if (s->eof_reached)   return AVERROR_EOF;
     }
     return size1 - size;
@@ -622,7 +622,7 @@ int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size)
     memcpy(buf, s->buf_ptr, len);
     s->buf_ptr += len;
     if (!len) {
-        if (url_ferror(s)) return url_ferror(s);
+        if (s->error)         return s->error;
         if (s->eof_reached)   return AVERROR_EOF;
     }
     return len;
diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c
index 7030491..023441b 100644
--- a/libavformat/dsicin.c
+++ b/libavformat/dsicin.c
@@ -147,7 +147,7 @@ static int cin_read_frame_header(CinDemuxContext *cin, AVIOContext *pb) {
     hdr->video_frame_size = avio_rl32(pb);
     hdr->audio_frame_size = avio_rl32(pb);
 
-    if (pb->eof_reached || url_ferror(pb))
+    if (pb->eof_reached || pb->error)
         return AVERROR(EIO);
 
     if (avio_rl32(pb) != 0xAA55AA55)
diff --git a/libavformat/mxg.c b/libavformat/mxg.c
index 3a71b22..7d342f1 100644
--- a/libavformat/mxg.c
+++ b/libavformat/mxg.c
@@ -132,7 +132,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt)
     uint8_t *startmarker_ptr, *end, *search_end, marker;
     MXGContext *mxg = s->priv_data;
 
-    while (!s->pb->eof_reached && !url_ferror(s->pb)){
+    while (!s->pb->eof_reached && !s->pb->error){
         if (mxg->cache_size <= OVERREAD_SIZE) {
             /* update internal buffer */
             ret = mxg_update_cache(s, DEFAULT_PACKET_SIZE + OVERREAD_SIZE);
diff --git a/libavformat/wtv.c b/libavformat/wtv.c
index 2b3737b..191c1c1 100644
--- a/libavformat/wtv.c
+++ b/libavformat/wtv.c
@@ -77,7 +77,7 @@ static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size)
     AVIOContext *pb = wf->pb_filesystem;
     int nread = 0;
 
-    if (wf->error || url_ferror(pb))
+    if (wf->error || pb->error)
         return -1;
     if (wf->position >= wf->length || pb->eof_reached)
         return 0;




More information about the ffmpeg-cvslog mailing list