Browse code

Replace all occurrences of AVERROR_IO with AVERROR(EIO).

Originally committed as revision 9760 to svn://svn.ffmpeg.org/ffmpeg/trunk

Panagiotis Issaris authored on 2007/07/20 00:23:32
Showing 67 changed files
... ...
@@ -133,7 +133,7 @@ void print_error(const char *filename, int err)
133 133
     case AVERROR_NOFMT:
134 134
         fprintf(stderr, "%s: Unknown format\n", filename);
135 135
         break;
136
-    case AVERROR_IO:
136
+    case AVERROR(EIO):
137 137
         fprintf(stderr, "%s: I/O error occured\n"
138 138
                 "Usually that means that input file is truncated and/or corrupted.\n",
139 139
                 filename);
... ...
@@ -118,7 +118,7 @@ static int fourxm_read_header(AVFormatContext *s,
118 118
     if (!header)
119 119
         return AVERROR(ENOMEM);
120 120
     if (get_buffer(pb, header, header_size) != header_size)
121
-        return AVERROR_IO;
121
+        return AVERROR(EIO);
122 122
 
123 123
     /* take the lazy approach and search for any and all vtrk and strk chunks */
124 124
     for (i = 0; i < header_size - 8; i++) {
... ...
@@ -235,7 +235,7 @@ static int fourxm_read_packet(AVFormatContext *s,
235 235
         fourcc_tag = AV_RL32(&header[0]);
236 236
         size = AV_RL32(&header[4]);
237 237
         if (url_feof(pb))
238
-            return AVERROR_IO;
238
+            return AVERROR(EIO);
239 239
         switch (fourcc_tag) {
240 240
 
241 241
         case LIST_TAG:
... ...
@@ -253,7 +253,7 @@ static int fourxm_read_packet(AVFormatContext *s,
253 253
             /* allocate 8 more bytes than 'size' to account for fourcc
254 254
              * and size */
255 255
             if (size + 8 < size || av_new_packet(pkt, size + 8))
256
-                return AVERROR_IO;
256
+                return AVERROR(EIO);
257 257
             pkt->stream_index = fourxm->video_stream_index;
258 258
             pkt->pts = fourxm->video_pts;
259 259
             pkt->pos = url_ftell(&s->pb);
... ...
@@ -275,7 +275,7 @@ static int fourxm_read_packet(AVFormatContext *s,
275 275
             if (track_number == fourxm->selected_track) {
276 276
                 ret= av_get_packet(&s->pb, pkt, size);
277 277
                 if(ret<0)
278
-                    return AVERROR_IO;
278
+                    return AVERROR(EIO);
279 279
                 pkt->stream_index =
280 280
                     fourxm->tracks[fourxm->selected_track].stream_index;
281 281
                 pkt->pts = fourxm->audio_pts;
... ...
@@ -64,7 +64,7 @@ static int get_tag(ByteIOContext *pb, uint32_t * tag)
64 64
     int size;
65 65
 
66 66
     if (url_feof(pb))
67
-        return AVERROR_IO;
67
+        return AVERROR(EIO);
68 68
 
69 69
     *tag = get_le32(pb);
70 70
     size = get_be32(pb);
... ...
@@ -400,7 +400,7 @@ static int aiff_read_packet(AVFormatContext *s,
400 400
 
401 401
     /* End of stream may be reached */
402 402
     if (url_feof(&s->pb))
403
-        return AVERROR_IO;
403
+        return AVERROR(EIO);
404 404
 
405 405
     /* Now for that packet */
406 406
     res = av_get_packet(&s->pb, pkt, (MAX_SIZE / st->codec->block_align) * st->codec->block_align);
... ...
@@ -122,7 +122,7 @@ static int amr_read_packet(AVFormatContext *s,
122 122
 
123 123
     if (url_feof(&s->pb))
124 124
     {
125
-        return AVERROR_IO;
125
+        return AVERROR(EIO);
126 126
     }
127 127
 
128 128
 //FIXME this is wrong, this should rather be in a AVParset
... ...
@@ -148,7 +148,7 @@ static int amr_read_packet(AVFormatContext *s,
148 148
 
149 149
     if ( (size==0) || av_new_packet(pkt, size))
150 150
     {
151
-        return AVERROR_IO;
151
+        return AVERROR(EIO);
152 152
     }
153 153
 
154 154
     pkt->stream_index = 0;
... ...
@@ -160,7 +160,7 @@ static int amr_read_packet(AVFormatContext *s,
160 160
     if (read != size-1)
161 161
     {
162 162
         av_free_packet(pkt);
163
-        return AVERROR_IO;
163
+        return AVERROR(EIO);
164 164
     }
165 165
 
166 166
     return 0;
... ...
@@ -75,7 +75,7 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
75 75
 static int apc_read_packet(AVFormatContext *s, AVPacket *pkt)
76 76
 {
77 77
     if (av_get_packet(&s->pb, pkt, MAX_READ_SIZE) <= 0)
78
-        return AVERROR_IO;
78
+        return AVERROR(EIO);
79 79
     pkt->stream_index = 0;
80 80
     return 0;
81 81
 }
... ...
@@ -714,7 +714,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
714 714
     //static int pc = 0;
715 715
     for (;;) {
716 716
         if(url_feof(pb))
717
-            return AVERROR_IO;
717
+            return AVERROR(EIO);
718 718
         if (asf->packet_size_left < FRAME_HEADER_SIZE
719 719
             || asf->packet_segments < 1) {
720 720
             //asf->packet_size_left <= asf->packet_padsize) {
... ...
@@ -727,7 +727,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
727 727
             asf->packet_pos= url_ftell(&s->pb);
728 728
             if (asf->data_object_size != (uint64_t)-1 &&
729 729
                 (asf->packet_pos - asf->data_object_offset >= asf->data_object_size))
730
-                return AVERROR_IO; /* Do not exceed the size of the data object */
730
+                return AVERROR(EIO); /* Do not exceed the size of the data object */
731 731
             ret = asf_get_packet(s);
732 732
             //printf("READ ASF PACKET  %d   r:%d   c:%d\n", ret, asf->packet_size_left, pc++);
733 733
             if (ret < 0)
... ...
@@ -159,10 +159,10 @@ static int au_read_packet(AVFormatContext *s,
159 159
     int ret;
160 160
 
161 161
     if (url_feof(&s->pb))
162
-        return AVERROR_IO;
162
+        return AVERROR(EIO);
163 163
     ret= av_get_packet(&s->pb, pkt, MAX_SIZE);
164 164
     if (ret < 0)
165
-        return AVERROR_IO;
165
+        return AVERROR(EIO);
166 166
     pkt->stream_index = 0;
167 167
 
168 168
     /* note: we need to modify the packet size here to handle the last
... ...
@@ -59,7 +59,7 @@ static int audio_open(AudioData *s, int is_output, const char *audio_device)
59 59
         audio_fd = open(audio_device, O_RDONLY);
60 60
     if (audio_fd < 0) {
61 61
         perror(audio_device);
62
-        return AVERROR_IO;
62
+        return AVERROR(EIO);
63 63
     }
64 64
 
65 65
     if (flip && *flip == '1') {
... ...
@@ -110,7 +110,7 @@ static int audio_open(AudioData *s, int is_output, const char *audio_device)
110 110
     default:
111 111
         av_log(NULL, AV_LOG_ERROR, "Soundcard does not support 16 bit sample format\n");
112 112
         close(audio_fd);
113
-        return AVERROR_IO;
113
+        return AVERROR(EIO);
114 114
     }
115 115
     err=ioctl(audio_fd, SNDCTL_DSP_SETFMT, &tmp);
116 116
     if (err < 0) {
... ...
@@ -139,7 +139,7 @@ static int audio_open(AudioData *s, int is_output, const char *audio_device)
139 139
     return 0;
140 140
  fail:
141 141
     close(audio_fd);
142
-    return AVERROR_IO;
142
+    return AVERROR(EIO);
143 143
 }
144 144
 
145 145
 static int audio_close(AudioData *s)
... ...
@@ -160,7 +160,7 @@ static int audio_write_header(AVFormatContext *s1)
160 160
     s->channels = st->codec->channels;
161 161
     ret = audio_open(s, 1, s1->filename);
162 162
     if (ret < 0) {
163
-        return AVERROR_IO;
163
+        return AVERROR(EIO);
164 164
     } else {
165 165
         return 0;
166 166
     }
... ...
@@ -185,7 +185,7 @@ static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
185 185
                 if (ret > 0)
186 186
                     break;
187 187
                 if (ret < 0 && (errno != EAGAIN && errno != EINTR))
188
-                    return AVERROR_IO;
188
+                    return AVERROR(EIO);
189 189
             }
190 190
             s->buffer_ptr = 0;
191 191
         }
... ...
@@ -224,7 +224,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
224 224
     ret = audio_open(s, 0, s1->filename);
225 225
     if (ret < 0) {
226 226
         av_free(st);
227
-        return AVERROR_IO;
227
+        return AVERROR(EIO);
228 228
     }
229 229
 
230 230
     /* take real parameters */
... ...
@@ -245,7 +245,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
245 245
     struct audio_buf_info abufi;
246 246
 
247 247
     if (av_new_packet(pkt, s->frame_size) < 0)
248
-        return AVERROR_IO;
248
+        return AVERROR(EIO);
249 249
     for(;;) {
250 250
         struct timeval tv;
251 251
         fd_set fds;
... ...
@@ -270,7 +270,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
270 270
         }
271 271
         if (!(ret == 0 || (ret == -1 && (errno == EAGAIN || errno == EINTR)))) {
272 272
             av_free_packet(pkt);
273
-            return AVERROR_IO;
273
+            return AVERROR(EIO);
274 274
         }
275 275
     }
276 276
     pkt->size = ret;
... ...
@@ -101,7 +101,7 @@ int url_read(URLContext *h, unsigned char *buf, int size)
101 101
 {
102 102
     int ret;
103 103
     if (h->flags & URL_WRONLY)
104
-        return AVERROR_IO;
104
+        return AVERROR(EIO);
105 105
     ret = h->prot->url_read(h, buf, size);
106 106
     return ret;
107 107
 }
... ...
@@ -111,10 +111,10 @@ int url_write(URLContext *h, unsigned char *buf, int size)
111 111
 {
112 112
     int ret;
113 113
     if (!(h->flags & (URL_WRONLY | URL_RDWR)))
114
-        return AVERROR_IO;
114
+        return AVERROR(EIO);
115 115
     /* avoid sending too big packets */
116 116
     if (h->max_packet_size && size > h->max_packet_size)
117
-        return AVERROR_IO;
117
+        return AVERROR(EIO);
118 118
     ret = h->prot->url_write(h, buf, size);
119 119
     return ret;
120 120
 }
... ...
@@ -514,7 +514,7 @@ int url_fdopen(ByteIOContext *s, URLContext *h)
514 514
                       (h->flags & URL_WRONLY || h->flags & URL_RDWR), h,
515 515
                       url_read_packet, url_write_packet, url_seek_packet) < 0) {
516 516
         av_free(buffer);
517
-        return AVERROR_IO;
517
+        return AVERROR(EIO);
518 518
     }
519 519
     s->is_streamed = h->is_streamed;
520 520
     s->max_packet_size = max_packet_size;
... ...
@@ -156,10 +156,10 @@ static int avisynth_read_packet(AVFormatContext *s, AVPacket *pkt)
156 156
   stream = &avs->streams[stream_id];
157 157
 
158 158
   if (stream->read >= stream->info.dwLength)
159
-    return AVERROR_IO;
159
+    return AVERROR(EIO);
160 160
 
161 161
   if (av_new_packet(pkt, stream->chunck_size))
162
-    return AVERROR_IO;
162
+    return AVERROR(EIO);
163 163
   pkt->stream_index = stream_id;
164 164
   pkt->pts = avs->streams[stream_id].read / avs->streams[stream_id].chunck_samples;
165 165
 
... ...
@@ -106,7 +106,7 @@ avs_read_video_packet(AVFormatContext * s, AVPacket * pkt,
106 106
     ret = get_buffer(&s->pb, pkt->data + palette_size + 4, size - 4) + 4;
107 107
     if (ret < size) {
108 108
         av_free_packet(pkt);
109
-        return AVERROR_IO;
109
+        return AVERROR(EIO);
110 110
     }
111 111
 
112 112
     pkt->size = ret + palette_size;
... ...
@@ -127,7 +127,7 @@ static int avs_read_audio_packet(AVFormatContext * s, AVPacket * pkt)
127 127
     size = url_ftell(&s->pb) - size;
128 128
     avs->remaining_audio_size -= size;
129 129
 
130
-    if (ret == AVERROR_IO)
130
+    if (ret == AVERROR(EIO))
131 131
         return 0;    /* this indicate EOS */
132 132
     if (ret < 0)
133 133
         return ret;
... ...
@@ -154,7 +154,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
154 154
     while (1) {
155 155
         if (avs->remaining_frame_size <= 0) {
156 156
             if (!get_le16(&s->pb))    /* found EOF */
157
-                return AVERROR_IO;
157
+                return AVERROR(EIO);
158 158
             avs->remaining_frame_size = get_le16(&s->pb) - 4;
159 159
         }
160 160
 
... ...
@@ -168,7 +168,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
168 168
             case AVS_PALETTE:
169 169
                 ret = get_buffer(&s->pb, palette, size - 4);
170 170
                 if (ret < size - 4)
171
-                    return AVERROR_IO;
171
+                    return AVERROR(EIO);
172 172
                 palette_size = size;
173 173
                 break;
174 174
 
... ...
@@ -179,7 +179,7 @@ static int vid_read_packet(AVFormatContext *s,
179 179
     int ret_value;
180 180
 
181 181
     if(vid->is_finished || url_feof(pb))
182
-        return AVERROR_IO;
182
+        return AVERROR(EIO);
183 183
 
184 184
     block_type = get_byte(pb);
185 185
     switch(block_type){
... ...
@@ -188,7 +188,7 @@ static int vid_read_packet(AVFormatContext *s,
188 188
             ret_value = av_get_packet(pb, pkt, 3 * 256 + 1);
189 189
             if(ret_value != 3 * 256 + 1){
190 190
                 av_free_packet(pkt);
191
-                return AVERROR_IO;
191
+                return AVERROR(EIO);
192 192
             }
193 193
             pkt->stream_index = 0;
194 194
             return ret_value;
... ...
@@ -202,7 +202,7 @@ static int vid_read_packet(AVFormatContext *s,
202 202
             audio_length = get_le16(pb);
203 203
             ret_value = av_get_packet(pb, pkt, audio_length);
204 204
             pkt->stream_index = 1;
205
-            return (ret_value != audio_length ? AVERROR_IO : ret_value);
205
+            return (ret_value != audio_length ? AVERROR(EIO) : ret_value);
206 206
 
207 207
         case VIDEO_P_FRAME:
208 208
         case VIDEO_YOFF_P_FRAME:
... ...
@@ -214,7 +214,7 @@ static int vid_read_packet(AVFormatContext *s,
214 214
             if(vid->nframes != 0)
215 215
                 av_log(s, AV_LOG_VERBOSE, "reached terminating character but not all frames read.\n");
216 216
             vid->is_finished = 1;
217
-            return AVERROR_IO;
217
+            return AVERROR(EIO);
218 218
         default:
219 219
             av_log(s, AV_LOG_ERROR, "unknown block (character = %c, decimal = %d, hex = %x)!!!\n",
220 220
                    block_type, block_type, block_type); return -1;
... ...
@@ -129,7 +129,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
129 129
     }
130 130
     if (c93->current_frame >= br->frames) {
131 131
         if (c93->current_block >= 511 || !br[1].length)
132
-            return AVERROR_IO;
132
+            return AVERROR(EIO);
133 133
         br++;
134 134
         c93->current_block++;
135 135
         c93->current_frame = 0;
... ...
@@ -154,7 +154,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
154 154
 
155 155
     ret = get_buffer(pb, pkt->data + 1, datasize);
156 156
     if (ret < datasize) {
157
-        ret = AVERROR_IO;
157
+        ret = AVERROR(EIO);
158 158
         goto fail;
159 159
     }
160 160
 
... ...
@@ -168,7 +168,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
168 168
         pkt->data[0] |= C93_HAS_PALETTE;
169 169
         ret = get_buffer(pb, pkt->data + pkt->size, datasize);
170 170
         if (ret < datasize) {
171
-            ret = AVERROR_IO;
171
+            ret = AVERROR(EIO);
172 172
             goto fail;
173 173
         }
174 174
         pkt->size += 768;
... ...
@@ -37,7 +37,7 @@ static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
37 37
     ByteIOContext *pb = &s->pb;
38 38
     int ret, size;
39 39
     if (url_feof(pb))
40
-        return AVERROR_IO;
40
+        return AVERROR(EIO);
41 41
     size = get_be16(pb);
42 42
     get_be16(pb); // unknown
43 43
     ret = av_get_packet(pb, pkt, size);
... ...
@@ -147,7 +147,7 @@ static int cin_read_frame_header(CinDemuxContext *cin, ByteIOContext *pb) {
147 147
     hdr->audio_frame_size = get_le32(pb);
148 148
 
149 149
     if (url_feof(pb) || url_ferror(pb))
150
-        return AVERROR_IO;
150
+        return AVERROR(EIO);
151 151
 
152 152
     if (get_le32(pb) != 0xAA55AA55)
153 153
         return AVERROR_INVALIDDATA;
... ...
@@ -189,7 +189,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
189 189
         pkt->data[3] = hdr->video_frame_type;
190 190
 
191 191
         if (get_buffer(pb, &pkt->data[4], pkt_size) != pkt_size)
192
-            return AVERROR_IO;
192
+            return AVERROR(EIO);
193 193
 
194 194
         /* sound buffer will be processed on next read_packet() call */
195 195
         cin->audio_buffer_size = hdr->audio_frame_size;
... ...
@@ -205,7 +205,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
205 205
     cin->audio_stream_pts += cin->audio_buffer_size * 2 / cin->file_header.audio_frame_size;
206 206
 
207 207
     if (get_buffer(pb, pkt->data, cin->audio_buffer_size) != cin->audio_buffer_size)
208
-        return AVERROR_IO;
208
+        return AVERROR(EIO);
209 209
 
210 210
     cin->audio_buffer_size = 0;
211 211
     return 0;
... ...
@@ -388,7 +388,7 @@ static int dv_read_header(AVFormatContext *s,
388 388
 
389 389
     if (get_buffer(&s->pb, c->buf, DV_PROFILE_BYTES) <= 0 ||
390 390
         url_fseek(&s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
391
-        return AVERROR_IO;
391
+        return AVERROR(EIO);
392 392
 
393 393
     c->dv_demux->sys = dv_frame_profile(c->buf);
394 394
     s->bit_rate = av_rescale(c->dv_demux->sys->frame_size * 8,
... ...
@@ -409,7 +409,7 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt)
409 409
     if (size < 0) {
410 410
         size = c->dv_demux->sys->frame_size;
411 411
         if (get_buffer(&s->pb, c->buf, size) <= 0)
412
-            return AVERROR_IO;
412
+            return AVERROR(EIO);
413 413
 
414 414
         size = dv_produce_packet(c->dv_demux, pkt, c->buf, size);
415 415
     }
... ...
@@ -124,7 +124,7 @@ static int dv1394_read_header(AVFormatContext * context, AVFormatParameters * ap
124 124
 
125 125
 failed:
126 126
     close(dv->fd);
127
-    return AVERROR_IO;
127
+    return AVERROR(EIO);
128 128
 }
129 129
 
130 130
 static int dv1394_read_packet(AVFormatContext *context, AVPacket *pkt)
... ...
@@ -163,12 +163,12 @@ restart_poll:
163 163
             if (errno == EAGAIN || errno == EINTR)
164 164
                 goto restart_poll;
165 165
             perror("Poll failed");
166
-            return AVERROR_IO;
166
+            return AVERROR(EIO);
167 167
         }
168 168
 
169 169
         if (ioctl(dv->fd, DV1394_GET_STATUS, &s) < 0) {
170 170
             perror("Failed to get status");
171
-            return AVERROR_IO;
171
+            return AVERROR(EIO);
172 172
         }
173 173
 #ifdef DV1394_DEBUG
174 174
         av_log(context, AV_LOG_DEBUG, "DV1394: status\n"
... ...
@@ -149,7 +149,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
149 149
         ret = av_get_packet(&s->pb, pkt, size);
150 150
         pkt->stream_index = 1;
151 151
         if(ret != size)
152
-            return AVERROR_IO;
152
+            return AVERROR(EIO);
153 153
         c->bytes_left -= size;
154 154
         c->wavpos = url_ftell(&s->pb);
155 155
         return 0;
... ...
@@ -186,7 +186,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
186 186
             ret = get_buffer(&s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
187 187
             if(ret != size){
188 188
                 av_free_packet(pkt);
189
-                return AVERROR_IO;
189
+                return AVERROR(EIO);
190 190
             }
191 191
             if(pal_size) memcpy(pkt->data, pal, pal_size);
192 192
             pkt->stream_index = 0;
... ...
@@ -178,7 +178,7 @@ static int ea_read_header(AVFormatContext *s,
178 178
     AVStream *st;
179 179
 
180 180
     if (!process_ea_header(s))
181
-        return AVERROR_IO;
181
+        return AVERROR(EIO);
182 182
 
183 183
 #if 0
184 184
     /* initialize the video decoder stream */
... ...
@@ -226,7 +226,7 @@ static int ea_read_packet(AVFormatContext *s,
226 226
     while (!packet_read) {
227 227
 
228 228
         if (get_buffer(pb, preamble, EA_PREAMBLE_SIZE) != EA_PREAMBLE_SIZE)
229
-            return AVERROR_IO;
229
+            return AVERROR(EIO);
230 230
         chunk_type = AV_RL32(&preamble[0]);
231 231
         chunk_size = AV_RL32(&preamble[4]) - EA_PREAMBLE_SIZE;
232 232
 
... ...
@@ -235,7 +235,7 @@ static int ea_read_packet(AVFormatContext *s,
235 235
         case SCDl_TAG:
236 236
             ret = av_get_packet(pb, pkt, chunk_size);
237 237
             if (ret != chunk_size)
238
-                ret = AVERROR_IO;
238
+                ret = AVERROR(EIO);
239 239
             else {
240 240
                     pkt->stream_index = ea->audio_stream_index;
241 241
                     pkt->pts = 90000;
... ...
@@ -253,7 +253,7 @@ static int ea_read_packet(AVFormatContext *s,
253 253
 
254 254
         /* ending tag */
255 255
         case SCEl_TAG:
256
-            ret = AVERROR_IO;
256
+            ret = AVERROR(EIO);
257 257
             packet_read = 1;
258 258
             break;
259 259
 
... ...
@@ -78,7 +78,7 @@ static int flic_read_header(AVFormatContext *s,
78 78
 
79 79
     /* load the whole header and pull out the width and height */
80 80
     if (get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE)
81
-        return AVERROR_IO;
81
+        return AVERROR(EIO);
82 82
 
83 83
     magic_number = AV_RL16(&header[4]);
84 84
     speed = AV_RL32(&header[0x10]);
... ...
@@ -169,7 +169,7 @@ static int flic_read_packet(AVFormatContext *s,
169 169
 
170 170
         if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) !=
171 171
             FLIC_PREAMBLE_SIZE) {
172
-            ret = AVERROR_IO;
172
+            ret = AVERROR(EIO);
173 173
             break;
174 174
         }
175 175
 
... ...
@@ -178,7 +178,7 @@ static int flic_read_packet(AVFormatContext *s,
178 178
 
179 179
         if (((magic == FLIC_CHUNK_MAGIC_1) || (magic == FLIC_CHUNK_MAGIC_2)) && size > FLIC_PREAMBLE_SIZE) {
180 180
             if (av_new_packet(pkt, size)) {
181
-                ret = AVERROR_IO;
181
+                ret = AVERROR(EIO);
182 182
                 break;
183 183
             }
184 184
             pkt->stream_index = flic->video_stream_index;
... ...
@@ -189,7 +189,7 @@ static int flic_read_packet(AVFormatContext *s,
189 189
                 size - FLIC_PREAMBLE_SIZE);
190 190
             if (ret != size - FLIC_PREAMBLE_SIZE) {
191 191
                 av_free_packet(pkt);
192
-                ret = AVERROR_IO;
192
+                ret = AVERROR(EIO);
193 193
             }
194 194
             flic->pts += flic->frame_pts_inc;
195 195
             packet_read = 1;
... ...
@@ -270,7 +270,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
270 270
     pts = get_be24(&s->pb);
271 271
 //    av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, pts:%d\n", type, size, pts);
272 272
     if (url_feof(&s->pb))
273
-        return AVERROR_IO;
273
+        return AVERROR(EIO);
274 274
     url_fskip(&s->pb, 4); /* reserved */
275 275
     flags = 0;
276 276
 
... ...
@@ -348,7 +348,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
348 348
 
349 349
     ret= av_get_packet(&s->pb, pkt, size - 1);
350 350
     if (ret <= 0) {
351
-        return AVERROR_IO;
351
+        return AVERROR(EIO);
352 352
     }
353 353
     /* note: we need to modify the packet size here to handle the last
354 354
        packet */
... ...
@@ -343,7 +343,7 @@ static int gif_write_header(AVFormatContext *s)
343 343
 
344 344
     if (video_enc->pix_fmt != PIX_FMT_RGB24) {
345 345
         av_log(s, AV_LOG_ERROR, "ERROR: gif only handles the rgb24 pixel format. Use -pix_fmt rgb24.\n");
346
-        return AVERROR_IO;
346
+        return AVERROR(EIO);
347 347
     }
348 348
 
349 349
     gif_image_write_header(pb, width, height, loop_count, NULL);
... ...
@@ -500,21 +500,21 @@ static int gif_parse_next_image(GifState *s)
500 500
         switch (code) {
501 501
         case ',':
502 502
             if (gif_read_image(s) < 0)
503
-                return AVERROR_IO;
503
+                return AVERROR(EIO);
504 504
             ret = 0;
505 505
             goto the_end;
506 506
         case ';':
507 507
             /* end of image */
508
-            ret = AVERROR_IO;
508
+            ret = AVERROR(EIO);
509 509
             goto the_end;
510 510
         case '!':
511 511
             if (gif_read_extension(s) < 0)
512
-                return AVERROR_IO;
512
+                return AVERROR(EIO);
513 513
             break;
514 514
         case EOF:
515 515
         default:
516 516
             /* error or errneous EOF */
517
-            ret = AVERROR_IO;
517
+            ret = AVERROR(EIO);
518 518
             goto the_end;
519 519
         }
520 520
     }
... ...
@@ -567,7 +567,7 @@ static int gif_read_packet(AVFormatContext * s1,
567 567
 
568 568
     /* XXX: avoid copying */
569 569
     if (av_new_packet(pkt, s->screen_width * s->screen_height * 3)) {
570
-        return AVERROR_IO;
570
+        return AVERROR(EIO);
571 571
     }
572 572
     pkt->stream_index = 0;
573 573
     memcpy(pkt->data, s->image_buf, s->screen_width * s->screen_height * 3);
... ...
@@ -279,7 +279,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
279 279
     if (video_fd >= 0)
280 280
         close(video_fd);
281 281
     av_free(st);
282
-    return AVERROR_IO;
282
+    return AVERROR(EIO);
283 283
 }
284 284
 
285 285
 static int v4l_mm_read_picture(VideoData *s, uint8_t *buf)
... ...
@@ -299,7 +299,7 @@ static int v4l_mm_read_picture(VideoData *s, uint8_t *buf)
299 299
             av_log(NULL, AV_LOG_ERROR, "Cannot Sync\n");
300 300
         else
301 301
             perror("VIDIOCMCAPTURE");
302
-        return AVERROR_IO;
302
+        return AVERROR(EIO);
303 303
     }
304 304
 
305 305
     /* This is now the grabbing frame */
... ...
@@ -334,7 +334,7 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
334 334
     }
335 335
 
336 336
     if (av_new_packet(pkt, s->frame_size) < 0)
337
-        return AVERROR_IO;
337
+        return AVERROR(EIO);
338 338
 
339 339
     pkt->pts = curtime;
340 340
 
... ...
@@ -345,7 +345,7 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
345 345
         return v4l_mm_read_picture(s, pkt->data);
346 346
     } else {
347 347
         if (read(s->fd, pkt->data, pkt->size) != pkt->size)
348
-            return AVERROR_IO;
348
+            return AVERROR(EIO);
349 349
         return s->frame_size;
350 350
     }
351 351
 }
... ...
@@ -473,7 +473,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
473 473
         pkt->dts = field_nr;
474 474
         return ret;
475 475
     }
476
-    return AVERROR_IO;
476
+    return AVERROR(EIO);
477 477
 }
478 478
 
479 479
 static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) {
... ...
@@ -101,7 +101,7 @@ static int http_open_cnx(URLContext *h)
101 101
         /* url moved, get next */
102 102
         url_close(hd);
103 103
         if (redirects++ >= MAX_REDIRECTS)
104
-            return AVERROR_IO;
104
+            return AVERROR(EIO);
105 105
         location_changed = 0;
106 106
         goto redo;
107 107
     }
... ...
@@ -109,7 +109,7 @@ static int http_open_cnx(URLContext *h)
109 109
  fail:
110 110
     if (hd)
111 111
         url_close(hd);
112
-    return AVERROR_IO;
112
+    return AVERROR(EIO);
113 113
 }
114 114
 
115 115
 static int http_open(URLContext *h, const char *uri, int flags)
... ...
@@ -139,7 +139,7 @@ static int http_getc(HTTPContext *s)
139 139
     if (s->buf_ptr >= s->buf_end) {
140 140
         len = url_read(s->hd, s->buffer, BUFFER_SIZE);
141 141
         if (len < 0) {
142
-            return AVERROR_IO;
142
+            return AVERROR(EIO);
143 143
         } else if (len == 0) {
144 144
             return -1;
145 145
         } else {
... ...
@@ -237,7 +237,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
237 237
 
238 238
     av_freep(&auth_b64);
239 239
     if (http_write(h, s->buffer, strlen(s->buffer)) < 0)
240
-        return AVERROR_IO;
240
+        return AVERROR(EIO);
241 241
 
242 242
     /* init input buffer */
243 243
     s->buf_ptr = s->buffer;
... ...
@@ -255,7 +255,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
255 255
     for(;;) {
256 256
         ch = http_getc(s);
257 257
         if (ch < 0)
258
-            return AVERROR_IO;
258
+            return AVERROR(EIO);
259 259
         if (ch == '\n') {
260 260
             /* process line */
261 261
             if (q > line && q[-1] == '\r')
... ...
@@ -165,7 +165,7 @@ static int idcin_read_header(AVFormatContext *s,
165 165
     st->codec->extradata = av_malloc(HUFFMAN_TABLE_SIZE);
166 166
     if (get_buffer(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) !=
167 167
         HUFFMAN_TABLE_SIZE)
168
-        return AVERROR_IO;
168
+        return AVERROR(EIO);
169 169
     /* save a reference in order to transport the palette */
170 170
     st->codec->palctrl = &idcin->palctrl;
171 171
 
... ...
@@ -222,17 +222,17 @@ static int idcin_read_packet(AVFormatContext *s,
222 222
     unsigned char palette_buffer[768];
223 223
 
224 224
     if (url_feof(&s->pb))
225
-        return AVERROR_IO;
225
+        return AVERROR(EIO);
226 226
 
227 227
     if (idcin->next_chunk_is_video) {
228 228
         command = get_le32(pb);
229 229
         if (command == 2) {
230
-            return AVERROR_IO;
230
+            return AVERROR(EIO);
231 231
         } else if (command == 1) {
232 232
             /* trigger a palette change */
233 233
             idcin->palctrl.palette_changed = 1;
234 234
             if (get_buffer(pb, palette_buffer, 768) != 768)
235
-                return AVERROR_IO;
235
+                return AVERROR(EIO);
236 236
             /* scale the palette as necessary */
237 237
             palette_scale = 2;
238 238
             for (i = 0; i < 768; i++)
... ...
@@ -255,7 +255,7 @@ static int idcin_read_packet(AVFormatContext *s,
255 255
         chunk_size -= 4;
256 256
         ret= av_get_packet(pb, pkt, chunk_size);
257 257
         if (ret != chunk_size)
258
-            return AVERROR_IO;
258
+            return AVERROR(EIO);
259 259
         pkt->stream_index = idcin->video_stream_index;
260 260
         pkt->pts = idcin->pts;
261 261
     } else {
... ...
@@ -266,7 +266,7 @@ static int idcin_read_packet(AVFormatContext *s,
266 266
             chunk_size = idcin->audio_chunk_size1;
267 267
         ret= av_get_packet(pb, pkt, chunk_size);
268 268
         if (ret != chunk_size)
269
-            return AVERROR_IO;
269
+            return AVERROR(EIO);
270 270
         pkt->stream_index = idcin->audio_stream_index;
271 271
         pkt->pts = idcin->pts;
272 272
 
... ...
@@ -79,7 +79,7 @@ static int roq_read_header(AVFormatContext *s,
79 79
     /* get the main header */
80 80
     if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
81 81
         RoQ_CHUNK_PREAMBLE_SIZE)
82
-        return AVERROR_IO;
82
+        return AVERROR(EIO);
83 83
     roq->framerate = AV_RL16(&preamble[6]);
84 84
     roq->frame_pts_inc = 90000 / roq->framerate;
85 85
 
... ...
@@ -91,7 +91,7 @@ static int roq_read_header(AVFormatContext *s,
91 91
     for (i = 0; i < RoQ_CHUNKS_TO_SCAN; i++) {
92 92
         if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
93 93
             RoQ_CHUNK_PREAMBLE_SIZE)
94
-            return AVERROR_IO;
94
+            return AVERROR(EIO);
95 95
 
96 96
         chunk_type = AV_RL16(&preamble[0]);
97 97
         chunk_size = AV_RL32(&preamble[2]);
... ...
@@ -102,7 +102,7 @@ static int roq_read_header(AVFormatContext *s,
102 102
             /* fetch the width and height; reuse the preamble bytes */
103 103
             if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
104 104
                 RoQ_CHUNK_PREAMBLE_SIZE)
105
-                return AVERROR_IO;
105
+                return AVERROR(EIO);
106 106
             roq->width = AV_RL16(&preamble[0]);
107 107
             roq->height = AV_RL16(&preamble[2]);
108 108
             break;
... ...
@@ -186,12 +186,12 @@ static int roq_read_packet(AVFormatContext *s,
186 186
     while (!packet_read) {
187 187
 
188 188
         if (url_feof(&s->pb))
189
-            return AVERROR_IO;
189
+            return AVERROR(EIO);
190 190
 
191 191
         /* get the next chunk preamble */
192 192
         if ((ret = get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) !=
193 193
             RoQ_CHUNK_PREAMBLE_SIZE)
194
-            return AVERROR_IO;
194
+            return AVERROR(EIO);
195 195
 
196 196
         chunk_type = AV_RL16(&preamble[0]);
197 197
         chunk_size = AV_RL32(&preamble[2]);
... ...
@@ -212,7 +212,7 @@ static int roq_read_packet(AVFormatContext *s,
212 212
             url_fseek(pb, codebook_size, SEEK_CUR);
213 213
             if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
214 214
                 RoQ_CHUNK_PREAMBLE_SIZE)
215
-                return AVERROR_IO;
215
+                return AVERROR(EIO);
216 216
             chunk_size = AV_RL32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 +
217 217
                 codebook_size;
218 218
 
... ...
@@ -222,7 +222,7 @@ static int roq_read_packet(AVFormatContext *s,
222 222
             /* load up the packet */
223 223
             ret= av_get_packet(pb, pkt, chunk_size);
224 224
             if (ret != chunk_size)
225
-                return AVERROR_IO;
225
+                return AVERROR(EIO);
226 226
             pkt->stream_index = roq->video_stream_index;
227 227
             pkt->pts = roq->video_pts;
228 228
 
... ...
@@ -235,7 +235,7 @@ static int roq_read_packet(AVFormatContext *s,
235 235
         case RoQ_QUAD_VQ:
236 236
             /* load up the packet */
237 237
             if (av_new_packet(pkt, chunk_size + RoQ_CHUNK_PREAMBLE_SIZE))
238
-                return AVERROR_IO;
238
+                return AVERROR(EIO);
239 239
             /* copy over preamble */
240 240
             memcpy(pkt->data, preamble, RoQ_CHUNK_PREAMBLE_SIZE);
241 241
 
... ...
@@ -255,7 +255,7 @@ static int roq_read_packet(AVFormatContext *s,
255 255
             ret = get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
256 256
                 chunk_size);
257 257
             if (ret != chunk_size)
258
-                ret = AVERROR_IO;
258
+                ret = AVERROR(EIO);
259 259
 
260 260
             packet_read = 1;
261 261
             break;
... ...
@@ -208,7 +208,7 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
208 208
 
209 209
     if (!s->is_pipe) {
210 210
         if (find_image_range(&first_index, &last_index, s->path) < 0)
211
-            return AVERROR_IO;
211
+            return AVERROR(EIO);
212 212
         s->img_first = first_index;
213 213
         s->img_last = last_index;
214 214
         s->img_number = first_index;
... ...
@@ -249,10 +249,10 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
249 249
         }
250 250
         if (av_get_frame_filename(filename, sizeof(filename),
251 251
                                   s->path, s->img_number)<0 && s->img_number > 1)
252
-            return AVERROR_IO;
252
+            return AVERROR(EIO);
253 253
         for(i=0; i<3; i++){
254 254
             if (url_fopen(f[i], filename, URL_RDONLY) < 0)
255
-                return AVERROR_IO;
255
+                return AVERROR(EIO);
256 256
             size[i]= url_fsize(f[i]);
257 257
 
258 258
             if(codec->codec_id != CODEC_ID_RAWVIDEO)
... ...
@@ -265,7 +265,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
265 265
     } else {
266 266
         f[0] = &s1->pb;
267 267
         if (url_feof(f[0]))
268
-            return AVERROR_IO;
268
+            return AVERROR(EIO);
269 269
         size[0]= 4096;
270 270
     }
271 271
 
... ...
@@ -286,7 +286,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
286 286
 
287 287
     if (ret[0] <= 0 || ret[1]<0 || ret[2]<0) {
288 288
         av_free_packet(pkt);
289
-        return AVERROR_IO; /* signal EOF */
289
+        return AVERROR(EIO); /* signal EOF */
290 290
     } else {
291 291
         s->img_count++;
292 292
         s->img_number++;
... ...
@@ -330,10 +330,10 @@ static int img_write_packet(AVFormatContext *s, AVPacket *pkt)
330 330
     if (!img->is_pipe) {
331 331
         if (av_get_frame_filename(filename, sizeof(filename),
332 332
                                   img->path, img->img_number) < 0 && img->img_number>1)
333
-            return AVERROR_IO;
333
+            return AVERROR(EIO);
334 334
         for(i=0; i<3; i++){
335 335
             if (url_fopen(pb[i], filename, URL_WRONLY) < 0)
336
-                return AVERROR_IO;
336
+                return AVERROR(EIO);
337 337
 
338 338
             if(codec->codec_id != CODEC_ID_RAWVIDEO)
339 339
                 break;
... ...
@@ -539,7 +539,7 @@ static int ipmovie_read_header(AVFormatContext *s,
539 539
      * it; if it is the first video chunk, this is a silent file */
540 540
     if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
541 541
         CHUNK_PREAMBLE_SIZE)
542
-        return AVERROR_IO;
542
+        return AVERROR(EIO);
543 543
     chunk_type = AV_RL16(&chunk_preamble[2]);
544 544
     url_fseek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR);
545 545
 
... ...
@@ -596,7 +596,7 @@ static int ipmovie_read_packet(AVFormatContext *s,
596 596
     if (ret == CHUNK_BAD)
597 597
         ret = AVERROR_INVALIDDATA;
598 598
     else if (ret == CHUNK_EOF)
599
-        ret = AVERROR_IO;
599
+        ret = AVERROR(EIO);
600 600
     else if (ret == CHUNK_NOMEM)
601 601
         ret = AVERROR(ENOMEM);
602 602
     else if (ret == CHUNK_VIDEO)
... ...
@@ -223,7 +223,7 @@ ebml_read_num (MatroskaDemuxContext *matroska,
223 223
                    "Read error at pos. %"PRIu64" (0x%"PRIx64")\n",
224 224
                    pos, pos);
225 225
         }
226
-        return AVERROR_IO; /* EOS or actual I/O error */
226
+        return AVERROR(EIO); /* EOS or actual I/O error */
227 227
     }
228 228
 
229 229
     /* get the length of the EBML number */
... ...
@@ -491,7 +491,7 @@ ebml_read_ascii (MatroskaDemuxContext *matroska,
491 491
         offset_t pos = url_ftell(pb);
492 492
         av_log(matroska->ctx, AV_LOG_ERROR,
493 493
                "Read error at pos. %"PRIu64" (0x%"PRIx64")\n", pos, pos);
494
-        return AVERROR_IO;
494
+        return AVERROR(EIO);
495 495
     }
496 496
     (*str)[size] = '\0';
497 497
 
... ...
@@ -588,7 +588,7 @@ ebml_read_binary (MatroskaDemuxContext *matroska,
588 588
         offset_t pos = url_ftell(pb);
589 589
         av_log(matroska->ctx, AV_LOG_ERROR,
590 590
                "Read error at pos. %"PRIu64" (0x%"PRIx64")\n", pos, pos);
591
-        return AVERROR_IO;
591
+        return AVERROR(EIO);
592 592
     }
593 593
 
594 594
     return 0;
... ...
@@ -693,7 +693,7 @@ ebml_read_header (MatroskaDemuxContext *matroska,
693 693
 
694 694
     while (res == 0) {
695 695
         if (!(id = ebml_peek_id(matroska, &level_up)))
696
-            return AVERROR_IO;
696
+            return AVERROR(EIO);
697 697
 
698 698
         /* end-of-header */
699 699
         if (level_up)
... ...
@@ -903,7 +903,7 @@ matroska_parse_info (MatroskaDemuxContext *matroska)
903 903
 
904 904
     while (res == 0) {
905 905
         if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
906
-            res = AVERROR_IO;
906
+            res = AVERROR(EIO);
907 907
             break;
908 908
         } else if (matroska->level_up) {
909 909
             matroska->level_up--;
... ...
@@ -1002,7 +1002,7 @@ matroska_add_stream (MatroskaDemuxContext *matroska)
1002 1002
     /* try reading the trackentry headers */
1003 1003
     while (res == 0) {
1004 1004
         if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1005
-            res = AVERROR_IO;
1005
+            res = AVERROR(EIO);
1006 1006
             break;
1007 1007
         } else if (matroska->level_up > 0) {
1008 1008
             matroska->level_up--;
... ...
@@ -1075,7 +1075,7 @@ matroska_add_stream (MatroskaDemuxContext *matroska)
1075 1075
 
1076 1076
                 while (res == 0) {
1077 1077
                     if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1078
-                        res = AVERROR_IO;
1078
+                        res = AVERROR(EIO);
1079 1079
                         break;
1080 1080
                     } else if (matroska->level_up > 0) {
1081 1081
                         matroska->level_up--;
... ...
@@ -1246,7 +1246,7 @@ matroska_add_stream (MatroskaDemuxContext *matroska)
1246 1246
 
1247 1247
                 while (res == 0) {
1248 1248
                     if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1249
-                        res = AVERROR_IO;
1249
+                        res = AVERROR(EIO);
1250 1250
                         break;
1251 1251
                     } else if (matroska->level_up > 0) {
1252 1252
                         matroska->level_up--;
... ...
@@ -1444,7 +1444,7 @@ matroska_parse_tracks (MatroskaDemuxContext *matroska)
1444 1444
 
1445 1445
     while (res == 0) {
1446 1446
         if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1447
-            res = AVERROR_IO;
1447
+            res = AVERROR(EIO);
1448 1448
             break;
1449 1449
         } else if (matroska->level_up) {
1450 1450
             matroska->level_up--;
... ...
@@ -1487,7 +1487,7 @@ matroska_parse_index (MatroskaDemuxContext *matroska)
1487 1487
 
1488 1488
     while (res == 0) {
1489 1489
         if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1490
-            res = AVERROR_IO;
1490
+            res = AVERROR(EIO);
1491 1491
             break;
1492 1492
         } else if (matroska->level_up) {
1493 1493
             matroska->level_up--;
... ...
@@ -1508,7 +1508,7 @@ matroska_parse_index (MatroskaDemuxContext *matroska)
1508 1508
 
1509 1509
                 while (res == 0) {
1510 1510
                     if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1511
-                        res = AVERROR_IO;
1511
+                        res = AVERROR(EIO);
1512 1512
                         break;
1513 1513
                     } else if (matroska->level_up) {
1514 1514
                         matroska->level_up--;
... ...
@@ -1535,7 +1535,7 @@ matroska_parse_index (MatroskaDemuxContext *matroska)
1535 1535
                             while (res == 0) {
1536 1536
                                 if (!(id = ebml_peek_id (matroska,
1537 1537
                                                     &matroska->level_up))) {
1538
-                                    res = AVERROR_IO;
1538
+                                    res = AVERROR(EIO);
1539 1539
                                     break;
1540 1540
                                 } else if (matroska->level_up) {
1541 1541
                                     matroska->level_up--;
... ...
@@ -1642,7 +1642,7 @@ matroska_parse_metadata (MatroskaDemuxContext *matroska)
1642 1642
 
1643 1643
     while (res == 0) {
1644 1644
         if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1645
-            res = AVERROR_IO;
1645
+            res = AVERROR(EIO);
1646 1646
             break;
1647 1647
         } else if (matroska->level_up) {
1648 1648
             matroska->level_up--;
... ...
@@ -1680,7 +1680,7 @@ matroska_parse_seekhead (MatroskaDemuxContext *matroska)
1680 1680
 
1681 1681
     while (res == 0) {
1682 1682
         if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1683
-            res = AVERROR_IO;
1683
+            res = AVERROR(EIO);
1684 1684
             break;
1685 1685
         } else if (matroska->level_up) {
1686 1686
             matroska->level_up--;
... ...
@@ -1697,7 +1697,7 @@ matroska_parse_seekhead (MatroskaDemuxContext *matroska)
1697 1697
 
1698 1698
                 while (res == 0) {
1699 1699
                     if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1700
-                        res = AVERROR_IO;
1700
+                        res = AVERROR(EIO);
1701 1701
                         break;
1702 1702
                     } else if (matroska->level_up) {
1703 1703
                         matroska->level_up--;
... ...
@@ -1913,7 +1913,7 @@ matroska_read_header (AVFormatContext    *s,
1913 1913
     /* The next thing is a segment. */
1914 1914
     while (1) {
1915 1915
         if (!(id = ebml_peek_id(matroska, &last_level)))
1916
-            return AVERROR_IO;
1916
+            return AVERROR(EIO);
1917 1917
         if (id == MATROSKA_ID_SEGMENT)
1918 1918
             break;
1919 1919
 
... ...
@@ -1936,7 +1936,7 @@ matroska_read_header (AVFormatContext    *s,
1936 1936
     /* we've found our segment, start reading the different contents in here */
1937 1937
     while (res == 0) {
1938 1938
         if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
1939
-            res = AVERROR_IO;
1939
+            res = AVERROR(EIO);
1940 1940
             break;
1941 1941
         } else if (matroska->level_up) {
1942 1942
             matroska->level_up--;
... ...
@@ -2497,7 +2497,7 @@ matroska_parse_blockgroup (MatroskaDemuxContext *matroska,
2497 2497
 
2498 2498
     while (res == 0) {
2499 2499
         if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
2500
-            res = AVERROR_IO;
2500
+            res = AVERROR(EIO);
2501 2501
             break;
2502 2502
         } else if (matroska->level_up) {
2503 2503
             matroska->level_up--;
... ...
@@ -2575,7 +2575,7 @@ matroska_parse_cluster (MatroskaDemuxContext *matroska)
2575 2575
 
2576 2576
     while (res == 0) {
2577 2577
         if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
2578
-            res = AVERROR_IO;
2578
+            res = AVERROR(EIO);
2579 2579
             break;
2580 2580
         } else if (matroska->level_up) {
2581 2581
             matroska->level_up--;
... ...
@@ -2640,12 +2640,12 @@ matroska_read_packet (AVFormatContext *s,
2640 2640
 
2641 2641
         /* Have we already reached the end? */
2642 2642
         if (matroska->done)
2643
-            return AVERROR_IO;
2643
+            return AVERROR(EIO);
2644 2644
 
2645 2645
         res = 0;
2646 2646
         while (res == 0) {
2647 2647
             if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
2648
-                return AVERROR_IO;
2648
+                return AVERROR(EIO);
2649 2649
             } else if (matroska->level_up) {
2650 2650
                 matroska->level_up--;
2651 2651
                 break;
... ...
@@ -136,7 +136,7 @@ static int mm_read_packet(AVFormatContext *s,
136 136
     while(1) {
137 137
 
138 138
         if (get_buffer(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) {
139
-            return AVERROR_IO;
139
+            return AVERROR(EIO);
140 140
         }
141 141
 
142 142
         type = AV_RL16(&preamble[0]);
... ...
@@ -146,7 +146,7 @@ static int mm_read_packet(AVFormatContext *s,
146 146
         case MM_TYPE_PALETTE :
147 147
             url_fseek(pb, 4, SEEK_CUR);  /* unknown data */
148 148
             if (get_buffer(pb, pal, MM_PALETTE_SIZE) != MM_PALETTE_SIZE)
149
-                return AVERROR_IO;
149
+                return AVERROR(EIO);
150 150
             url_fseek(pb, length - (4 + MM_PALETTE_SIZE), SEEK_CUR);
151 151
 
152 152
             for (i=0; i<MM_PALETTE_COUNT; i++) {
... ...
@@ -171,7 +171,7 @@ static int mm_read_packet(AVFormatContext *s,
171 171
                 return AVERROR(ENOMEM);
172 172
             memcpy(pkt->data, preamble, MM_PREAMBLE_SIZE);
173 173
             if (get_buffer(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length)
174
-                return AVERROR_IO;
174
+                return AVERROR(EIO);
175 175
             pkt->size = length + MM_PREAMBLE_SIZE;
176 176
             pkt->stream_index = 0;
177 177
             pkt->pts = mm->video_pts++;
... ...
@@ -266,7 +266,7 @@ static int mmf_read_packet(AVFormatContext *s,
266 266
     int ret, size;
267 267
 
268 268
     if (url_feof(&s->pb))
269
-        return AVERROR_IO;
269
+        return AVERROR(EIO);
270 270
     st = s->streams[0];
271 271
 
272 272
     size = MAX_SIZE;
... ...
@@ -274,10 +274,10 @@ static int mmf_read_packet(AVFormatContext *s,
274 274
         size = mmf->data_size;
275 275
 
276 276
     if(!size)
277
-        return AVERROR_IO;
277
+        return AVERROR(EIO);
278 278
 
279 279
     if (av_new_packet(pkt, size))
280
-        return AVERROR_IO;
280
+        return AVERROR(EIO);
281 281
     pkt->stream_index = 0;
282 282
 
283 283
     ret = get_buffer(&s->pb, pkt->data, pkt->size);
... ...
@@ -485,7 +485,7 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
485 485
 
486 486
     pkt->stream_index = 0;
487 487
     if (ret <= 0) {
488
-        return AVERROR_IO;
488
+        return AVERROR(EIO);
489 489
     }
490 490
     /* note: we need to modify the packet size here to handle the last
491 491
        packet */
... ...
@@ -148,7 +148,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
148 148
     c->curbits = (curbits + size2) & 0x1F;
149 149
 
150 150
     if (av_new_packet(pkt, size) < 0)
151
-        return AVERROR_IO;
151
+        return AVERROR(EIO);
152 152
 
153 153
     pkt->data[0] = curbits;
154 154
     pkt->data[1] = (c->curframe > c->fcount);
... ...
@@ -160,7 +160,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
160 160
         url_fseek(&s->pb, -4, SEEK_CUR);
161 161
     if(ret < size){
162 162
         av_free_packet(pkt);
163
-        return AVERROR_IO;
163
+        return AVERROR(EIO);
164 164
     }
165 165
     pkt->size = ret + 4;
166 166
 
... ...
@@ -232,7 +232,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
232 232
         last_sync = url_ftell(&s->pb);
233 233
     //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(&s->pb));
234 234
     if (startcode < 0)
235
-        return AVERROR_IO;
235
+        return AVERROR(EIO);
236 236
     if (startcode == PACK_START_CODE)
237 237
         goto redo;
238 238
     if (startcode == SYSTEM_HEADER_START_CODE)
... ...
@@ -1014,7 +1014,7 @@ static int read_packet(ByteIOContext *pb, uint8_t *buf, int raw_packet_size)
1014 1014
     for(;;) {
1015 1015
         len = get_buffer(pb, buf, TS_PACKET_SIZE);
1016 1016
         if (len != TS_PACKET_SIZE)
1017
-            return AVERROR_IO;
1017
+            return AVERROR(EIO);
1018 1018
         /* check paquet sync byte */
1019 1019
         if (buf[0] != 0x47) {
1020 1020
             /* find a new packet start */
... ...
@@ -122,7 +122,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
122 122
     /* Jump over header */
123 123
 
124 124
     if(url_fseek(pb, MTV_HEADER_SIZE, SEEK_SET) != MTV_HEADER_SIZE)
125
-        return AVERROR_IO;
125
+        return AVERROR(EIO);
126 126
 
127 127
     return(0);
128 128
 
... ...
@@ -145,7 +145,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
145 145
 
146 146
         ret = av_get_packet(pb, pkt, MTV_ASUBCHUNK_DATA_SIZE);
147 147
         if(ret != MTV_ASUBCHUNK_DATA_SIZE)
148
-            return AVERROR_IO;
148
+            return AVERROR(EIO);
149 149
 
150 150
         mtv->audio_packet_count++;
151 151
         pkt->stream_index = AUDIO_SID;
... ...
@@ -154,7 +154,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
154 154
     {
155 155
         ret = av_get_packet(pb, pkt, mtv->img_segment_size);
156 156
         if(ret != mtv->img_segment_size)
157
-            return AVERROR_IO;
157
+            return AVERROR(EIO);
158 158
 
159 159
 #ifndef WORDS_BIGENDIAN
160 160
 
... ...
@@ -361,7 +361,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
361 361
         } else
362 362
             url_fskip(&s->pb, klv.length);
363 363
     }
364
-    return AVERROR_IO;
364
+    return AVERROR(EIO);
365 365
 }
366 366
 
367 367
 static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set)
... ...
@@ -225,7 +225,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
225 225
                 break;
226 226
         }
227 227
     }
228
-    return AVERROR_IO;
228
+    return AVERROR(EIO);
229 229
 }
230 230
 
231 231
 AVInputFormat nuv_demuxer = {
... ...
@@ -205,7 +205,7 @@ static int ogg_read_header(AVFormatContext *avfcontext, AVFormatParameters *ap)
205 205
     buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ;
206 206
 
207 207
     if(get_buffer(&avfcontext->pb, buf, DECODER_BUFFER_SIZE) <= 0)
208
-        return AVERROR_IO ;
208
+        return AVERROR(EIO) ;
209 209
 
210 210
     ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ;
211 211
     ogg_sync_pageout(&context->oy, &og) ;
... ...
@@ -245,9 +245,9 @@ static int ogg_read_packet(AVFormatContext *avfcontext, AVPacket *pkt) {
245 245
     ogg_packet op ;
246 246
 
247 247
     if(next_packet(avfcontext, &op))
248
-        return AVERROR_IO ;
248
+        return AVERROR(EIO) ;
249 249
     if(av_new_packet(pkt, op.bytes) < 0)
250
-        return AVERROR_IO ;
250
+        return AVERROR(EIO) ;
251 251
     pkt->stream_index = 0 ;
252 252
     memcpy(pkt->data, op.packet, op.bytes);
253 253
     if(avfcontext->streams[0]->codec.sample_rate && op.granulepos!=-1)
... ...
@@ -540,7 +540,7 @@ ogg_read_packet (AVFormatContext * s, AVPacket * pkt)
540 540
     //Get an ogg packet
541 541
     do{
542 542
         if (ogg_packet (s, &idx, &pstart, &psize) < 0)
543
-            return AVERROR_IO;
543
+            return AVERROR(EIO);
544 544
     }while (idx < 0 || !s->streams[idx]);
545 545
 
546 546
     ogg = s->priv_data;
... ...
@@ -548,7 +548,7 @@ ogg_read_packet (AVFormatContext * s, AVPacket * pkt)
548 548
 
549 549
     //Alloc a pkt
550 550
     if (av_new_packet (pkt, psize) < 0)
551
-        return AVERROR_IO;
551
+        return AVERROR(EIO);
552 552
     pkt->stream_index = idx;
553 553
     memcpy (pkt->data, os->buf + pstart, psize);
554 554
     if (os->lastgp != -1LL){
... ...
@@ -142,7 +142,7 @@ static int str_read_header(AVFormatContext *s,
142 142
 
143 143
     /* skip over any RIFF header */
144 144
     if (get_buffer(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE)
145
-        return AVERROR_IO;
145
+        return AVERROR(EIO);
146 146
     if (AV_RL32(&sector[0]) == RIFF_TAG)
147 147
         start = RIFF_HEADER_SIZE;
148 148
     else
... ...
@@ -153,7 +153,7 @@ static int str_read_header(AVFormatContext *s,
153 153
     /* check through the first 32 sectors for individual channels */
154 154
     for (i = 0; i < 32; i++) {
155 155
         if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE)
156
-            return AVERROR_IO;
156
+            return AVERROR(EIO);
157 157
 
158 158
 //printf("%02x %02x %02x %02x\n",sector[0x10],sector[0x11],sector[0x12],sector[0x13]);
159 159
 
... ...
@@ -260,7 +260,7 @@ static int str_read_packet(AVFormatContext *s,
260 260
     while (!packet_read) {
261 261
 
262 262
         if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE)
263
-            return AVERROR_IO;
263
+            return AVERROR(EIO);
264 264
 
265 265
         channel = sector[0x11];
266 266
         if (channel >= 32)
... ...
@@ -282,7 +282,7 @@ static int str_read_packet(AVFormatContext *s,
282 282
                 pkt = &str->tmp_pkt;
283 283
                 if (current_sector == 0) {
284 284
                     if (av_new_packet(pkt, frame_size))
285
-                        return AVERROR_IO;
285
+                        return AVERROR(EIO);
286 286
 
287 287
                     pkt->pos= url_ftell(pb) - RAW_CD_SECTOR_SIZE;
288 288
                     pkt->stream_index =
... ...
@@ -319,7 +319,7 @@ printf (" dropping audio sector\n");
319 319
             if (channel == str->audio_channel) {
320 320
                 pkt = ret_pkt;
321 321
                 if (av_new_packet(pkt, 2304))
322
-                    return AVERROR_IO;
322
+                    return AVERROR(EIO);
323 323
                 memcpy(pkt->data,sector+24,2304);
324 324
 
325 325
                 pkt->stream_index =
... ...
@@ -338,7 +338,7 @@ printf (" dropping other sector\n");
338 338
         }
339 339
 
340 340
         if (url_feof(pb))
341
-            return AVERROR_IO;
341
+            return AVERROR(EIO);
342 342
     }
343 343
 
344 344
     return ret;
... ...
@@ -115,7 +115,7 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
115 115
 
116 116
     pkt->stream_index = 0;
117 117
     if (ret <= 0) {
118
-        return AVERROR_IO;
118
+        return AVERROR(EIO);
119 119
     }
120 120
     /* note: we need to modify the packet size here to handle the last
121 121
        packet */
... ...
@@ -130,14 +130,14 @@ static int raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
130 130
     size = RAW_PACKET_SIZE;
131 131
 
132 132
     if (av_new_packet(pkt, size) < 0)
133
-        return AVERROR_IO;
133
+        return AVERROR(EIO);
134 134
 
135 135
     pkt->pos= url_ftell(&s->pb);
136 136
     pkt->stream_index = 0;
137 137
     ret = get_partial_buffer(&s->pb, pkt->data, size);
138 138
     if (ret <= 0) {
139 139
         av_free_packet(pkt);
140
-        return AVERROR_IO;
140
+        return AVERROR(EIO);
141 141
     }
142 142
     pkt->size = ret;
143 143
     return ret;
... ...
@@ -149,7 +149,7 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
149 149
     int ret, size, w, h, unk1, unk2;
150 150
 
151 151
     if (get_le32(&s->pb) != MKTAG('M', 'J', 'P', 'G'))
152
-        return AVERROR_IO; // FIXME
152
+        return AVERROR(EIO); // FIXME
153 153
 
154 154
     size = get_le32(&s->pb);
155 155
 
... ...
@@ -166,14 +166,14 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
166 166
         size, w, h, unk1, unk2);
167 167
 
168 168
     if (av_new_packet(pkt, size) < 0)
169
-        return AVERROR_IO;
169
+        return AVERROR(EIO);
170 170
 
171 171
     pkt->pos = url_ftell(&s->pb);
172 172
     pkt->stream_index = 0;
173 173
     ret = get_buffer(&s->pb, pkt->data, size);
174 174
     if (ret <= 0) {
175 175
         av_free_packet(pkt);
176
-        return AVERROR_IO;
176
+        return AVERROR(EIO);
177 177
     }
178 178
     pkt->size = ret;
179 179
     return ret;
... ...
@@ -848,7 +848,7 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
848 848
 
849 849
     pkt->stream_index = 0;
850 850
     if (ret != packet_size) {
851
-        return AVERROR_IO;
851
+        return AVERROR(EIO);
852 852
     } else {
853 853
         return 0;
854 854
     }
... ...
@@ -220,7 +220,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
220 220
         /* very old .ra format */
221 221
         return rm_read_header_old(s, ap);
222 222
     } else if (tag != MKTAG('.', 'R', 'M', 'F')) {
223
-        return AVERROR_IO;
223
+        return AVERROR(EIO);
224 224
     }
225 225
 
226 226
     get_be32(pb); /* header size */
... ...
@@ -359,7 +359,7 @@ skip:
359 359
     for(i=0;i<s->nb_streams;i++) {
360 360
         av_free(s->streams[i]);
361 361
     }
362
-    return AVERROR_IO;
362
+    return AVERROR(EIO);
363 363
 }
364 364
 
365 365
 static int get_num(ByteIOContext *pb, int *len)
... ...
@@ -468,7 +468,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
468 468
             for (y = 0; y < rm->sub_packet_h; y++)
469 469
                 for (x = 0; x < rm->sub_packet_h/2; x++)
470 470
                     if (get_buffer(pb, rm->audiobuf+x*2*rm->audio_framesize+y*rm->coded_framesize, rm->coded_framesize) <= 0)
471
-                        return AVERROR_IO;
471
+                        return AVERROR(EIO);
472 472
             rm->audio_stream_num = 0;
473 473
             rm->audio_pkt_cnt = rm->sub_packet_h * rm->audio_framesize / st->codec->block_align - 1;
474 474
             // Release first audio packet
... ...
@@ -482,7 +482,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
482 482
             len= av_get_packet(pb, pkt, len);
483 483
             pkt->stream_index = 0;
484 484
             if (len <= 0) {
485
-                return AVERROR_IO;
485
+                return AVERROR(EIO);
486 486
             }
487 487
             pkt->size = len;
488 488
         }
... ...
@@ -491,7 +491,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
491 491
 resync:
492 492
         len=sync(s, &timestamp, &flags, &i, &pos);
493 493
         if(len<0)
494
-            return AVERROR_IO;
494
+            return AVERROR(EIO);
495 495
         st = s->streams[i];
496 496
 
497 497
         if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
... ...
@@ -741,7 +741,7 @@ static int rtp_write_header(AVFormatContext *s1)
741 741
 
742 742
     max_packet_size = url_fget_max_packet_size(&s1->pb);
743 743
     if (max_packet_size <= 12)
744
-        return AVERROR_IO;
744
+        return AVERROR(EIO);
745 745
     s->max_payload_size = max_packet_size - 12;
746 746
 
747 747
     switch(st->codec->codec_id) {
... ...
@@ -163,7 +163,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
163 163
     if (s->rtcp_hd)
164 164
         url_close(s->rtcp_hd);
165 165
     av_free(s);
166
-    return AVERROR_IO;
166
+    return AVERROR(EIO);
167 167
 }
168 168
 
169 169
 static int rtp_read(URLContext *h, uint8_t *buf, int size)
... ...
@@ -182,7 +182,7 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size)
182 182
             if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
183 183
                 ff_neterrno() == FF_NETERROR(EINTR))
184 184
                 continue;
185
-            return AVERROR_IO;
185
+            return AVERROR(EIO);
186 186
         }
187 187
         break;
188 188
     }
... ...
@@ -206,7 +206,7 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size)
206 206
                     if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
207 207
                         ff_neterrno() == FF_NETERROR(EINTR))
208 208
                         continue;
209
-                    return AVERROR_IO;
209
+                    return AVERROR(EIO);
210 210
                 }
211 211
                 break;
212 212
             }
... ...
@@ -219,7 +219,7 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size)
219 219
                     if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
220 220
                         ff_neterrno() == FF_NETERROR(EINTR))
221 221
                         continue;
222
-                    return AVERROR_IO;
222
+                    return AVERROR(EIO);
223 223
                 }
224 224
                 break;
225 225
             }
... ...
@@ -886,7 +886,7 @@ static int rtsp_read_header(AVFormatContext *s,
886 886
     /* open the tcp connexion */
887 887
     snprintf(tcpname, sizeof(tcpname), "tcp://%s:%d", host, port);
888 888
     if (url_open(&rtsp_hd, tcpname, URL_RDWR) < 0)
889
-        return AVERROR_IO;
889
+        return AVERROR(EIO);
890 890
     rt->rtsp_hd = rtsp_hd;
891 891
     rt->seq = 0;
892 892
 
... ...
@@ -1199,7 +1199,7 @@ static int rtsp_read_packet(AVFormatContext *s,
1199 1199
         break;
1200 1200
     }
1201 1201
     if (len < 0)
1202
-        return AVERROR_IO;
1202
+        return AVERROR(EIO);
1203 1203
     ret = rtp_parse_packet(rtsp_st->rtp_ctx, pkt, buf, len);
1204 1204
     if (ret < 0)
1205 1205
         goto redo;
... ...
@@ -1473,7 +1473,7 @@ int redir_open(AVFormatContext **ic_ptr, ByteIOContext *f)
1473 1473
     }
1474 1474
     *ic_ptr = ic;
1475 1475
     if (!ic)
1476
-        return AVERROR_IO;
1476
+        return AVERROR(EIO);
1477 1477
     else
1478 1478
         return 0;
1479 1479
 }
... ...
@@ -89,7 +89,7 @@ static int film_read_header(AVFormatContext *s,
89 89
 
90 90
     /* load the main FILM header */
91 91
     if (get_buffer(pb, scratch, 16) != 16)
92
-        return AVERROR_IO;
92
+        return AVERROR(EIO);
93 93
     data_offset = AV_RB32(&scratch[4]);
94 94
     film->version = AV_RB32(&scratch[8]);
95 95
 
... ...
@@ -97,7 +97,7 @@ static int film_read_header(AVFormatContext *s,
97 97
     if (film->version == 0) {
98 98
         /* special case for Lemmings .film files; 20-byte header */
99 99
         if (get_buffer(pb, scratch, 20) != 20)
100
-            return AVERROR_IO;
100
+            return AVERROR(EIO);
101 101
         /* make some assumptions about the audio parameters */
102 102
         film->audio_type = CODEC_ID_PCM_S8;
103 103
         film->audio_samplerate = 22050;
... ...
@@ -106,7 +106,7 @@ static int film_read_header(AVFormatContext *s,
106 106
     } else {
107 107
         /* normal Saturn .cpk files; 32-byte header */
108 108
         if (get_buffer(pb, scratch, 32) != 32)
109
-            return AVERROR_IO;
109
+            return AVERROR(EIO);
110 110
         film->audio_samplerate = AV_RB16(&scratch[24]);;
111 111
         film->audio_channels = scratch[21];
112 112
         film->audio_bits = scratch[22];
... ...
@@ -158,7 +158,7 @@ static int film_read_header(AVFormatContext *s,
158 158
 
159 159
     /* load the sample table */
160 160
     if (get_buffer(pb, scratch, 16) != 16)
161
-        return AVERROR_IO;
161
+        return AVERROR(EIO);
162 162
     if (AV_RB32(&scratch[0]) != STAB_TAG)
163 163
         return AVERROR_INVALIDDATA;
164 164
     film->base_clock = AV_RB32(&scratch[8]);
... ...
@@ -175,7 +175,7 @@ static int film_read_header(AVFormatContext *s,
175 175
         /* load the next sample record and transfer it to an internal struct */
176 176
         if (get_buffer(pb, scratch, 16) != 16) {
177 177
             av_free(film->sample_table);
178
-            return AVERROR_IO;
178
+            return AVERROR(EIO);
179 179
         }
180 180
         film->sample_table[i].sample_offset =
181 181
             data_offset + AV_RB32(&scratch[0]);
... ...
@@ -211,7 +211,7 @@ static int film_read_packet(AVFormatContext *s,
211 211
     int left, right;
212 212
 
213 213
     if (film->current_sample >= film->sample_count)
214
-        return AVERROR_IO;
214
+        return AVERROR(EIO);
215 215
 
216 216
     sample = &film->sample_table[film->current_sample];
217 217
 
... ...
@@ -242,7 +242,7 @@ static int film_read_packet(AVFormatContext *s,
242 242
         pkt->pos= url_ftell(pb);
243 243
         ret = get_buffer(pb, film->stereo_buffer, sample->sample_size);
244 244
         if (ret != sample->sample_size)
245
-            ret = AVERROR_IO;
245
+            ret = AVERROR(EIO);
246 246
 
247 247
         left = 0;
248 248
         right = sample->sample_size / 2;
... ...
@@ -260,7 +260,7 @@ static int film_read_packet(AVFormatContext *s,
260 260
     } else {
261 261
         ret= av_get_packet(pb, pkt, sample->sample_size);
262 262
         if (ret != sample->sample_size)
263
-            ret = AVERROR_IO;
263
+            ret = AVERROR(EIO);
264 264
     }
265 265
 
266 266
     pkt->stream_index = sample->stream;
... ...
@@ -89,7 +89,7 @@ static int vmd_read_header(AVFormatContext *s,
89 89
     /* fetch the main header, including the 2 header length bytes */
90 90
     url_fseek(pb, 0, SEEK_SET);
91 91
     if (get_buffer(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE)
92
-        return AVERROR_IO;
92
+        return AVERROR(EIO);
93 93
 
94 94
     /* start up the decoders */
95 95
     vst = av_new_stream(s, 0);
... ...
@@ -161,7 +161,7 @@ static int vmd_read_header(AVFormatContext *s,
161 161
         raw_frame_table_size) {
162 162
         av_free(raw_frame_table);
163 163
         av_free(vmd->frame_table);
164
-        return AVERROR_IO;
164
+        return AVERROR(EIO);
165 165
     }
166 166
 
167 167
     total_frames = 0;
... ...
@@ -250,7 +250,7 @@ static int vmd_read_packet(AVFormatContext *s,
250 250
     vmd_frame_t *frame;
251 251
 
252 252
     if (vmd->current_frame >= vmd->frame_count)
253
-        return AVERROR_IO;
253
+        return AVERROR(EIO);
254 254
 
255 255
     frame = &vmd->frame_table[vmd->current_frame];
256 256
     /* position the stream (will probably be there already) */
... ...
@@ -265,7 +265,7 @@ static int vmd_read_packet(AVFormatContext *s,
265 265
 
266 266
     if (ret != frame->frame_size) {
267 267
         av_free_packet(pkt);
268
-        ret = AVERROR_IO;
268
+        ret = AVERROR(EIO);
269 269
     }
270 270
     pkt->stream_index = frame->stream_index;
271 271
     pkt->pts = frame->pts;
... ...
@@ -199,7 +199,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
199 199
     if(ret != st->codec->extradata_size - 16){
200 200
         av_free(smk->frm_size);
201 201
         av_free(smk->frm_flags);
202
-        return AVERROR_IO;
202
+        return AVERROR(EIO);
203 203
     }
204 204
     ((int32_t*)st->codec->extradata)[0] = le2me_32(smk->mmap_size);
205 205
     ((int32_t*)st->codec->extradata)[1] = le2me_32(smk->mclr_size);
... ...
@@ -284,7 +284,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
284 284
                 smk->buf_sizes[smk->curstream] = size;
285 285
                 ret = get_buffer(&s->pb, smk->bufs[smk->curstream], size);
286 286
                 if(ret != size)
287
-                    return AVERROR_IO;
287
+                    return AVERROR(EIO);
288 288
                 smk->stream_id[smk->curstream] = smk->indexes[i];
289 289
             }
290 290
             flags >>= 1;
... ...
@@ -297,7 +297,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
297 297
         memcpy(pkt->data + 1, smk->pal, 768);
298 298
         ret = get_buffer(&s->pb, pkt->data + 769, frame_size);
299 299
         if(ret != frame_size)
300
-            return AVERROR_IO;
300
+            return AVERROR(EIO);
301 301
         pkt->stream_index = smk->videoindex;
302 302
         pkt->size = ret + 769;
303 303
         smk->cur_frame++;
... ...
@@ -639,10 +639,10 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
639 639
     if (tag == MKBETAG('C', 'W', 'S', 0))
640 640
     {
641 641
         av_log(s, AV_LOG_ERROR, "Compressed SWF format not supported\n");
642
-        return AVERROR_IO;
642
+        return AVERROR(EIO);
643 643
     }
644 644
     if (tag != MKBETAG('F', 'W', 'S', 0))
645
-        return AVERROR_IO;
645
+        return AVERROR(EIO);
646 646
     get_le32(pb);
647 647
     /* skip rectangle size */
648 648
     nbits = get_byte(pb) >> 3;
... ...
@@ -684,7 +684,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
684 684
             ast->need_parsing = AVSTREAM_PARSE_FULL;
685 685
             sample_rate_code= (v>>2) & 3;
686 686
             if (!sample_rate_code)
687
-                return AVERROR_IO;
687
+                return AVERROR(EIO);
688 688
             ast->codec->sample_rate = 11025 << (sample_rate_code-1);
689 689
             av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
690 690
             if (len > 4)
... ...
@@ -715,7 +715,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
715 715
     for(;;) {
716 716
         tag = get_swf_tag(pb, &len);
717 717
         if (tag < 0)
718
-            return AVERROR_IO;
718
+            return AVERROR(EIO);
719 719
         if (tag == TAG_VIDEOFRAME) {
720 720
             int ch_id = get_le16(pb);
721 721
             len -= 2;
... ...
@@ -98,7 +98,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
98 98
     return 0;
99 99
 
100 100
  fail:
101
-    ret = AVERROR_IO;
101
+    ret = AVERROR(EIO);
102 102
  fail1:
103 103
     if (fd >= 0)
104 104
         closesocket(fd);
... ...
@@ -148,7 +148,7 @@ static int thp_read_packet(AVFormatContext *s,
148 148
     if (thp->audiosize == 0) {
149 149
         /* Terminate when last frame is reached.  */
150 150
         if (thp->frame >= thp->framecnt)
151
-            return AVERROR_IO;
151
+            return AVERROR(EIO);
152 152
 
153 153
         url_fseek(pb, thp->next_frame, SEEK_SET);
154 154
 
... ...
@@ -169,7 +169,7 @@ static int thp_read_packet(AVFormatContext *s,
169 169
         ret = av_get_packet(pb, pkt, size);
170 170
         if (ret != size) {
171 171
             av_free_packet(pkt);
172
-            return AVERROR_IO;
172
+            return AVERROR(EIO);
173 173
         }
174 174
 
175 175
         pkt->stream_index = thp->video_stream_index;
... ...
@@ -177,7 +177,7 @@ static int thp_read_packet(AVFormatContext *s,
177 177
         ret = av_get_packet(pb, pkt, thp->audiosize);
178 178
         if (ret != thp->audiosize) {
179 179
             av_free_packet(pkt);
180
-            return AVERROR_IO;
180
+            return AVERROR(EIO);
181 181
         }
182 182
 
183 183
         pkt->stream_index = thp->audio_stream_index;
... ...
@@ -115,7 +115,7 @@ static int seq_fill_buffer(SeqDemuxContext *seq, ByteIOContext *pb, int buffer_n
115 115
 
116 116
     url_fseek(pb, seq->current_frame_offs + data_offs, SEEK_SET);
117 117
     if (get_buffer(pb, seq_buffer->data + seq_buffer->fill_size, data_size) != data_size)
118
-        return AVERROR_IO;
118
+        return AVERROR(EIO);
119 119
 
120 120
     seq_buffer->fill_size += data_size;
121 121
     return 0;
... ...
@@ -258,7 +258,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt)
258 258
                 pkt->data[0] |= 1;
259 259
                 url_fseek(pb, seq->current_frame_offs + seq->current_pal_data_offs, SEEK_SET);
260 260
                 if (get_buffer(pb, &pkt->data[1], seq->current_pal_data_size) != seq->current_pal_data_size)
261
-                    return AVERROR_IO;
261
+                    return AVERROR(EIO);
262 262
             }
263 263
             if (seq->current_video_data_size != 0) {
264 264
                 pkt->data[0] |= 2;
... ...
@@ -277,7 +277,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt)
277 277
 
278 278
     /* audio packet */
279 279
     if (seq->current_audio_data_offs == 0) /* end of data reached */
280
-        return AVERROR_IO;
280
+        return AVERROR(EIO);
281 281
 
282 282
     url_fseek(pb, seq->current_frame_offs + seq->current_audio_data_offs, SEEK_SET);
283 283
     rc = av_get_packet(pb, pkt, seq->current_audio_data_size);
... ...
@@ -61,10 +61,10 @@ next_chunk:
61 61
     marker     = get_le32(pb);
62 62
 
63 63
     if (url_feof(&s->pb))
64
-        return AVERROR_IO;
64
+        return AVERROR(EIO);
65 65
     if (marker != TXD_MARKER && marker != TXD_MARKER2) {
66 66
         av_log(NULL, AV_LOG_ERROR, "marker does not match\n");
67
-        return AVERROR_IO;
67
+        return AVERROR(EIO);
68 68
     }
69 69
 
70 70
     switch (id) {
... ...
@@ -78,13 +78,13 @@ next_chunk:
78 78
             goto next_chunk;
79 79
         default:
80 80
             av_log(NULL, AV_LOG_ERROR, "unknown chunk id %i\n", id);
81
-            return AVERROR_IO;
81
+            return AVERROR(EIO);
82 82
     }
83 83
 
84 84
     ret = av_get_packet(&s->pb, pkt, chunk_size);
85 85
     pkt->stream_index = 0;
86 86
 
87
-    return ret <= 0 ? AVERROR_IO : ret;
87
+    return ret <= 0 ? AVERROR(EIO) : ret;
88 88
 }
89 89
 
90 90
 static int txd_read_close(AVFormatContext *s) {
... ...
@@ -138,7 +138,7 @@ static int udp_ipv6_set_remote_url(URLContext *h, const char *uri) {
138 138
     struct addrinfo *res0;
139 139
     url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
140 140
     res0 = udp_ipv6_resolve_host(hostname, port, SOCK_DGRAM, AF_UNSPEC, 0);
141
-    if (res0 == 0) return AVERROR_IO;
141
+    if (res0 == 0) return AVERROR(EIO);
142 142
     memcpy(&s->dest_addr, res0->ai_addr, res0->ai_addrlen);
143 143
     s->dest_addr_len = res0->ai_addrlen;
144 144
     freeaddrinfo(res0);
... ...
@@ -236,7 +236,7 @@ int udp_set_remote_url(URLContext *h, const char *uri)
236 236
 
237 237
     /* set the destination address */
238 238
     if (resolve_host(&s->dest_addr.sin_addr, hostname) < 0)
239
-        return AVERROR_IO;
239
+        return AVERROR(EIO);
240 240
     s->dest_addr.sin_family = AF_INET;
241 241
     s->dest_addr.sin_port = htons(port);
242 242
     return 0;
... ...
@@ -401,7 +401,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
401 401
     if (udp_fd >= 0)
402 402
         closesocket(udp_fd);
403 403
     av_free(s);
404
-    return AVERROR_IO;
404
+    return AVERROR(EIO);
405 405
 }
406 406
 
407 407
 static int udp_read(URLContext *h, uint8_t *buf, int size)
... ...
@@ -422,7 +422,7 @@ static int udp_read(URLContext *h, uint8_t *buf, int size)
422 422
         if (len < 0) {
423 423
             if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
424 424
                 ff_neterrno() != FF_NETERROR(EINTR))
425
-                return AVERROR_IO;
425
+                return AVERROR(EIO);
426 426
         } else {
427 427
             break;
428 428
         }
... ...
@@ -446,7 +446,7 @@ static int udp_write(URLContext *h, uint8_t *buf, int size)
446 446
         if (ret < 0) {
447 447
             if (ff_neterrno() != FF_NETERROR(EINTR) &&
448 448
                 ff_neterrno() != FF_NETERROR(EAGAIN))
449
-                return AVERROR_IO;
449
+                return AVERROR(EIO);
450 450
         } else {
451 451
             break;
452 452
         }
... ...
@@ -449,7 +449,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
449 449
                 url_fclose(pb);
450 450
                 if (url_fopen(pb, filename, URL_RDONLY) < 0) {
451 451
                     file_opened = 0;
452
-                    err = AVERROR_IO;
452
+                    err = AVERROR(EIO);
453 453
                     goto fail;
454 454
                 }
455 455
             }
... ...
@@ -443,7 +443,7 @@ static int v4l2_set_parameters( AVFormatContext *s1, AVFormatParameters *ap )
443 443
         input.index = ap->channel;
444 444
         if(ioctl (s->fd, VIDIOC_ENUMINPUT, &input) < 0) {
445 445
             av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl enum input failed:\n");
446
-            return AVERROR_IO;
446
+            return AVERROR(EIO);
447 447
         }
448 448
 
449 449
         av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set input_id: %d, input: %s\n",
... ...
@@ -451,7 +451,7 @@ static int v4l2_set_parameters( AVFormatContext *s1, AVFormatParameters *ap )
451 451
         if(ioctl (s->fd, VIDIOC_S_INPUT, &input.index) < 0 ) {
452 452
             av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set input(%d) failed\n",
453 453
                    ap->channel);
454
-            return AVERROR_IO;
454
+            return AVERROR(EIO);
455 455
         }
456 456
     }
457 457
 
... ...
@@ -465,7 +465,7 @@ static int v4l2_set_parameters( AVFormatContext *s1, AVFormatParameters *ap )
465 465
             if (ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0) {
466 466
                 av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set standard(%s) failed\n",
467 467
                        ap->standard);
468
-                return AVERROR_IO;
468
+                return AVERROR(EIO);
469 469
             }
470 470
 
471 471
             if(!strcasecmp(standard.name, ap->standard)) {
... ...
@@ -478,7 +478,7 @@ static int v4l2_set_parameters( AVFormatContext *s1, AVFormatParameters *ap )
478 478
         if (ioctl(s->fd, VIDIOC_S_STD, &standard.id) < 0) {
479 479
             av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set standard(%s) failed\n",
480 480
                    ap->standard);
481
-            return AVERROR_IO;
481
+            return AVERROR(EIO);
482 482
         }
483 483
     }
484 484
 
... ...
@@ -526,7 +526,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
526 526
     if (s->fd < 0) {
527 527
         av_free(st);
528 528
 
529
-        return AVERROR_IO;
529
+        return AVERROR(EIO);
530 530
     }
531 531
     av_log(s1, AV_LOG_INFO, "[%d]Capabilities: %x\n", s->fd, capabilities);
532 532
 
... ...
@@ -553,12 +553,12 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
553 553
         close(s->fd);
554 554
         av_free(st);
555 555
 
556
-        return AVERROR_IO;
556
+        return AVERROR(EIO);
557 557
     }
558 558
     s->frame_format = desired_format;
559 559
 
560 560
     if( v4l2_set_parameters( s1, ap ) < 0 )
561
-        return AVERROR_IO;
561
+        return AVERROR(EIO);
562 562
 
563 563
     st->codec->pix_fmt = fmt_v4l2ff(desired_format);
564 564
     s->frame_size = avpicture_get_size(st->codec->pix_fmt, width, height);
... ...
@@ -576,7 +576,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
576 576
         close(s->fd);
577 577
         av_free(st);
578 578
 
579
-        return AVERROR_IO;
579
+        return AVERROR(EIO);
580 580
     }
581 581
     s->top_field_first = first_field(s->fd);
582 582
 
... ...
@@ -601,14 +601,14 @@ static int v4l2_read_packet(AVFormatContext *s1, AVPacket *pkt)
601 601
         res = mmap_read_frame(s1, pkt);
602 602
     } else if (s->io_method == io_read) {
603 603
         if (av_new_packet(pkt, s->frame_size) < 0)
604
-            return AVERROR_IO;
604
+            return AVERROR(EIO);
605 605
 
606 606
         res = read_frame(s1, pkt);
607 607
     } else {
608
-        return AVERROR_IO;
608
+        return AVERROR(EIO);
609 609
     }
610 610
     if (res < 0) {
611
-        return AVERROR_IO;
611
+        return AVERROR(EIO);
612 612
     }
613 613
 
614 614
     if (s1->streams[0]->codec->coded_frame) {
... ...
@@ -73,7 +73,7 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
73 73
     while (!voc->remaining_size) {
74 74
         type = get_byte(pb);
75 75
         if (type == VOC_TYPE_EOF)
76
-            return AVERROR_IO;
76
+            return AVERROR(EIO);
77 77
         voc->remaining_size = get_le24(pb);
78 78
         max_size -= 4;
79 79
 
... ...
@@ -200,14 +200,14 @@ static int wav_read_packet(AVFormatContext *s,
200 200
     WAVContext *wav = s->priv_data;
201 201
 
202 202
     if (url_feof(&s->pb))
203
-        return AVERROR_IO;
203
+        return AVERROR(EIO);
204 204
     st = s->streams[0];
205 205
 
206 206
     left= wav->data_end - url_ftell(&s->pb);
207 207
     if(left <= 0){
208 208
         left = find_tag(&(s->pb), MKTAG('d', 'a', 't', 'a'));
209 209
         if (left < 0) {
210
-            return AVERROR_IO;
210
+            return AVERROR(EIO);
211 211
         }
212 212
         wav->data_end= url_ftell(&s->pb) + left;
213 213
     }
... ...
@@ -221,7 +221,7 @@ static int wav_read_packet(AVFormatContext *s,
221 221
     size= FFMIN(size, left);
222 222
     ret= av_get_packet(&s->pb, pkt, size);
223 223
     if (ret <= 0)
224
-        return AVERROR_IO;
224
+        return AVERROR(EIO);
225 225
     pkt->stream_index = 0;
226 226
 
227 227
     /* note: we need to modify the packet size here to handle the last
... ...
@@ -152,7 +152,7 @@ static int wc3_read_header(AVFormatContext *s,
152 152
      * the first BRCH tag */
153 153
     if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
154 154
         WC3_PREAMBLE_SIZE)
155
-        return AVERROR_IO;
155
+        return AVERROR(EIO);
156 156
     fourcc_tag = AV_RL32(&preamble[0]);
157 157
     size = (AV_RB32(&preamble[4]) + 1) & (~1);
158 158
 
... ...
@@ -169,7 +169,7 @@ static int wc3_read_header(AVFormatContext *s,
169 169
             /* need the number of palettes */
170 170
             url_fseek(pb, 8, SEEK_CUR);
171 171
             if ((ret = get_buffer(pb, preamble, 4)) != 4)
172
-                return AVERROR_IO;
172
+                return AVERROR(EIO);
173 173
             wc3->palette_count = AV_RL32(&preamble[0]);
174 174
             if((unsigned)wc3->palette_count >= UINT_MAX / PALETTE_SIZE){
175 175
                 wc3->palette_count= 0;
... ...
@@ -185,14 +185,14 @@ static int wc3_read_header(AVFormatContext *s,
185 185
             else
186 186
                 bytes_to_read = 512;
187 187
             if ((ret = get_buffer(pb, s->title, bytes_to_read)) != bytes_to_read)
188
-                return AVERROR_IO;
188
+                return AVERROR(EIO);
189 189
             break;
190 190
 
191 191
         case SIZE_TAG:
192 192
             /* video resolution override */
193 193
             if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
194 194
                 WC3_PREAMBLE_SIZE)
195
-                return AVERROR_IO;
195
+                return AVERROR(EIO);
196 196
             wc3->width = AV_RL32(&preamble[0]);
197 197
             wc3->height = AV_RL32(&preamble[4]);
198 198
             break;
... ...
@@ -204,7 +204,7 @@ static int wc3_read_header(AVFormatContext *s,
204 204
             if ((ret = get_buffer(pb,
205 205
                 &wc3->palettes[current_palette * PALETTE_SIZE],
206 206
                 PALETTE_SIZE)) != PALETTE_SIZE)
207
-                return AVERROR_IO;
207
+                return AVERROR(EIO);
208 208
 
209 209
             /* transform the current palette in place */
210 210
             for (i = current_palette * PALETTE_SIZE;
... ...
@@ -228,7 +228,7 @@ static int wc3_read_header(AVFormatContext *s,
228 228
 
229 229
         if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
230 230
             WC3_PREAMBLE_SIZE)
231
-            return AVERROR_IO;
231
+            return AVERROR(EIO);
232 232
         fourcc_tag = AV_RL32(&preamble[0]);
233 233
         /* chunk sizes are 16-bit aligned */
234 234
         size = (AV_RB32(&preamble[4]) + 1) & (~1);
... ...
@@ -289,7 +289,7 @@ static int wc3_read_packet(AVFormatContext *s,
289 289
         /* get the next chunk preamble */
290 290
         if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
291 291
             WC3_PREAMBLE_SIZE)
292
-            ret = AVERROR_IO;
292
+            ret = AVERROR(EIO);
293 293
 
294 294
         fourcc_tag = AV_RL32(&preamble[0]);
295 295
         /* chunk sizes are 16-bit aligned */
... ...
@@ -304,7 +304,7 @@ static int wc3_read_packet(AVFormatContext *s,
304 304
         case SHOT_TAG:
305 305
             /* load up new palette */
306 306
             if ((ret = get_buffer(pb, preamble, 4)) != 4)
307
-                return AVERROR_IO;
307
+                return AVERROR(EIO);
308 308
             palette_number = AV_RL32(&preamble[0]);
309 309
             if (palette_number >= wc3->palette_count)
310 310
                 return AVERROR_INVALIDDATA;
... ...
@@ -324,7 +324,7 @@ static int wc3_read_packet(AVFormatContext *s,
324 324
             pkt->stream_index = wc3->video_stream_index;
325 325
             pkt->pts = wc3->pts;
326 326
             if (ret != size)
327
-                ret = AVERROR_IO;
327
+                ret = AVERROR(EIO);
328 328
             packet_read = 1;
329 329
             break;
330 330
 
... ...
@@ -334,7 +334,7 @@ static int wc3_read_packet(AVFormatContext *s,
334 334
             url_fseek(pb, size, SEEK_CUR);
335 335
 #else
336 336
             if ((unsigned)size > sizeof(text) || (ret = get_buffer(pb, text, size)) != size)
337
-                ret = AVERROR_IO;
337
+                ret = AVERROR(EIO);
338 338
             else {
339 339
                 int i = 0;
340 340
                 av_log (s, AV_LOG_DEBUG, "Subtitle time!\n");
... ...
@@ -353,7 +353,7 @@ static int wc3_read_packet(AVFormatContext *s,
353 353
             pkt->stream_index = wc3->audio_stream_index;
354 354
             pkt->pts = wc3->pts;
355 355
             if (ret != size)
356
-                ret = AVERROR_IO;
356
+                ret = AVERROR(EIO);
357 357
 
358 358
             /* time to advance pts */
359 359
             wc3->pts += WC3_FRAME_PTS_INC;
... ...
@@ -123,7 +123,7 @@ static int wsaud_read_header(AVFormatContext *s,
123 123
     unsigned char header[AUD_HEADER_SIZE];
124 124
 
125 125
     if (get_buffer(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE)
126
-        return AVERROR_IO;
126
+        return AVERROR(EIO);
127 127
     wsaud->audio_samplerate = AV_RL16(&header[0]);
128 128
     if (header[11] == 99)
129 129
         wsaud->audio_type = CODEC_ID_ADPCM_IMA_WS;
... ...
@@ -167,7 +167,7 @@ static int wsaud_read_packet(AVFormatContext *s,
167 167
 
168 168
     if (get_buffer(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) !=
169 169
         AUD_CHUNK_PREAMBLE_SIZE)
170
-        return AVERROR_IO;
170
+        return AVERROR(EIO);
171 171
 
172 172
     /* validate the chunk */
173 173
     if (AV_RL32(&preamble[4]) != AUD_CHUNK_SIGNATURE)
... ...
@@ -176,7 +176,7 @@ static int wsaud_read_packet(AVFormatContext *s,
176 176
     chunk_size = AV_RL16(&preamble[0]);
177 177
     ret= av_get_packet(pb, pkt, chunk_size);
178 178
     if (ret != chunk_size)
179
-        return AVERROR_IO;
179
+        return AVERROR(EIO);
180 180
     pkt->stream_index = wsaud->audio_stream_index;
181 181
     pkt->pts = wsaud->audio_frame_counter;
182 182
     pkt->pts /= wsaud->audio_samplerate;
... ...
@@ -240,7 +240,7 @@ static int wsvqa_read_header(AVFormatContext *s,
240 240
     if (get_buffer(pb, st->codec->extradata, VQA_HEADER_SIZE) !=
241 241
         VQA_HEADER_SIZE) {
242 242
         av_free(st->codec->extradata);
243
-        return AVERROR_IO;
243
+        return AVERROR(EIO);
244 244
     }
245 245
     st->codec->width = AV_RL16(&header[6]);
246 246
     st->codec->height = AV_RL16(&header[8]);
... ...
@@ -279,7 +279,7 @@ static int wsvqa_read_header(AVFormatContext *s,
279 279
     do {
280 280
         if (get_buffer(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) {
281 281
             av_free(st->codec->extradata);
282
-            return AVERROR_IO;
282
+            return AVERROR(EIO);
283 283
         }
284 284
         chunk_tag = AV_RB32(&scratch[0]);
285 285
         chunk_size = AV_RB32(&scratch[4]);
... ...
@@ -330,11 +330,11 @@ static int wsvqa_read_packet(AVFormatContext *s,
330 330
         if ((chunk_type == SND1_TAG) || (chunk_type == SND2_TAG) || (chunk_type == VQFR_TAG)) {
331 331
 
332 332
             if (av_new_packet(pkt, chunk_size))
333
-                return AVERROR_IO;
333
+                return AVERROR(EIO);
334 334
             ret = get_buffer(pb, pkt->data, chunk_size);
335 335
             if (ret != chunk_size) {
336 336
                 av_free_packet(pkt);
337
-                return AVERROR_IO;
337
+                return AVERROR(EIO);
338 338
             }
339 339
 
340 340
             if (chunk_type == SND2_TAG) {
... ...
@@ -182,7 +182,7 @@ static int wv_read_packet(AVFormatContext *s,
182 182
     ret = get_buffer(&s->pb, pkt->data + WV_EXTRA_SIZE, wc->blksize);
183 183
     if(ret != wc->blksize){
184 184
         av_free_packet(pkt);
185
-        return AVERROR_IO;
185
+        return AVERROR(EIO);
186 186
     }
187 187
     pkt->stream_index = 0;
188 188
     wc->block_parsed = 1;
... ...
@@ -80,7 +80,7 @@ typedef struct x11_grab_s
80 80
  * @param ap Parameters from avformat core
81 81
  * @return <ul>
82 82
  *          <li>ENOMEM no memory left</li>
83
- *          <li>AVERROR_IO other failure case</li>
83
+ *          <li>AVERROR(EIO) other failure case</li>
84 84
  *          <li>0 success</li>
85 85
  *         </ul>
86 86
  */
... ...
@@ -109,12 +109,12 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
109 109
     dpy = XOpenDisplay(param);
110 110
     if(!dpy) {
111 111
         av_log(s1, AV_LOG_ERROR, "Could not open X display.\n");
112
-        return AVERROR_IO;
112
+        return AVERROR(EIO);
113 113
     }
114 114
 
115 115
     if (!ap || ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) {
116 116
         av_log(s1, AV_LOG_ERROR, "AVParameters don't have any video size. Use -s.\n");
117
-        return AVERROR_IO;
117
+        return AVERROR(EIO);
118 118
     }
119 119
 
120 120
     st = av_new_stream(s1, 0);
... ...
@@ -148,7 +148,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
148 148
         if (!XShmAttach(dpy, &x11grab->shminfo)) {
149 149
             av_log(s1, AV_LOG_ERROR, "Fatal: Failed to attach shared memory!\n");
150 150
             /* needs some better error subroutine :) */
151
-            return AVERROR_IO;
151
+            return AVERROR(EIO);
152 152
         }
153 153
     } else {
154 154
         image = XGetImage(dpy, RootWindow(dpy, DefaultScreen(dpy)),
... ...
@@ -176,7 +176,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
176 176
         } else {
177 177
             av_log(s1, AV_LOG_ERROR, "RGB ordering at image depth %i not supported ... aborting\n", image->bits_per_pixel);
178 178
             av_log(s1, AV_LOG_ERROR, "color masks: r 0x%.6lx g 0x%.6lx b 0x%.6lx\n", image->red_mask, image->green_mask, image->blue_mask);
179
-            return AVERROR_IO;
179
+            return AVERROR(EIO);
180 180
         }
181 181
         break;
182 182
     case 24:
... ...
@@ -191,7 +191,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
191 191
         } else {
192 192
             av_log(s1, AV_LOG_ERROR,"rgb ordering at image depth %i not supported ... aborting\n", image->bits_per_pixel);
193 193
             av_log(s1, AV_LOG_ERROR, "color masks: r 0x%.6lx g 0x%.6lx b 0x%.6lx\n", image->red_mask, image->green_mask, image->blue_mask);
194
-            return AVERROR_IO;
194
+            return AVERROR(EIO);
195 195
         }
196 196
         break;
197 197
     case 32:
... ...
@@ -207,7 +207,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
207 207
             input_pixfmt = PIX_FMT_ARGB32;
208 208
         }  else {
209 209
             av_log(s1, AV_LOG_ERROR,"image depth %i not supported ... aborting\n", image->bits_per_pixel);
210
-            return AVERROR_IO;
210
+            return AVERROR(EIO);
211 211
         }
212 212
 #endif
213 213
         input_pixfmt = PIX_FMT_RGB32;
... ...
@@ -459,7 +459,7 @@ x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
459 459
     }
460 460
 
461 461
     if (av_new_packet(pkt, s->frame_size) < 0) {
462
-        return AVERROR_IO;
462
+        return AVERROR(EIO);
463 463
     }
464 464
 
465 465
     pkt->pts = curtime;
... ...
@@ -103,7 +103,7 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
103 103
         *first_pkt = 0;
104 104
         if (yuv4_generate_header(s, buf2) < 0) {
105 105
             av_log(s, AV_LOG_ERROR, "Error. YUV4MPEG stream header write failed.\n");
106
-            return AVERROR_IO;
106
+            return AVERROR(EIO);
107 107
         } else {
108 108
             put_buffer(pb, buf2, strlen(buf2));
109 109
         }
... ...
@@ -149,7 +149,7 @@ static int yuv4_write_header(AVFormatContext *s)
149 149
     int* first_pkt = s->priv_data;
150 150
 
151 151
     if (s->nb_streams != 1)
152
-        return AVERROR_IO;
152
+        return AVERROR(EIO);
153 153
 
154 154
     if (s->streams[0]->codec->pix_fmt == PIX_FMT_YUV411P) {
155 155
         av_log(s, AV_LOG_ERROR, "Warning: generating rarely used 4:1:1 YUV stream, some mjpegtools might not work.\n");
... ...
@@ -159,7 +159,7 @@ static int yuv4_write_header(AVFormatContext *s)
159 159
              (s->streams[0]->codec->pix_fmt != PIX_FMT_GRAY8) &&
160 160
              (s->streams[0]->codec->pix_fmt != PIX_FMT_YUV444P)) {
161 161
         av_log(s, AV_LOG_ERROR, "ERROR: yuv4mpeg only handles yuv444p, yuv422p, yuv420p, yuv411p and gray pixel formats. Use -pix_fmt to select one.\n");
162
-        return AVERROR_IO;
162
+        return AVERROR(EIO);
163 163
     }
164 164
 
165 165
     *first_pkt = 1;
... ...
@@ -361,7 +361,7 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
361 361
         return -1;
362 362
 
363 363
     if (av_get_packet(&s->pb, pkt, packet_size) != packet_size)
364
-        return AVERROR_IO;
364
+        return AVERROR(EIO);
365 365
 
366 366
     if (s->streams[0]->codec->coded_frame) {
367 367
         s->streams[0]->codec->coded_frame->interlaced_frame = s1->interlaced_frame;