sweeping change from -EIO -> AVERROR_IO

Originally committed as revision 3239 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Mike Melanson 21 years ago
parent cbf5374fc0
commit 0bd586c50d
  1. 6
      libavformat/4xm.c
  2. 14
      libavformat/amr.c
  3. 6
      libavformat/asf.c
  4. 4
      libavformat/au.c
  5. 16
      libavformat/audio.c
  6. 6
      libavformat/avio.c
  7. 2
      libavformat/aviobuf.c
  8. 4
      libavformat/dv.c
  9. 6
      libavformat/dv1394.c
  10. 8
      libavformat/flic.c
  11. 6
      libavformat/flvdec.c
  12. 10
      libavformat/gifdec.c
  13. 8
      libavformat/grab.c
  14. 8
      libavformat/http.c
  15. 16
      libavformat/idcin.c
  16. 14
      libavformat/idroq.c
  17. 14
      libavformat/img.c
  18. 6
      libavformat/ipmovie.c
  19. 4
      libavformat/mp3.c
  20. 13
      libavformat/mpeg.c
  21. 6
      libavformat/ogg.c
  22. 8
      libavformat/psxstr.c
  23. 83
      libavformat/raw.c
  24. 10
      libavformat/rm.c
  25. 8
      libavformat/rtpproto.c
  26. 18
      libavformat/segafilm.c
  27. 8
      libavformat/sierravmd.c
  28. 8
      libavformat/swf.c
  29. 2
      libavformat/tcp.c
  30. 8
      libavformat/udp.c
  31. 4
      libavformat/wav.c
  32. 26
      libavformat/wc3movie.c
  33. 18
      libavformat/westwood.c
  34. 12
      libavformat/yuv.c
  35. 10
      libavformat/yuv4mpeg.c

@ -260,7 +260,7 @@ static int fourxm_read_packet(AVFormatContext *s,
fourcc_tag = LE_32(&header[0]);
size = LE_32(&header[4]);
if (url_feof(pb))
return -EIO;
return AVERROR_IO;
switch (fourcc_tag) {
case LIST_TAG:
@ -278,7 +278,7 @@ static int fourxm_read_packet(AVFormatContext *s,
/* allocate 8 more bytes than 'size' to account for fourcc
* and size */
if (av_new_packet(pkt, size + 8))
return -EIO;
return AVERROR_IO;
pkt->stream_index = fourxm->video_stream_index;
pkt->pts = fourxm->video_pts;
memcpy(pkt->data, header, 8);
@ -298,7 +298,7 @@ static int fourxm_read_packet(AVFormatContext *s,
if (track_number == fourxm->selected_track) {
if (av_new_packet(pkt, size))
return -EIO;
return AVERROR_IO;
pkt->stream_index =
fourxm->tracks[fourxm->selected_track].stream_index;
pkt->pts = fourxm->audio_pts;

@ -140,7 +140,7 @@ static int amr_read_packet(AVFormatContext *s,
if (url_feof(&s->pb))
{
return -EIO;
return AVERROR_IO;
}
toc=get_byte(&s->pb);
@ -151,7 +151,7 @@ static int amr_read_packet(AVFormatContext *s,
if (av_new_packet(pkt, size+1))
{
return -EIO;
return AVERROR_IO;
}
pkt->stream_index = 0;
@ -162,7 +162,7 @@ static int amr_read_packet(AVFormatContext *s,
if (read != size)
{
av_free_packet(pkt);
return -EIO;
return AVERROR_IO;
}
return 0;
@ -176,7 +176,7 @@ static int amr_read_packet(AVFormatContext *s,
if (url_feof(&s->pb))
{
return -EIO;
return AVERROR_IO;
}
toc=get_byte(&s->pb);
@ -185,7 +185,7 @@ static int amr_read_packet(AVFormatContext *s,
if ( (size==0) || av_new_packet(pkt, size))
{
return -EIO;
return AVERROR_IO;
}
pkt->stream_index = 0;
@ -196,14 +196,14 @@ static int amr_read_packet(AVFormatContext *s,
if (read != (size-1))
{
av_free_packet(pkt);
return -EIO;
return AVERROR_IO;
}
return 0;
}
else
{
return -EIO;
return AVERROR_IO;
}
}

@ -434,13 +434,13 @@ static int asf_get_packet(AVFormatContext *s)
if (get_le16(pb) != 0) {
if (!url_feof(pb))
av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n");
return -EIO;
return AVERROR_IO;
}
rsize+=2;
/* }else{
if (!url_feof(pb))
printf("ff asf bad header %x at:%lld\n", c, url_ftell(pb));
return -EIO;*/
return AVERROR_IO;*/
}
asf->packet_flags = get_byte(pb);
@ -490,7 +490,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = asf_get_packet(s);
//printf("READ ASF PACKET %d r:%d c:%d\n", ret, asf->packet_size_left, pc++);
if (ret < 0 || url_feof(pb))
return -EIO;
return AVERROR_IO;
asf->packet_time_start = 0;
continue;
}

@ -159,9 +159,9 @@ static int au_read_packet(AVFormatContext *s,
int ret;
if (url_feof(&s->pb))
return -EIO;
return AVERROR_IO;
if (av_new_packet(pkt, MAX_SIZE))
return -EIO;
return AVERROR_IO;
pkt->stream_index = 0;
ret = get_buffer(&s->pb, pkt->data, pkt->size);

@ -57,7 +57,7 @@ static int audio_open(AudioData *s, int is_output, const char *audio_device)
audio_fd = open(audio_device, O_RDONLY);
if (audio_fd < 0) {
perror(audio_device);
return -EIO;
return AVERROR_IO;
}
if (flip && *flip == '1') {
@ -108,7 +108,7 @@ static int audio_open(AudioData *s, int is_output, const char *audio_device)
default:
av_log(NULL, AV_LOG_ERROR, "Soundcard does not support 16 bit sample format\n");
close(audio_fd);
return -EIO;
return AVERROR_IO;
}
err=ioctl(audio_fd, SNDCTL_DSP_SETFMT, &tmp);
if (err < 0) {
@ -137,7 +137,7 @@ static int audio_open(AudioData *s, int is_output, const char *audio_device)
return 0;
fail:
close(audio_fd);
return -EIO;
return AVERROR_IO;
}
static int audio_close(AudioData *s)
@ -158,7 +158,7 @@ static int audio_write_header(AVFormatContext *s1)
s->channels = st->codec.channels;
ret = audio_open(s, 1, NULL);
if (ret < 0) {
return -EIO;
return AVERROR_IO;
} else {
return 0;
}
@ -183,7 +183,7 @@ static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
if (ret > 0)
break;
if (ret < 0 && (errno != EAGAIN && errno != EINTR))
return -EIO;
return AVERROR_IO;
}
s->buffer_ptr = 0;
}
@ -222,7 +222,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
ret = audio_open(s, 0, ap->device);
if (ret < 0) {
av_free(st);
return -EIO;
return AVERROR_IO;
}
/* take real parameters */
@ -243,7 +243,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
struct audio_buf_info abufi;
if (av_new_packet(pkt, s->frame_size) < 0)
return -EIO;
return AVERROR_IO;
for(;;) {
struct timeval tv;
fd_set fds;
@ -268,7 +268,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
}
if (!(ret == 0 || (ret == -1 && (errno == EAGAIN || errno == EINTR)))) {
av_free_packet(pkt);
return -EIO;
return AVERROR_IO;
}
}
pkt->size = ret;

@ -95,7 +95,7 @@ int url_read(URLContext *h, unsigned char *buf, int size)
{
int ret;
if (h->flags & URL_WRONLY)
return -EIO;
return AVERROR_IO;
ret = h->prot->url_read(h, buf, size);
return ret;
}
@ -105,10 +105,10 @@ int url_write(URLContext *h, unsigned char *buf, int size)
{
int ret;
if (!(h->flags & (URL_WRONLY | URL_RDWR)))
return -EIO;
return AVERROR_IO;
/* avoid sending too big packets */
if (h->max_packet_size && size > h->max_packet_size)
return -EIO;
return AVERROR_IO;
ret = h->prot->url_write(h, buf, size);
return ret;
}

@ -473,7 +473,7 @@ int url_fdopen(ByteIOContext *s, URLContext *h)
(h->flags & URL_WRONLY || h->flags & URL_RDWR), h,
url_read_packet, url_write_packet, url_seek_packet) < 0) {
av_free(buffer);
return -EIO;
return AVERROR_IO;
}
s->is_streamed = h->is_streamed;
s->max_packet_size = max_packet_size;

@ -850,11 +850,11 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt)
if (size < 0) {
if (get_buffer(&s->pb, c->buf, 4) <= 0)
return -EIO;
return AVERROR_IO;
size = dv_frame_profile(c->buf)->frame_size;
if (get_buffer(&s->pb, c->buf + 4, size - 4) <= 0)
return -EIO;
return AVERROR_IO;
size = dv_produce_packet(c->dv_demux, pkt, c->buf, size);
}

@ -126,7 +126,7 @@ static int dv1394_read_header(AVFormatContext * context, AVFormatParameters * ap
failed:
close(dv->fd);
return -EIO;
return AVERROR_IO;
}
static int dv1394_read_packet(AVFormatContext *context, AVPacket *pkt)
@ -165,12 +165,12 @@ restart_poll:
if (errno == EAGAIN || errno == EINTR)
goto restart_poll;
perror("Poll failed");
return -EIO;
return AVERROR_IO;
}
if (ioctl(dv->fd, DV1394_GET_STATUS, &s) < 0) {
perror("Failed to get status");
return -EIO;
return AVERROR_IO;
}
#ifdef DV1394_DEBUG
fprintf(stderr, "DV1394: status\n"

@ -76,7 +76,7 @@ static int flic_read_header(AVFormatContext *s,
/* load the whole header and pull out the width and height */
if (get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE)
return -EIO;
return AVERROR_IO;
magic_number = LE_16(&header[4]);
speed = LE_32(&header[0x10]);
@ -164,7 +164,7 @@ static int flic_read_packet(AVFormatContext *s,
if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) !=
FLIC_PREAMBLE_SIZE) {
ret = -EIO;
ret = AVERROR_IO;
break;
}
@ -173,7 +173,7 @@ static int flic_read_packet(AVFormatContext *s,
if ((magic == FLIC_CHUNK_MAGIC_1) || (magic == FLIC_CHUNK_MAGIC_2)) {
if (av_new_packet(pkt, size)) {
ret = -EIO;
ret = AVERROR_IO;
break;
}
pkt->stream_index = flic->video_stream_index;
@ -183,7 +183,7 @@ static int flic_read_packet(AVFormatContext *s,
size - FLIC_PREAMBLE_SIZE);
if (ret != size - FLIC_PREAMBLE_SIZE) {
av_free_packet(pkt);
ret = -EIO;
ret = AVERROR_IO;
}
flic->pts += flic->frame_pts_inc;
packet_read = 1;

@ -69,7 +69,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
pts = get_be24(&s->pb);
// av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, pts:%d\n", type, size, pts);
if (url_feof(&s->pb))
return -EIO;
return AVERROR_IO;
url_fskip(&s->pb, 4); /* reserved */
flags = 0;
@ -139,12 +139,12 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
}
if (av_new_packet(pkt, size) < 0)
return -EIO;
return AVERROR_IO;
ret = get_buffer(&s->pb, pkt->data, size);
if (ret <= 0) {
av_free_packet(pkt);
return -EIO;
return AVERROR_IO;
}
/* note: we need to modify the packet size here to handle the last
packet */

@ -505,21 +505,21 @@ static int gif_parse_next_image(GifState *s)
switch (code) {
case ',':
if (gif_read_image(s) < 0)
return -EIO;
return AVERROR_IO;
ret = 0;
goto the_end;
case ';':
/* end of image */
ret = -EIO;
ret = AVERROR_IO;
goto the_end;
case '!':
if (gif_read_extension(s) < 0)
return -EIO;
return AVERROR_IO;
break;
case EOF:
default:
/* error or errneous EOF */
ret = -EIO;
ret = AVERROR_IO;
goto the_end;
}
}
@ -572,7 +572,7 @@ static int gif_read_packet(AVFormatContext * s1,
/* XXX: avoid copying */
if (av_new_packet(pkt, s->screen_width * s->screen_height * 3)) {
return -EIO;
return AVERROR_IO;
}
pkt->stream_index = 0;
memcpy(pkt->data, s->image_buf, s->screen_width * s->screen_height * 3);

@ -270,7 +270,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
if (video_fd >= 0)
close(video_fd);
av_free(st);
return -EIO;
return AVERROR_IO;
}
static int v4l_mm_read_picture(VideoData *s, uint8_t *buf)
@ -290,7 +290,7 @@ static int v4l_mm_read_picture(VideoData *s, uint8_t *buf)
av_log(NULL, AV_LOG_ERROR, "Cannot Sync\n");
else
perror("VIDIOCMCAPTURE");
return -EIO;
return AVERROR_IO;
}
/* This is now the grabbing frame */
@ -325,7 +325,7 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
}
if (av_new_packet(pkt, s->frame_size) < 0)
return -EIO;
return AVERROR_IO;
pkt->pts = curtime & ((1LL << 48) - 1);
@ -336,7 +336,7 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
return v4l_mm_read_picture(s, pkt->data);
} else {
if (read(s->fd, pkt->data, pkt->size) != pkt->size)
return -EIO;
return AVERROR_IO;
return s->frame_size;
}
}

@ -116,7 +116,7 @@ static int http_open(URLContext *h, const char *uri, int flags)
if (hd)
url_close(hd);
av_free(s);
return -EIO;
return AVERROR_IO;
}
static int http_getc(HTTPContext *s)
@ -125,7 +125,7 @@ static int http_getc(HTTPContext *s)
if (s->buf_ptr >= s->buf_end) {
len = url_read(s->hd, s->buffer, BUFFER_SIZE);
if (len < 0) {
return -EIO;
return AVERROR_IO;
} else if (len == 0) {
return -1;
} else {
@ -194,7 +194,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr)
hoststr);
if (http_write(h, s->buffer, strlen(s->buffer)) < 0)
return -EIO;
return AVERROR_IO;
/* init input buffer */
s->buf_ptr = s->buffer;
@ -211,7 +211,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr)
for(;;) {
ch = http_getc(s);
if (ch < 0)
return -EIO;
return AVERROR_IO;
if (ch == '\n') {
/* process line */
if (q > line && q[-1] == '\r')

@ -167,7 +167,7 @@ static int idcin_read_header(AVFormatContext *s,
st->codec.extradata = av_malloc(HUFFMAN_TABLE_SIZE);
if (get_buffer(pb, st->codec.extradata, HUFFMAN_TABLE_SIZE) !=
HUFFMAN_TABLE_SIZE)
return -EIO;
return AVERROR_IO;
/* save a reference in order to transport the palette */
st->codec.palctrl = &idcin->palctrl;
@ -224,17 +224,17 @@ static int idcin_read_packet(AVFormatContext *s,
unsigned char palette_buffer[768];
if (url_feof(&s->pb))
return -EIO;
return AVERROR_IO;
if (idcin->next_chunk_is_video) {
command = get_le32(pb);
if (command == 2) {
return -EIO;
return AVERROR_IO;
} else if (command == 1) {
/* trigger a palette change */
idcin->palctrl.palette_changed = 1;
if (get_buffer(pb, palette_buffer, 768) != 768)
return -EIO;
return AVERROR_IO;
/* scale the palette as necessary */
palette_scale = 2;
for (i = 0; i < 768; i++)
@ -256,12 +256,12 @@ static int idcin_read_packet(AVFormatContext *s,
url_fseek(pb, 4, SEEK_CUR);
chunk_size -= 4;
if (av_new_packet(pkt, chunk_size))
ret = -EIO;
ret = AVERROR_IO;
pkt->stream_index = idcin->video_stream_index;
pkt->pts = idcin->pts;
ret = get_buffer(pb, pkt->data, chunk_size);
if (ret != chunk_size)
ret = -EIO;
ret = AVERROR_IO;
} else {
/* send out the audio chunk */
if (idcin->current_audio_chunk)
@ -269,12 +269,12 @@ static int idcin_read_packet(AVFormatContext *s,
else
chunk_size = idcin->audio_chunk_size1;
if (av_new_packet(pkt, chunk_size))
return -EIO;
return AVERROR_IO;
pkt->stream_index = idcin->audio_stream_index;
pkt->pts = idcin->pts;
ret = get_buffer(&s->pb, pkt->data, chunk_size);
if (ret != chunk_size)
ret = -EIO;
ret = AVERROR_IO;
idcin->current_audio_chunk ^= 1;
idcin->pts += FRAME_PTS_INC;

@ -187,12 +187,12 @@ static int roq_read_packet(AVFormatContext *s,
while (!packet_read) {
if (url_feof(&s->pb))
return -EIO;
return AVERROR_IO;
/* get the next chunk preamble */
if ((ret = get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) !=
RoQ_CHUNK_PREAMBLE_SIZE)
return -EIO;
return AVERROR_IO;
chunk_type = LE_16(&preamble[0]);
chunk_size = LE_32(&preamble[2]);
@ -211,7 +211,7 @@ static int roq_read_packet(AVFormatContext *s,
url_fseek(pb, codebook_size, SEEK_CUR);
if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
RoQ_CHUNK_PREAMBLE_SIZE)
return -EIO;
return AVERROR_IO;
chunk_size = LE_32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 +
codebook_size;
@ -220,12 +220,12 @@ static int roq_read_packet(AVFormatContext *s,
/* load up the packet */
if (av_new_packet(pkt, chunk_size))
return -EIO;
return AVERROR_IO;
pkt->stream_index = roq->video_stream_index;
pkt->pts = roq->video_pts;
ret = get_buffer(pb, pkt->data, chunk_size);
if (ret != chunk_size)
ret = -EIO;
ret = AVERROR_IO;
roq->video_pts += roq->frame_pts_inc;
packet_read = 1;
@ -236,7 +236,7 @@ static int roq_read_packet(AVFormatContext *s,
case RoQ_QUAD_VQ:
/* load up the packet */
if (av_new_packet(pkt, chunk_size + RoQ_CHUNK_PREAMBLE_SIZE))
return -EIO;
return AVERROR_IO;
/* copy over preamble */
memcpy(pkt->data, preamble, RoQ_CHUNK_PREAMBLE_SIZE);
@ -255,7 +255,7 @@ static int roq_read_packet(AVFormatContext *s,
ret = get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
chunk_size);
if (ret != chunk_size)
ret = -EIO;
ret = AVERROR_IO;
packet_read = 1;
break;

@ -183,7 +183,7 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
url_fclose(f);
fail:
av_free(s);
return -EIO;
return AVERROR_IO;
}
static int read_packet_alloc_cb(void *opaque, AVImageInfo *info)
@ -211,14 +211,14 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
}
if (get_frame_filename(filename, sizeof(filename),
s->path, s->img_number) < 0)
return -EIO;
return AVERROR_IO;
f = &f1;
if (url_fopen(f, filename, URL_RDONLY) < 0)
return -EIO;
return AVERROR_IO;
} else {
f = &s1->pb;
if (url_feof(f))
return -EIO;
return AVERROR_IO;
}
av_new_packet(pkt, s->img_size);
@ -232,7 +232,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
if (ret < 0) {
av_free_packet(pkt);
return -EIO; /* signal EOF */
return AVERROR_IO; /* signal EOF */
} else {
/* XXX: computing this pts is not necessary as it is done in
the generic code too */
@ -318,10 +318,10 @@ static int img_write_packet(AVFormatContext *s, AVPacket *pkt)
if (!img->is_pipe) {
if (get_frame_filename(filename, sizeof(filename),
img->path, img->img_number) < 0)
return -EIO;
return AVERROR_IO;
pb = &pb1;
if (url_fopen(pb, filename, URL_WRONLY) < 0)
return -EIO;
return AVERROR_IO;
} else {
pb = &s->pb;
}

@ -34,7 +34,7 @@
/* debugging support: #define DEBUG_IPMOVIE as non-zero to see extremely
* verbose information about the demux process */
#define DEBUG_IPMOVIE 0
#define DEBUG_IPMOVIE 1
#if DEBUG_IPMOVIE
#define debug_ipmovie printf
@ -543,7 +543,7 @@ static int ipmovie_read_header(AVFormatContext *s,
* it; if it is the first video chunk, this is a silent file */
if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
CHUNK_PREAMBLE_SIZE)
return -EIO;
return AVERROR_IO;
chunk_type = LE_16(&chunk_preamble[2]);
url_fseek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR);
@ -600,7 +600,7 @@ static int ipmovie_read_packet(AVFormatContext *s,
if (ret == CHUNK_BAD)
ret = AVERROR_INVALIDDATA;
else if (ret == CHUNK_EOF)
ret = -EIO;
ret = AVERROR_IO;
else if (ret == CHUNK_NOMEM)
ret = AVERROR_NOMEM;
else

@ -298,13 +298,13 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
size= MP3_PACKET_SIZE;
if (av_new_packet(pkt, size) < 0)
return -EIO;
return AVERROR_IO;
pkt->stream_index = 0;
ret = get_buffer(&s->pb, pkt->data, size);
if (ret <= 0) {
av_free_packet(pkt);
return -EIO;
return AVERROR_IO;
}
/* note: we need to modify the packet size here to handle the last
packet */

@ -1164,7 +1164,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
startcode = find_next_start_code(&s->pb, &size, &m->header_state);
//printf("startcode=%x pos=0x%Lx\n", startcode, url_ftell(&s->pb));
if (startcode < 0)
return -EIO;
return AVERROR_IO;
if (startcode == PACK_START_CODE)
goto redo;
if (startcode == SYSTEM_HEADER_START_CODE)
@ -1284,7 +1284,7 @@ static int mpegps_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
AVStream *st;
int len, startcode, i, type, codec_id;
int len, startcode, i, type, codec_id = 0;
int64_t pts, dts, dummy_pos; //dummy_pos is needed for the index building to work
redo:
@ -1350,6 +1350,15 @@ static int mpegps_read_packet(AVFormatContext *s,
av_log(s, AV_LOG_DEBUG, "%d: pts=%0.3f dts=%0.3f\n",
pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0);
#endif
#if 1
//#ifdef CONFIG_ADX
if (codec_id == CODEC_ID_MP2 && is_adx(pkt->data,pkt->size)) {
printf ("found ADX...\n");
st->codec.codec_id = CODEC_ID_ADPCM_ADX;
}
#endif //CONFIG_ADX
return 0;
}

@ -176,7 +176,7 @@ static int ogg_read_header(AVFormatContext *avfcontext, AVFormatParameters *ap)
buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ;
if(get_buffer(&avfcontext->pb, buf, DECODER_BUFFER_SIZE) <= 0)
return -EIO ;
return AVERROR_IO ;
ogg_sync_wrote(&context->oy, DECODER_BUFFER_SIZE) ;
ogg_sync_pageout(&context->oy, &og) ;
@ -213,9 +213,9 @@ static int ogg_read_packet(AVFormatContext *avfcontext, AVPacket *pkt) {
ogg_packet op ;
if(next_packet(avfcontext, &op))
return -EIO ;
return AVERROR_IO ;
if(av_new_packet(pkt, op.bytes) < 0)
return -EIO ;
return AVERROR_IO ;
pkt->stream_index = 0 ;
memcpy(pkt->data, op.packet, op.bytes);
if(avfcontext->streams[0]->codec.sample_rate && op.granulepos!=-1)

@ -257,7 +257,7 @@ static int str_read_packet(AVFormatContext *s,
while (!packet_read) {
if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE)
return -EIO;
return AVERROR_IO;
channel = sector[0x11];
if (channel >= 32)
@ -279,7 +279,7 @@ static int str_read_packet(AVFormatContext *s,
pkt = &str->tmp_pkt;
if (current_sector == 0) {
if (av_new_packet(pkt, frame_size))
return -EIO;
return AVERROR_IO;
pkt->stream_index =
str->channels[channel].video_stream_index;
@ -315,7 +315,7 @@ printf (" dropping audio sector\n");
if (channel == str->audio_channel) {
pkt = ret_pkt;
if (av_new_packet(pkt, 2304))
return -EIO;
return AVERROR_IO;
memcpy(pkt->data,sector+24,2304);
pkt->stream_index =
@ -334,7 +334,7 @@ printf (" dropping other sector\n");
}
if (url_feof(pb))
return -EIO;
return AVERROR_IO;
}
return ret;

@ -87,13 +87,13 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
size= RAW_PACKET_SIZE;
if (av_new_packet(pkt, size) < 0)
return -EIO;
return AVERROR_IO;
pkt->stream_index = 0;
ret = get_buffer(&s->pb, pkt->data, size);
if (ret <= 0) {
av_free_packet(pkt);
return -EIO;
return AVERROR_IO;
}
/* note: we need to modify the packet size here to handle the last
packet */
@ -108,13 +108,13 @@ static int raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
size = RAW_PACKET_SIZE;
if (av_new_packet(pkt, size) < 0)
return -EIO;
return AVERROR_IO;
pkt->stream_index = 0;
ret = get_partial_buffer(&s->pb, pkt->data, size);
if (ret <= 0) {
av_free_packet(pkt);
return -EIO;
return AVERROR_IO;
}
pkt->size = ret;
return ret;
@ -532,7 +532,7 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
av_abort();
if (av_new_packet(pkt, packet_size) < 0)
return -EIO;
return AVERROR_IO;
pkt->stream_index = 0;
#if 0
@ -543,7 +543,7 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
#endif
if (ret != pkt->size) {
av_free_packet(pkt);
return -EIO;
return AVERROR_IO;
} else {
return 0;
}
@ -601,6 +601,73 @@ AVOutputFormat null_oformat = {
};
#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
#define av_register_output_format(format)
#endif
@ -651,5 +718,9 @@ int raw_init(void)
av_register_output_format(&rawvideo_oformat);
av_register_output_format(&null_oformat);
av_register_input_format(&adx_iformat);
av_register_output_format(&adx_oformat);
return 0;
}

@ -563,7 +563,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* very old .ra format */
return rm_read_header_old(s, ap);
} else if (tag != MKTAG('.', 'R', 'M', 'F')) {
return -EIO;
return AVERROR_IO;
}
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++) {
av_free(s->streams[i]);
}
return -EIO;
return AVERROR_IO;
}
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);
if (len <= 0) {
av_free_packet(pkt);
return -EIO;
return AVERROR_IO;
}
pkt->size = len;
st = s->streams[0];
} else {
redo:
if (rm->nb_packets == 0)
return -EIO;
return AVERROR_IO;
get_be16(pb);
len = get_be16(pb);
if (len < 12)
return -EIO;
return AVERROR_IO;
num = get_be16(pb);
timestamp = get_be32(pb);
get_byte(pb); /* reserved */

@ -168,7 +168,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
if (s->rtcp_hd)
url_close(s->rtcp_hd);
av_free(s);
return -EIO;
return AVERROR_IO;
}
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 (errno == EAGAIN || errno == EINTR)
continue;
return -EIO;
return AVERROR_IO;
}
break;
}
@ -208,7 +208,7 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size)
if (len < 0) {
if (errno == EAGAIN || errno == EINTR)
continue;
return -EIO;
return AVERROR_IO;
}
break;
}
@ -220,7 +220,7 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size)
if (len < 0) {
if (errno == EAGAIN || errno == EINTR)
continue;
return -EIO;
return AVERROR_IO;
}
break;
}

@ -92,7 +92,7 @@ static int film_read_header(AVFormatContext *s,
/* load the main FILM header */
if (get_buffer(pb, scratch, 16) != 16)
return -EIO;
return AVERROR_IO;
data_offset = BE_32(&scratch[4]);
film->version = BE_32(&scratch[8]);
@ -100,7 +100,7 @@ static int film_read_header(AVFormatContext *s,
if (film->version == 0) {
/* special case for Lemmings .film files; 20-byte header */
if (get_buffer(pb, scratch, 20) != 20)
return -EIO;
return AVERROR_IO;
/* make some assumptions about the audio parameters */
film->audio_type = CODEC_ID_PCM_S8;
film->audio_samplerate = 22050;
@ -109,7 +109,7 @@ static int film_read_header(AVFormatContext *s,
} else {
/* normal Saturn .cpk files; 32-byte header */
if (get_buffer(pb, scratch, 32) != 32)
return -EIO;
return AVERROR_IO;
film->audio_samplerate = BE_16(&scratch[24]);;
film->audio_channels = scratch[21];
film->audio_bits = scratch[22];
@ -166,7 +166,7 @@ static int film_read_header(AVFormatContext *s,
/* load the sample table */
if (get_buffer(pb, scratch, 16) != 16)
return -EIO;
return AVERROR_IO;
if (BE_32(&scratch[0]) != STAB_TAG)
return AVERROR_INVALIDDATA;
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 */
if (get_buffer(pb, scratch, 16) != 16) {
av_free(film->sample_table);
return -EIO;
return AVERROR_IO;
}
film->sample_table[i].sample_offset =
data_offset + BE_32(&scratch[0]);
@ -217,7 +217,7 @@ static int film_read_packet(AVFormatContext *s,
int left, right;
if (film->current_sample >= film->sample_count)
return -EIO;
return AVERROR_IO;
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,
sample->sample_size - 10 - 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) &&
(film->audio_channels == 2)) {
/* 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);
if (ret != sample->sample_size)
ret = -EIO;
ret = AVERROR_IO;
left = 0;
right = sample->sample_size / 2;
@ -272,7 +272,7 @@ static int film_read_packet(AVFormatContext *s,
return AVERROR_NOMEM;
ret = get_buffer(pb, pkt->data, sample->sample_size);
if (ret != sample->sample_size)
ret = -EIO;
ret = AVERROR_IO;
}
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 */
url_fseek(pb, 0, SEEK_SET);
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_frame_divisor = 1;
@ -200,7 +200,7 @@ static int vmd_read_header(AVFormatContext *s,
raw_frame_table_size) {
av_free(raw_frame_table);
av_free(vmd->frame_table);
return -EIO;
return AVERROR_IO;
}
current_offset = LE_32(&vmd->vmd_header[20]);
@ -259,7 +259,7 @@ static int vmd_read_packet(AVFormatContext *s,
vmd_frame_t *frame;
if (vmd->current_frame >= vmd->frame_count)
return -EIO;
return AVERROR_IO;
frame = &vmd->frame_table[vmd->current_frame];
/* position the stream (will probably be there already) */
@ -273,7 +273,7 @@ static int vmd_read_packet(AVFormatContext *s,
if (ret != frame->frame_size) {
av_free_packet(pkt);
ret = -EIO;
ret = AVERROR_IO;
}
pkt->stream_index = frame->stream_index;
if (frame->frame_record[0] == 0x02)

@ -795,7 +795,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
s->priv_data = swf;
if ((get_be32(pb) & 0xffffff00) != MKBETAG('F', 'W', 'S', 0))
return -EIO;
return AVERROR_IO;
get_le32(pb);
/* skip rectangle size */
nbits = get_byte(pb) >> 3;
@ -823,7 +823,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
break;
}
av_log(s, AV_LOG_ERROR, "No media found in SWF\n");
return -EIO;
return AVERROR_IO;
}
if ( tag == TAG_VIDEOSTREAM && !vst) {
swf->ch_id = get_le16(pb);
@ -877,7 +877,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
break;
default:
av_free(ast);
return -EIO;
return AVERROR_IO;
}
ast->codec.codec_type = CODEC_TYPE_AUDIO;
ast->codec.codec_id = CODEC_ID_MP3;
@ -901,7 +901,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
for(;;) {
tag = get_swf_tag(pb, &len);
if (tag < 0)
return -EIO;
return AVERROR_IO;
if (tag == TAG_VIDEOFRAME) {
for( i=0; i<s->nb_streams; i++ ) {
st = s->streams[i];

@ -130,7 +130,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
return 0;
fail:
ret = -EIO;
ret = AVERROR_IO;
fail1:
if (fd >= 0)
close(fd);

@ -64,7 +64,7 @@ int udp_set_remote_url(URLContext *h, const char *uri)
/* set the destination address */
if (resolve_host(&s->dest_addr.sin_addr, hostname) < 0)
return -EIO;
return AVERROR_IO;
s->dest_addr.sin_family = AF_INET;
s->dest_addr.sin_port = htons(port);
return 0;
@ -206,7 +206,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
close(udp_fd);
#endif
av_free(s);
return -EIO;
return AVERROR_IO;
}
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);
if (len < 0) {
if (errno != EAGAIN && errno != EINTR)
return -EIO;
return AVERROR_IO;
} else {
break;
}
@ -240,7 +240,7 @@ static int udp_write(URLContext *h, uint8_t *buf, int size)
sizeof (s->dest_addr));
if (ret < 0) {
if (errno != EINTR && errno != EAGAIN)
return -EIO;
return AVERROR_IO;
} else {
break;
}

@ -311,7 +311,7 @@ static int wav_read_packet(AVFormatContext *s,
AVStream *st;
if (url_feof(&s->pb))
return -EIO;
return AVERROR_IO;
st = s->streams[0];
size = MAX_SIZE;
@ -321,7 +321,7 @@ static int wav_read_packet(AVFormatContext *s,
size = (size / st->codec.block_align) * st->codec.block_align;
}
if (av_new_packet(pkt, size))
return -EIO;
return AVERROR_IO;
pkt->stream_index = 0;
ret = get_buffer(&s->pb, pkt->data, pkt->size);

@ -150,7 +150,7 @@ static int wc3_read_header(AVFormatContext *s,
* the first BRCH tag */
if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
WC3_PREAMBLE_SIZE)
return -EIO;
return AVERROR_IO;
fourcc_tag = LE_32(&preamble[0]);
size = (BE_32(&preamble[4]) + 1) & (~1);
@ -167,7 +167,7 @@ static int wc3_read_header(AVFormatContext *s,
/* need the number of palettes */
url_fseek(pb, 8, SEEK_CUR);
if ((ret = get_buffer(pb, preamble, 4)) != 4)
return -EIO;
return AVERROR_IO;
wc3->palette_count = LE_32(&preamble[0]);
wc3->palettes = av_malloc(wc3->palette_count * PALETTE_SIZE);
break;
@ -179,14 +179,14 @@ static int wc3_read_header(AVFormatContext *s,
else
bytes_to_read = 512;
if ((ret = get_buffer(pb, s->title, bytes_to_read)) != bytes_to_read)
return -EIO;
return AVERROR_IO;
break;
case SIZE_TAG:
/* video resolution override */
if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
WC3_PREAMBLE_SIZE)
return -EIO;
return AVERROR_IO;
wc3->width = LE_32(&preamble[0]);
wc3->height = LE_32(&preamble[4]);
break;
@ -198,7 +198,7 @@ static int wc3_read_header(AVFormatContext *s,
if ((ret = get_buffer(pb,
&wc3->palettes[current_palette * PALETTE_SIZE],
PALETTE_SIZE)) != PALETTE_SIZE)
return -EIO;
return AVERROR_IO;
/* transform the current palette in place */
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)) !=
WC3_PREAMBLE_SIZE)
return -EIO;
return AVERROR_IO;
fourcc_tag = LE_32(&preamble[0]);
/* chunk sizes are 16-bit aligned */
size = (BE_32(&preamble[4]) + 1) & (~1);
@ -283,7 +283,7 @@ static int wc3_read_packet(AVFormatContext *s,
/* get the next chunk preamble */
if ((ret = get_buffer(pb, preamble, WC3_PREAMBLE_SIZE)) !=
WC3_PREAMBLE_SIZE)
ret = -EIO;
ret = AVERROR_IO;
fourcc_tag = LE_32(&preamble[0]);
/* chunk sizes are 16-bit aligned */
@ -298,7 +298,7 @@ static int wc3_read_packet(AVFormatContext *s,
case SHOT_TAG:
/* load up new palette */
if ((ret = get_buffer(pb, preamble, 4)) != 4)
return -EIO;
return AVERROR_IO;
palette_number = LE_32(&preamble[0]);
if (palette_number >= wc3->palette_count)
return AVERROR_INVALIDDATA;
@ -315,12 +315,12 @@ static int wc3_read_packet(AVFormatContext *s,
case VGA__TAG:
/* send out video chunk */
if (av_new_packet(pkt, size))
ret = -EIO;
ret = AVERROR_IO;
pkt->stream_index = wc3->video_stream_index;
pkt->pts = wc3->pts;
ret = get_buffer(pb, pkt->data, size);
if (ret != size)
ret = -EIO;
ret = AVERROR_IO;
packet_read = 1;
break;
@ -330,7 +330,7 @@ static int wc3_read_packet(AVFormatContext *s,
url_fseek(pb, size, SEEK_CUR);
#else
if ((ret = get_buffer(pb, text, size)) != size)
ret = -EIO;
ret = AVERROR_IO;
else {
int i = 0;
av_log (s, AV_LOG_DEBUG, "Subtitle time!\n");
@ -346,12 +346,12 @@ static int wc3_read_packet(AVFormatContext *s,
case AUDI_TAG:
/* send out audio chunk */
if (av_new_packet(pkt, size))
ret = -EIO;
ret = AVERROR_IO;
pkt->stream_index = wc3->audio_stream_index;
pkt->pts = wc3->pts;
ret = get_buffer(pb, pkt->data, size);
if (ret != size)
ret = -EIO;
ret = AVERROR_IO;
/* time to advance pts */
wc3->pts += WC3_FRAME_PTS_INC;

@ -119,7 +119,7 @@ static int wsaud_read_header(AVFormatContext *s,
unsigned char header[AUD_HEADER_SIZE];
if (get_buffer(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE)
return -EIO;
return AVERROR_IO;
wsaud->audio_samplerate = LE_16(&header[0]);
if (header[11] == 99)
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) !=
AUD_CHUNK_PREAMBLE_SIZE)
return -EIO;
return AVERROR_IO;
/* validate the chunk */
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]);
if (av_new_packet(pkt, chunk_size))
return -EIO;
return AVERROR_IO;
pkt->stream_index = wsaud->audio_stream_index;
pkt->pts = wsaud->audio_frame_counter;
pkt->pts /= wsaud->audio_samplerate;
if ((ret = get_buffer(pb, pkt->data, chunk_size)) != chunk_size) {
av_free_packet(pkt);
ret = -EIO;
ret = AVERROR_IO;
}
/* 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) !=
VQA_HEADER_SIZE) {
av_free(st->codec.extradata);
return -EIO;
return AVERROR_IO;
}
st->codec.width = LE_16(&header[6]);
st->codec.height = LE_16(&header[8]);
@ -271,7 +271,7 @@ static int wsvqa_read_header(AVFormatContext *s,
do {
if (get_buffer(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) {
av_free(st->codec.extradata);
return -EIO;
return AVERROR_IO;
}
chunk_tag = BE_32(&scratch[0]);
chunk_size = BE_32(&scratch[4]);
@ -314,7 +314,7 @@ static int wsvqa_read_packet(AVFormatContext *s,
int skip_byte;
if (get_buffer(pb, preamble, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE)
return -EIO;
return AVERROR_IO;
chunk_type = BE_32(&preamble[0]);
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 (av_new_packet(pkt, chunk_size))
return -EIO;
return AVERROR_IO;
ret = get_buffer(pb, pkt->data, chunk_size);
if (ret != chunk_size) {
av_free_packet(pkt);
ret = -EIO;
ret = AVERROR_IO;
}
if (chunk_type == SND2_TAG) {

@ -60,7 +60,7 @@ static int yuv_read(ByteIOContext *f,
url_get_filename(h, fname, sizeof(fname));
if (infer_size(&info->width, &info->height, img_size) < 0) {
return -EIO;
return AVERROR_IO;
}
info->pix_fmt = PIX_FMT_YUV420P;
@ -72,20 +72,20 @@ static int yuv_read(ByteIOContext *f,
p = strrchr(fname, '.');
if (!p || p[1] != 'Y')
return -EIO;
return AVERROR_IO;
get_buffer(f, info->pict.data[0], size);
p[1] = 'U';
if (url_fopen(pb, fname, URL_RDONLY) < 0)
return -EIO;
return AVERROR_IO;
get_buffer(pb, info->pict.data[1], size / 4);
url_fclose(pb);
p[1] = 'V';
if (url_fopen(pb, fname, URL_RDONLY) < 0)
return -EIO;
return AVERROR_IO;
get_buffer(pb, info->pict.data[2], size / 4);
url_fclose(pb);
@ -107,7 +107,7 @@ static int yuv_write(ByteIOContext *pb2, AVImageInfo *info)
p = strrchr(fname, '.');
if (!p || p[1] != 'Y')
return -EIO;
return AVERROR_IO;
width = info->width;
height = info->height;
@ -122,7 +122,7 @@ static int yuv_write(ByteIOContext *pb2, AVImageInfo *info)
pb = &pb1;
p[1] = ext[i];
if (url_fopen(pb, fname, URL_WRONLY) < 0)
return -EIO;
return AVERROR_IO;
} else {
pb = pb2;
}

@ -77,7 +77,7 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
*first_pkt = 0;
if (yuv4_generate_header(s, buf2) < 0) {
av_log(s, AV_LOG_ERROR, "Error. YUV4MPEG stream header write failed.\n");
return -EIO;
return AVERROR_IO;
} else {
put_buffer(pb, buf2, strlen(buf2));
}
@ -118,14 +118,14 @@ static int yuv4_write_header(AVFormatContext *s)
int* first_pkt = s->priv_data;
if (s->nb_streams != 1)
return -EIO;
return AVERROR_IO;
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");
}
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");
return -EIO;
return AVERROR_IO;
}
*first_pkt = 1;
@ -217,13 +217,13 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
av_abort();
if (av_new_packet(pkt, packet_size) < 0)
return -EIO;
return AVERROR_IO;
pkt->stream_index = 0;
ret = get_buffer(&s->pb, pkt->data, pkt->size);
if (ret != pkt->size) {
av_free_packet(pkt);
return -EIO;
return AVERROR_IO;
} else {
return 0;
}

Loading…
Cancel
Save