diff options
author | Panagiotis Issaris <takis.issaris@uhasselt.be> | 2007-07-19 15:23:32 +0000 |
---|---|---|
committer | Panagiotis Issaris <takis.issaris@uhasselt.be> | 2007-07-19 15:23:32 +0000 |
commit | 6f3e0b21748b53fd7b0471196bbda1d7e561f4fe (patch) | |
tree | 5130d5b49907a72bf1f16c7861ec3b891a3708e4 /libavformat | |
parent | 769e10f0684c63aefb6fe36788f3e543312e185d (diff) | |
download | ffmpeg-6f3e0b21748b53fd7b0471196bbda1d7e561f4fe.tar.gz |
Replace all occurrences of AVERROR_IO with AVERROR(EIO).
Originally committed as revision 9760 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
66 files changed, 250 insertions, 250 deletions
diff --git a/libavformat/4xm.c b/libavformat/4xm.c index d377167264..87dad7dbb0 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -118,7 +118,7 @@ static int fourxm_read_header(AVFormatContext *s, if (!header) return AVERROR(ENOMEM); if (get_buffer(pb, header, header_size) != header_size) - return AVERROR_IO; + return AVERROR(EIO); /* take the lazy approach and search for any and all vtrk and strk chunks */ for (i = 0; i < header_size - 8; i++) { @@ -235,7 +235,7 @@ static int fourxm_read_packet(AVFormatContext *s, fourcc_tag = AV_RL32(&header[0]); size = AV_RL32(&header[4]); if (url_feof(pb)) - return AVERROR_IO; + return AVERROR(EIO); switch (fourcc_tag) { case LIST_TAG: @@ -253,7 +253,7 @@ static int fourxm_read_packet(AVFormatContext *s, /* allocate 8 more bytes than 'size' to account for fourcc * and size */ if (size + 8 < size || av_new_packet(pkt, size + 8)) - return AVERROR_IO; + return AVERROR(EIO); pkt->stream_index = fourxm->video_stream_index; pkt->pts = fourxm->video_pts; pkt->pos = url_ftell(&s->pb); @@ -275,7 +275,7 @@ static int fourxm_read_packet(AVFormatContext *s, if (track_number == fourxm->selected_track) { ret= av_get_packet(&s->pb, pkt, size); if(ret<0) - return AVERROR_IO; + return AVERROR(EIO); pkt->stream_index = fourxm->tracks[fourxm->selected_track].stream_index; pkt->pts = fourxm->audio_pts; diff --git a/libavformat/aiff.c b/libavformat/aiff.c index 9f476cb142..6f1d9cd191 100644 --- a/libavformat/aiff.c +++ b/libavformat/aiff.c @@ -64,7 +64,7 @@ static int get_tag(ByteIOContext *pb, uint32_t * tag) int size; if (url_feof(pb)) - return AVERROR_IO; + return AVERROR(EIO); *tag = get_le32(pb); size = get_be32(pb); @@ -400,7 +400,7 @@ static int aiff_read_packet(AVFormatContext *s, /* End of stream may be reached */ if (url_feof(&s->pb)) - return AVERROR_IO; + return AVERROR(EIO); /* Now for that packet */ res = av_get_packet(&s->pb, pkt, (MAX_SIZE / st->codec->block_align) * st->codec->block_align); diff --git a/libavformat/amr.c b/libavformat/amr.c index 4d1a40604c..c0a8707b6a 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -122,7 +122,7 @@ static int amr_read_packet(AVFormatContext *s, if (url_feof(&s->pb)) { - return AVERROR_IO; + return AVERROR(EIO); } //FIXME this is wrong, this should rather be in a AVParset @@ -148,7 +148,7 @@ static int amr_read_packet(AVFormatContext *s, if ( (size==0) || av_new_packet(pkt, size)) { - return AVERROR_IO; + return AVERROR(EIO); } pkt->stream_index = 0; @@ -160,7 +160,7 @@ static int amr_read_packet(AVFormatContext *s, if (read != size-1) { av_free_packet(pkt); - return AVERROR_IO; + return AVERROR(EIO); } return 0; diff --git a/libavformat/apc.c b/libavformat/apc.c index ef62606d3e..683c0c257b 100644 --- a/libavformat/apc.c +++ b/libavformat/apc.c @@ -75,7 +75,7 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) static int apc_read_packet(AVFormatContext *s, AVPacket *pkt) { if (av_get_packet(&s->pb, pkt, MAX_READ_SIZE) <= 0) - return AVERROR_IO; + return AVERROR(EIO); pkt->stream_index = 0; return 0; } diff --git a/libavformat/asf.c b/libavformat/asf.c index b37bc4c76d..550c37ce41 100644 --- a/libavformat/asf.c +++ b/libavformat/asf.c @@ -714,7 +714,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt) //static int pc = 0; for (;;) { if(url_feof(pb)) - return AVERROR_IO; + return AVERROR(EIO); if (asf->packet_size_left < FRAME_HEADER_SIZE || asf->packet_segments < 1) { //asf->packet_size_left <= asf->packet_padsize) { @@ -727,7 +727,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt) asf->packet_pos= url_ftell(&s->pb); if (asf->data_object_size != (uint64_t)-1 && (asf->packet_pos - asf->data_object_offset >= asf->data_object_size)) - return AVERROR_IO; /* Do not exceed the size of the data object */ + return AVERROR(EIO); /* Do not exceed the size of the data object */ ret = asf_get_packet(s); //printf("READ ASF PACKET %d r:%d c:%d\n", ret, asf->packet_size_left, pc++); if (ret < 0) diff --git a/libavformat/au.c b/libavformat/au.c index aaa97c76fa..bd26e54d6f 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -159,10 +159,10 @@ static int au_read_packet(AVFormatContext *s, int ret; if (url_feof(&s->pb)) - return AVERROR_IO; + return AVERROR(EIO); ret= av_get_packet(&s->pb, pkt, MAX_SIZE); if (ret < 0) - return AVERROR_IO; + return AVERROR(EIO); pkt->stream_index = 0; /* note: we need to modify the packet size here to handle the last diff --git a/libavformat/audio.c b/libavformat/audio.c index b17dcea8e7..ce209d1a9f 100644 --- a/libavformat/audio.c +++ b/libavformat/audio.c @@ -59,7 +59,7 @@ static int audio_open(AudioData *s, int is_output, const char *audio_device) audio_fd = open(audio_device, O_RDONLY); if (audio_fd < 0) { perror(audio_device); - return AVERROR_IO; + return AVERROR(EIO); } if (flip && *flip == '1') { @@ -110,7 +110,7 @@ static int audio_open(AudioData *s, int is_output, const char *audio_device) default: av_log(NULL, AV_LOG_ERROR, "Soundcard does not support 16 bit sample format\n"); close(audio_fd); - return AVERROR_IO; + return AVERROR(EIO); } err=ioctl(audio_fd, SNDCTL_DSP_SETFMT, &tmp); if (err < 0) { @@ -139,7 +139,7 @@ static int audio_open(AudioData *s, int is_output, const char *audio_device) return 0; fail: close(audio_fd); - return AVERROR_IO; + return AVERROR(EIO); } static int audio_close(AudioData *s) @@ -160,7 +160,7 @@ static int audio_write_header(AVFormatContext *s1) s->channels = st->codec->channels; ret = audio_open(s, 1, s1->filename); if (ret < 0) { - return AVERROR_IO; + return AVERROR(EIO); } else { return 0; } @@ -185,7 +185,7 @@ static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt) if (ret > 0) break; if (ret < 0 && (errno != EAGAIN && errno != EINTR)) - return AVERROR_IO; + return AVERROR(EIO); } s->buffer_ptr = 0; } @@ -224,7 +224,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap) ret = audio_open(s, 0, s1->filename); if (ret < 0) { av_free(st); - return AVERROR_IO; + return AVERROR(EIO); } /* take real parameters */ @@ -245,7 +245,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt) struct audio_buf_info abufi; if (av_new_packet(pkt, s->frame_size) < 0) - return AVERROR_IO; + return AVERROR(EIO); for(;;) { struct timeval tv; fd_set fds; @@ -270,7 +270,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt) } if (!(ret == 0 || (ret == -1 && (errno == EAGAIN || errno == EINTR)))) { av_free_packet(pkt); - return AVERROR_IO; + return AVERROR(EIO); } } pkt->size = ret; diff --git a/libavformat/avio.c b/libavformat/avio.c index 4bfa13762f..23642db90a 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -101,7 +101,7 @@ int url_read(URLContext *h, unsigned char *buf, int size) { int ret; if (h->flags & URL_WRONLY) - return AVERROR_IO; + return AVERROR(EIO); ret = h->prot->url_read(h, buf, size); return ret; } @@ -111,10 +111,10 @@ int url_write(URLContext *h, unsigned char *buf, int size) { int ret; if (!(h->flags & (URL_WRONLY | URL_RDWR))) - return AVERROR_IO; + return AVERROR(EIO); /* avoid sending too big packets */ if (h->max_packet_size && size > h->max_packet_size) - return AVERROR_IO; + return AVERROR(EIO); ret = h->prot->url_write(h, buf, size); return ret; } diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 0c178636ee..e7d9a623c7 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -514,7 +514,7 @@ int url_fdopen(ByteIOContext *s, URLContext *h) (h->flags & URL_WRONLY || h->flags & URL_RDWR), h, url_read_packet, url_write_packet, url_seek_packet) < 0) { av_free(buffer); - return AVERROR_IO; + return AVERROR(EIO); } s->is_streamed = h->is_streamed; s->max_packet_size = max_packet_size; diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 1afcdea5e6..158cac1fcd 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -156,10 +156,10 @@ static int avisynth_read_packet(AVFormatContext *s, AVPacket *pkt) stream = &avs->streams[stream_id]; if (stream->read >= stream->info.dwLength) - return AVERROR_IO; + return AVERROR(EIO); if (av_new_packet(pkt, stream->chunck_size)) - return AVERROR_IO; + return AVERROR(EIO); pkt->stream_index = stream_id; pkt->pts = avs->streams[stream_id].read / avs->streams[stream_id].chunck_samples; diff --git a/libavformat/avs.c b/libavformat/avs.c index 74cf5038f3..b6ede08ed3 100644 --- a/libavformat/avs.c +++ b/libavformat/avs.c @@ -106,7 +106,7 @@ avs_read_video_packet(AVFormatContext * s, AVPacket * pkt, ret = get_buffer(&s->pb, pkt->data + palette_size + 4, size - 4) + 4; if (ret < size) { av_free_packet(pkt); - return AVERROR_IO; + return AVERROR(EIO); } pkt->size = ret + palette_size; @@ -127,7 +127,7 @@ static int avs_read_audio_packet(AVFormatContext * s, AVPacket * pkt) size = url_ftell(&s->pb) - size; avs->remaining_audio_size -= size; - if (ret == AVERROR_IO) + if (ret == AVERROR(EIO)) return 0; /* this indicate EOS */ if (ret < 0) return ret; @@ -154,7 +154,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) while (1) { if (avs->remaining_frame_size <= 0) { if (!get_le16(&s->pb)) /* found EOF */ - return AVERROR_IO; + return AVERROR(EIO); avs->remaining_frame_size = get_le16(&s->pb) - 4; } @@ -168,7 +168,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) case AVS_PALETTE: ret = get_buffer(&s->pb, palette, size - 4); if (ret < size - 4) - return AVERROR_IO; + return AVERROR(EIO); palette_size = size; break; diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index 4406659d8b..89af4f16fe 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -179,7 +179,7 @@ static int vid_read_packet(AVFormatContext *s, int ret_value; if(vid->is_finished || url_feof(pb)) - return AVERROR_IO; + return AVERROR(EIO); block_type = get_byte(pb); switch(block_type){ @@ -188,7 +188,7 @@ static int vid_read_packet(AVFormatContext *s, ret_value = av_get_packet(pb, pkt, 3 * 256 + 1); if(ret_value != 3 * 256 + 1){ av_free_packet(pkt); - return AVERROR_IO; + return AVERROR(EIO); } pkt->stream_index = 0; return ret_value; @@ -202,7 +202,7 @@ static int vid_read_packet(AVFormatContext *s, audio_length = get_le16(pb); ret_value = av_get_packet(pb, pkt, audio_length); pkt->stream_index = 1; - return (ret_value != audio_length ? AVERROR_IO : ret_value); + return (ret_value != audio_length ? AVERROR(EIO) : ret_value); case VIDEO_P_FRAME: case VIDEO_YOFF_P_FRAME: @@ -214,7 +214,7 @@ static int vid_read_packet(AVFormatContext *s, if(vid->nframes != 0) av_log(s, AV_LOG_VERBOSE, "reached terminating character but not all frames read.\n"); vid->is_finished = 1; - return AVERROR_IO; + return AVERROR(EIO); default: av_log(s, AV_LOG_ERROR, "unknown block (character = %c, decimal = %d, hex = %x)!!!\n", block_type, block_type, block_type); return -1; diff --git a/libavformat/c93.c b/libavformat/c93.c index 419f28e42c..3bc6855c85 100644 --- a/libavformat/c93.c +++ b/libavformat/c93.c @@ -129,7 +129,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) } if (c93->current_frame >= br->frames) { if (c93->current_block >= 511 || !br[1].length) - return AVERROR_IO; + return AVERROR(EIO); br++; c93->current_block++; c93->current_frame = 0; @@ -154,7 +154,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) ret = get_buffer(pb, pkt->data + 1, datasize); if (ret < datasize) { - ret = AVERROR_IO; + ret = AVERROR(EIO); goto fail; } @@ -168,7 +168,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) pkt->data[0] |= C93_HAS_PALETTE; ret = get_buffer(pb, pkt->data + pkt->size, datasize); if (ret < datasize) { - ret = AVERROR_IO; + ret = AVERROR(EIO); goto fail; } pkt->size += 768; diff --git a/libavformat/daud.c b/libavformat/daud.c index 703589726f..e1d901aa16 100644 --- a/libavformat/daud.c +++ b/libavformat/daud.c @@ -37,7 +37,7 @@ static int daud_packet(AVFormatContext *s, AVPacket *pkt) { ByteIOContext *pb = &s->pb; int ret, size; if (url_feof(pb)) - return AVERROR_IO; + return AVERROR(EIO); size = get_be16(pb); get_be16(pb); // unknown ret = av_get_packet(pb, pkt, size); diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c index 32f4ac2729..b00bfd29b3 100644 --- a/libavformat/dsicin.c +++ b/libavformat/dsicin.c @@ -147,7 +147,7 @@ static int cin_read_frame_header(CinDemuxContext *cin, ByteIOContext *pb) { hdr->audio_frame_size = get_le32(pb); if (url_feof(pb) || url_ferror(pb)) - return AVERROR_IO; + return AVERROR(EIO); if (get_le32(pb) != 0xAA55AA55) return AVERROR_INVALIDDATA; @@ -189,7 +189,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->data[3] = hdr->video_frame_type; if (get_buffer(pb, &pkt->data[4], pkt_size) != pkt_size) - return AVERROR_IO; + return AVERROR(EIO); /* sound buffer will be processed on next read_packet() call */ cin->audio_buffer_size = hdr->audio_frame_size; @@ -205,7 +205,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt) cin->audio_stream_pts += cin->audio_buffer_size * 2 / cin->file_header.audio_frame_size; if (get_buffer(pb, pkt->data, cin->audio_buffer_size) != cin->audio_buffer_size) - return AVERROR_IO; + return AVERROR(EIO); cin->audio_buffer_size = 0; return 0; diff --git a/libavformat/dv.c b/libavformat/dv.c index e459ed9742..89fd26a47f 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -388,7 +388,7 @@ static int dv_read_header(AVFormatContext *s, if (get_buffer(&s->pb, c->buf, DV_PROFILE_BYTES) <= 0 || url_fseek(&s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0) - return AVERROR_IO; + return AVERROR(EIO); c->dv_demux->sys = dv_frame_profile(c->buf); 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) if (size < 0) { size = c->dv_demux->sys->frame_size; if (get_buffer(&s->pb, c->buf, size) <= 0) - return AVERROR_IO; + return AVERROR(EIO); size = dv_produce_packet(c->dv_demux, pkt, c->buf, size); } diff --git a/libavformat/dv1394.c b/libavformat/dv1394.c index 3a5f479c8e..93e08ee6e2 100644 --- a/libavformat/dv1394.c +++ b/libavformat/dv1394.c @@ -124,7 +124,7 @@ static int dv1394_read_header(AVFormatContext * context, AVFormatParameters * ap failed: close(dv->fd); - return AVERROR_IO; + return AVERROR(EIO); } static int dv1394_read_packet(AVFormatContext *context, AVPacket *pkt) @@ -163,12 +163,12 @@ restart_poll: if (errno == EAGAIN || errno == EINTR) goto restart_poll; perror("Poll failed"); - return AVERROR_IO; + return AVERROR(EIO); } if (ioctl(dv->fd, DV1394_GET_STATUS, &s) < 0) { perror("Failed to get status"); - return AVERROR_IO; + return AVERROR(EIO); } #ifdef DV1394_DEBUG av_log(context, AV_LOG_DEBUG, "DV1394: status\n" diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 0acf1b81dd..c313df567a 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -149,7 +149,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) ret = av_get_packet(&s->pb, pkt, size); pkt->stream_index = 1; if(ret != size) - return AVERROR_IO; + return AVERROR(EIO); c->bytes_left -= size; c->wavpos = url_ftell(&s->pb); return 0; @@ -186,7 +186,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) ret = get_buffer(&s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size); if(ret != size){ av_free_packet(pkt); - return AVERROR_IO; + return AVERROR(EIO); } if(pal_size) memcpy(pkt->data, pal, pal_size); pkt->stream_index = 0; diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index f8bd4d8ed8..871a2f75fe 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -178,7 +178,7 @@ static int ea_read_header(AVFormatContext *s, AVStream *st; if (!process_ea_header(s)) - return AVERROR_IO; + return AVERROR(EIO); #if 0 /* initialize the video decoder stream */ @@ -226,7 +226,7 @@ static int ea_read_packet(AVFormatContext *s, while (!packet_read) { if (get_buffer(pb, preamble, EA_PREAMBLE_SIZE) != EA_PREAMBLE_SIZE) - return AVERROR_IO; + return AVERROR(EIO); chunk_type = AV_RL32(&preamble[0]); chunk_size = AV_RL32(&preamble[4]) - EA_PREAMBLE_SIZE; @@ -235,7 +235,7 @@ static int ea_read_packet(AVFormatContext *s, case SCDl_TAG: ret = av_get_packet(pb, pkt, chunk_size); if (ret != chunk_size) - ret = AVERROR_IO; + ret = AVERROR(EIO); else { pkt->stream_index = ea->audio_stream_index; pkt->pts = 90000; @@ -253,7 +253,7 @@ static int ea_read_packet(AVFormatContext *s, /* ending tag */ case SCEl_TAG: - ret = AVERROR_IO; + ret = AVERROR(EIO); packet_read = 1; break; diff --git a/libavformat/flic.c b/libavformat/flic.c index 69259fe72d..7ad25c2bff 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -78,7 +78,7 @@ static int flic_read_header(AVFormatContext *s, /* load the whole header and pull out the width and height */ if (get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE) - return AVERROR_IO; + return AVERROR(EIO); magic_number = AV_RL16(&header[4]); speed = AV_RL32(&header[0x10]); @@ -169,7 +169,7 @@ static int flic_read_packet(AVFormatContext *s, if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) != FLIC_PREAMBLE_SIZE) { - ret = AVERROR_IO; + ret = AVERROR(EIO); break; } @@ -178,7 +178,7 @@ static int flic_read_packet(AVFormatContext *s, if (((magic == FLIC_CHUNK_MAGIC_1) || (magic == FLIC_CHUNK_MAGIC_2)) && size > FLIC_PREAMBLE_SIZE) { if (av_new_packet(pkt, size)) { - ret = AVERROR_IO; + ret = AVERROR(EIO); break; } pkt->stream_index = flic->video_stream_index; @@ -189,7 +189,7 @@ static int flic_read_packet(AVFormatContext *s, size - FLIC_PREAMBLE_SIZE); if (ret != size - FLIC_PREAMBLE_SIZE) { av_free_packet(pkt); - ret = AVERROR_IO; + ret = AVERROR(EIO); } flic->pts += flic->frame_pts_inc; packet_read = 1; diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index e60257f8e5..076da069bc 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -270,7 +270,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) pts = get_be24(&s->pb); // av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, pts:%d\n", type, size, pts); if (url_feof(&s->pb)) - return AVERROR_IO; + return AVERROR(EIO); url_fskip(&s->pb, 4); /* reserved */ flags = 0; @@ -348,7 +348,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) ret= av_get_packet(&s->pb, pkt, size - 1); if (ret <= 0) { - return AVERROR_IO; + return AVERROR(EIO); } /* note: we need to modify the packet size here to handle the last packet */ diff --git a/libavformat/gif.c b/libavformat/gif.c index 1083710d5c..a5d81fbbcf 100644 --- a/libavformat/gif.c +++ b/libavformat/gif.c @@ -343,7 +343,7 @@ static int gif_write_header(AVFormatContext *s) if (video_enc->pix_fmt != PIX_FMT_RGB24) { av_log(s, AV_LOG_ERROR, "ERROR: gif only handles the rgb24 pixel format. Use -pix_fmt rgb24.\n"); - return AVERROR_IO; + return AVERROR(EIO); } gif_image_write_header(pb, width, height, loop_count, NULL); diff --git a/libavformat/gifdec.c b/libavformat/gifdec.c index 1d31211f6c..26cbe69962 100644 --- a/libavformat/gifdec.c +++ b/libavformat/gifdec.c @@ -500,21 +500,21 @@ static int gif_parse_next_image(GifState *s) switch (code) { case ',': if (gif_read_image(s) < 0) - return AVERROR_IO; + return AVERROR(EIO); ret = 0; goto the_end; case ';': /* end of image */ - ret = AVERROR_IO; + ret = AVERROR(EIO); goto the_end; case '!': if (gif_read_extension(s) < 0) - return AVERROR_IO; + return AVERROR(EIO); break; case EOF: default: /* error or errneous EOF */ - ret = AVERROR_IO; + ret = AVERROR(EIO); goto the_end; } } @@ -567,7 +567,7 @@ static int gif_read_packet(AVFormatContext * s1, /* XXX: avoid copying */ if (av_new_packet(pkt, s->screen_width * s->screen_height * 3)) { - return AVERROR_IO; + return AVERROR(EIO); } pkt->stream_index = 0; memcpy(pkt->data, s->image_buf, s->screen_width * s->screen_height * 3); diff --git a/libavformat/grab.c b/libavformat/grab.c index 5936598e68..c5ca12bac6 100644 --- a/libavformat/grab.c +++ b/libavformat/grab.c @@ -279,7 +279,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) if (video_fd >= 0) close(video_fd); av_free(st); - return AVERROR_IO; + return AVERROR(EIO); } 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) av_log(NULL, AV_LOG_ERROR, "Cannot Sync\n"); else perror("VIDIOCMCAPTURE"); - return AVERROR_IO; + return AVERROR(EIO); } /* This is now the grabbing frame */ @@ -334,7 +334,7 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt) } if (av_new_packet(pkt, s->frame_size) < 0) - return AVERROR_IO; + return AVERROR(EIO); pkt->pts = curtime; @@ -345,7 +345,7 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt) return v4l_mm_read_picture(s, pkt->data); } else { if (read(s->fd, pkt->data, pkt->size) != pkt->size) - return AVERROR_IO; + return AVERROR(EIO); return s->frame_size; } } diff --git a/libavformat/gxf.c b/libavformat/gxf.c index e6ee74c493..0217ba51fa 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -473,7 +473,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { pkt->dts = field_nr; return ret; } - return AVERROR_IO; + return AVERROR(EIO); } static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { diff --git a/libavformat/http.c b/libavformat/http.c index 0d9591e3a6..5bfd736885 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -101,7 +101,7 @@ static int http_open_cnx(URLContext *h) /* url moved, get next */ url_close(hd); if (redirects++ >= MAX_REDIRECTS) - return AVERROR_IO; + return AVERROR(EIO); location_changed = 0; goto redo; } @@ -109,7 +109,7 @@ static int http_open_cnx(URLContext *h) fail: if (hd) url_close(hd); - return AVERROR_IO; + return AVERROR(EIO); } static int http_open(URLContext *h, const char *uri, int flags) @@ -139,7 +139,7 @@ static int http_getc(HTTPContext *s) if (s->buf_ptr >= s->buf_end) { len = url_read(s->hd, s->buffer, BUFFER_SIZE); if (len < 0) { - return AVERROR_IO; + return AVERROR(EIO); } else if (len == 0) { return -1; } else { @@ -237,7 +237,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr, av_freep(&auth_b64); if (http_write(h, s->buffer, strlen(s->buffer)) < 0) - return AVERROR_IO; + return AVERROR(EIO); /* init input buffer */ s->buf_ptr = s->buffer; @@ -255,7 +255,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr, for(;;) { ch = http_getc(s); if (ch < 0) - return AVERROR_IO; + return AVERROR(EIO); if (ch == '\n') { /* process line */ if (q > line && q[-1] == '\r') diff --git a/libavformat/idcin.c b/libavformat/idcin.c index 3b76627669..56850ec82a 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -165,7 +165,7 @@ static int idcin_read_header(AVFormatContext *s, st->codec->extradata = av_malloc(HUFFMAN_TABLE_SIZE); if (get_buffer(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) != HUFFMAN_TABLE_SIZE) - return AVERROR_IO; + return AVERROR(EIO); /* save a reference in order to transport the palette */ st->codec->palctrl = &idcin->palctrl; @@ -222,17 +222,17 @@ static int idcin_read_packet(AVFormatContext *s, unsigned char palette_buffer[768]; if (url_feof(&s->pb)) - return AVERROR_IO; + return AVERROR(EIO); if (idcin->next_chunk_is_video) { command = get_le32(pb); if (command == 2) { - return AVERROR_IO; + return AVERROR(EIO); } else if (command == 1) { /* trigger a palette change */ idcin->palctrl.palette_changed = 1; if (get_buffer(pb, palette_buffer, 768) != 768) - return AVERROR_IO; + return AVERROR(EIO); /* scale the palette as necessary */ palette_scale = 2; for (i = 0; i < 768; i++) @@ -255,7 +255,7 @@ static int idcin_read_packet(AVFormatContext *s, chunk_size -= 4; ret= av_get_packet(pb, pkt, chunk_size); if (ret != chunk_size) - return AVERROR_IO; + return AVERROR(EIO); pkt->stream_index = idcin->video_stream_index; pkt->pts = idcin->pts; } else { @@ -266,7 +266,7 @@ static int idcin_read_packet(AVFormatContext *s, chunk_size = idcin->audio_chunk_size1; ret= av_get_packet(pb, pkt, chunk_size); if (ret != chunk_size) - return AVERROR_IO; + return AVERROR(EIO); pkt->stream_index = idcin->audio_stream_index; pkt->pts = idcin->pts; diff --git a/libavformat/idroq.c b/libavformat/idroq.c index de28d1ef4b..122b31e471 100644 --- a/libavformat/idroq.c +++ b/libavformat/idroq.c @@ -79,7 +79,7 @@ static int roq_read_header(AVFormatContext *s, /* get the main header */ if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) - return AVERROR_IO; + return AVERROR(EIO); roq->framerate = AV_RL16(&preamble[6]); roq->frame_pts_inc = 90000 / roq->framerate; @@ -91,7 +91,7 @@ static int roq_read_header(AVFormatContext *s, for (i = 0; i < RoQ_CHUNKS_TO_SCAN; i++) { if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) - return AVERROR_IO; + return AVERROR(EIO); chunk_type = AV_RL16(&preamble[0]); chunk_size = AV_RL32(&preamble[2]); @@ -102,7 +102,7 @@ static int roq_read_header(AVFormatContext *s, /* fetch the width and height; reuse the preamble bytes */ if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) - return AVERROR_IO; + return AVERROR(EIO); roq->width = AV_RL16(&preamble[0]); roq->height = AV_RL16(&preamble[2]); break; @@ -186,12 +186,12 @@ static int roq_read_packet(AVFormatContext *s, while (!packet_read) { if (url_feof(&s->pb)) - return AVERROR_IO; + return AVERROR(EIO); /* get the next chunk preamble */ if ((ret = get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) != RoQ_CHUNK_PREAMBLE_SIZE) - return AVERROR_IO; + return AVERROR(EIO); chunk_type = AV_RL16(&preamble[0]); chunk_size = AV_RL32(&preamble[2]); @@ -212,7 +212,7 @@ static int roq_read_packet(AVFormatContext *s, url_fseek(pb, codebook_size, SEEK_CUR); if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) - return AVERROR_IO; + return AVERROR(EIO); chunk_size = AV_RL32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 + codebook_size; @@ -222,7 +222,7 @@ static int roq_read_packet(AVFormatContext *s, /* load up the packet */ ret= av_get_packet(pb, pkt, chunk_size); if (ret != chunk_size) - return AVERROR_IO; + return AVERROR(EIO); pkt->stream_index = roq->video_stream_index; pkt->pts = roq->video_pts; @@ -235,7 +235,7 @@ static int roq_read_packet(AVFormatContext *s, case RoQ_QUAD_VQ: /* load up the packet */ if (av_new_packet(pkt, chunk_size + RoQ_CHUNK_PREAMBLE_SIZE)) - return AVERROR_IO; + return AVERROR(EIO); /* copy over preamble */ memcpy(pkt->data, preamble, RoQ_CHUNK_PREAMBLE_SIZE); @@ -255,7 +255,7 @@ static int roq_read_packet(AVFormatContext *s, ret = get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE, chunk_size); if (ret != chunk_size) - ret = AVERROR_IO; + ret = AVERROR(EIO); packet_read = 1; break; diff --git a/libavformat/img2.c b/libavformat/img2.c index 8d36593ac2..af17040fad 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -208,7 +208,7 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap) if (!s->is_pipe) { if (find_image_range(&first_index, &last_index, s->path) < 0) - return AVERROR_IO; + return AVERROR(EIO); s->img_first = first_index; s->img_last = last_index; s->img_number = first_index; @@ -249,10 +249,10 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt) } if (av_get_frame_filename(filename, sizeof(filename), s->path, s->img_number)<0 && s->img_number > 1) - return AVERROR_IO; + return AVERROR(EIO); for(i=0; i<3; i++){ if (url_fopen(f[i], filename, URL_RDONLY) < 0) - return AVERROR_IO; + return AVERROR(EIO); size[i]= url_fsize(f[i]); if(codec->codec_id != CODEC_ID_RAWVIDEO) @@ -265,7 +265,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt) } else { f[0] = &s1->pb; if (url_feof(f[0])) - return AVERROR_IO; + return AVERROR(EIO); size[0]= 4096; } @@ -286,7 +286,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt) if (ret[0] <= 0 || ret[1]<0 || ret[2]<0) { av_free_packet(pkt); - return AVERROR_IO; /* signal EOF */ + return AVERROR(EIO); /* signal EOF */ } else { s->img_count++; s->img_number++; @@ -330,10 +330,10 @@ static int img_write_packet(AVFormatContext *s, AVPacket *pkt) if (!img->is_pipe) { if (av_get_frame_filename(filename, sizeof(filename), img->path, img->img_number) < 0 && img->img_number>1) - return AVERROR_IO; + return AVERROR(EIO); for(i=0; i<3; i++){ if (url_fopen(pb[i], filename, URL_WRONLY) < 0) - return AVERROR_IO; + return AVERROR(EIO); if(codec->codec_id != CODEC_ID_RAWVIDEO) break; diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index f2dbb9ae1e..bf403d7c73 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -539,7 +539,7 @@ static int ipmovie_read_header(AVFormatContext *s, * it; if it is the first video chunk, this is a silent file */ if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != CHUNK_PREAMBLE_SIZE) - return AVERROR_IO; + return AVERROR(EIO); chunk_type = AV_RL16(&chunk_preamble[2]); url_fseek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR); @@ -596,7 +596,7 @@ static int ipmovie_read_packet(AVFormatContext *s, if (ret == CHUNK_BAD) ret = AVERROR_INVALIDDATA; else if (ret == CHUNK_EOF) - ret = AVERROR_IO; + ret = AVERROR(EIO); else if (ret == CHUNK_NOMEM) ret = AVERROR(ENOMEM); else if (ret == CHUNK_VIDEO) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index b6fc4bd149..c12e55ffdf 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -223,7 +223,7 @@ ebml_read_num (MatroskaDemuxContext *matroska, "Read error at pos. %"PRIu64" (0x%"PRIx64")\n", pos, pos); } - return AVERROR_IO; /* EOS or actual I/O error */ + return AVERROR(EIO); /* EOS or actual I/O error */ } /* get the length of the EBML number */ @@ -491,7 +491,7 @@ ebml_read_ascii (MatroskaDemuxContext *matroska, offset_t pos = url_ftell(pb); av_log(matroska->ctx, AV_LOG_ERROR, "Read error at pos. %"PRIu64" (0x%"PRIx64")\n", pos, pos); - return AVERROR_IO; + return AVERROR(EIO); } (*str)[size] = '\0'; @@ -588,7 +588,7 @@ ebml_read_binary (MatroskaDemuxContext *matroska, offset_t pos = url_ftell(pb); av_log(matroska->ctx, AV_LOG_ERROR, "Read error at pos. %"PRIu64" (0x%"PRIx64")\n", pos, pos); - return AVERROR_IO; + return AVERROR(EIO); } return 0; @@ -693,7 +693,7 @@ ebml_read_header (MatroskaDemuxContext *matroska, while (res == 0) { if (!(id = ebml_peek_id(matroska, &level_up))) - return AVERROR_IO; + return AVERROR(EIO); /* end-of-header */ if (level_up) @@ -903,7 +903,7 @@ matroska_parse_info (MatroskaDemuxContext *matroska) while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { - res = AVERROR_IO; + res = AVERROR(EIO); break; } else if (matroska->level_up) { matroska->level_up--; @@ -1002,7 +1002,7 @@ matroska_add_stream (MatroskaDemuxContext *matroska) /* try reading the trackentry headers */ while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { - res = AVERROR_IO; + res = AVERROR(EIO); break; } else if (matroska->level_up > 0) { matroska->level_up--; @@ -1075,7 +1075,7 @@ matroska_add_stream (MatroskaDemuxContext *matroska) while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { - res = AVERROR_IO; + res = AVERROR(EIO); break; } else if (matroska->level_up > 0) { matroska->level_up--; @@ -1246,7 +1246,7 @@ matroska_add_stream (MatroskaDemuxContext *matroska) while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { - res = AVERROR_IO; + res = AVERROR(EIO); break; } else if (matroska->level_up > 0) { matroska->level_up--; @@ -1444,7 +1444,7 @@ matroska_parse_tracks (MatroskaDemuxContext *matroska) while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { - res = AVERROR_IO; + res = AVERROR(EIO); break; } else if (matroska->level_up) { matroska->level_up--; @@ -1487,7 +1487,7 @@ matroska_parse_index (MatroskaDemuxContext *matroska) while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { - res = AVERROR_IO; + res = AVERROR(EIO); break; } else if (matroska->level_up) { matroska->level_up--; @@ -1508,7 +1508,7 @@ matroska_parse_index (MatroskaDemuxContext *matroska) while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { - res = AVERROR_IO; + res = AVERROR(EIO); break; } else if (matroska->level_up) { matroska->level_up--; @@ -1535,7 +1535,7 @@ matroska_parse_index (MatroskaDemuxContext *matroska) while (res == 0) { if (!(id = ebml_peek_id (matroska, &matroska->level_up))) { - res = AVERROR_IO; + res = AVERROR(EIO); break; } else if (matroska->level_up) { matroska->level_up--; @@ -1642,7 +1642,7 @@ matroska_parse_metadata (MatroskaDemuxContext *matroska) while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { - res = AVERROR_IO; + res = AVERROR(EIO); break; } else if (matroska->level_up) { matroska->level_up--; @@ -1680,7 +1680,7 @@ matroska_parse_seekhead (MatroskaDemuxContext *matroska) while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { - res = AVERROR_IO; + res = AVERROR(EIO); break; } else if (matroska->level_up) { matroska->level_up--; @@ -1697,7 +1697,7 @@ matroska_parse_seekhead (MatroskaDemuxContext *matroska) while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { - res = AVERROR_IO; + res = AVERROR(EIO); break; } else if (matroska->level_up) { matroska->level_up--; @@ -1913,7 +1913,7 @@ matroska_read_header (AVFormatContext *s, /* The next thing is a segment. */ while (1) { if (!(id = ebml_peek_id(matroska, &last_level))) - return AVERROR_IO; + return AVERROR(EIO); if (id == MATROSKA_ID_SEGMENT) break; @@ -1936,7 +1936,7 @@ matroska_read_header (AVFormatContext *s, /* we've found our segment, start reading the different contents in here */ while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { - res = AVERROR_IO; + res = AVERROR(EIO); break; } else if (matroska->level_up) { matroska->level_up--; @@ -2497,7 +2497,7 @@ matroska_parse_blockgroup (MatroskaDemuxContext *matroska, while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { - res = AVERROR_IO; + res = AVERROR(EIO); break; } else if (matroska->level_up) { matroska->level_up--; @@ -2575,7 +2575,7 @@ matroska_parse_cluster (MatroskaDemuxContext *matroska) while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { - res = AVERROR_IO; + res = AVERROR(EIO); break; } else if (matroska->level_up) { matroska->level_up--; @@ -2640,12 +2640,12 @@ matroska_read_packet (AVFormatContext *s, /* Have we already reached the end? */ if (matroska->done) - return AVERROR_IO; + return AVERROR(EIO); res = 0; while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { - return AVERROR_IO; + return AVERROR(EIO); } else if (matroska->level_up) { matroska->level_up--; break; diff --git a/libavformat/mm.c b/libavformat/mm.c index 366259b807..7fb34f3e9b 100644 --- a/libavformat/mm.c +++ b/libavformat/mm.c @@ -136,7 +136,7 @@ static int mm_read_packet(AVFormatContext *s, while(1) { if (get_buffer(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) { - return AVERROR_IO; + return AVERROR(EIO); } type = AV_RL16(&preamble[0]); @@ -146,7 +146,7 @@ static int mm_read_packet(AVFormatContext *s, case MM_TYPE_PALETTE : url_fseek(pb, 4, SEEK_CUR); /* unknown data */ if (get_buffer(pb, pal, MM_PALETTE_SIZE) != MM_PALETTE_SIZE) - return AVERROR_IO; + return AVERROR(EIO); url_fseek(pb, length - (4 + MM_PALETTE_SIZE), SEEK_CUR); for (i=0; i<MM_PALETTE_COUNT; i++) { @@ -171,7 +171,7 @@ static int mm_read_packet(AVFormatContext *s, return AVERROR(ENOMEM); memcpy(pkt->data, preamble, MM_PREAMBLE_SIZE); if (get_buffer(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length) - return AVERROR_IO; + return AVERROR(EIO); pkt->size = length + MM_PREAMBLE_SIZE; pkt->stream_index = 0; pkt->pts = mm->video_pts++; diff --git a/libavformat/mmf.c b/libavformat/mmf.c index 4dce8881f7..7fcbde9e7f 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -266,7 +266,7 @@ static int mmf_read_packet(AVFormatContext *s, int ret, size; if (url_feof(&s->pb)) - return AVERROR_IO; + return AVERROR(EIO); st = s->streams[0]; size = MAX_SIZE; @@ -274,10 +274,10 @@ static int mmf_read_packet(AVFormatContext *s, size = mmf->data_size; if(!size) - return AVERROR_IO; + return AVERROR(EIO); if (av_new_packet(pkt, size)) - return AVERROR_IO; + return AVERROR(EIO); pkt->stream_index = 0; ret = get_buffer(&s->pb, pkt->data, pkt->size); diff --git a/libavformat/mp3.c b/libavformat/mp3.c index 3acdfa5c7f..d8c91e7795 100644 --- a/libavformat/mp3.c +++ b/libavformat/mp3.c @@ -485,7 +485,7 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->stream_index = 0; if (ret <= 0) { - return AVERROR_IO; + return AVERROR(EIO); } /* note: we need to modify the packet size here to handle the last packet */ diff --git a/libavformat/mpc.c b/libavformat/mpc.c index 886eb3e468..ac6733788f 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -148,7 +148,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) c->curbits = (curbits + size2) & 0x1F; if (av_new_packet(pkt, size) < 0) - return AVERROR_IO; + return AVERROR(EIO); pkt->data[0] = curbits; pkt->data[1] = (c->curframe > c->fcount); @@ -160,7 +160,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) url_fseek(&s->pb, -4, SEEK_CUR); if(ret < size){ av_free_packet(pkt); - return AVERROR_IO; + return AVERROR(EIO); } pkt->size = ret + 4; diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index fd4e5b04bb..d831b7160c 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -232,7 +232,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, last_sync = url_ftell(&s->pb); //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(&s->pb)); if (startcode < 0) - return AVERROR_IO; + return AVERROR(EIO); if (startcode == PACK_START_CODE) goto redo; if (startcode == SYSTEM_HEADER_START_CODE) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index b4d46aa11e..de38221b9c 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1014,7 +1014,7 @@ static int read_packet(ByteIOContext *pb, uint8_t *buf, int raw_packet_size) for(;;) { len = get_buffer(pb, buf, TS_PACKET_SIZE); if (len != TS_PACKET_SIZE) - return AVERROR_IO; + return AVERROR(EIO); /* check paquet sync byte */ if (buf[0] != 0x47) { /* find a new packet start */ diff --git a/libavformat/mtv.c b/libavformat/mtv.c index 2d4832c2cd..ce70db0db3 100644 --- a/libavformat/mtv.c +++ b/libavformat/mtv.c @@ -122,7 +122,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) /* Jump over header */ if(url_fseek(pb, MTV_HEADER_SIZE, SEEK_SET) != MTV_HEADER_SIZE) - return AVERROR_IO; + return AVERROR(EIO); return(0); @@ -145,7 +145,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) ret = av_get_packet(pb, pkt, MTV_ASUBCHUNK_DATA_SIZE); if(ret != MTV_ASUBCHUNK_DATA_SIZE) - return AVERROR_IO; + return AVERROR(EIO); mtv->audio_packet_count++; pkt->stream_index = AUDIO_SID; @@ -154,7 +154,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) { ret = av_get_packet(pb, pkt, mtv->img_segment_size); if(ret != mtv->img_segment_size) - return AVERROR_IO; + return AVERROR(EIO); #ifndef WORDS_BIGENDIAN diff --git a/libavformat/mxf.c b/libavformat/mxf.c index 68f6782b8b..17a5a20a07 100644 --- a/libavformat/mxf.c +++ b/libavformat/mxf.c @@ -361,7 +361,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) } else url_fskip(&s->pb, klv.length); } - return AVERROR_IO; + return AVERROR(EIO); } static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set) diff --git a/libavformat/nuv.c b/libavformat/nuv.c index 70d4d48ed6..4288f288cd 100644 --- a/libavformat/nuv.c +++ b/libavformat/nuv.c @@ -225,7 +225,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { break; } } - return AVERROR_IO; + return AVERROR(EIO); } AVInputFormat nuv_demuxer = { diff --git a/libavformat/ogg.c b/libavformat/ogg.c index f6f67c06b9..71906bdc73 100644 --- a/libavformat/ogg.c +++ b/libavformat/ogg.c @@ -205,7 +205,7 @@ static int ogg_read_header(AVFormatContext *avfcontext, AVFormatParameters *ap) buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ; if(get_buffer(&avfcontext->pb, buf, DECODER_BUFFER_SIZE) <= 0) - return AVERROR_IO ; + return AVERROR(EIO) ; ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ; ogg_sync_pageout(&context->oy, &og) ; @@ -245,9 +245,9 @@ static int ogg_read_packet(AVFormatContext *avfcontext, AVPacket *pkt) { ogg_packet op ; if(next_packet(avfcontext, &op)) - return AVERROR_IO ; + return AVERROR(EIO) ; if(av_new_packet(pkt, op.bytes) < 0) - return AVERROR_IO ; + return AVERROR(EIO) ; pkt->stream_index = 0 ; memcpy(pkt->data, op.packet, op.bytes); if(avfcontext->streams[0]->codec.sample_rate && op.granulepos!=-1) diff --git a/libavformat/ogg2.c b/libavformat/ogg2.c index ca8c2c31d7..3602f21675 100644 --- a/libavformat/ogg2.c +++ b/libavformat/ogg2.c @@ -540,7 +540,7 @@ ogg_read_packet (AVFormatContext * s, AVPacket * pkt) //Get an ogg packet do{ if (ogg_packet (s, &idx, &pstart, &psize) < 0) - return AVERROR_IO; + return AVERROR(EIO); }while (idx < 0 || !s->streams[idx]); ogg = s->priv_data; @@ -548,7 +548,7 @@ ogg_read_packet (AVFormatContext * s, AVPacket * pkt) //Alloc a pkt if (av_new_packet (pkt, psize) < 0) - return AVERROR_IO; + return AVERROR(EIO); pkt->stream_index = idx; memcpy (pkt->data, os->buf + pstart, psize); if (os->lastgp != -1LL){ diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c index ce54fb1a0e..654155622d 100644 --- a/libavformat/psxstr.c +++ b/libavformat/psxstr.c @@ -142,7 +142,7 @@ static int str_read_header(AVFormatContext *s, /* skip over any RIFF header */ if (get_buffer(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE) - return AVERROR_IO; + return AVERROR(EIO); if (AV_RL32(§or[0]) == RIFF_TAG) start = RIFF_HEADER_SIZE; else @@ -153,7 +153,7 @@ static int str_read_header(AVFormatContext *s, /* check through the first 32 sectors for individual channels */ for (i = 0; i < 32; i++) { if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE) - return AVERROR_IO; + return AVERROR(EIO); //printf("%02x %02x %02x %02x\n",sector[0x10],sector[0x11],sector[0x12],sector[0x13]); @@ -260,7 +260,7 @@ static int str_read_packet(AVFormatContext *s, while (!packet_read) { if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE) - return AVERROR_IO; + return AVERROR(EIO); channel = sector[0x11]; if (channel >= 32) @@ -282,7 +282,7 @@ static int str_read_packet(AVFormatContext *s, pkt = &str->tmp_pkt; if (current_sector == 0) { if (av_new_packet(pkt, frame_size)) - return AVERROR_IO; + return AVERROR(EIO); pkt->pos= url_ftell(pb) - RAW_CD_SECTOR_SIZE; pkt->stream_index = @@ -319,7 +319,7 @@ printf (" dropping audio sector\n"); if (channel == str->audio_channel) { pkt = ret_pkt; if (av_new_packet(pkt, 2304)) - return AVERROR_IO; + return AVERROR(EIO); memcpy(pkt->data,sector+24,2304); pkt->stream_index = @@ -338,7 +338,7 @@ printf (" dropping other sector\n"); } if (url_feof(pb)) - return AVERROR_IO; + return AVERROR(EIO); } return ret; diff --git a/libavformat/raw.c b/libavformat/raw.c index 7637fd15a6..59b5c585c1 100644 --- a/libavformat/raw.c +++ b/libavformat/raw.c @@ -115,7 +115,7 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->stream_index = 0; if (ret <= 0) { - return AVERROR_IO; + return AVERROR(EIO); } /* note: we need to modify the packet size here to handle the last packet */ @@ -130,14 +130,14 @@ static int raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) size = RAW_PACKET_SIZE; if (av_new_packet(pkt, size) < 0) - return AVERROR_IO; + return AVERROR(EIO); pkt->pos= url_ftell(&s->pb); pkt->stream_index = 0; ret = get_partial_buffer(&s->pb, pkt->data, size); if (ret <= 0) { av_free_packet(pkt); - return AVERROR_IO; + return AVERROR(EIO); } pkt->size = ret; return ret; @@ -149,7 +149,7 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) int ret, size, w, h, unk1, unk2; if (get_le32(&s->pb) != MKTAG('M', 'J', 'P', 'G')) - return AVERROR_IO; // FIXME + return AVERROR(EIO); // FIXME size = get_le32(&s->pb); @@ -166,14 +166,14 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) size, w, h, unk1, unk2); if (av_new_packet(pkt, size) < 0) - return AVERROR_IO; + return AVERROR(EIO); pkt->pos = url_ftell(&s->pb); pkt->stream_index = 0; ret = get_buffer(&s->pb, pkt->data, size); if (ret <= 0) { av_free_packet(pkt); - return AVERROR_IO; + return AVERROR(EIO); } pkt->size = ret; return ret; @@ -848,7 +848,7 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->stream_index = 0; if (ret != packet_size) { - return AVERROR_IO; + return AVERROR(EIO); } else { return 0; } diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 100d512adb..7f73416292 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -220,7 +220,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) /* very old .ra format */ return rm_read_header_old(s, ap); } else if (tag != MKTAG('.', 'R', 'M', 'F')) { - return AVERROR_IO; + return AVERROR(EIO); } get_be32(pb); /* header size */ @@ -359,7 +359,7 @@ skip: for(i=0;i<s->nb_streams;i++) { av_free(s->streams[i]); } - return AVERROR_IO; + return AVERROR(EIO); } static int get_num(ByteIOContext *pb, int *len) @@ -468,7 +468,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) for (y = 0; y < rm->sub_packet_h; y++) for (x = 0; x < rm->sub_packet_h/2; x++) if (get_buffer(pb, rm->audiobuf+x*2*rm->audio_framesize+y*rm->coded_framesize, rm->coded_framesize) <= 0) - return AVERROR_IO; + return AVERROR(EIO); rm->audio_stream_num = 0; rm->audio_pkt_cnt = rm->sub_packet_h * rm->audio_framesize / st->codec->block_align - 1; // Release first audio packet @@ -482,7 +482,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) len= av_get_packet(pb, pkt, len); pkt->stream_index = 0; if (len <= 0) { - return AVERROR_IO; + return AVERROR(EIO); } pkt->size = len; } @@ -491,7 +491,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) resync: len=sync(s, ×tamp, &flags, &i, &pos); if(len<0) - return AVERROR_IO; + return AVERROR(EIO); st = s->streams[i]; if (st->codec->codec_type == CODEC_TYPE_VIDEO) { diff --git a/libavformat/rtp.c b/libavformat/rtp.c index 637e4d469d..e42cfb16d4 100644 --- a/libavformat/rtp.c +++ b/libavformat/rtp.c @@ -741,7 +741,7 @@ static int rtp_write_header(AVFormatContext *s1) max_packet_size = url_fget_max_packet_size(&s1->pb); if (max_packet_size <= 12) - return AVERROR_IO; + return AVERROR(EIO); s->max_payload_size = max_packet_size - 12; switch(st->codec->codec_id) { diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index f56b63f534..870273f8cc 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -163,7 +163,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags) if (s->rtcp_hd) url_close(s->rtcp_hd); av_free(s); - return AVERROR_IO; + return AVERROR(EIO); } 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) if (ff_neterrno() == FF_NETERROR(EAGAIN) || ff_neterrno() == FF_NETERROR(EINTR)) continue; - return AVERROR_IO; + return AVERROR(EIO); } break; } @@ -206,7 +206,7 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) if (ff_neterrno() == FF_NETERROR(EAGAIN) || ff_neterrno() == FF_NETERROR(EINTR)) continue; - return AVERROR_IO; + return AVERROR(EIO); } break; } @@ -219,7 +219,7 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) if (ff_neterrno() == FF_NETERROR(EAGAIN) || ff_neterrno() == FF_NETERROR(EINTR)) continue; - return AVERROR_IO; + return AVERROR(EIO); } break; } diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 417c6be9be..d6f8e39fc1 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -886,7 +886,7 @@ static int rtsp_read_header(AVFormatContext *s, /* open the tcp connexion */ snprintf(tcpname, sizeof(tcpname), "tcp://%s:%d", host, port); if (url_open(&rtsp_hd, tcpname, URL_RDWR) < 0) - return AVERROR_IO; + return AVERROR(EIO); rt->rtsp_hd = rtsp_hd; rt->seq = 0; @@ -1199,7 +1199,7 @@ static int rtsp_read_packet(AVFormatContext *s, break; } if (len < 0) - return AVERROR_IO; + return AVERROR(EIO); ret = rtp_parse_packet(rtsp_st->rtp_ctx, pkt, buf, len); if (ret < 0) goto redo; @@ -1473,7 +1473,7 @@ int redir_open(AVFormatContext **ic_ptr, ByteIOContext *f) } *ic_ptr = ic; if (!ic) - return AVERROR_IO; + return AVERROR(EIO); else return 0; } diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index 1ae29ee4e2..a06db71360 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -89,7 +89,7 @@ static int film_read_header(AVFormatContext *s, /* load the main FILM header */ if (get_buffer(pb, scratch, 16) != 16) - return AVERROR_IO; + return AVERROR(EIO); data_offset = AV_RB32(&scratch[4]); film->version = AV_RB32(&scratch[8]); @@ -97,7 +97,7 @@ static int film_read_header(AVFormatContext *s, if (film->version == 0) { /* special case for Lemmings .film files; 20-byte header */ if (get_buffer(pb, scratch, 20) != 20) - return AVERROR_IO; + return AVERROR(EIO); /* make some assumptions about the audio parameters */ film->audio_type = CODEC_ID_PCM_S8; film->audio_samplerate = 22050; @@ -106,7 +106,7 @@ static int film_read_header(AVFormatContext *s, } else { /* normal Saturn .cpk files; 32-byte header */ if (get_buffer(pb, scratch, 32) != 32) - return AVERROR_IO; + return AVERROR(EIO); film->audio_samplerate = AV_RB16(&scratch[24]);; film->audio_channels = scratch[21]; film->audio_bits = scratch[22]; @@ -158,7 +158,7 @@ static int film_read_header(AVFormatContext *s, /* load the sample table */ if (get_buffer(pb, scratch, 16) != 16) - return AVERROR_IO; + return AVERROR(EIO); if (AV_RB32(&scratch[0]) != STAB_TAG) return AVERROR_INVALIDDATA; film->base_clock = AV_RB32(&scratch[8]); @@ -175,7 +175,7 @@ static int film_read_header(AVFormatContext *s, /* load the next sample record and transfer it to an internal struct */ if (get_buffer(pb, scratch, 16) != 16) { av_free(film->sample_table); - return AVERROR_IO; + return AVERROR(EIO); } film->sample_table[i].sample_offset = data_offset + AV_RB32(&scratch[0]); @@ -211,7 +211,7 @@ static int film_read_packet(AVFormatContext *s, int left, right; if (film->current_sample >= film->sample_count) - return AVERROR_IO; + return AVERROR(EIO); sample = &film->sample_table[film->current_sample]; @@ -242,7 +242,7 @@ static int film_read_packet(AVFormatContext *s, pkt->pos= url_ftell(pb); ret = get_buffer(pb, film->stereo_buffer, sample->sample_size); if (ret != sample->sample_size) - ret = AVERROR_IO; + ret = AVERROR(EIO); left = 0; right = sample->sample_size / 2; @@ -260,7 +260,7 @@ static int film_read_packet(AVFormatContext *s, } else { ret= av_get_packet(pb, pkt, sample->sample_size); if (ret != sample->sample_size) - ret = AVERROR_IO; + ret = AVERROR(EIO); } pkt->stream_index = sample->stream; diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c index 68fc685e48..d3eaa37cec 100644 --- a/libavformat/sierravmd.c +++ b/libavformat/sierravmd.c @@ -89,7 +89,7 @@ static int vmd_read_header(AVFormatContext *s, /* fetch the main header, including the 2 header length bytes */ url_fseek(pb, 0, SEEK_SET); if (get_buffer(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE) - return AVERROR_IO; + return AVERROR(EIO); /* start up the decoders */ vst = av_new_stream(s, 0); @@ -161,7 +161,7 @@ static int vmd_read_header(AVFormatContext *s, raw_frame_table_size) { av_free(raw_frame_table); av_free(vmd->frame_table); - return AVERROR_IO; + return AVERROR(EIO); } total_frames = 0; @@ -250,7 +250,7 @@ static int vmd_read_packet(AVFormatContext *s, vmd_frame_t *frame; if (vmd->current_frame >= vmd->frame_count) - return AVERROR_IO; + return AVERROR(EIO); frame = &vmd->frame_table[vmd->current_frame]; /* position the stream (will probably be there already) */ @@ -265,7 +265,7 @@ static int vmd_read_packet(AVFormatContext *s, if (ret != frame->frame_size) { av_free_packet(pkt); - ret = AVERROR_IO; + ret = AVERROR(EIO); } pkt->stream_index = frame->stream_index; pkt->pts = frame->pts; diff --git a/libavformat/smacker.c b/libavformat/smacker.c index de1685f55f..2b2166cd53 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -199,7 +199,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) if(ret != st->codec->extradata_size - 16){ av_free(smk->frm_size); av_free(smk->frm_flags); - return AVERROR_IO; + return AVERROR(EIO); } ((int32_t*)st->codec->extradata)[0] = le2me_32(smk->mmap_size); ((int32_t*)st->codec->extradata)[1] = le2me_32(smk->mclr_size); @@ -284,7 +284,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) smk->buf_sizes[smk->curstream] = size; ret = get_buffer(&s->pb, smk->bufs[smk->curstream], size); if(ret != size) - return AVERROR_IO; + return AVERROR(EIO); smk->stream_id[smk->curstream] = smk->indexes[i]; } flags >>= 1; @@ -297,7 +297,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) memcpy(pkt->data + 1, smk->pal, 768); ret = get_buffer(&s->pb, pkt->data + 769, frame_size); if(ret != frame_size) - return AVERROR_IO; + return AVERROR(EIO); pkt->stream_index = smk->videoindex; pkt->size = ret + 769; smk->cur_frame++; diff --git a/libavformat/swf.c b/libavformat/swf.c index ca4befec01..286462381b 100644 --- a/libavformat/swf.c +++ b/libavformat/swf.c @@ -639,10 +639,10 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (tag == MKBETAG('C', 'W', 'S', 0)) { av_log(s, AV_LOG_ERROR, "Compressed SWF format not supported\n"); - return AVERROR_IO; + return AVERROR(EIO); } if (tag != MKBETAG('F', 'W', 'S', 0)) - return AVERROR_IO; + return AVERROR(EIO); get_le32(pb); /* skip rectangle size */ nbits = get_byte(pb) >> 3; @@ -684,7 +684,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) ast->need_parsing = AVSTREAM_PARSE_FULL; sample_rate_code= (v>>2) & 3; if (!sample_rate_code) - return AVERROR_IO; + return AVERROR(EIO); ast->codec->sample_rate = 11025 << (sample_rate_code-1); av_set_pts_info(ast, 64, 1, ast->codec->sample_rate); if (len > 4) @@ -715,7 +715,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) for(;;) { tag = get_swf_tag(pb, &len); if (tag < 0) - return AVERROR_IO; + return AVERROR(EIO); if (tag == TAG_VIDEOFRAME) { int ch_id = get_le16(pb); len -= 2; diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 36b67076af..3c9ff0fd53 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -98,7 +98,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags) return 0; fail: - ret = AVERROR_IO; + ret = AVERROR(EIO); fail1: if (fd >= 0) closesocket(fd); diff --git a/libavformat/thp.c b/libavformat/thp.c index 7f9a8881ca..2b7533c6e2 100644 --- a/libavformat/thp.c +++ b/libavformat/thp.c @@ -148,7 +148,7 @@ static int thp_read_packet(AVFormatContext *s, if (thp->audiosize == 0) { /* Terminate when last frame is reached. */ if (thp->frame >= thp->framecnt) - return AVERROR_IO; + return AVERROR(EIO); url_fseek(pb, thp->next_frame, SEEK_SET); @@ -169,7 +169,7 @@ static int thp_read_packet(AVFormatContext *s, ret = av_get_packet(pb, pkt, size); if (ret != size) { av_free_packet(pkt); - return AVERROR_IO; + return AVERROR(EIO); } pkt->stream_index = thp->video_stream_index; @@ -177,7 +177,7 @@ static int thp_read_packet(AVFormatContext *s, ret = av_get_packet(pb, pkt, thp->audiosize); if (ret != thp->audiosize) { av_free_packet(pkt); - return AVERROR_IO; + return AVERROR(EIO); } pkt->stream_index = thp->audio_stream_index; diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c index 6181577bae..d6808a043f 100644 --- a/libavformat/tiertexseq.c +++ b/libavformat/tiertexseq.c @@ -115,7 +115,7 @@ static int seq_fill_buffer(SeqDemuxContext *seq, ByteIOContext *pb, int buffer_n url_fseek(pb, seq->current_frame_offs + data_offs, SEEK_SET); if (get_buffer(pb, seq_buffer->data + seq_buffer->fill_size, data_size) != data_size) - return AVERROR_IO; + return AVERROR(EIO); seq_buffer->fill_size += data_size; return 0; @@ -258,7 +258,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->data[0] |= 1; url_fseek(pb, seq->current_frame_offs + seq->current_pal_data_offs, SEEK_SET); if (get_buffer(pb, &pkt->data[1], seq->current_pal_data_size) != seq->current_pal_data_size) - return AVERROR_IO; + return AVERROR(EIO); } if (seq->current_video_data_size != 0) { pkt->data[0] |= 2; @@ -277,7 +277,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt) /* audio packet */ if (seq->current_audio_data_offs == 0) /* end of data reached */ - return AVERROR_IO; + return AVERROR(EIO); url_fseek(pb, seq->current_frame_offs + seq->current_audio_data_offs, SEEK_SET); rc = av_get_packet(pb, pkt, seq->current_audio_data_size); diff --git a/libavformat/txd.c b/libavformat/txd.c index 8843226681..6c17dff55a 100644 --- a/libavformat/txd.c +++ b/libavformat/txd.c @@ -61,10 +61,10 @@ next_chunk: marker = get_le32(pb); if (url_feof(&s->pb)) - return AVERROR_IO; + return AVERROR(EIO); if (marker != TXD_MARKER && marker != TXD_MARKER2) { av_log(NULL, AV_LOG_ERROR, "marker does not match\n"); - return AVERROR_IO; + return AVERROR(EIO); } switch (id) { @@ -78,13 +78,13 @@ next_chunk: goto next_chunk; default: av_log(NULL, AV_LOG_ERROR, "unknown chunk id %i\n", id); - return AVERROR_IO; + return AVERROR(EIO); } ret = av_get_packet(&s->pb, pkt, chunk_size); pkt->stream_index = 0; - return ret <= 0 ? AVERROR_IO : ret; + return ret <= 0 ? AVERROR(EIO) : ret; } static int txd_read_close(AVFormatContext *s) { diff --git a/libavformat/udp.c b/libavformat/udp.c index cb5f516fae..0c42945eb1 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -138,7 +138,7 @@ static int udp_ipv6_set_remote_url(URLContext *h, const char *uri) { struct addrinfo *res0; url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri); res0 = udp_ipv6_resolve_host(hostname, port, SOCK_DGRAM, AF_UNSPEC, 0); - if (res0 == 0) return AVERROR_IO; + if (res0 == 0) return AVERROR(EIO); memcpy(&s->dest_addr, res0->ai_addr, res0->ai_addrlen); s->dest_addr_len = res0->ai_addrlen; freeaddrinfo(res0); @@ -236,7 +236,7 @@ int udp_set_remote_url(URLContext *h, const char *uri) /* set the destination address */ if (resolve_host(&s->dest_addr.sin_addr, hostname) < 0) - return AVERROR_IO; + return AVERROR(EIO); s->dest_addr.sin_family = AF_INET; s->dest_addr.sin_port = htons(port); return 0; @@ -401,7 +401,7 @@ static int udp_open(URLContext *h, const char *uri, int flags) if (udp_fd >= 0) closesocket(udp_fd); av_free(s); - return AVERROR_IO; + return AVERROR(EIO); } 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) if (len < 0) { if (ff_neterrno() != FF_NETERROR(EAGAIN) && ff_neterrno() != FF_NETERROR(EINTR)) - return AVERROR_IO; + return AVERROR(EIO); } else { break; } @@ -446,7 +446,7 @@ static int udp_write(URLContext *h, uint8_t *buf, int size) if (ret < 0) { if (ff_neterrno() != FF_NETERROR(EINTR) && ff_neterrno() != FF_NETERROR(EAGAIN)) - return AVERROR_IO; + return AVERROR(EIO); } else { break; } diff --git a/libavformat/utils.c b/libavformat/utils.c index 9d85518df2..5bd3b9a9bd 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -449,7 +449,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, url_fclose(pb); if (url_fopen(pb, filename, URL_RDONLY) < 0) { file_opened = 0; - err = AVERROR_IO; + err = AVERROR(EIO); goto fail; } } diff --git a/libavformat/v4l2.c b/libavformat/v4l2.c index 956d7c7509..99b768774e 100644 --- a/libavformat/v4l2.c +++ b/libavformat/v4l2.c @@ -443,7 +443,7 @@ static int v4l2_set_parameters( AVFormatContext *s1, AVFormatParameters *ap ) input.index = ap->channel; if(ioctl (s->fd, VIDIOC_ENUMINPUT, &input) < 0) { av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl enum input failed:\n"); - return AVERROR_IO; + return AVERROR(EIO); } 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 ) if(ioctl (s->fd, VIDIOC_S_INPUT, &input.index) < 0 ) { av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set input(%d) failed\n", ap->channel); - return AVERROR_IO; + return AVERROR(EIO); } } @@ -465,7 +465,7 @@ static int v4l2_set_parameters( AVFormatContext *s1, AVFormatParameters *ap ) if (ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0) { av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set standard(%s) failed\n", ap->standard); - return AVERROR_IO; + return AVERROR(EIO); } if(!strcasecmp(standard.name, ap->standard)) { @@ -478,7 +478,7 @@ static int v4l2_set_parameters( AVFormatContext *s1, AVFormatParameters *ap ) if (ioctl(s->fd, VIDIOC_S_STD, &standard.id) < 0) { av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set standard(%s) failed\n", ap->standard); - return AVERROR_IO; + return AVERROR(EIO); } } @@ -526,7 +526,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) if (s->fd < 0) { av_free(st); - return AVERROR_IO; + return AVERROR(EIO); } av_log(s1, AV_LOG_INFO, "[%d]Capabilities: %x\n", s->fd, capabilities); @@ -553,12 +553,12 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) close(s->fd); av_free(st); - return AVERROR_IO; + return AVERROR(EIO); } s->frame_format = desired_format; if( v4l2_set_parameters( s1, ap ) < 0 ) - return AVERROR_IO; + return AVERROR(EIO); st->codec->pix_fmt = fmt_v4l2ff(desired_format); 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) close(s->fd); av_free(st); - return AVERROR_IO; + return AVERROR(EIO); } s->top_field_first = first_field(s->fd); @@ -601,14 +601,14 @@ static int v4l2_read_packet(AVFormatContext *s1, AVPacket *pkt) res = mmap_read_frame(s1, pkt); } else if (s->io_method == io_read) { if (av_new_packet(pkt, s->frame_size) < 0) - return AVERROR_IO; + return AVERROR(EIO); res = read_frame(s1, pkt); } else { - return AVERROR_IO; + return AVERROR(EIO); } if (res < 0) { - return AVERROR_IO; + return AVERROR(EIO); } if (s1->streams[0]->codec->coded_frame) { diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c index 58f79d73c6..d7aa2d3d93 100644 --- a/libavformat/vocdec.c +++ b/libavformat/vocdec.c @@ -73,7 +73,7 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) while (!voc->remaining_size) { type = get_byte(pb); if (type == VOC_TYPE_EOF) - return AVERROR_IO; + return AVERROR(EIO); voc->remaining_size = get_le24(pb); max_size -= 4; diff --git a/libavformat/wav.c b/libavformat/wav.c index f16b52e96d..cb748a9dcb 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -200,14 +200,14 @@ static int wav_read_packet(AVFormatContext *s, WAVContext *wav = s->priv_data; if (url_feof(&s->pb)) - return AVERROR_IO; + return AVERROR(EIO); st = s->streams[0]; left= wav->data_end - url_ftell(&s->pb); if(left <= 0){ left = find_tag(&(s->pb), MKTAG('d', 'a', 't', 'a')); if (left < 0) { - return AVERROR_IO; + return AVERROR(EIO); } wav->data_end= url_ftell(&s->pb) + left; } @@ -221,7 +221,7 @@ static int wav_read_packet(AVFormatContext *s, size= FFMIN(size, left); ret= av_get_packet(&s->pb, pkt, size); if (ret <= 0) - return AVERROR_IO; + return AVERROR(EIO); pkt->stream_index = 0; /* note: we need to modify the packet size here to handle the last diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index 2692de408b..84b67005d8 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -152,7 +152,7 @@ static int wc3_read_header(AVFormatContext *s, * the first BRCH tag */ if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) != WC3_PREAMBLE_SIZE) - return AVERROR_IO; + return AVERROR(EIO); fourcc_tag = AV_RL32(&preamble[0]); size = (AV_RB32(&preamble[4]) + 1) & (~1); @@ -169,7 +169,7 @@ static int wc3_read_header(AVFormatContext *s, /* need the number of palettes */ url_fseek(pb, 8, SEEK_CUR); if ((ret = get_buffer(pb, preamble, 4)) != 4) - return AVERROR_IO; + return AVERROR(EIO); wc3->palette_count = AV_RL32(&preamble[0]); if((unsigned)wc3->palette_count >= UINT_MAX / PALETTE_SIZE){ wc3->palette_count= 0; @@ -185,14 +185,14 @@ static int wc3_read_header(AVFormatContext *s, else bytes_to_read = 512; if ((ret = get_buffer(pb, s->title, bytes_to_read)) != bytes_to_read) - return AVERROR_IO; + return AVERROR(EIO); break; case SIZE_TAG: /* video resolution override */ if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) != WC3_PREAMBLE_SIZE) - return AVERROR_IO; + return AVERROR(EIO); wc3->width = AV_RL32(&preamble[0]); wc3->height = AV_RL32(&preamble[4]); break; @@ -204,7 +204,7 @@ static int wc3_read_header(AVFormatContext *s, if ((ret = get_buffer(pb, &wc3->palettes[current_palette * PALETTE_SIZE], PALETTE_SIZE)) != PALETTE_SIZE) - return AVERROR_IO; + return AVERROR(EIO); /* transform the current palette in place */ for (i = current_palette * PALETTE_SIZE; @@ -228,7 +228,7 @@ static int wc3_read_header(AVFormatContext *s, if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) != WC3_PREAMBLE_SIZE) - return AVERROR_IO; + return AVERROR(EIO); fourcc_tag = AV_RL32(&preamble[0]); /* chunk sizes are 16-bit aligned */ size = (AV_RB32(&preamble[4]) + 1) & (~1); @@ -289,7 +289,7 @@ static int wc3_read_packet(AVFormatContext *s, /* get the next chunk preamble */ if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) != WC3_PREAMBLE_SIZE) - ret = AVERROR_IO; + ret = AVERROR(EIO); fourcc_tag = AV_RL32(&preamble[0]); /* chunk sizes are 16-bit aligned */ @@ -304,7 +304,7 @@ static int wc3_read_packet(AVFormatContext *s, case SHOT_TAG: /* load up new palette */ if ((ret = get_buffer(pb, preamble, 4)) != 4) - return AVERROR_IO; + return AVERROR(EIO); palette_number = AV_RL32(&preamble[0]); if (palette_number >= wc3->palette_count) return AVERROR_INVALIDDATA; @@ -324,7 +324,7 @@ static int wc3_read_packet(AVFormatContext *s, pkt->stream_index = wc3->video_stream_index; pkt->pts = wc3->pts; if (ret != size) - ret = AVERROR_IO; + ret = AVERROR(EIO); packet_read = 1; break; @@ -334,7 +334,7 @@ static int wc3_read_packet(AVFormatContext *s, url_fseek(pb, size, SEEK_CUR); #else if ((unsigned)size > sizeof(text) || (ret = get_buffer(pb, text, size)) != size) - ret = AVERROR_IO; + ret = AVERROR(EIO); else { int i = 0; av_log (s, AV_LOG_DEBUG, "Subtitle time!\n"); @@ -353,7 +353,7 @@ static int wc3_read_packet(AVFormatContext *s, pkt->stream_index = wc3->audio_stream_index; pkt->pts = wc3->pts; if (ret != size) - ret = AVERROR_IO; + ret = AVERROR(EIO); /* time to advance pts */ wc3->pts += WC3_FRAME_PTS_INC; diff --git a/libavformat/westwood.c b/libavformat/westwood.c index 7df258d178..b553073970 100644 --- a/libavformat/westwood.c +++ b/libavformat/westwood.c @@ -123,7 +123,7 @@ static int wsaud_read_header(AVFormatContext *s, unsigned char header[AUD_HEADER_SIZE]; if (get_buffer(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE) - return AVERROR_IO; + return AVERROR(EIO); wsaud->audio_samplerate = AV_RL16(&header[0]); if (header[11] == 99) wsaud->audio_type = CODEC_ID_ADPCM_IMA_WS; @@ -167,7 +167,7 @@ static int wsaud_read_packet(AVFormatContext *s, if (get_buffer(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) != AUD_CHUNK_PREAMBLE_SIZE) - return AVERROR_IO; + return AVERROR(EIO); /* validate the chunk */ if (AV_RL32(&preamble[4]) != AUD_CHUNK_SIGNATURE) @@ -176,7 +176,7 @@ static int wsaud_read_packet(AVFormatContext *s, chunk_size = AV_RL16(&preamble[0]); ret= av_get_packet(pb, pkt, chunk_size); if (ret != chunk_size) - return AVERROR_IO; + return AVERROR(EIO); pkt->stream_index = wsaud->audio_stream_index; pkt->pts = wsaud->audio_frame_counter; pkt->pts /= wsaud->audio_samplerate; @@ -240,7 +240,7 @@ static int wsvqa_read_header(AVFormatContext *s, if (get_buffer(pb, st->codec->extradata, VQA_HEADER_SIZE) != VQA_HEADER_SIZE) { av_free(st->codec->extradata); - return AVERROR_IO; + return AVERROR(EIO); } st->codec->width = AV_RL16(&header[6]); st->codec->height = AV_RL16(&header[8]); @@ -279,7 +279,7 @@ static int wsvqa_read_header(AVFormatContext *s, do { if (get_buffer(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) { av_free(st->codec->extradata); - return AVERROR_IO; + return AVERROR(EIO); } chunk_tag = AV_RB32(&scratch[0]); chunk_size = AV_RB32(&scratch[4]); @@ -330,11 +330,11 @@ static int wsvqa_read_packet(AVFormatContext *s, if ((chunk_type == SND1_TAG) || (chunk_type == SND2_TAG) || (chunk_type == VQFR_TAG)) { if (av_new_packet(pkt, chunk_size)) - return AVERROR_IO; + return AVERROR(EIO); ret = get_buffer(pb, pkt->data, chunk_size); if (ret != chunk_size) { av_free_packet(pkt); - return AVERROR_IO; + return AVERROR(EIO); } if (chunk_type == SND2_TAG) { diff --git a/libavformat/wv.c b/libavformat/wv.c index b3c7957248..40f94f950e 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -182,7 +182,7 @@ static int wv_read_packet(AVFormatContext *s, ret = get_buffer(&s->pb, pkt->data + WV_EXTRA_SIZE, wc->blksize); if(ret != wc->blksize){ av_free_packet(pkt); - return AVERROR_IO; + return AVERROR(EIO); } pkt->stream_index = 0; wc->block_parsed = 1; diff --git a/libavformat/x11grab.c b/libavformat/x11grab.c index 65e313982b..5b0d3a3463 100644 --- a/libavformat/x11grab.c +++ b/libavformat/x11grab.c @@ -80,7 +80,7 @@ typedef struct x11_grab_s * @param ap Parameters from avformat core * @return <ul> * <li>ENOMEM no memory left</li> - * <li>AVERROR_IO other failure case</li> + * <li>AVERROR(EIO) other failure case</li> * <li>0 success</li> * </ul> */ @@ -109,12 +109,12 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) dpy = XOpenDisplay(param); if(!dpy) { av_log(s1, AV_LOG_ERROR, "Could not open X display.\n"); - return AVERROR_IO; + return AVERROR(EIO); } if (!ap || ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) { av_log(s1, AV_LOG_ERROR, "AVParameters don't have any video size. Use -s.\n"); - return AVERROR_IO; + return AVERROR(EIO); } st = av_new_stream(s1, 0); @@ -148,7 +148,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) if (!XShmAttach(dpy, &x11grab->shminfo)) { av_log(s1, AV_LOG_ERROR, "Fatal: Failed to attach shared memory!\n"); /* needs some better error subroutine :) */ - return AVERROR_IO; + return AVERROR(EIO); } } else { image = XGetImage(dpy, RootWindow(dpy, DefaultScreen(dpy)), @@ -176,7 +176,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) } else { av_log(s1, AV_LOG_ERROR, "RGB ordering at image depth %i not supported ... aborting\n", image->bits_per_pixel); 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); - return AVERROR_IO; + return AVERROR(EIO); } break; case 24: @@ -191,7 +191,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) } else { av_log(s1, AV_LOG_ERROR,"rgb ordering at image depth %i not supported ... aborting\n", image->bits_per_pixel); 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); - return AVERROR_IO; + return AVERROR(EIO); } break; case 32: @@ -207,7 +207,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) input_pixfmt = PIX_FMT_ARGB32; } else { av_log(s1, AV_LOG_ERROR,"image depth %i not supported ... aborting\n", image->bits_per_pixel); - return AVERROR_IO; + return AVERROR(EIO); } #endif input_pixfmt = PIX_FMT_RGB32; @@ -459,7 +459,7 @@ x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt) } if (av_new_packet(pkt, s->frame_size) < 0) { - return AVERROR_IO; + return AVERROR(EIO); } pkt->pts = curtime; diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c index da0a8a19ea..9614894caf 100644 --- a/libavformat/yuv4mpeg.c +++ b/libavformat/yuv4mpeg.c @@ -103,7 +103,7 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt) *first_pkt = 0; if (yuv4_generate_header(s, buf2) < 0) { av_log(s, AV_LOG_ERROR, "Error. YUV4MPEG stream header write failed.\n"); - return AVERROR_IO; + return AVERROR(EIO); } else { put_buffer(pb, buf2, strlen(buf2)); } @@ -149,7 +149,7 @@ static int yuv4_write_header(AVFormatContext *s) int* first_pkt = s->priv_data; if (s->nb_streams != 1) - return AVERROR_IO; + return AVERROR(EIO); if (s->streams[0]->codec->pix_fmt == PIX_FMT_YUV411P) { 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) (s->streams[0]->codec->pix_fmt != PIX_FMT_GRAY8) && (s->streams[0]->codec->pix_fmt != PIX_FMT_YUV444P)) { 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"); - return AVERROR_IO; + return AVERROR(EIO); } *first_pkt = 1; @@ -361,7 +361,7 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt) return -1; if (av_get_packet(&s->pb, pkt, packet_size) != packet_size) - return AVERROR_IO; + return AVERROR(EIO); if (s->streams[0]->codec->coded_frame) { s->streams[0]->codec->coded_frame->interlaced_frame = s1->interlaced_frame; |