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