case AVERROR_NOFMT:
fprintf(stderr, "%s: Unknown format\n", filename);
break;
- case AVERROR_IO:
+ case AVERROR(EIO):
fprintf(stderr, "%s: I/O error occured\n"
"Usually that means that input file is truncated and/or corrupted.\n",
filename);
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++) {
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:
/* 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);
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;
int size;
if (url_feof(pb))
- return AVERROR_IO;
+ return AVERROR(EIO);
*tag = get_le32(pb);
size = get_be32(pb);
/* 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);
if (url_feof(&s->pb))
{
- return AVERROR_IO;
+ return AVERROR(EIO);
}
//FIXME this is wrong, this should rather be in a AVParset
if ( (size==0) || av_new_packet(pkt, size))
{
- return AVERROR_IO;
+ return AVERROR(EIO);
}
pkt->stream_index = 0;
if (read != size-1)
{
av_free_packet(pkt);
- return AVERROR_IO;
+ return AVERROR(EIO);
}
return 0;
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;
}
//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) {
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)
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
audio_fd = open(audio_device, O_RDONLY);
if (audio_fd < 0) {
perror(audio_device);
- return AVERROR_IO;
+ return AVERROR(EIO);
}
if (flip && *flip == '1') {
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) {
return 0;
fail:
close(audio_fd);
- return AVERROR_IO;
+ return AVERROR(EIO);
}
static int audio_close(AudioData *s)
s->channels = st->codec->channels;
ret = audio_open(s, 1, s1->filename);
if (ret < 0) {
- return AVERROR_IO;
+ return AVERROR(EIO);
} else {
return 0;
}
if (ret > 0)
break;
if (ret < 0 && (errno != EAGAIN && errno != EINTR))
- return AVERROR_IO;
+ return AVERROR(EIO);
}
s->buffer_ptr = 0;
}
ret = audio_open(s, 0, s1->filename);
if (ret < 0) {
av_free(st);
- return AVERROR_IO;
+ return AVERROR(EIO);
}
/* take real parameters */
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;
}
if (!(ret == 0 || (ret == -1 && (errno == EAGAIN || errno == EINTR)))) {
av_free_packet(pkt);
- return AVERROR_IO;
+ return AVERROR(EIO);
}
}
pkt->size = ret;
{
int ret;
if (h->flags & URL_WRONLY)
- return AVERROR_IO;
+ return AVERROR(EIO);
ret = h->prot->url_read(h, buf, size);
return ret;
}
{
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;
}
(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;
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;
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;
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;
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;
}
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;
int ret_value;
if(vid->is_finished || url_feof(pb))
- return AVERROR_IO;
+ return AVERROR(EIO);
block_type = get_byte(pb);
switch(block_type){
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;
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:
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;
}
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;
ret = get_buffer(pb, pkt->data + 1, datasize);
if (ret < datasize) {
- ret = AVERROR_IO;
+ ret = AVERROR(EIO);
goto fail;
}
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;
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);
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;
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;
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;
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,
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);
}
failed:
close(dv->fd);
- return AVERROR_IO;
+ return AVERROR(EIO);
}
static int dv1394_read_packet(AVFormatContext *context, AVPacket *pkt)
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"
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;
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;
AVStream *st;
if (!process_ea_header(s))
- return AVERROR_IO;
+ return AVERROR(EIO);
#if 0
/* initialize the video decoder stream */
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;
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;
/* ending tag */
case SCEl_TAG:
- ret = AVERROR_IO;
+ ret = AVERROR(EIO);
packet_read = 1;
break;
/* 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]);
if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) !=
FLIC_PREAMBLE_SIZE) {
- ret = AVERROR_IO;
+ ret = AVERROR(EIO);
break;
}
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;
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;
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;
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 */
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);
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;
}
}
/* 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);
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)
av_log(NULL, AV_LOG_ERROR, "Cannot Sync\n");
else
perror("VIDIOCMCAPTURE");
- return AVERROR_IO;
+ return AVERROR(EIO);
}
/* This is now the grabbing frame */
}
if (av_new_packet(pkt, s->frame_size) < 0)
- return AVERROR_IO;
+ return AVERROR(EIO);
pkt->pts = curtime;
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;
}
}
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) {
/* url moved, get next */
url_close(hd);
if (redirects++ >= MAX_REDIRECTS)
- return AVERROR_IO;
+ return AVERROR(EIO);
location_changed = 0;
goto redo;
}
fail:
if (hd)
url_close(hd);
- return AVERROR_IO;
+ return AVERROR(EIO);
}
static int http_open(URLContext *h, const char *uri, int flags)
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 {
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;
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')
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;
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++)
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 {
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;
/* 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;
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]);
/* 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;
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]);
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;
/* 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;
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);
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;
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;
}
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)
} else {
f[0] = &s1->pb;
if (url_feof(f[0]))
- return AVERROR_IO;
+ return AVERROR(EIO);
size[0]= 4096;
}
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++;
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;
* 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);
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)
"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 */
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';
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;
while (res == 0) {
if (!(id = ebml_peek_id(matroska, &level_up)))
- return AVERROR_IO;
+ return AVERROR(EIO);
/* end-of-header */
if (level_up)
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--;
/* 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--;
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--;
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--;
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--;
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--;
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--;
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--;
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--;
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--;
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--;
/* 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;
/* 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--;
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--;
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--;
/* 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;
while(1) {
if (get_buffer(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) {
- return AVERROR_IO;
+ return AVERROR(EIO);
}
type = AV_RL16(&preamble[0]);
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++) {
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++;
int ret, size;
if (url_feof(&s->pb))
- return AVERROR_IO;
+ return AVERROR(EIO);
st = s->streams[0];
size = MAX_SIZE;
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);
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 */
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);
url_fseek(&s->pb, -4, SEEK_CUR);
if(ret < size){
av_free_packet(pkt);
- return AVERROR_IO;
+ return AVERROR(EIO);
}
pkt->size = ret + 4;
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)
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 */
/* Jump over header */
if(url_fseek(pb, MTV_HEADER_SIZE, SEEK_SET) != MTV_HEADER_SIZE)
- return AVERROR_IO;
+ return AVERROR(EIO);
return(0);
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;
{
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
} else
url_fskip(&s->pb, klv.length);
}
- return AVERROR_IO;
+ return AVERROR(EIO);
}
static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set)
break;
}
}
- return AVERROR_IO;
+ return AVERROR(EIO);
}
AVInputFormat nuv_demuxer = {
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) ;
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)
//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;
//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){
/* 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
/* 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]);
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)
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 =
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 =
}
if (url_feof(pb))
- return AVERROR_IO;
+ return AVERROR(EIO);
}
return ret;
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 */
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;
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);
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;
pkt->stream_index = 0;
if (ret != packet_size) {
- return AVERROR_IO;
+ return AVERROR(EIO);
} else {
return 0;
}
/* 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 */
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)
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
len= av_get_packet(pb, pkt, len);
pkt->stream_index = 0;
if (len <= 0) {
- return AVERROR_IO;
+ return AVERROR(EIO);
}
pkt->size = len;
}
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) {
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) {
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)
if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
ff_neterrno() == FF_NETERROR(EINTR))
continue;
- return AVERROR_IO;
+ return AVERROR(EIO);
}
break;
}
if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
ff_neterrno() == FF_NETERROR(EINTR))
continue;
- return AVERROR_IO;
+ return AVERROR(EIO);
}
break;
}
if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
ff_neterrno() == FF_NETERROR(EINTR))
continue;
- return AVERROR_IO;
+ return AVERROR(EIO);
}
break;
}
/* 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;
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;
}
*ic_ptr = ic;
if (!ic)
- return AVERROR_IO;
+ return AVERROR(EIO);
else
return 0;
}
/* 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]);
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;
} 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];
/* 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]);
/* 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]);
int left, right;
if (film->current_sample >= film->sample_count)
- return AVERROR_IO;
+ return AVERROR(EIO);
sample = &film->sample_table[film->current_sample];
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;
} 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;
/* 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);
raw_frame_table_size) {
av_free(raw_frame_table);
av_free(vmd->frame_table);
- return AVERROR_IO;
+ return AVERROR(EIO);
}
total_frames = 0;
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) */
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;
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);
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;
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++;
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;
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)
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;
return 0;
fail:
- ret = AVERROR_IO;
+ ret = AVERROR(EIO);
fail1:
if (fd >= 0)
closesocket(fd);
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);
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;
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;
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;
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;
/* 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);
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) {
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) {
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);
/* 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;
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)
if (len < 0) {
if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
ff_neterrno() != FF_NETERROR(EINTR))
- return AVERROR_IO;
+ return AVERROR(EIO);
} else {
break;
}
if (ret < 0) {
if (ff_neterrno() != FF_NETERROR(EINTR) &&
ff_neterrno() != FF_NETERROR(EAGAIN))
- return AVERROR_IO;
+ return AVERROR(EIO);
} else {
break;
}
url_fclose(pb);
if (url_fopen(pb, filename, URL_RDONLY) < 0) {
file_opened = 0;
- err = AVERROR_IO;
+ err = AVERROR(EIO);
goto fail;
}
}
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",
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);
}
}
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)) {
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);
}
}
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);
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);
close(s->fd);
av_free(st);
- return AVERROR_IO;
+ return AVERROR(EIO);
}
s->top_field_first = first_field(s->fd);
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) {
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;
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;
}
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
* 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);
/* 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;
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;
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;
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);
/* 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 */
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;
pkt->stream_index = wc3->video_stream_index;
pkt->pts = wc3->pts;
if (ret != size)
- ret = AVERROR_IO;
+ ret = AVERROR(EIO);
packet_read = 1;
break;
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");
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;
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;
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)
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;
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]);
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]);
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) {
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;
* @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>
*/
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);
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)),
} 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:
} 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:
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;
}
if (av_new_packet(pkt, s->frame_size) < 0) {
- return AVERROR_IO;
+ return AVERROR(EIO);
}
pkt->pts = curtime;
*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));
}
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");
(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;
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;