changeset 482:0fdc96c2f2fe libavformat

sweeping change from -EIO -> AVERROR_IO
author melanson
date Sat, 19 Jun 2004 03:59:34 +0000
parents f1430abbbd8b
children f4e9e55f703c
files 4xm.c amr.c asf.c au.c audio.c avio.c aviobuf.c dv.c dv1394.c flic.c flvdec.c gifdec.c grab.c http.c idcin.c idroq.c img.c ipmovie.c mp3.c mpeg.c ogg.c psxstr.c raw.c rm.c rtpproto.c segafilm.c sierravmd.c swf.c tcp.c udp.c wav.c wc3movie.c westwood.c yuv.c yuv4mpeg.c
diffstat 35 files changed, 240 insertions(+), 160 deletions(-) [+]
line wrap: on
line diff
--- a/4xm.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/4xm.c	Sat Jun 19 03:59:34 2004 +0000
@@ -260,7 +260,7 @@
         fourcc_tag = LE_32(&header[0]);
         size = LE_32(&header[4]);
         if (url_feof(pb))
-            return -EIO;
+            return AVERROR_IO;
         switch (fourcc_tag) {
 
         case LIST_TAG:
@@ -278,7 +278,7 @@
             /* allocate 8 more bytes than 'size' to account for fourcc
              * and size */
             if (av_new_packet(pkt, size + 8))
-                return -EIO;
+                return AVERROR_IO;
             pkt->stream_index = fourxm->video_stream_index;
             pkt->pts = fourxm->video_pts;
             memcpy(pkt->data, header, 8);
@@ -298,7 +298,7 @@
 
             if (track_number == fourxm->selected_track) {
                 if (av_new_packet(pkt, size))
-                    return -EIO;
+                    return AVERROR_IO;
                 pkt->stream_index = 
                     fourxm->tracks[fourxm->selected_track].stream_index;
                 pkt->pts = fourxm->audio_pts;
--- a/amr.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/amr.c	Sat Jun 19 03:59:34 2004 +0000
@@ -140,7 +140,7 @@
     
         if (url_feof(&s->pb))
         {
-            return -EIO;
+            return AVERROR_IO;
         }
     
         toc=get_byte(&s->pb);
@@ -151,7 +151,7 @@
     
         if (av_new_packet(pkt, size+1))
         {
-            return -EIO;
+            return AVERROR_IO;
         }
         pkt->stream_index = 0;
         
@@ -162,7 +162,7 @@
         if (read != size)
         {
             av_free_packet(pkt);
-            return -EIO;
+            return AVERROR_IO;
         }
     
         return 0;
@@ -176,7 +176,7 @@
     
         if (url_feof(&s->pb))
         {
-            return -EIO;
+            return AVERROR_IO;
         }
     
         toc=get_byte(&s->pb);
@@ -185,7 +185,7 @@
     
         if ( (size==0) || av_new_packet(pkt, size))
         {
-            return -EIO;
+            return AVERROR_IO;
         }
     
         pkt->stream_index = 0;
@@ -196,14 +196,14 @@
         if (read != (size-1))
         {
             av_free_packet(pkt);
-            return -EIO;
+            return AVERROR_IO;
         }
     
         return 0;
     }
     else
     {
-        return -EIO;
+        return AVERROR_IO;
     }
 }
 
--- a/asf.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/asf.c	Sat Jun 19 03:59:34 2004 +0000
@@ -434,13 +434,13 @@
 	if (get_le16(pb) != 0) {
             if (!url_feof(pb))
 		av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n");
-	    return -EIO;
+	    return AVERROR_IO;
 	}
         rsize+=2;
 /*    }else{
         if (!url_feof(pb))
 	    printf("ff asf bad header %x  at:%lld\n", c, url_ftell(pb));
-	return -EIO;*/
+	return AVERROR_IO;*/
     }
 
     asf->packet_flags = get_byte(pb);
@@ -490,7 +490,7 @@
 	    ret = asf_get_packet(s);
 	    //printf("READ ASF PACKET  %d   r:%d   c:%d\n", ret, asf->packet_size_left, pc++);
 	    if (ret < 0 || url_feof(pb))
-		return -EIO;
+		return AVERROR_IO;
             asf->packet_time_start = 0;
             continue;
 	}
--- a/au.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/au.c	Sat Jun 19 03:59:34 2004 +0000
@@ -159,9 +159,9 @@
     int ret;
 
     if (url_feof(&s->pb))
-        return -EIO;
+        return AVERROR_IO;
     if (av_new_packet(pkt, MAX_SIZE))
-        return -EIO;
+        return AVERROR_IO;
     pkt->stream_index = 0;
 
     ret = get_buffer(&s->pb, pkt->data, pkt->size);
--- a/audio.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/audio.c	Sat Jun 19 03:59:34 2004 +0000
@@ -57,7 +57,7 @@
         audio_fd = open(audio_device, O_RDONLY);
     if (audio_fd < 0) {
         perror(audio_device);
-        return -EIO;
+        return AVERROR_IO;
     }
 
     if (flip && *flip == '1') {
@@ -108,7 +108,7 @@
     default:
         av_log(NULL, AV_LOG_ERROR, "Soundcard does not support 16 bit sample format\n");
         close(audio_fd);
-        return -EIO;
+        return AVERROR_IO;
     }
     err=ioctl(audio_fd, SNDCTL_DSP_SETFMT, &tmp);
     if (err < 0) {
@@ -137,7 +137,7 @@
     return 0;
  fail:
     close(audio_fd);
-    return -EIO;
+    return AVERROR_IO;
 }
 
 static int audio_close(AudioData *s)
@@ -158,7 +158,7 @@
     s->channels = st->codec.channels;
     ret = audio_open(s, 1, NULL);
     if (ret < 0) {
-        return -EIO;
+        return AVERROR_IO;
     } else {
         return 0;
     }
@@ -183,7 +183,7 @@
                 if (ret > 0)
                     break;
                 if (ret < 0 && (errno != EAGAIN && errno != EINTR))
-                    return -EIO;
+                    return AVERROR_IO;
             }
             s->buffer_ptr = 0;
         }
@@ -222,7 +222,7 @@
     ret = audio_open(s, 0, ap->device);
     if (ret < 0) {
         av_free(st);
-        return -EIO;
+        return AVERROR_IO;
     }
 
     /* take real parameters */
@@ -243,7 +243,7 @@
     struct audio_buf_info abufi;
     
     if (av_new_packet(pkt, s->frame_size) < 0)
-        return -EIO;
+        return AVERROR_IO;
     for(;;) {
         struct timeval tv;
         fd_set fds;
@@ -268,7 +268,7 @@
         }
         if (!(ret == 0 || (ret == -1 && (errno == EAGAIN || errno == EINTR)))) {
             av_free_packet(pkt);
-            return -EIO;
+            return AVERROR_IO;
         }
     }
     pkt->size = ret;
--- a/avio.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/avio.c	Sat Jun 19 03:59:34 2004 +0000
@@ -95,7 +95,7 @@
 {
     int ret;
     if (h->flags & URL_WRONLY)
-        return -EIO;
+        return AVERROR_IO;
     ret = h->prot->url_read(h, buf, size);
     return ret;
 }
@@ -105,10 +105,10 @@
 {
     int ret;
     if (!(h->flags & (URL_WRONLY | URL_RDWR)))
-        return -EIO;
+        return AVERROR_IO;
     /* avoid sending too big packets */
     if (h->max_packet_size && size > h->max_packet_size)
-        return -EIO; 
+        return AVERROR_IO; 
     ret = h->prot->url_write(h, buf, size);
     return ret;
 }
--- a/aviobuf.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/aviobuf.c	Sat Jun 19 03:59:34 2004 +0000
@@ -473,7 +473,7 @@
                       (h->flags & URL_WRONLY || h->flags & URL_RDWR), h,
                       url_read_packet, url_write_packet, url_seek_packet) < 0) {
         av_free(buffer);
-        return -EIO;
+        return AVERROR_IO;
     }
     s->is_streamed = h->is_streamed;
     s->max_packet_size = max_packet_size;
--- a/dv.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/dv.c	Sat Jun 19 03:59:34 2004 +0000
@@ -850,11 +850,11 @@
     
     if (size < 0) {
         if (get_buffer(&s->pb, c->buf, 4) <= 0) 
-            return -EIO;
+            return AVERROR_IO;
     
         size = dv_frame_profile(c->buf)->frame_size;
         if (get_buffer(&s->pb, c->buf + 4, size - 4) <= 0)
-	    return -EIO;
+	    return AVERROR_IO;
 
 	size = dv_produce_packet(c->dv_demux, pkt, c->buf, size);
     } 
--- a/dv1394.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/dv1394.c	Sat Jun 19 03:59:34 2004 +0000
@@ -126,7 +126,7 @@
 
 failed:
     close(dv->fd);
-    return -EIO;
+    return AVERROR_IO;
 }
 
 static int dv1394_read_packet(AVFormatContext *context, AVPacket *pkt)
@@ -165,12 +165,12 @@
             if (errno == EAGAIN || errno == EINTR)
                 goto restart_poll;
             perror("Poll failed");
-            return -EIO;
+            return AVERROR_IO;
         }
 
         if (ioctl(dv->fd, DV1394_GET_STATUS, &s) < 0) {
             perror("Failed to get status");
-            return -EIO;
+            return AVERROR_IO;
         }
 #ifdef DV1394_DEBUG
         fprintf(stderr, "DV1394: status\n"
--- a/flic.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/flic.c	Sat Jun 19 03:59:34 2004 +0000
@@ -76,7 +76,7 @@
 
     /* load the whole header and pull out the width and height */
     if (get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE)
-        return -EIO;
+        return AVERROR_IO;
 
     magic_number = LE_16(&header[4]);
     speed = LE_32(&header[0x10]);
@@ -164,7 +164,7 @@
 
         if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) !=
             FLIC_PREAMBLE_SIZE) {
-            ret = -EIO;
+            ret = AVERROR_IO;
             break;
         }
 
@@ -173,7 +173,7 @@
 
         if ((magic == FLIC_CHUNK_MAGIC_1) || (magic == FLIC_CHUNK_MAGIC_2)) {
             if (av_new_packet(pkt, size)) {
-                ret = -EIO;
+                ret = AVERROR_IO;
                 break;
             }
             pkt->stream_index = flic->video_stream_index;
@@ -183,7 +183,7 @@
                 size - FLIC_PREAMBLE_SIZE);
             if (ret != size - FLIC_PREAMBLE_SIZE) {
                 av_free_packet(pkt);
-                ret = -EIO;
+                ret = AVERROR_IO;
             }
             flic->pts += flic->frame_pts_inc;
             packet_read = 1;
--- a/flvdec.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/flvdec.c	Sat Jun 19 03:59:34 2004 +0000
@@ -69,7 +69,7 @@
     pts = get_be24(&s->pb);
 //    av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, pts:%d\n", type, size, pts);
     if (url_feof(&s->pb))
-        return -EIO;
+        return AVERROR_IO;
     url_fskip(&s->pb, 4); /* reserved */
     flags = 0;
     
@@ -139,12 +139,12 @@
     }
 
     if (av_new_packet(pkt, size) < 0)
-        return -EIO;
+        return AVERROR_IO;
 
     ret = get_buffer(&s->pb, pkt->data, size);
     if (ret <= 0) {
         av_free_packet(pkt);
-        return -EIO;
+        return AVERROR_IO;
     }
     /* note: we need to modify the packet size here to handle the last
        packet */
--- a/gifdec.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/gifdec.c	Sat Jun 19 03:59:34 2004 +0000
@@ -505,21 +505,21 @@
 	switch (code) {
 	case ',':
 	    if (gif_read_image(s) < 0)
-		return -EIO;
+		return AVERROR_IO;
 	    ret = 0;
 	    goto the_end;
 	case ';':
 	    /* end of image */
-	    ret = -EIO;
+	    ret = AVERROR_IO;
 	    goto the_end;
 	case '!':
             if (gif_read_extension(s) < 0)
-                return -EIO;
+                return AVERROR_IO;
 	    break;
 	case EOF:
 	default:
 	    /* error or errneous EOF */
-	    ret = -EIO;
+	    ret = AVERROR_IO;
 	    goto the_end;
 	}
     }
@@ -572,7 +572,7 @@
 
     /* XXX: avoid copying */
     if (av_new_packet(pkt, s->screen_width * s->screen_height * 3)) {
-	return -EIO;
+	return AVERROR_IO;
     }
     pkt->stream_index = 0;
     memcpy(pkt->data, s->image_buf, s->screen_width * s->screen_height * 3);
--- a/grab.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/grab.c	Sat Jun 19 03:59:34 2004 +0000
@@ -270,7 +270,7 @@
     if (video_fd >= 0)
         close(video_fd);
     av_free(st);
-    return -EIO;
+    return AVERROR_IO;
 }
 
 static int v4l_mm_read_picture(VideoData *s, uint8_t *buf)
@@ -290,7 +290,7 @@
             av_log(NULL, AV_LOG_ERROR, "Cannot Sync\n");
         else
             perror("VIDIOCMCAPTURE");
-        return -EIO;
+        return AVERROR_IO;
     }
 
     /* This is now the grabbing frame */
@@ -325,7 +325,7 @@
     }
 
     if (av_new_packet(pkt, s->frame_size) < 0)
-        return -EIO;
+        return AVERROR_IO;
 
     pkt->pts = curtime & ((1LL << 48) - 1);
 
@@ -336,7 +336,7 @@
         return v4l_mm_read_picture(s, pkt->data);
     } else {
         if (read(s->fd, pkt->data, pkt->size) != pkt->size)
-            return -EIO;
+            return AVERROR_IO;
         return s->frame_size;
     }
 }
--- a/http.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/http.c	Sat Jun 19 03:59:34 2004 +0000
@@ -116,7 +116,7 @@
     if (hd)
         url_close(hd);
     av_free(s);
-    return -EIO;
+    return AVERROR_IO;
 }
 
 static int http_getc(HTTPContext *s)
@@ -125,7 +125,7 @@
     if (s->buf_ptr >= s->buf_end) {
         len = url_read(s->hd, s->buffer, BUFFER_SIZE);
         if (len < 0) {
-            return -EIO;
+            return AVERROR_IO;
         } else if (len == 0) {
             return -1;
         } else {
@@ -194,7 +194,7 @@
              hoststr);
     
     if (http_write(h, s->buffer, strlen(s->buffer)) < 0)
-        return -EIO;
+        return AVERROR_IO;
         
     /* init input buffer */
     s->buf_ptr = s->buffer;
@@ -211,7 +211,7 @@
     for(;;) {
         ch = http_getc(s);
         if (ch < 0)
-            return -EIO;
+            return AVERROR_IO;
         if (ch == '\n') {
             /* process line */
             if (q > line && q[-1] == '\r')
--- a/idcin.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/idcin.c	Sat Jun 19 03:59:34 2004 +0000
@@ -167,7 +167,7 @@
     st->codec.extradata = av_malloc(HUFFMAN_TABLE_SIZE);
     if (get_buffer(pb, st->codec.extradata, HUFFMAN_TABLE_SIZE) !=
         HUFFMAN_TABLE_SIZE)
-        return -EIO;
+        return AVERROR_IO;
     /* save a reference in order to transport the palette */
     st->codec.palctrl = &idcin->palctrl;
 
@@ -224,17 +224,17 @@
     unsigned char palette_buffer[768];
 
     if (url_feof(&s->pb))
-        return -EIO;
+        return AVERROR_IO;
 
     if (idcin->next_chunk_is_video) {
         command = get_le32(pb);
         if (command == 2) {
-            return -EIO;
+            return AVERROR_IO;
         } else if (command == 1) {
             /* trigger a palette change */
             idcin->palctrl.palette_changed = 1;
             if (get_buffer(pb, palette_buffer, 768) != 768)
-                return -EIO;
+                return AVERROR_IO;
             /* scale the palette as necessary */
             palette_scale = 2;
             for (i = 0; i < 768; i++)
@@ -256,12 +256,12 @@
         url_fseek(pb, 4, SEEK_CUR);
         chunk_size -= 4;
         if (av_new_packet(pkt, chunk_size))
-            ret = -EIO;
+            ret = AVERROR_IO;
         pkt->stream_index = idcin->video_stream_index;
         pkt->pts = idcin->pts;
         ret = get_buffer(pb, pkt->data, chunk_size);
         if (ret != chunk_size)
-            ret = -EIO;
+            ret = AVERROR_IO;
     } else {
         /* send out the audio chunk */
         if (idcin->current_audio_chunk)
@@ -269,12 +269,12 @@
         else
             chunk_size = idcin->audio_chunk_size1;
         if (av_new_packet(pkt, chunk_size))
-            return -EIO;
+            return AVERROR_IO;
         pkt->stream_index = idcin->audio_stream_index;
         pkt->pts = idcin->pts;
         ret = get_buffer(&s->pb, pkt->data, chunk_size);
         if (ret != chunk_size)
-            ret = -EIO;
+            ret = AVERROR_IO;
 
         idcin->current_audio_chunk ^= 1;
         idcin->pts += FRAME_PTS_INC;
--- a/idroq.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/idroq.c	Sat Jun 19 03:59:34 2004 +0000
@@ -187,12 +187,12 @@
     while (!packet_read) {
 
         if (url_feof(&s->pb))
-            return -EIO;
+            return AVERROR_IO;
 
         /* get the next chunk preamble */
         if ((ret = get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) != 
             RoQ_CHUNK_PREAMBLE_SIZE)
-            return -EIO;
+            return AVERROR_IO;
 
         chunk_type = LE_16(&preamble[0]);
         chunk_size = LE_32(&preamble[2]);
@@ -211,7 +211,7 @@
             url_fseek(pb, codebook_size, SEEK_CUR);
             if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != 
                 RoQ_CHUNK_PREAMBLE_SIZE)
-                return -EIO;
+                return AVERROR_IO;
             chunk_size = LE_32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 + 
                 codebook_size;
 
@@ -220,12 +220,12 @@
 
             /* load up the packet */
             if (av_new_packet(pkt, chunk_size))
-                return -EIO;
+                return AVERROR_IO;
             pkt->stream_index = roq->video_stream_index;
             pkt->pts = roq->video_pts;
             ret = get_buffer(pb, pkt->data, chunk_size);
             if (ret != chunk_size)
-                ret = -EIO;
+                ret = AVERROR_IO;
 
             roq->video_pts += roq->frame_pts_inc;
             packet_read = 1;
@@ -236,7 +236,7 @@
         case RoQ_QUAD_VQ:
             /* load up the packet */
             if (av_new_packet(pkt, chunk_size + RoQ_CHUNK_PREAMBLE_SIZE))
-                return -EIO;
+                return AVERROR_IO;
             /* copy over preamble */
             memcpy(pkt->data, preamble, RoQ_CHUNK_PREAMBLE_SIZE);
 
@@ -255,7 +255,7 @@
             ret = get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
                 chunk_size);
             if (ret != chunk_size)
-                ret = -EIO;
+                ret = AVERROR_IO;
 
             packet_read = 1;
             break;
--- a/img.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/img.c	Sat Jun 19 03:59:34 2004 +0000
@@ -183,7 +183,7 @@
         url_fclose(f);
  fail:
     av_free(s);
-    return -EIO;
+    return AVERROR_IO;
 }
 
 static int read_packet_alloc_cb(void *opaque, AVImageInfo *info)
@@ -211,14 +211,14 @@
         }
         if (get_frame_filename(filename, sizeof(filename),
                                s->path, s->img_number) < 0)
-            return -EIO;
+            return AVERROR_IO;
         f = &f1;
         if (url_fopen(f, filename, URL_RDONLY) < 0)
-            return -EIO;
+            return AVERROR_IO;
     } else {
         f = &s1->pb;
         if (url_feof(f))
-            return -EIO;
+            return AVERROR_IO;
     }
 
     av_new_packet(pkt, s->img_size);
@@ -232,7 +232,7 @@
 
     if (ret < 0) {
         av_free_packet(pkt);
-        return -EIO; /* signal EOF */
+        return AVERROR_IO; /* signal EOF */
     } else {
         /* XXX: computing this pts is not necessary as it is done in
            the generic code too */
@@ -318,10 +318,10 @@
     if (!img->is_pipe) {
         if (get_frame_filename(filename, sizeof(filename), 
                                img->path, img->img_number) < 0)
-            return -EIO;
+            return AVERROR_IO;
         pb = &pb1;
         if (url_fopen(pb, filename, URL_WRONLY) < 0)
-            return -EIO;
+            return AVERROR_IO;
     } else {
         pb = &s->pb;
     }
--- a/ipmovie.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/ipmovie.c	Sat Jun 19 03:59:34 2004 +0000
@@ -34,7 +34,7 @@
 
 /* debugging support: #define DEBUG_IPMOVIE as non-zero to see extremely
  * verbose information about the demux process */
-#define DEBUG_IPMOVIE 0
+#define DEBUG_IPMOVIE 1
 
 #if DEBUG_IPMOVIE
 #define debug_ipmovie printf
@@ -543,7 +543,7 @@
      * it; if it is the first video chunk, this is a silent file */
     if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
         CHUNK_PREAMBLE_SIZE)
-        return -EIO;
+        return AVERROR_IO;
     chunk_type = LE_16(&chunk_preamble[2]);
     url_fseek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR);
 
@@ -600,7 +600,7 @@
     if (ret == CHUNK_BAD)
         ret = AVERROR_INVALIDDATA;
     else if (ret == CHUNK_EOF)
-        ret = -EIO;
+        ret = AVERROR_IO;
     else if (ret == CHUNK_NOMEM)
         ret = AVERROR_NOMEM;
     else
--- a/mp3.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/mp3.c	Sat Jun 19 03:59:34 2004 +0000
@@ -298,13 +298,13 @@
     size= MP3_PACKET_SIZE;
 
     if (av_new_packet(pkt, size) < 0)
-        return -EIO;
+        return AVERROR_IO;
 
     pkt->stream_index = 0;
     ret = get_buffer(&s->pb, pkt->data, size);
     if (ret <= 0) {
         av_free_packet(pkt);
-        return -EIO;
+        return AVERROR_IO;
     }
     /* note: we need to modify the packet size here to handle the last
        packet */
--- a/mpeg.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/mpeg.c	Sat Jun 19 03:59:34 2004 +0000
@@ -1164,7 +1164,7 @@
         startcode = find_next_start_code(&s->pb, &size, &m->header_state);
     //printf("startcode=%x pos=0x%Lx\n", startcode, url_ftell(&s->pb));
     if (startcode < 0)
-        return -EIO;
+        return AVERROR_IO;
     if (startcode == PACK_START_CODE)
         goto redo;
     if (startcode == SYSTEM_HEADER_START_CODE)
@@ -1284,7 +1284,7 @@
                               AVPacket *pkt)
 {
     AVStream *st;
-    int len, startcode, i, type, codec_id;
+    int len, startcode, i, type, codec_id = 0;
     int64_t pts, dts, dummy_pos; //dummy_pos is needed for the index building to work
 
  redo:
@@ -1350,6 +1350,15 @@
     av_log(s, AV_LOG_DEBUG, "%d: pts=%0.3f dts=%0.3f\n",
            pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0);
 #endif
+
+#if 1
+//#ifdef CONFIG_ADX
+    if (codec_id == CODEC_ID_MP2 && is_adx(pkt->data,pkt->size)) {
+printf ("found ADX...\n");
+        st->codec.codec_id = CODEC_ID_ADPCM_ADX;
+    }
+#endif //CONFIG_ADX
+
     return 0;
 }
 
--- a/ogg.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/ogg.c	Sat Jun 19 03:59:34 2004 +0000
@@ -176,7 +176,7 @@
     buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ;
 
     if(get_buffer(&avfcontext->pb, buf, DECODER_BUFFER_SIZE) <= 0)
-	return -EIO ;
+	return AVERROR_IO ;
     
     ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ;   
     ogg_sync_pageout(&context->oy, &og) ;
@@ -213,9 +213,9 @@
     ogg_packet op ;
 
     if(next_packet(avfcontext, &op)) 
-	return -EIO ;
+	return AVERROR_IO ;
     if(av_new_packet(pkt, op.bytes) < 0)
-	return -EIO ;
+	return AVERROR_IO ;
     pkt->stream_index = 0 ;
     memcpy(pkt->data, op.packet, op.bytes);
     if(avfcontext->streams[0]->codec.sample_rate && op.granulepos!=-1)
--- a/psxstr.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/psxstr.c	Sat Jun 19 03:59:34 2004 +0000
@@ -257,7 +257,7 @@
     while (!packet_read) {
 
         if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE)
-            return -EIO;
+            return AVERROR_IO;
 
         channel = sector[0x11];
         if (channel >= 32)
@@ -279,7 +279,7 @@
                 pkt = &str->tmp_pkt;
                 if (current_sector == 0) {
                     if (av_new_packet(pkt, frame_size))
-                        return -EIO;
+                        return AVERROR_IO;
 
                     pkt->stream_index = 
                         str->channels[channel].video_stream_index;
@@ -315,7 +315,7 @@
             if (channel == str->audio_channel) {
                 pkt = ret_pkt;
                 if (av_new_packet(pkt, 2304))
-                    return -EIO;
+                    return AVERROR_IO;
                 memcpy(pkt->data,sector+24,2304);
 
                 pkt->stream_index = 
@@ -334,7 +334,7 @@
         }
 
         if (url_feof(pb))
-            return -EIO;
+            return AVERROR_IO;
     }
 
     return ret;
--- a/raw.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/raw.c	Sat Jun 19 03:59:34 2004 +0000
@@ -87,13 +87,13 @@
     size= RAW_PACKET_SIZE;
 
     if (av_new_packet(pkt, size) < 0)
-        return -EIO;
+        return AVERROR_IO;
 
     pkt->stream_index = 0;
     ret = get_buffer(&s->pb, pkt->data, size);
     if (ret <= 0) {
         av_free_packet(pkt);
-        return -EIO;
+        return AVERROR_IO;
     }
     /* note: we need to modify the packet size here to handle the last
        packet */
@@ -108,13 +108,13 @@
     size = RAW_PACKET_SIZE;
 
     if (av_new_packet(pkt, size) < 0)
-        return -EIO;
+        return AVERROR_IO;
 
     pkt->stream_index = 0;
     ret = get_partial_buffer(&s->pb, pkt->data, size);
     if (ret <= 0) {
         av_free_packet(pkt);
-        return -EIO;
+        return AVERROR_IO;
     }
     pkt->size = ret;
     return ret;
@@ -532,7 +532,7 @@
         av_abort();
 
     if (av_new_packet(pkt, packet_size) < 0)
-        return -EIO;
+        return AVERROR_IO;
 
     pkt->stream_index = 0;
 #if 0
@@ -543,7 +543,7 @@
 #endif
     if (ret != pkt->size) {
         av_free_packet(pkt);
-        return -EIO;
+        return AVERROR_IO;
     } else {
         return 0;
     }
@@ -601,6 +601,73 @@
 };
 #endif //CONFIG_ENCODERS
 
+static int adx_probe(AVProbeData *p)
+{
+    if (is_adx(p->buf,p->buf_size))
+        return 100;
+    return 0;
+}
+
+static int adx_read_header(AVFormatContext *s,
+                           AVFormatParameters *ap)
+{
+    AVStream *st;
+
+    st = av_new_stream(s, 0);
+    if (!st)
+        return AVERROR_NOMEM;
+
+    st->codec.codec_type = CODEC_TYPE_AUDIO;
+    st->codec.codec_id = CODEC_ID_ADPCM_ADX;
+    /* the parameters will be extracted from the compressed bitstream */
+    return 0;
+}
+
+AVInputFormat adx_iformat = {
+    "adx",
+    "SEGA CRI ADX audio",
+    0,
+    adx_probe,
+    adx_read_header,
+    raw_read_packet,
+    raw_read_close,
+    .extensions = "adx", //FIXME remove after writing mpeg4_probe
+};
+
+#ifdef CONFIG_ENCODERS
+
+static int adx_write_trailer(AVFormatContext *s)
+{
+    ByteIOContext *pb = &s->pb;
+    offset_t file_size;
+
+    if (!url_is_streamed(&s->pb)) {
+        /* update file size */
+        file_size = url_ftell(pb);
+        url_fseek(pb, 0, SEEK_SET);
+        put_be32(pb, (uint32_t)(file_size - 8));
+        url_fseek(pb, file_size, SEEK_SET);
+
+        put_flush_packet(pb);
+    }
+    return 0;
+}
+
+AVOutputFormat adx_oformat = {
+    "adx",
+    "SEGA CRI ADX audio",
+    NULL, 
+    "adx",
+    0,
+    CODEC_ID_ADPCM_ADX,
+    0,
+    raw_write_header,
+    raw_write_packet,
+    raw_write_trailer,
+};
+#endif //CONFIG_ENCODERS
+
+
 #ifndef CONFIG_ENCODERS
 #define av_register_output_format(format)
 #endif
@@ -651,5 +718,9 @@
     av_register_output_format(&rawvideo_oformat);
 
     av_register_output_format(&null_oformat);
+
+    av_register_input_format(&adx_iformat);
+    av_register_output_format(&adx_oformat);
+
     return 0;
 }
--- a/rm.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/rm.c	Sat Jun 19 03:59:34 2004 +0000
@@ -563,7 +563,7 @@
         /* very old .ra format */
         return rm_read_header_old(s, ap);
     } else if (tag != MKTAG('.', 'R', 'M', 'F')) {
-        return -EIO;
+        return AVERROR_IO;
     }
 
     get_be32(pb); /* header size */
@@ -688,7 +688,7 @@
     for(i=0;i<s->nb_streams;i++) {
         av_free(s->streams[i]);
     }
-    return -EIO;
+    return AVERROR_IO;
 }
 
 static int get_num(ByteIOContext *pb, int *len)
@@ -726,18 +726,18 @@
         len = get_buffer(pb, pkt->data, len);
         if (len <= 0) {
             av_free_packet(pkt);
-            return -EIO;
+            return AVERROR_IO;
         }
         pkt->size = len;
         st = s->streams[0];
     } else {
     redo:
         if (rm->nb_packets == 0)
-            return -EIO;
+            return AVERROR_IO;
         get_be16(pb);
         len = get_be16(pb);
         if (len < 12)
-            return -EIO;
+            return AVERROR_IO;
         num = get_be16(pb);
         timestamp = get_be32(pb);
         get_byte(pb); /* reserved */
--- a/rtpproto.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/rtpproto.c	Sat Jun 19 03:59:34 2004 +0000
@@ -168,7 +168,7 @@
     if (s->rtcp_hd)
         url_close(s->rtcp_hd);
     av_free(s);
-    return -EIO;
+    return AVERROR_IO;
 }
 
 static int rtp_read(URLContext *h, uint8_t *buf, int size)
@@ -185,7 +185,7 @@
         if (len < 0) {
             if (errno == EAGAIN || errno == EINTR)
                 continue;
-            return -EIO;
+            return AVERROR_IO;
         }
         break;
     }
@@ -208,7 +208,7 @@
                 if (len < 0) {
                     if (errno == EAGAIN || errno == EINTR)
                         continue;
-                    return -EIO;
+                    return AVERROR_IO;
                 }
                 break;
             }
@@ -220,7 +220,7 @@
                 if (len < 0) {
                     if (errno == EAGAIN || errno == EINTR)
                         continue;
-                    return -EIO;
+                    return AVERROR_IO;
                 }
                 break;
             }
--- a/segafilm.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/segafilm.c	Sat Jun 19 03:59:34 2004 +0000
@@ -92,7 +92,7 @@
 
     /* load the main FILM header */
     if (get_buffer(pb, scratch, 16) != 16)
-        return -EIO;
+        return AVERROR_IO;
     data_offset = BE_32(&scratch[4]);
     film->version = BE_32(&scratch[8]);
 
@@ -100,7 +100,7 @@
     if (film->version == 0) {
         /* special case for Lemmings .film files; 20-byte header */
         if (get_buffer(pb, scratch, 20) != 20)
-            return -EIO;
+            return AVERROR_IO;
         /* make some assumptions about the audio parameters */
         film->audio_type = CODEC_ID_PCM_S8;
         film->audio_samplerate = 22050;
@@ -109,7 +109,7 @@
     } else {
         /* normal Saturn .cpk files; 32-byte header */
         if (get_buffer(pb, scratch, 32) != 32)
-            return -EIO;
+            return AVERROR_IO;
         film->audio_samplerate = BE_16(&scratch[24]);;
         film->audio_channels = scratch[21];
         film->audio_bits = scratch[22];
@@ -166,7 +166,7 @@
 
     /* load the sample table */
     if (get_buffer(pb, scratch, 16) != 16)
-        return -EIO;
+        return AVERROR_IO;
     if (BE_32(&scratch[0]) != STAB_TAG)
         return AVERROR_INVALIDDATA;
     film->base_clock = BE_32(&scratch[8]);
@@ -181,7 +181,7 @@
         /* load the next sample record and transfer it to an internal struct */
         if (get_buffer(pb, scratch, 16) != 16) {
             av_free(film->sample_table);
-            return -EIO;
+            return AVERROR_IO;
         }
         film->sample_table[i].sample_offset = 
             data_offset + BE_32(&scratch[0]);
@@ -217,7 +217,7 @@
     int left, right;
 
     if (film->current_sample >= film->sample_count)
-        return -EIO;
+        return AVERROR_IO;
 
     sample = &film->sample_table[film->current_sample];
 
@@ -235,7 +235,7 @@
         ret += get_buffer(pb, pkt->data + 10, 
             sample->sample_size - 10 - film->cvid_extra_bytes);
         if (ret != sample->sample_size - film->cvid_extra_bytes)
-            ret = -EIO;
+            ret = AVERROR_IO;
     } else if ((sample->stream == film->audio_stream_index) &&
         (film->audio_channels == 2)) {
         /* stereo PCM needs to be interleaved */
@@ -252,7 +252,7 @@
 
         ret = get_buffer(pb, film->stereo_buffer, sample->sample_size);
         if (ret != sample->sample_size)
-            ret = -EIO;
+            ret = AVERROR_IO;
 
         left = 0;
         right = sample->sample_size / 2;
@@ -272,7 +272,7 @@
             return AVERROR_NOMEM;
         ret = get_buffer(pb, pkt->data, sample->sample_size);
         if (ret != sample->sample_size)
-            ret = -EIO;
+            ret = AVERROR_IO;
     }
 
     pkt->stream_index = sample->stream;
--- a/sierravmd.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/sierravmd.c	Sat Jun 19 03:59:34 2004 +0000
@@ -119,7 +119,7 @@
     /* fetch the main header, including the 2 header length bytes */
     url_fseek(pb, 0, SEEK_SET);
     if (get_buffer(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE)
-        return -EIO;
+        return AVERROR_IO;
 
     vmd->audio_sample_counter = 0;
     vmd->audio_frame_divisor = 1;
@@ -200,7 +200,7 @@
         raw_frame_table_size) {
         av_free(raw_frame_table);
         av_free(vmd->frame_table);
-        return -EIO;
+        return AVERROR_IO;
     }
 
     current_offset = LE_32(&vmd->vmd_header[20]);
@@ -259,7 +259,7 @@
     vmd_frame_t *frame;
 
     if (vmd->current_frame >= vmd->frame_count)
-        return -EIO;
+        return AVERROR_IO;
 
     frame = &vmd->frame_table[vmd->current_frame];
     /* position the stream (will probably be there already) */
@@ -273,7 +273,7 @@
 
     if (ret != frame->frame_size) {
         av_free_packet(pkt);
-        ret = -EIO;
+        ret = AVERROR_IO;
     }
     pkt->stream_index = frame->stream_index;
     if (frame->frame_record[0] == 0x02)
--- a/swf.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/swf.c	Sat Jun 19 03:59:34 2004 +0000
@@ -795,7 +795,7 @@
     s->priv_data = swf;
 
     if ((get_be32(pb) & 0xffffff00) != MKBETAG('F', 'W', 'S', 0))
-        return -EIO;
+        return AVERROR_IO;
     get_le32(pb);
     /* skip rectangle size */
     nbits = get_byte(pb) >> 3;
@@ -823,7 +823,7 @@
                 break;
             }
             av_log(s, AV_LOG_ERROR, "No media found in SWF\n");
-            return -EIO;
+            return AVERROR_IO;
         }
         if ( tag == TAG_VIDEOSTREAM && !vst) {
             swf->ch_id = get_le16(pb);
@@ -877,7 +877,7 @@
                     break;
                 default:
                     av_free(ast);
-                    return -EIO;
+                    return AVERROR_IO;
                 }
                 ast->codec.codec_type = CODEC_TYPE_AUDIO;
                 ast->codec.codec_id = CODEC_ID_MP3;
@@ -901,7 +901,7 @@
     for(;;) {
         tag = get_swf_tag(pb, &len);
         if (tag < 0) 
-            return -EIO;
+            return AVERROR_IO;
         if (tag == TAG_VIDEOFRAME) {
             for( i=0; i<s->nb_streams; i++ ) {
         	st = s->streams[i];
--- a/tcp.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/tcp.c	Sat Jun 19 03:59:34 2004 +0000
@@ -130,7 +130,7 @@
     return 0;
 
  fail:
-    ret = -EIO;
+    ret = AVERROR_IO;
  fail1:
     if (fd >= 0)
         close(fd);
--- a/udp.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/udp.c	Sat Jun 19 03:59:34 2004 +0000
@@ -64,7 +64,7 @@
 
     /* set the destination address */
     if (resolve_host(&s->dest_addr.sin_addr, hostname) < 0)
-        return -EIO;
+        return AVERROR_IO;
     s->dest_addr.sin_family = AF_INET;
     s->dest_addr.sin_port = htons(port);
     return 0;
@@ -206,7 +206,7 @@
         close(udp_fd);
 #endif
     av_free(s);
-    return -EIO;
+    return AVERROR_IO;
 }
 
 static int udp_read(URLContext *h, uint8_t *buf, int size)
@@ -221,7 +221,7 @@
                         (struct sockaddr *)&from, &from_len);
         if (len < 0) {
             if (errno != EAGAIN && errno != EINTR)
-                return -EIO;
+                return AVERROR_IO;
         } else {
             break;
         }
@@ -240,7 +240,7 @@
                       sizeof (s->dest_addr));
         if (ret < 0) {
             if (errno != EINTR && errno != EAGAIN)
-                return -EIO;
+                return AVERROR_IO;
         } else {
             break;
         }
--- a/wav.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/wav.c	Sat Jun 19 03:59:34 2004 +0000
@@ -311,7 +311,7 @@
     AVStream *st;
 
     if (url_feof(&s->pb))
-        return -EIO;
+        return AVERROR_IO;
     st = s->streams[0];
 
     size = MAX_SIZE;
@@ -321,7 +321,7 @@
         size = (size / st->codec.block_align) * st->codec.block_align;
     }
     if (av_new_packet(pkt, size))
-        return -EIO;
+        return AVERROR_IO;
     pkt->stream_index = 0;
 
     ret = get_buffer(&s->pb, pkt->data, pkt->size);
--- a/wc3movie.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/wc3movie.c	Sat Jun 19 03:59:34 2004 +0000
@@ -150,7 +150,7 @@
      * the first BRCH tag */
     if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) != 
         WC3_PREAMBLE_SIZE)
-        return -EIO;
+        return AVERROR_IO;
     fourcc_tag = LE_32(&preamble[0]);
     size = (BE_32(&preamble[4]) + 1) & (~1);
 
@@ -167,7 +167,7 @@
             /* need the number of palettes */
             url_fseek(pb, 8, SEEK_CUR);
             if ((ret = get_buffer(pb, preamble, 4)) != 4)
-                return -EIO;
+                return AVERROR_IO;
             wc3->palette_count = LE_32(&preamble[0]);
             wc3->palettes = av_malloc(wc3->palette_count * PALETTE_SIZE);
             break;
@@ -179,14 +179,14 @@
             else
                 bytes_to_read = 512;
             if ((ret = get_buffer(pb, s->title, bytes_to_read)) != bytes_to_read)
-                return -EIO;
+                return AVERROR_IO;
             break;
 
         case SIZE_TAG:
             /* video resolution override */
             if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) != 
                 WC3_PREAMBLE_SIZE)
-                return -EIO;
+                return AVERROR_IO;
             wc3->width = LE_32(&preamble[0]);
             wc3->height = LE_32(&preamble[4]);
             break;
@@ -198,7 +198,7 @@
             if ((ret = get_buffer(pb, 
                 &wc3->palettes[current_palette * PALETTE_SIZE], 
                 PALETTE_SIZE)) != PALETTE_SIZE)
-                return -EIO;
+                return AVERROR_IO;
 
             /* transform the current palette in place */
             for (i = current_palette * PALETTE_SIZE;
@@ -222,7 +222,7 @@
 
         if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) != 
             WC3_PREAMBLE_SIZE)
-            return -EIO;
+            return AVERROR_IO;
         fourcc_tag = LE_32(&preamble[0]);
         /* chunk sizes are 16-bit aligned */
         size = (BE_32(&preamble[4]) + 1) & (~1);
@@ -283,7 +283,7 @@
         /* get the next chunk preamble */
         if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
             WC3_PREAMBLE_SIZE)
-            ret = -EIO;
+            ret = AVERROR_IO;
 
         fourcc_tag = LE_32(&preamble[0]);
         /* chunk sizes are 16-bit aligned */
@@ -298,7 +298,7 @@
         case SHOT_TAG:
             /* load up new palette */
             if ((ret = get_buffer(pb, preamble, 4)) != 4)
-                return -EIO;
+                return AVERROR_IO;
             palette_number = LE_32(&preamble[0]);
             if (palette_number >= wc3->palette_count)
                 return AVERROR_INVALIDDATA;
@@ -315,12 +315,12 @@
         case VGA__TAG:
             /* send out video chunk */
             if (av_new_packet(pkt, size))
-                ret = -EIO;
+                ret = AVERROR_IO;
             pkt->stream_index = wc3->video_stream_index;
             pkt->pts = wc3->pts;
             ret = get_buffer(pb, pkt->data, size);
             if (ret != size)
-                ret = -EIO;
+                ret = AVERROR_IO;
             packet_read = 1;
             break;
 
@@ -330,7 +330,7 @@
             url_fseek(pb, size, SEEK_CUR);
 #else
             if ((ret = get_buffer(pb, text, size)) != size)
-                ret = -EIO;
+                ret = AVERROR_IO;
             else {
                 int i = 0;
                 av_log (s, AV_LOG_DEBUG, "Subtitle time!\n");
@@ -346,12 +346,12 @@
         case AUDI_TAG:
             /* send out audio chunk */
             if (av_new_packet(pkt, size))
-                ret = -EIO;
+                ret = AVERROR_IO;
             pkt->stream_index = wc3->audio_stream_index;
             pkt->pts = wc3->pts;
             ret = get_buffer(pb, pkt->data, size);
             if (ret != size)
-                ret = -EIO;
+                ret = AVERROR_IO;
 
             /* time to advance pts */
             wc3->pts += WC3_FRAME_PTS_INC;
--- a/westwood.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/westwood.c	Sat Jun 19 03:59:34 2004 +0000
@@ -119,7 +119,7 @@
     unsigned char header[AUD_HEADER_SIZE];
 
     if (get_buffer(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE)
-        return -EIO;
+        return AVERROR_IO;
     wsaud->audio_samplerate = LE_16(&header[0]);
     if (header[11] == 99)
         wsaud->audio_type = CODEC_ID_ADPCM_IMA_WS;
@@ -163,7 +163,7 @@
 
     if (get_buffer(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) !=
         AUD_CHUNK_PREAMBLE_SIZE)
-        return -EIO;
+        return AVERROR_IO;
 
     /* validate the chunk */
     if (LE_32(&preamble[4]) != AUD_CHUNK_SIGNATURE)
@@ -171,13 +171,13 @@
 
     chunk_size = LE_16(&preamble[0]);
     if (av_new_packet(pkt, chunk_size))
-        return -EIO;
+        return AVERROR_IO;
     pkt->stream_index = wsaud->audio_stream_index;
     pkt->pts = wsaud->audio_frame_counter;
     pkt->pts /= wsaud->audio_samplerate;
     if ((ret = get_buffer(pb, pkt->data, chunk_size)) != chunk_size) {
         av_free_packet(pkt);
-        ret = -EIO;
+        ret = AVERROR_IO;
     }
 
     /* 2 samples/byte, 1 or 2 samples per frame depending on stereo */
@@ -239,7 +239,7 @@
     if (get_buffer(pb, st->codec.extradata, VQA_HEADER_SIZE) !=
         VQA_HEADER_SIZE) {
         av_free(st->codec.extradata);
-        return -EIO;
+        return AVERROR_IO;
     }
     st->codec.width = LE_16(&header[6]);
     st->codec.height = LE_16(&header[8]);
@@ -271,7 +271,7 @@
     do {
         if (get_buffer(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) {
             av_free(st->codec.extradata);
-            return -EIO;
+            return AVERROR_IO;
         }
         chunk_tag = BE_32(&scratch[0]);
         chunk_size = BE_32(&scratch[4]);
@@ -314,7 +314,7 @@
     int skip_byte;
 
     if (get_buffer(pb, preamble, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE)
-        return -EIO;
+        return AVERROR_IO;
 
     chunk_type = BE_32(&preamble[0]);
     chunk_size = BE_32(&preamble[4]);
@@ -323,11 +323,11 @@
     if ((chunk_type == SND2_TAG) || (chunk_type == VQFR_TAG)) {
 
         if (av_new_packet(pkt, chunk_size))
-            return -EIO;
+            return AVERROR_IO;
         ret = get_buffer(pb, pkt->data, chunk_size);
         if (ret != chunk_size) {
             av_free_packet(pkt);
-            ret = -EIO;
+            ret = AVERROR_IO;
         }
 
         if (chunk_type == SND2_TAG) {
--- a/yuv.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/yuv.c	Sat Jun 19 03:59:34 2004 +0000
@@ -60,7 +60,7 @@
     url_get_filename(h, fname, sizeof(fname));
 
     if (infer_size(&info->width, &info->height, img_size) < 0) {
-        return -EIO;
+        return AVERROR_IO;
     }
     info->pix_fmt = PIX_FMT_YUV420P;
     
@@ -72,20 +72,20 @@
     
     p = strrchr(fname, '.');
     if (!p || p[1] != 'Y')
-        return -EIO;
+        return AVERROR_IO;
 
     get_buffer(f, info->pict.data[0], size);
     
     p[1] = 'U';
     if (url_fopen(pb, fname, URL_RDONLY) < 0)
-        return -EIO;
+        return AVERROR_IO;
 
     get_buffer(pb, info->pict.data[1], size / 4);
     url_fclose(pb);
     
     p[1] = 'V';
     if (url_fopen(pb, fname, URL_RDONLY) < 0)
-        return -EIO;
+        return AVERROR_IO;
 
     get_buffer(pb, info->pict.data[2], size / 4);
     url_fclose(pb);
@@ -107,7 +107,7 @@
 
     p = strrchr(fname, '.');
     if (!p || p[1] != 'Y')
-        return -EIO;
+        return AVERROR_IO;
 
     width = info->width;
     height = info->height;
@@ -122,7 +122,7 @@
             pb = &pb1;
             p[1] = ext[i];
             if (url_fopen(pb, fname, URL_WRONLY) < 0)
-                return -EIO;
+                return AVERROR_IO;
         } else {
             pb = pb2;
         }
--- a/yuv4mpeg.c	Fri Jun 18 03:03:32 2004 +0000
+++ b/yuv4mpeg.c	Sat Jun 19 03:59:34 2004 +0000
@@ -77,7 +77,7 @@
         *first_pkt = 0;
 	if (yuv4_generate_header(s, buf2) < 0) {
 	    av_log(s, AV_LOG_ERROR, "Error. YUV4MPEG stream header write failed.\n");
-	    return -EIO;
+	    return AVERROR_IO;
 	} else {
 	    put_buffer(pb, buf2, strlen(buf2)); 
 	}
@@ -118,14 +118,14 @@
     int* first_pkt = s->priv_data;
     
     if (s->nb_streams != 1)
-        return -EIO;
+        return AVERROR_IO;
     
     if (s->streams[0]->codec.pix_fmt == PIX_FMT_YUV411P) {
         av_log(s, AV_LOG_ERROR, "Warning: generating non-standard 4:1:1 YUV stream, some mjpegtools might not work.\n");
     } 
     else if (s->streams[0]->codec.pix_fmt != PIX_FMT_YUV420P) {
         av_log(s, AV_LOG_ERROR, "ERROR: yuv4mpeg only handles 4:2:0, 4:1:1 YUV data. Use -pix_fmt to select one.\n");
-	return -EIO;
+	return AVERROR_IO;
     }
     
     *first_pkt = 1;
@@ -217,13 +217,13 @@
         av_abort();
 
     if (av_new_packet(pkt, packet_size) < 0)
-        return -EIO;
+        return AVERROR_IO;
 
     pkt->stream_index = 0;
     ret = get_buffer(&s->pb, pkt->data, pkt->size);
     if (ret != pkt->size) {
         av_free_packet(pkt);
-        return -EIO;
+        return AVERROR_IO;
     } else {
         return 0;
     }