Skip to content
Snippets Groups Projects
Commit 0bd586c5 authored by Mike Melanson's avatar Mike Melanson
Browse files

sweeping change from -EIO -> AVERROR_IO

Originally committed as revision 3239 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent cbf5374f
No related branches found
No related tags found
No related merge requests found
......@@ -260,7 +260,7 @@ static int fourxm_read_packet(AVFormatContext *s,
fourcc_tag = LE_32(&header[0]);
size = LE_32(&header[4]);
if (url_feof(pb))
return -EIO;
return AVERROR_IO;
switch (fourcc_tag) {
case LIST_TAG:
......@@ -278,7 +278,7 @@ static int fourxm_read_packet(AVFormatContext *s,
/* allocate 8 more bytes than 'size' to account for fourcc
* and size */
if (av_new_packet(pkt, size + 8))
return -EIO;
return AVERROR_IO;
pkt->stream_index = fourxm->video_stream_index;
pkt->pts = fourxm->video_pts;
memcpy(pkt->data, header, 8);
......@@ -298,7 +298,7 @@ static int fourxm_read_packet(AVFormatContext *s,
if (track_number == fourxm->selected_track) {
if (av_new_packet(pkt, size))
return -EIO;
return AVERROR_IO;
pkt->stream_index =
fourxm->tracks[fourxm->selected_track].stream_index;
pkt->pts = fourxm->audio_pts;
......
......@@ -140,7 +140,7 @@ static int amr_read_packet(AVFormatContext *s,
if (url_feof(&s->pb))
{
return -EIO;
return AVERROR_IO;
}
toc=get_byte(&s->pb);
......@@ -151,7 +151,7 @@ static int amr_read_packet(AVFormatContext *s,
if (av_new_packet(pkt, size+1))
{
return -EIO;
return AVERROR_IO;
}
pkt->stream_index = 0;
......@@ -162,7 +162,7 @@ static int amr_read_packet(AVFormatContext *s,
if (read != size)
{
av_free_packet(pkt);
return -EIO;
return AVERROR_IO;
}
return 0;
......@@ -176,7 +176,7 @@ static int amr_read_packet(AVFormatContext *s,
if (url_feof(&s->pb))
{
return -EIO;
return AVERROR_IO;
}
toc=get_byte(&s->pb);
......@@ -185,7 +185,7 @@ static int amr_read_packet(AVFormatContext *s,
if ( (size==0) || av_new_packet(pkt, size))
{
return -EIO;
return AVERROR_IO;
}
pkt->stream_index = 0;
......@@ -196,14 +196,14 @@ static int amr_read_packet(AVFormatContext *s,
if (read != (size-1))
{
av_free_packet(pkt);
return -EIO;
return AVERROR_IO;
}
return 0;
}
else
{
return -EIO;
return AVERROR_IO;
}
}
......
......@@ -434,13 +434,13 @@ static int asf_get_packet(AVFormatContext *s)
if (get_le16(pb) != 0) {
if (!url_feof(pb))
av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n");
return -EIO;
return AVERROR_IO;
}
rsize+=2;
/* }else{
if (!url_feof(pb))
printf("ff asf bad header %x at:%lld\n", c, url_ftell(pb));
return -EIO;*/
return AVERROR_IO;*/
}
asf->packet_flags = get_byte(pb);
......@@ -490,7 +490,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = asf_get_packet(s);
//printf("READ ASF PACKET %d r:%d c:%d\n", ret, asf->packet_size_left, pc++);
if (ret < 0 || url_feof(pb))
return -EIO;
return AVERROR_IO;
asf->packet_time_start = 0;
continue;
}
......
......@@ -159,9 +159,9 @@ static int au_read_packet(AVFormatContext *s,
int ret;
if (url_feof(&s->pb))
return -EIO;
return AVERROR_IO;
if (av_new_packet(pkt, MAX_SIZE))
return -EIO;
return AVERROR_IO;
pkt->stream_index = 0;
ret = get_buffer(&s->pb, pkt->data, pkt->size);
......
......@@ -57,7 +57,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 -EIO;
return AVERROR_IO;
}
if (flip && *flip == '1') {
......@@ -108,7 +108,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 -EIO;
return AVERROR_IO;
}
err=ioctl(audio_fd, SNDCTL_DSP_SETFMT, &tmp);
if (err < 0) {
......@@ -137,7 +137,7 @@ static int audio_open(AudioData *s, int is_output, const char *audio_device)
return 0;
fail:
close(audio_fd);
return -EIO;
return AVERROR_IO;
}
static int audio_close(AudioData *s)
......@@ -158,7 +158,7 @@ static int audio_write_header(AVFormatContext *s1)
s->channels = st->codec.channels;
ret = audio_open(s, 1, NULL);
if (ret < 0) {
return -EIO;
return AVERROR_IO;
} else {
return 0;
}
......@@ -183,7 +183,7 @@ static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
if (ret > 0)
break;
if (ret < 0 && (errno != EAGAIN && errno != EINTR))
return -EIO;
return AVERROR_IO;
}
s->buffer_ptr = 0;
}
......@@ -222,7 +222,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
ret = audio_open(s, 0, ap->device);
if (ret < 0) {
av_free(st);
return -EIO;
return AVERROR_IO;
}
/* take real parameters */
......@@ -243,7 +243,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
struct audio_buf_info abufi;
if (av_new_packet(pkt, s->frame_size) < 0)
return -EIO;
return AVERROR_IO;
for(;;) {
struct timeval tv;
fd_set fds;
......@@ -268,7 +268,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
}
if (!(ret == 0 || (ret == -1 && (errno == EAGAIN || errno == EINTR)))) {
av_free_packet(pkt);
return -EIO;
return AVERROR_IO;
}
}
pkt->size = ret;
......
......@@ -95,7 +95,7 @@ int url_read(URLContext *h, unsigned char *buf, int size)
{
int ret;
if (h->flags & URL_WRONLY)
return -EIO;
return AVERROR_IO;
ret = h->prot->url_read(h, buf, size);
return ret;
}
......@@ -105,10 +105,10 @@ int url_write(URLContext *h, unsigned char *buf, int size)
{
int ret;
if (!(h->flags & (URL_WRONLY | URL_RDWR)))
return -EIO;
return AVERROR_IO;
/* avoid sending too big packets */
if (h->max_packet_size && size > h->max_packet_size)
return -EIO;
return AVERROR_IO;
ret = h->prot->url_write(h, buf, size);
return ret;
}
......
......@@ -473,7 +473,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 -EIO;
return AVERROR_IO;
}
s->is_streamed = h->is_streamed;
s->max_packet_size = max_packet_size;
......
......@@ -850,11 +850,11 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt)
if (size < 0) {
if (get_buffer(&s->pb, c->buf, 4) <= 0)
return -EIO;
return AVERROR_IO;
size = dv_frame_profile(c->buf)->frame_size;
if (get_buffer(&s->pb, c->buf + 4, size - 4) <= 0)
return -EIO;
return AVERROR_IO;
size = dv_produce_packet(c->dv_demux, pkt, c->buf, size);
}
......
......@@ -126,7 +126,7 @@ static int dv1394_read_header(AVFormatContext * context, AVFormatParameters * ap
failed:
close(dv->fd);
return -EIO;
return AVERROR_IO;
}
static int dv1394_read_packet(AVFormatContext *context, AVPacket *pkt)
......@@ -165,12 +165,12 @@ restart_poll:
if (errno == EAGAIN || errno == EINTR)
goto restart_poll;
perror("Poll failed");
return -EIO;
return AVERROR_IO;
}
if (ioctl(dv->fd, DV1394_GET_STATUS, &s) < 0) {
perror("Failed to get status");
return -EIO;
return AVERROR_IO;
}
#ifdef DV1394_DEBUG
fprintf(stderr, "DV1394: status\n"
......
......@@ -76,7 +76,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 -EIO;
return AVERROR_IO;
magic_number = LE_16(&header[4]);
speed = LE_32(&header[0x10]);
......@@ -164,7 +164,7 @@ static int flic_read_packet(AVFormatContext *s,
if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) !=
FLIC_PREAMBLE_SIZE) {
ret = -EIO;
ret = AVERROR_IO;
break;
}
......@@ -173,7 +173,7 @@ static int flic_read_packet(AVFormatContext *s,
if ((magic == FLIC_CHUNK_MAGIC_1) || (magic == FLIC_CHUNK_MAGIC_2)) {
if (av_new_packet(pkt, size)) {
ret = -EIO;
ret = AVERROR_IO;
break;
}
pkt->stream_index = flic->video_stream_index;
......@@ -183,7 +183,7 @@ static int flic_read_packet(AVFormatContext *s,
size - FLIC_PREAMBLE_SIZE);
if (ret != size - FLIC_PREAMBLE_SIZE) {
av_free_packet(pkt);
ret = -EIO;
ret = AVERROR_IO;
}
flic->pts += flic->frame_pts_inc;
packet_read = 1;
......
......@@ -69,7 +69,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 -EIO;
return AVERROR_IO;
url_fskip(&s->pb, 4); /* reserved */
flags = 0;
......@@ -139,12 +139,12 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
}
if (av_new_packet(pkt, size) < 0)
return -EIO;
return AVERROR_IO;
ret = get_buffer(&s->pb, pkt->data, size);
if (ret <= 0) {
av_free_packet(pkt);
return -EIO;
return AVERROR_IO;
}
/* note: we need to modify the packet size here to handle the last
packet */
......
......@@ -505,21 +505,21 @@ static int gif_parse_next_image(GifState *s)
switch (code) {
case ',':
if (gif_read_image(s) < 0)
return -EIO;
return AVERROR_IO;
ret = 0;
goto the_end;
case ';':
/* end of image */
ret = -EIO;
ret = AVERROR_IO;
goto the_end;
case '!':
if (gif_read_extension(s) < 0)
return -EIO;
return AVERROR_IO;
break;
case EOF:
default:
/* error or errneous EOF */
ret = -EIO;
ret = AVERROR_IO;
goto the_end;
}
}
......@@ -572,7 +572,7 @@ static int gif_read_packet(AVFormatContext * s1,
/* XXX: avoid copying */
if (av_new_packet(pkt, s->screen_width * s->screen_height * 3)) {
return -EIO;
return AVERROR_IO;
}
pkt->stream_index = 0;
memcpy(pkt->data, s->image_buf, s->screen_width * s->screen_height * 3);
......
......@@ -270,7 +270,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
if (video_fd >= 0)
close(video_fd);
av_free(st);
return -EIO;
return AVERROR_IO;
}
static int v4l_mm_read_picture(VideoData *s, uint8_t *buf)
......@@ -290,7 +290,7 @@ static int v4l_mm_read_picture(VideoData *s, uint8_t *buf)
av_log(NULL, AV_LOG_ERROR, "Cannot Sync\n");
else
perror("VIDIOCMCAPTURE");
return -EIO;
return AVERROR_IO;
}
/* This is now the grabbing frame */
......@@ -325,7 +325,7 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
}
if (av_new_packet(pkt, s->frame_size) < 0)
return -EIO;
return AVERROR_IO;
pkt->pts = curtime & ((1LL << 48) - 1);
......@@ -336,7 +336,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 -EIO;
return AVERROR_IO;
return s->frame_size;
}
}
......
......@@ -116,7 +116,7 @@ static int http_open(URLContext *h, const char *uri, int flags)
if (hd)
url_close(hd);
av_free(s);
return -EIO;
return AVERROR_IO;
}
static int http_getc(HTTPContext *s)
......@@ -125,7 +125,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 -EIO;
return AVERROR_IO;
} else if (len == 0) {
return -1;
} else {
......@@ -194,7 +194,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr)
hoststr);
if (http_write(h, s->buffer, strlen(s->buffer)) < 0)
return -EIO;
return AVERROR_IO;
/* init input buffer */
s->buf_ptr = s->buffer;
......@@ -211,7 +211,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr)
for(;;) {
ch = http_getc(s);
if (ch < 0)
return -EIO;
return AVERROR_IO;
if (ch == '\n') {
/* process line */
if (q > line && q[-1] == '\r')
......
......@@ -167,7 +167,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 -EIO;
return AVERROR_IO;
/* save a reference in order to transport the palette */
st->codec.palctrl = &idcin->palctrl;
......@@ -224,17 +224,17 @@ static int idcin_read_packet(AVFormatContext *s,
unsigned char palette_buffer[768];
if (url_feof(&s->pb))
return -EIO;
return AVERROR_IO;
if (idcin->next_chunk_is_video) {
command = get_le32(pb);
if (command == 2) {
return -EIO;
return AVERROR_IO;
} else if (command == 1) {
/* trigger a palette change */
idcin->palctrl.palette_changed = 1;
if (get_buffer(pb, palette_buffer, 768) != 768)
return -EIO;
return AVERROR_IO;
/* scale the palette as necessary */
palette_scale = 2;
for (i = 0; i < 768; i++)
......@@ -256,12 +256,12 @@ static int idcin_read_packet(AVFormatContext *s,
url_fseek(pb, 4, SEEK_CUR);
chunk_size -= 4;
if (av_new_packet(pkt, chunk_size))
ret = -EIO;
ret = AVERROR_IO;
pkt->stream_index = idcin->video_stream_index;
pkt->pts = idcin->pts;
ret = get_buffer(pb, pkt->data, chunk_size);
if (ret != chunk_size)
ret = -EIO;
ret = AVERROR_IO;
} else {
/* send out the audio chunk */
if (idcin->current_audio_chunk)
......@@ -269,12 +269,12 @@ static int idcin_read_packet(AVFormatContext *s,
else
chunk_size = idcin->audio_chunk_size1;
if (av_new_packet(pkt, chunk_size))
return -EIO;
return AVERROR_IO;
pkt->stream_index = idcin->audio_stream_index;
pkt->pts = idcin->pts;
ret = get_buffer(&s->pb, pkt->data, chunk_size);
if (ret != chunk_size)
ret = -EIO;
ret = AVERROR_IO;
idcin->current_audio_chunk ^= 1;
idcin->pts += FRAME_PTS_INC;
......
......@@ -187,12 +187,12 @@ static int roq_read_packet(AVFormatContext *s,
while (!packet_read) {
if (url_feof(&s->pb))
return -EIO;
return AVERROR_IO;
/* get the next chunk preamble */
if ((ret = get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) !=
RoQ_CHUNK_PREAMBLE_SIZE)
return -EIO;
return AVERROR_IO;
chunk_type = LE_16(&preamble[0]);
chunk_size = LE_32(&preamble[2]);
......@@ -211,7 +211,7 @@ 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 -EIO;
return AVERROR_IO;
chunk_size = LE_32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 +
codebook_size;
......@@ -220,12 +220,12 @@ static int roq_read_packet(AVFormatContext *s,
/* load up the packet */
if (av_new_packet(pkt, chunk_size))
return -EIO;
return AVERROR_IO;
pkt->stream_index = roq->video_stream_index;
pkt->pts = roq->video_pts;
ret = get_buffer(pb, pkt->data, chunk_size);
if (ret != chunk_size)
ret = -EIO;
ret = AVERROR_IO;
roq->video_pts += roq->frame_pts_inc;
packet_read = 1;
......@@ -236,7 +236,7 @@ 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 -EIO;
return AVERROR_IO;
/* 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 = -EIO;
ret = AVERROR_IO;
packet_read = 1;
break;
......
......@@ -183,7 +183,7 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
url_fclose(f);
fail:
av_free(s);
return -EIO;
return AVERROR_IO;
}
static int read_packet_alloc_cb(void *opaque, AVImageInfo *info)
......@@ -211,14 +211,14 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
}
if (get_frame_filename(filename, sizeof(filename),
s->path, s->img_number) < 0)
return -EIO;
return AVERROR_IO;
f = &f1;
if (url_fopen(f, filename, URL_RDONLY) < 0)
return -EIO;
return AVERROR_IO;
} else {
f = &s1->pb;
if (url_feof(f))
return -EIO;
return AVERROR_IO;
}
av_new_packet(pkt, s->img_size);
......@@ -232,7 +232,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
if (ret < 0) {
av_free_packet(pkt);
return -EIO; /* signal EOF */
return AVERROR_IO; /* signal EOF */
} else {
/* XXX: computing this pts is not necessary as it is done in
the generic code too */
......@@ -318,10 +318,10 @@ static int img_write_packet(AVFormatContext *s, AVPacket *pkt)
if (!img->is_pipe) {
if (get_frame_filename(filename, sizeof(filename),
img->path, img->img_number) < 0)
return -EIO;
return AVERROR_IO;
pb = &pb1;
if (url_fopen(pb, filename, URL_WRONLY) < 0)
return -EIO;
return AVERROR_IO;
} else {
pb = &s->pb;
}
......
......@@ -34,7 +34,7 @@
/* debugging support: #define DEBUG_IPMOVIE as non-zero to see extremely
* verbose information about the demux process */
#define DEBUG_IPMOVIE 0
#define DEBUG_IPMOVIE 1
#if DEBUG_IPMOVIE
#define debug_ipmovie printf
......@@ -543,7 +543,7 @@ 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 -EIO;
return AVERROR_IO;
chunk_type = LE_16(&chunk_preamble[2]);
url_fseek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR);
......@@ -600,7 +600,7 @@ static int ipmovie_read_packet(AVFormatContext *s,
if (ret == CHUNK_BAD)
ret = AVERROR_INVALIDDATA;
else if (ret == CHUNK_EOF)
ret = -EIO;
ret = AVERROR_IO;
else if (ret == CHUNK_NOMEM)
ret = AVERROR_NOMEM;
else
......
......@@ -298,13 +298,13 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
size= MP3_PACKET_SIZE;
if (av_new_packet(pkt, size) < 0)
return -EIO;
return AVERROR_IO;
pkt->stream_index = 0;
ret = get_buffer(&s->pb, pkt->data, size);
if (ret <= 0) {
av_free_packet(pkt);
return -EIO;
return AVERROR_IO;
}
/* note: we need to modify the packet size here to handle the last
packet */
......
......@@ -1164,7 +1164,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
startcode = find_next_start_code(&s->pb, &size, &m->header_state);
//printf("startcode=%x pos=0x%Lx\n", startcode, url_ftell(&s->pb));
if (startcode < 0)
return -EIO;
return AVERROR_IO;
if (startcode == PACK_START_CODE)
goto redo;
if (startcode == SYSTEM_HEADER_START_CODE)
......@@ -1284,7 +1284,7 @@ static int mpegps_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
AVStream *st;
int len, startcode, i, type, codec_id;
int len, startcode, i, type, codec_id = 0;
int64_t pts, dts, dummy_pos; //dummy_pos is needed for the index building to work
redo:
......@@ -1350,6 +1350,15 @@ static int mpegps_read_packet(AVFormatContext *s,
av_log(s, AV_LOG_DEBUG, "%d: pts=%0.3f dts=%0.3f\n",
pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0);
#endif
#if 1
//#ifdef CONFIG_ADX
if (codec_id == CODEC_ID_MP2 && is_adx(pkt->data,pkt->size)) {
printf ("found ADX...\n");
st->codec.codec_id = CODEC_ID_ADPCM_ADX;
}
#endif //CONFIG_ADX
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment