replace calls to url_feof() with avio_feof()

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/80/head
James Almer 11 years ago committed by Michael Niedermayer
parent 5c3c67126f
commit d34ec64a22
  1. 4
      ffplay.c
  2. 2
      libavformat/4xm.c
  3. 2
      libavformat/adp.c
  4. 2
      libavformat/aiffdec.c
  5. 2
      libavformat/amr.c
  6. 2
      libavformat/anm.c
  7. 2
      libavformat/ape.c
  8. 2
      libavformat/aqtitledec.c
  9. 16
      libavformat/asfdec.c
  10. 2
      libavformat/astdec.c
  11. 12
      libavformat/avidec.c
  12. 2
      libavformat/bethsoftvid.c
  13. 4
      libavformat/bfi.c
  14. 2
      libavformat/bintext.c
  15. 2
      libavformat/bit.c
  16. 4
      libavformat/brstm.c
  17. 6
      libavformat/cafdec.c
  18. 2
      libavformat/cdxl.c
  19. 2
      libavformat/dauddec.c
  20. 2
      libavformat/dsicin.c
  21. 2
      libavformat/dtshddec.c
  22. 2
      libavformat/dv.c
  23. 4
      libavformat/dxa.c
  24. 4
      libavformat/electronicarts.c
  25. 4
      libavformat/ffmdec.c
  26. 4
      libavformat/ffmetadec.c
  27. 2
      libavformat/filmstripdec.c
  28. 2
      libavformat/flacdec.c
  29. 2
      libavformat/flvdec.c
  30. 6
      libavformat/gifdec.c
  31. 4
      libavformat/gxf.c
  32. 4
      libavformat/hls.c
  33. 2
      libavformat/hlsproto.c
  34. 2
      libavformat/idcin.c
  35. 2
      libavformat/idroqdec.c
  36. 2
      libavformat/iff.c
  37. 2
      libavformat/img2dec.c
  38. 6
      libavformat/ipmovie.c
  39. 2
      libavformat/jacosubdec.c
  40. 2
      libavformat/jvdec.c
  41. 4
      libavformat/lrcdec.c
  42. 4
      libavformat/lvfdec.c
  43. 2
      libavformat/lxfdec.c
  44. 4
      libavformat/matroskadec.c
  45. 2
      libavformat/mgsts.c
  46. 2
      libavformat/microdvddec.c
  47. 2
      libavformat/mlvdec.c
  48. 2
      libavformat/mmf.c
  49. 6
      libavformat/mov.c
  50. 4
      libavformat/mpc8.c
  51. 6
      libavformat/mpeg.c
  52. 2
      libavformat/mpegts.c
  53. 2
      libavformat/mpl2dec.c
  54. 2
      libavformat/mpsubdec.c
  55. 4
      libavformat/msnwc_tcp.c
  56. 8
      libavformat/mxfdec.c
  57. 2
      libavformat/mxg.c
  58. 2
      libavformat/ncdec.c
  59. 2
      libavformat/nistspheredec.c
  60. 12
      libavformat/nsvdec.c
  61. 4
      libavformat/nutdec.c
  62. 8
      libavformat/nuv.c
  63. 2
      libavformat/oggdec.c
  64. 2
      libavformat/paf.c
  65. 2
      libavformat/pjsdec.c
  66. 4
      libavformat/pmpdec.c
  67. 2
      libavformat/psxstr.c
  68. 2
      libavformat/qcp.c
  69. 2
      libavformat/realtextdec.c
  70. 2
      libavformat/redspark.c
  71. 2
      libavformat/riffdec.c
  72. 6
      libavformat/rmdec.c
  73. 2
      libavformat/rpl.c
  74. 2
      libavformat/rsd.c
  75. 2
      libavformat/samidec.c
  76. 2
      libavformat/smacker.c
  77. 4
      libavformat/smjpegdec.c
  78. 4
      libavformat/smush.c
  79. 2
      libavformat/sol.c
  80. 2
      libavformat/spdifdec.c
  81. 2
      libavformat/srtdec.c
  82. 2
      libavformat/subviewer1dec.c
  83. 2
      libavformat/subviewerdec.c
  84. 2
      libavformat/swfdec.c
  85. 2
      libavformat/takdec.c
  86. 2
      libavformat/tmv.c
  87. 2
      libavformat/tty.c
  88. 2
      libavformat/txd.c
  89. 2
      libavformat/vc1test.c
  90. 6
      libavformat/vivo.c
  91. 2
      libavformat/vplayerdec.c
  92. 2
      libavformat/vqf.c
  93. 10
      libavformat/wavdec.c
  94. 4
      libavformat/wc3movie.c
  95. 10
      libavformat/wtvdec.c
  96. 2
      libavformat/wvdec.c

@ -2824,7 +2824,7 @@ static int read_thread(void *arg)
av_freep(&opts); av_freep(&opts);
if (ic->pb) if (ic->pb)
ic->pb->eof_reached = 0; // FIXME hack, ffplay maybe should not use url_feof() to test for the end ic->pb->eof_reached = 0; // FIXME hack, ffplay maybe should not use avio_feof() to test for the end
if (seek_by_bytes < 0) if (seek_by_bytes < 0)
seek_by_bytes = !!(ic->iformat->flags & AVFMT_TS_DISCONT) && strcmp("ogg", ic->iformat->name); seek_by_bytes = !!(ic->iformat->flags & AVFMT_TS_DISCONT) && strcmp("ogg", ic->iformat->name);
@ -3013,7 +3013,7 @@ static int read_thread(void *arg)
} }
ret = av_read_frame(ic, pkt); ret = av_read_frame(ic, pkt);
if (ret < 0) { if (ret < 0) {
if (ret == AVERROR_EOF || url_feof(ic->pb)) if (ret == AVERROR_EOF || avio_feof(ic->pb))
eof = 1; eof = 1;
if (ic->pb && ic->pb->error) if (ic->pb && ic->pb->error)
break; break;

@ -293,7 +293,7 @@ static int fourxm_read_packet(AVFormatContext *s,
return ret; return ret;
fourcc_tag = AV_RL32(&header[0]); fourcc_tag = AV_RL32(&header[0]);
size = AV_RL32(&header[4]); size = AV_RL32(&header[4]);
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR(EIO); return AVERROR(EIO);
switch (fourcc_tag) { switch (fourcc_tag) {
case LIST_TAG: case LIST_TAG:

@ -71,7 +71,7 @@ static int adp_read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
int ret, size = 1024; int ret, size = 1024;
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR_EOF; return AVERROR_EOF;
ret = av_get_packet(s->pb, pkt, size); ret = av_get_packet(s->pb, pkt, size);

@ -58,7 +58,7 @@ static int get_tag(AVIOContext *pb, uint32_t * tag)
{ {
int size; int size;
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR(EIO); return AVERROR(EIO);
*tag = avio_rl32(pb); *tag = avio_rl32(pb);

@ -117,7 +117,7 @@ static int amr_read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t pos = avio_tell(s->pb); int64_t pos = avio_tell(s->pb);
AMRContext *amr = s->priv_data; AMRContext *amr = s->priv_data;
if (url_feof(s->pb)) { if (avio_feof(s->pb)) {
return AVERROR(EIO); return AVERROR(EIO);
} }

@ -175,7 +175,7 @@ static int read_packet(AVFormatContext *s,
Page *p; Page *p;
int tmp, record_size; int tmp, record_size;
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR(EIO); return AVERROR(EIO);
if (anm->page < 0) if (anm->page < 0)

@ -389,7 +389,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
APEContext *ape = s->priv_data; APEContext *ape = s->priv_data;
uint32_t extra_size = 8; uint32_t extra_size = 8;
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR_EOF; return AVERROR_EOF;
if (ape->currentframe >= ape->totalframes) if (ape->currentframe >= ape->totalframes)
return AVERROR_EOF; return AVERROR_EOF;

@ -61,7 +61,7 @@ static int aqt_read_header(AVFormatContext *s)
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
st->codec->codec_id = AV_CODEC_ID_TEXT; st->codec->codec_id = AV_CODEC_ID_TEXT;
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
char line[4096]; char line[4096];
int len = ff_get_line(s->pb, line, sizeof(line)); int len = ff_get_line(s->pb, line, sizeof(line));

@ -785,7 +785,7 @@ static int asf_read_header(AVFormatContext *s)
continue; continue;
} else if (!ff_guidcmp(&g, &ff_asf_marker_header)) { } else if (!ff_guidcmp(&g, &ff_asf_marker_header)) {
asf_read_marker(s, gsize); asf_read_marker(s, gsize);
} else if (url_feof(pb)) { } else if (avio_feof(pb)) {
return AVERROR_EOF; return AVERROR_EOF;
} else { } else {
if (!s->keylen) { if (!s->keylen) {
@ -822,7 +822,7 @@ static int asf_read_header(AVFormatContext *s)
avio_rl64(pb); avio_rl64(pb);
avio_r8(pb); avio_r8(pb);
avio_r8(pb); avio_r8(pb);
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
asf->data_offset = avio_tell(pb); asf->data_offset = avio_tell(pb);
asf->packet_size_left = 0; asf->packet_size_left = 0;
@ -922,20 +922,20 @@ static int asf_get_packet(AVFormatContext *s, AVIOContext *pb)
* the stream. */ * the stream. */
if (pb->error == AVERROR(EAGAIN)) if (pb->error == AVERROR(EAGAIN))
return AVERROR(EAGAIN); return AVERROR(EAGAIN);
if (!url_feof(pb)) if (!avio_feof(pb))
av_log(s, AV_LOG_ERROR, av_log(s, AV_LOG_ERROR,
"ff asf bad header %x at:%"PRId64"\n", c, avio_tell(pb)); "ff asf bad header %x at:%"PRId64"\n", c, avio_tell(pb));
} }
if ((c & 0x8f) == 0x82) { if ((c & 0x8f) == 0x82) {
if (d || e) { if (d || e) {
if (!url_feof(pb)) if (!avio_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 AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
c = avio_r8(pb); c = avio_r8(pb);
d = avio_r8(pb); d = avio_r8(pb);
rsize += 3; rsize += 3;
} else if(!url_feof(pb)) { } else if(!avio_feof(pb)) {
avio_seek(pb, -1, SEEK_CUR); // FIXME avio_seek(pb, -1, SEEK_CUR); // FIXME
} }
@ -1126,7 +1126,7 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
ASFStream *asf_st = 0; ASFStream *asf_st = 0;
for (;;) { for (;;) {
int ret; int ret;
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
if (asf->packet_size_left < FRAME_HEADER_SIZE || if (asf->packet_size_left < FRAME_HEADER_SIZE ||
asf->packet_segments < 1 && asf->packet_time_start == 0) { asf->packet_segments < 1 && asf->packet_time_start == 0) {
@ -1494,7 +1494,7 @@ static int asf_build_simple_index(AVFormatContext *s, int stream_index)
* skip them until the simple index object is reached */ * skip them until the simple index object is reached */
while (ff_guidcmp(&g, &ff_asf_simple_index_header)) { while (ff_guidcmp(&g, &ff_asf_simple_index_header)) {
int64_t gsize = avio_rl64(s->pb); int64_t gsize = avio_rl64(s->pb);
if (gsize < 24 || url_feof(s->pb)) { if (gsize < 24 || avio_feof(s->pb)) {
goto end; goto end;
} }
avio_skip(s->pb, gsize - 24); avio_skip(s->pb, gsize - 24);
@ -1532,7 +1532,7 @@ static int asf_build_simple_index(AVFormatContext *s, int stream_index)
asf->index_read = ict > 1; asf->index_read = ict > 1;
} }
end: end:
// if (url_feof(s->pb)) { // if (avio_feof(s->pb)) {
// ret = 0; // ret = 0;
// } // }
avio_seek(s->pb, current_pos, SEEK_SET); avio_seek(s->pb, current_pos, SEEK_SET);

@ -84,7 +84,7 @@ static int ast_read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t pos; int64_t pos;
int ret; int ret;
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR_EOF; return AVERROR_EOF;
pos = avio_tell(s->pb); pos = avio_tell(s->pb);

@ -219,7 +219,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num)
#ifdef DEBUG_SEEK #ifdef DEBUG_SEEK
av_log(s, AV_LOG_ERROR, "pos:%"PRId64", len:%X\n", pos, len); av_log(s, AV_LOG_ERROR, "pos:%"PRId64", len:%X\n", pos, len);
#endif #endif
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
if (last_pos == pos || pos == base - 8) if (last_pos == pos || pos == base - 8)
@ -237,7 +237,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num)
avio_rl32(pb); /* size */ avio_rl32(pb); /* size */
duration = avio_rl32(pb); duration = avio_rl32(pb);
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
pos = avio_tell(pb); pos = avio_tell(pb);
@ -492,7 +492,7 @@ static int avi_read_header(AVFormatContext *s)
codec_type = -1; codec_type = -1;
frame_period = 0; frame_period = 0;
for (;;) { for (;;) {
if (url_feof(pb)) if (avio_feof(pb))
goto fail; goto fail;
tag = avio_rl32(pb); tag = avio_rl32(pb);
size = avio_rl32(pb); size = avio_rl32(pb);
@ -1111,7 +1111,7 @@ static int avi_sync(AVFormatContext *s, int exit_early)
start_sync: start_sync:
memset(d, -1, sizeof(d)); memset(d, -1, sizeof(d));
for (i = sync = avio_tell(pb); !url_feof(pb); i++) { for (i = sync = avio_tell(pb); !avio_feof(pb); i++) {
int j; int j;
for (j = 0; j < 7; j++) for (j = 0; j < 7; j++)
@ -1506,7 +1506,7 @@ static int avi_read_idx1(AVFormatContext *s, int size)
/* Read the entries and sort them in each stream component. */ /* Read the entries and sort them in each stream component. */
for (i = 0; i < nb_index_entries; i++) { for (i = 0; i < nb_index_entries; i++) {
if (url_feof(pb)) if (avio_feof(pb))
return -1; return -1;
tag = avio_rl32(pb); tag = avio_rl32(pb);
@ -1662,7 +1662,7 @@ static int avi_load_index(AVFormatContext *s)
for (;;) { for (;;) {
tag = avio_rl32(pb); tag = avio_rl32(pb);
size = avio_rl32(pb); size = avio_rl32(pb);
if (url_feof(pb)) if (avio_feof(pb))
break; break;
next = avio_tell(pb) + size + (size & 1); next = avio_tell(pb) + size + (size & 1);

@ -213,7 +213,7 @@ static int vid_read_packet(AVFormatContext *s,
int audio_length; int audio_length;
int ret_value; int ret_value;
if(vid->is_finished || url_feof(pb)) if(vid->is_finished || avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
block_type = avio_r8(pb); block_type = avio_r8(pb);

@ -116,7 +116,7 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
BFIContext *bfi = s->priv_data; BFIContext *bfi = s->priv_data;
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int ret, audio_offset, video_offset, chunk_size, audio_size = 0; int ret, audio_offset, video_offset, chunk_size, audio_size = 0;
if (bfi->nframes == 0 || url_feof(pb)) { if (bfi->nframes == 0 || avio_feof(pb)) {
return AVERROR_EOF; return AVERROR_EOF;
} }
@ -124,7 +124,7 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
if (!bfi->avflag) { if (!bfi->avflag) {
uint32_t state = 0; uint32_t state = 0;
while(state != MKTAG('S','A','V','I')){ while(state != MKTAG('S','A','V','I')){
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR(EIO); return AVERROR(EIO);
state = 256*state + avio_r8(pb); state = 256*state + avio_r8(pb);
} }

@ -310,7 +310,7 @@ static int read_packet(AVFormatContext *s,
return AVERROR(EIO); return AVERROR(EIO);
bin->fsize = -1; /* done */ bin->fsize = -1; /* done */
} else if (!bin->fsize) { } else if (!bin->fsize) {
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR(EIO); return AVERROR(EIO);
if (av_get_packet(s->pb, pkt, bin->chars_per_frame) < 0) if (av_get_packet(s->pb, pkt, bin->chars_per_frame) < 0)
return AVERROR(EIO); return AVERROR(EIO);

@ -76,7 +76,7 @@ static int read_packet(AVFormatContext *s,
int i, j, ret; int i, j, ret;
int64_t pos= avio_tell(pb); int64_t pos= avio_tell(pb);
if(url_feof(pb)) if(avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
avio_rl16(pb); // sync word avio_rl16(pb); // sync word

@ -181,7 +181,7 @@ static int read_header(AVFormatContext *s)
} }
avio_skip(s->pb, size - (avio_tell(s->pb) - pos)); avio_skip(s->pb, size - (avio_tell(s->pb) - pos));
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
chunk = avio_rl32(s->pb); chunk = avio_rl32(s->pb);
size = avio_rb32(s->pb); size = avio_rb32(s->pb);
if (size < 8) { if (size < 8) {
@ -244,7 +244,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
uint32_t samples, size; uint32_t samples, size;
int ret; int ret;
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR_EOF; return AVERROR_EOF;
b->current_block++; b->current_block++;
if (b->current_block == b->block_count) { if (b->current_block == b->block_count) {

@ -241,7 +241,7 @@ static int read_header(AVFormatContext *s)
/* parse each chunk */ /* parse each chunk */
found_data = 0; found_data = 0;
while (!url_feof(pb)) { while (!avio_feof(pb)) {
/* stop at data chunk if seeking is not supported or /* stop at data chunk if seeking is not supported or
data chunk size is unknown */ data chunk size is unknown */
@ -251,7 +251,7 @@ static int read_header(AVFormatContext *s)
tag = avio_rb32(pb); tag = avio_rb32(pb);
size = avio_rb64(pb); size = avio_rb64(pb);
pos = avio_tell(pb); pos = avio_tell(pb);
if (url_feof(pb)) if (avio_feof(pb))
break; break;
switch (tag) { switch (tag) {
@ -339,7 +339,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
int res, pkt_size = 0, pkt_frames = 0; int res, pkt_size = 0, pkt_frames = 0;
int64_t left = CAF_MAX_PKT_SIZE; int64_t left = CAF_MAX_PKT_SIZE;
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
/* don't read past end of data chunk */ /* don't read past end of data chunk */

@ -110,7 +110,7 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t pos; int64_t pos;
int ret; int ret;
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
pos = avio_tell(pb); pos = avio_tell(pb);

@ -41,7 +41,7 @@ static int daud_header(AVFormatContext *s) {
static int daud_packet(AVFormatContext *s, AVPacket *pkt) { static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int ret, size; int ret, size;
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR(EIO); return AVERROR(EIO);
size = avio_rb16(pb); size = avio_rb16(pb);
avio_rb16(pb); // unknown avio_rb16(pb); // unknown

@ -150,7 +150,7 @@ static int cin_read_frame_header(CinDemuxContext *cin, AVIOContext *pb) {
hdr->video_frame_size = avio_rl32(pb); hdr->video_frame_size = avio_rl32(pb);
hdr->audio_frame_size = avio_rl32(pb); hdr->audio_frame_size = avio_rl32(pb);
if (url_feof(pb) || pb->error) if (avio_feof(pb) || pb->error)
return AVERROR(EIO); return AVERROR(EIO);
if (avio_rl32(pb) != 0xAA55AA55) if (avio_rl32(pb) != 0xAA55AA55)

@ -64,7 +64,7 @@ static int dtshd_read_header(AVFormatContext *s)
st->codec->codec_id = AV_CODEC_ID_DTS; st->codec->codec_id = AV_CODEC_ID_DTS;
st->need_parsing = AVSTREAM_PARSE_FULL_RAW; st->need_parsing = AVSTREAM_PARSE_FULL_RAW;
while (!url_feof(pb)) { while (!avio_feof(pb)) {
chunk_type = avio_rb64(pb); chunk_type = avio_rb64(pb);
chunk_size = avio_rb64(pb); chunk_size = avio_rb64(pb);

@ -504,7 +504,7 @@ static int dv_read_header(AVFormatContext *s)
state = avio_rb32(s->pb); state = avio_rb32(s->pb);
while ((state & 0xffffff7f) != 0x1f07003f) { while ((state & 0xffffff7f) != 0x1f07003f) {
if (url_feof(s->pb)) { if (avio_feof(s->pb)) {
av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n"); av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n");
return -1; return -1;
} }

@ -112,7 +112,7 @@ static int dxa_read_header(AVFormatContext *s)
if (ast->codec->sample_rate > 0) if (ast->codec->sample_rate > 0)
avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate); avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
// find 'data' chunk // find 'data' chunk
while(avio_tell(pb) < c->vidpos && !url_feof(pb)){ while(avio_tell(pb) < c->vidpos && !avio_feof(pb)){
tag = avio_rl32(pb); tag = avio_rl32(pb);
fsize = avio_rl32(pb); fsize = avio_rl32(pb);
if(tag == MKTAG('d', 'a', 't', 'a')) break; if(tag == MKTAG('d', 'a', 't', 'a')) break;
@ -170,7 +170,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
return 0; return 0;
} }
avio_seek(s->pb, c->vidpos, SEEK_SET); avio_seek(s->pb, c->vidpos, SEEK_SET);
while(!url_feof(s->pb) && c->frames){ while(!avio_feof(s->pb) && c->frames){
if ((ret = avio_read(s->pb, buf, 4)) != 4) { if ((ret = avio_read(s->pb, buf, 4)) != 4) {
av_log(s, AV_LOG_ERROR, "failed reading chunk type\n"); av_log(s, AV_LOG_ERROR, "failed reading chunk type\n");
return ret < 0 ? ret : AVERROR_INVALIDDATA; return ret < 0 ? ret : AVERROR_INVALIDDATA;

@ -109,7 +109,7 @@ static int process_audio_header_elements(AVFormatContext *s)
ea->sample_rate = -1; ea->sample_rate = -1;
ea->num_channels = 1; ea->num_channels = 1;
while (!url_feof(pb) && in_header) { while (!avio_feof(pb) && in_header) {
int in_subheader; int in_subheader;
uint8_t byte; uint8_t byte;
byte = avio_r8(pb); byte = avio_r8(pb);
@ -118,7 +118,7 @@ static int process_audio_header_elements(AVFormatContext *s)
case 0xFD: case 0xFD:
av_log(s, AV_LOG_DEBUG, "entered audio subheader\n"); av_log(s, AV_LOG_DEBUG, "entered audio subheader\n");
in_subheader = 1; in_subheader = 1;
while (!url_feof(pb) && in_subheader) { while (!avio_feof(pb) && in_subheader) {
uint8_t subbyte; uint8_t subbyte;
subbyte = avio_r8(pb); subbyte = avio_r8(pb);

@ -63,7 +63,7 @@ static int ffm_resync(AVFormatContext *s, int state)
{ {
av_log(s, AV_LOG_ERROR, "resyncing\n"); av_log(s, AV_LOG_ERROR, "resyncing\n");
while (state != PACKET_ID) { while (state != PACKET_ID) {
if (url_feof(s->pb)) { if (avio_feof(s->pb)) {
av_log(s, AV_LOG_ERROR, "cannot find FFM syncword\n"); av_log(s, AV_LOG_ERROR, "cannot find FFM syncword\n");
return -1; return -1;
} }
@ -250,7 +250,7 @@ static int ffm2_read_header(AVFormatContext *s)
ffm->file_size = (UINT64_C(1) << 63) - 1; ffm->file_size = (UINT64_C(1) << 63) - 1;
} }
while(!url_feof(pb)) { while(!avio_feof(pb)) {
unsigned id = avio_rb32(pb); unsigned id = avio_rb32(pb);
unsigned size = avio_rb32(pb); unsigned size = avio_rb32(pb);
int64_t next = avio_tell(pb) + size; int64_t next = avio_tell(pb) + size;

@ -50,7 +50,7 @@ static void get_line(AVIOContext *s, uint8_t *buf, int size)
buf[i++] = c; buf[i++] = c;
} }
buf[i] = 0; buf[i] = 0;
} while (!url_feof(s) && (buf[0] == ';' || buf[0] == '#' || buf[0] == 0)); } while (!avio_feof(s) && (buf[0] == ';' || buf[0] == '#' || buf[0] == 0));
} }
static AVChapter *read_chapter(AVFormatContext *s) static AVChapter *read_chapter(AVFormatContext *s)
@ -128,7 +128,7 @@ static int read_header(AVFormatContext *s)
AVDictionary **m = &s->metadata; AVDictionary **m = &s->metadata;
uint8_t line[1024]; uint8_t line[1024];
while(!url_feof(s->pb)) { while(!avio_feof(s->pb)) {
get_line(s->pb, line, sizeof(line)); get_line(s->pb, line, sizeof(line));
if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) { if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) {

@ -80,7 +80,7 @@ static int read_packet(AVFormatContext *s,
FilmstripDemuxContext *film = s->priv_data; FilmstripDemuxContext *film = s->priv_data;
AVStream *st = s->streams[0]; AVStream *st = s->streams[0];
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR(EIO); return AVERROR(EIO);
pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4); pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4);
pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4); pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4);

@ -49,7 +49,7 @@ static int flac_read_header(AVFormatContext *s)
} }
/* process metadata blocks */ /* process metadata blocks */
while (!url_feof(s->pb) && !metadata_last) { while (!avio_feof(s->pb) && !metadata_last) {
avio_read(s->pb, header, 4); avio_read(s->pb, header, 4);
flac_parse_block_header(header, &metadata_last, &metadata_type, flac_parse_block_header(header, &metadata_last, &metadata_type,
&metadata_size); &metadata_size);

@ -779,7 +779,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
dts = avio_rb24(s->pb); dts = avio_rb24(s->pb);
dts |= avio_r8(s->pb) << 24; dts |= avio_r8(s->pb) << 24;
av_dlog(s, "type:%d, size:%d, dts:%"PRId64" pos:%"PRId64"\n", type, size, dts, avio_tell(s->pb)); av_dlog(s, "type:%d, size:%d, dts:%"PRId64" pos:%"PRId64"\n", type, size, dts, avio_tell(s->pb));
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR_EOF; return AVERROR_EOF;
avio_skip(s->pb, 3); /* stream id, always 0 */ avio_skip(s->pb, 3); /* stream id, always 0 */
flags = 0; flags = 0;

@ -84,7 +84,7 @@ static int resync(AVIOContext *pb)
int b = avio_r8(pb); int b = avio_r8(pb);
if (b != gif87a_sig[i] && b != gif89a_sig[i]) if (b != gif87a_sig[i] && b != gif89a_sig[i])
i = -(b != 'G'); i = -(b != 'G');
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
} }
return 0; return 0;
@ -234,7 +234,7 @@ parse_keyframe:
ret = AVERROR_EOF; ret = AVERROR_EOF;
} }
while (GIF_TRAILER != (block_label = avio_r8(pb)) && !url_feof(pb)) { while (GIF_TRAILER != (block_label = avio_r8(pb)) && !avio_feof(pb)) {
if (block_label == GIF_EXTENSION_INTRODUCER) { if (block_label == GIF_EXTENSION_INTRODUCER) {
if ((ret = gif_read_ext (s)) < 0 ) if ((ret = gif_read_ext (s)) < 0 )
goto resync; goto resync;
@ -299,7 +299,7 @@ resync:
if ((ret >= 0 && !frame_parsed) || ret == AVERROR_EOF) { if ((ret >= 0 && !frame_parsed) || ret == AVERROR_EOF) {
/* This might happen when there is no image block /* This might happen when there is no image block
* between extension blocks and GIF_TRAILER or EOF */ * between extension blocks and GIF_TRAILER or EOF */
if (!gdc->ignore_loop && (block_label == GIF_TRAILER || url_feof(pb)) if (!gdc->ignore_loop && (block_label == GIF_TRAILER || avio_feof(pb))
&& (gdc->total_iter < 0 || ++gdc->iter_count < gdc->total_iter)) && (gdc->total_iter < 0 || ++gdc->iter_count < gdc->total_iter))
return avio_seek(pb, 0, SEEK_SET); return avio_seek(pb, 0, SEEK_SET);
return AVERROR_EOF; return AVERROR_EOF;

@ -442,7 +442,7 @@ static int gxf_header(AVFormatContext *s) {
#define READ_ONE() \ #define READ_ONE() \
{ \ { \
if (!max_interval-- || url_feof(pb)) \ if (!max_interval-- || avio_feof(pb)) \
goto out; \ goto out; \
tmp = tmp << 8 | avio_r8(pb); \ tmp = tmp << 8 | avio_r8(pb); \
} }
@ -504,7 +504,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
int field_nr, field_info, skip = 0; int field_nr, field_info, skip = 0;
int stream_index; int stream_index;
if (!parse_packet_header(pb, &pkt_type, &pkt_len)) { if (!parse_packet_header(pb, &pkt_type, &pkt_len)) {
if (!url_feof(pb)) if (!avio_feof(pb))
av_log(s, AV_LOG_ERROR, "sync lost\n"); av_log(s, AV_LOG_ERROR, "sync lost\n");
return -1; return -1;
} }

@ -541,7 +541,7 @@ static int parse_playlist(HLSContext *c, const char *url,
pls->finished = 0; pls->finished = 0;
pls->type = PLS_TYPE_UNSPECIFIED; pls->type = PLS_TYPE_UNSPECIFIED;
} }
while (!url_feof(in)) { while (!avio_feof(in)) {
read_chomp_line(in, line, sizeof(line)); read_chomp_line(in, line, sizeof(line));
if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) { if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
is_variant = 1; is_variant = 1;
@ -1532,7 +1532,7 @@ static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
AVRational tb; AVRational tb;
ret = av_read_frame(pls->ctx, &pls->pkt); ret = av_read_frame(pls->ctx, &pls->pkt);
if (ret < 0) { if (ret < 0) {
if (!url_feof(&pls->pb) && ret != AVERROR_EOF) if (!avio_feof(&pls->pb) && ret != AVERROR_EOF)
return ret; return ret;
reset_packet(&pls->pkt); reset_packet(&pls->pkt);
break; break;

@ -126,7 +126,7 @@ static int parse_playlist(URLContext *h, const char *url)
free_segment_list(s); free_segment_list(s);
s->finished = 0; s->finished = 0;
while (!url_feof(in)) { while (!avio_feof(in)) {
read_chomp_line(in, line, sizeof(line)); read_chomp_line(in, line, sizeof(line));
if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) { if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
struct variant_info info = {{0}}; struct variant_info info = {{0}};

@ -262,7 +262,7 @@ static int idcin_read_packet(AVFormatContext *s,
unsigned char palette_buffer[768]; unsigned char palette_buffer[768];
uint32_t palette[256]; uint32_t palette[256];
if (url_feof(s->pb)) if (avio_feof(s->pb))
return s->pb->error ? s->pb->error : AVERROR_EOF; return s->pb->error ? s->pb->error : AVERROR_EOF;
if (idcin->next_chunk_is_video) { if (idcin->next_chunk_is_video) {

@ -106,7 +106,7 @@ static int roq_read_packet(AVFormatContext *s,
while (!packet_read) { while (!packet_read) {
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR(EIO); return AVERROR(EIO);
/* get the next chunk preamble */ /* get the next chunk preamble */

@ -363,7 +363,7 @@ static int iff_read_header(AVFormatContext *s)
iff->maud_bits = -1; iff->maud_bits = -1;
iff->maud_compression = -1; iff->maud_compression = -1;
while(!url_feof(pb)) { while(!avio_feof(pb)) {
uint64_t orig_pos; uint64_t orig_pos;
int res; int res;
const char *metadata_tag = NULL; const char *metadata_tag = NULL;

@ -419,7 +419,7 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
infer_size(&codec->width, &codec->height, size[0]); infer_size(&codec->width, &codec->height, size[0]);
} else { } else {
f[0] = s1->pb; f[0] = s1->pb;
if (url_feof(f[0])) if (avio_feof(f[0]))
return AVERROR(EIO); return AVERROR(EIO);
if (s->frame_size > 0) { if (s->frame_size > 0) {
size[0] = s->frame_size; size[0] = s->frame_size;

@ -237,7 +237,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
return chunk_type; return chunk_type;
/* read the next chunk, wherever the file happens to be pointing */ /* read the next chunk, wherever the file happens to be pointing */
if (url_feof(pb)) if (avio_feof(pb))
return CHUNK_EOF; return CHUNK_EOF;
if (avio_read(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != if (avio_read(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
CHUNK_PREAMBLE_SIZE) CHUNK_PREAMBLE_SIZE)
@ -283,7 +283,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
while ((chunk_size > 0) && (chunk_type != CHUNK_BAD)) { while ((chunk_size > 0) && (chunk_type != CHUNK_BAD)) {
/* read the next chunk, wherever the file happens to be pointing */ /* read the next chunk, wherever the file happens to be pointing */
if (url_feof(pb)) { if (avio_feof(pb)) {
chunk_type = CHUNK_EOF; chunk_type = CHUNK_EOF;
break; break;
} }
@ -555,7 +555,7 @@ static int ipmovie_read_header(AVFormatContext *s)
while (memcmp(signature_buffer, signature, sizeof(signature))) { while (memcmp(signature_buffer, signature, sizeof(signature))) {
memmove(signature_buffer, signature_buffer + 1, sizeof(signature_buffer) - 1); memmove(signature_buffer, signature_buffer + 1, sizeof(signature_buffer) - 1);
signature_buffer[sizeof(signature_buffer) - 1] = avio_r8(pb); signature_buffer[sizeof(signature_buffer) - 1] = avio_r8(pb);
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
} }
/* initialize private context members */ /* initialize private context members */

@ -174,7 +174,7 @@ static int jacosub_read_header(AVFormatContext *s)
av_bprint_init(&header, 1024+FF_INPUT_BUFFER_PADDING_SIZE, 4096); av_bprint_init(&header, 1024+FF_INPUT_BUFFER_PADDING_SIZE, 4096);
while (!url_feof(pb)) { while (!avio_feof(pb)) {
int cmd_len; int cmd_len;
const char *p = line; const char *p = line;
int64_t pos = avio_tell(pb); int64_t pos = avio_tell(pb);

@ -166,7 +166,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *ast = s->streams[0]; AVStream *ast = s->streams[0];
while (!url_feof(s->pb) && jv->pts < ast->nb_index_entries) { while (!avio_feof(s->pb) && jv->pts < ast->nb_index_entries) {
const AVIndexEntry *e = ast->index_entries + jv->pts; const AVIndexEntry *e = ast->index_entries + jv->pts;
const JVFrame *jvf = jv->frames + jv->pts; const JVFrame *jvf = jv->frames + jv->pts;

@ -104,7 +104,7 @@ static int64_t read_line(AVBPrint *buf, AVIOContext *pb)
int64_t pos = avio_tell(pb); int64_t pos = avio_tell(pb);
av_bprint_clear(buf); av_bprint_clear(buf);
while(!url_feof(pb)) { while(!avio_feof(pb)) {
int c = avio_r8(pb); int c = avio_r8(pb);
if(c != '\r') { if(c != '\r') {
av_bprint_chars(buf, c, 1); av_bprint_chars(buf, c, 1);
@ -169,7 +169,7 @@ static int lrc_read_header(AVFormatContext *s)
st->codec->codec_id = AV_CODEC_ID_TEXT; st->codec->codec_id = AV_CODEC_ID_TEXT;
av_bprint_init(&line, 0, AV_BPRINT_SIZE_UNLIMITED); av_bprint_init(&line, 0, AV_BPRINT_SIZE_UNLIMITED);
while(!url_feof(s->pb)) { while(!avio_feof(s->pb)) {
int64_t pos = read_line(&line, s->pb); int64_t pos = read_line(&line, s->pb);
int64_t header_offset = find_header(line.str); int64_t header_offset = find_header(line.str);
if(header_offset >= 0) { if(header_offset >= 0) {

@ -51,7 +51,7 @@ static int lvf_read_header(AVFormatContext *s)
avio_skip(s->pb, 1012); avio_skip(s->pb, 1012);
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
id = avio_rl32(s->pb); id = avio_rl32(s->pb);
size = avio_rl32(s->pb); size = avio_rl32(s->pb);
next_offset = avio_tell(s->pb) + size; next_offset = avio_tell(s->pb) + size;
@ -108,7 +108,7 @@ static int lvf_read_packet(AVFormatContext *s, AVPacket *pkt)
int ret, is_video = 0; int ret, is_video = 0;
pos = avio_tell(s->pb); pos = avio_tell(s->pb);
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
id = avio_rl32(s->pb); id = avio_rl32(s->pb);
size = avio_rl32(s->pb); size = avio_rl32(s->pb);

@ -92,7 +92,7 @@ static int sync(AVFormatContext *s, uint8_t *header)
return ret < 0 ? ret : AVERROR_EOF; return ret < 0 ? ret : AVERROR_EOF;
while (memcmp(buf, LXF_IDENT, LXF_IDENT_LENGTH)) { while (memcmp(buf, LXF_IDENT, LXF_IDENT_LENGTH)) {
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR_EOF; return AVERROR_EOF;
memmove(buf, &buf[1], LXF_IDENT_LENGTH-1); memmove(buf, &buf[1], LXF_IDENT_LENGTH-1);

@ -654,7 +654,7 @@ static int matroska_resync(MatroskaDemuxContext *matroska, int64_t last_pos)
id = avio_rb32(pb); id = avio_rb32(pb);
// try to find a toplevel element // try to find a toplevel element
while (!url_feof(pb)) { while (!avio_feof(pb)) {
if (id == MATROSKA_ID_INFO || id == MATROSKA_ID_TRACKS || if (id == MATROSKA_ID_INFO || id == MATROSKA_ID_TRACKS ||
id == MATROSKA_ID_CUES || id == MATROSKA_ID_TAGS || id == MATROSKA_ID_CUES || id == MATROSKA_ID_TAGS ||
id == MATROSKA_ID_SEEKHEAD || id == MATROSKA_ID_ATTACHMENTS || id == MATROSKA_ID_SEEKHEAD || id == MATROSKA_ID_ATTACHMENTS ||
@ -707,7 +707,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb,
* use it safely here to catch EOS. */ * use it safely here to catch EOS. */
if (!(total = avio_r8(pb))) { if (!(total = avio_r8(pb))) {
/* we might encounter EOS here */ /* we might encounter EOS here */
if (!url_feof(pb)) { if (!avio_feof(pb)) {
int64_t pos = avio_tell(pb); int64_t pos = avio_tell(pb);
av_log(matroska->ctx, AV_LOG_ERROR, av_log(matroska->ctx, AV_LOG_ERROR,
"Read error at pos. %"PRIu64" (0x%"PRIx64")\n", "Read error at pos. %"PRIu64" (0x%"PRIx64")\n",

@ -74,7 +74,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
uint32_t chunk_size, payload_size; uint32_t chunk_size, payload_size;
int ret; int ret;
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
avio_skip(pb, 4); avio_skip(pb, 4);

@ -88,7 +88,7 @@ static int microdvd_read_header(AVFormatContext *s)
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
char *p; char *p;
AVPacket *sub; AVPacket *sub;
int64_t pos = avio_tell(s->pb); int64_t pos = avio_tell(s->pb);

@ -126,7 +126,7 @@ static int scan_file(AVFormatContext *avctx, AVStream *vst, AVStream *ast, int f
MlvContext *mlv = avctx->priv_data; MlvContext *mlv = avctx->priv_data;
AVIOContext *pb = mlv->pb[file]; AVIOContext *pb = mlv->pb[file];
int ret; int ret;
while (!url_feof(pb)) { while (!avio_feof(pb)) {
int type; int type;
unsigned int size; unsigned int size;
type = avio_rl32(pb); type = avio_rl32(pb);

@ -286,7 +286,7 @@ static int mmf_read_packet(AVFormatContext *s, AVPacket *pkt)
left = mmf->data_end - avio_tell(s->pb); left = mmf->data_end - avio_tell(s->pb);
size = FFMIN(left, MAX_SIZE); size = FFMIN(left, MAX_SIZE);
if (url_feof(s->pb) || size <= 0) if (avio_feof(s->pb) || size <= 0)
return AVERROR_EOF; return AVERROR_EOF;
ret = av_get_packet(s->pb, pkt, size); ret = av_get_packet(s->pb, pkt, size);

@ -485,7 +485,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_skip(pb, 16); avio_skip(pb, 16);
for (type = 0; type != -1 && avio_tell(pb) < next; ) { for (type = 0; type != -1 && avio_tell(pb) < next; ) {
if(url_feof(pb)) if(avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
type = avio_rb16(pb); type = avio_rb16(pb);
len = avio_rb16(pb); len = avio_rb16(pb);
@ -3173,7 +3173,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (atom.size < 0) if (atom.size < 0)
atom.size = INT64_MAX; atom.size = INT64_MAX;
while (total_size + 8 <= atom.size && !url_feof(pb)) { while (total_size + 8 <= atom.size && !avio_feof(pb)) {
int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL; int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL;
a.size = atom.size; a.size = atom.size;
a.type=0; a.type=0;
@ -3721,7 +3721,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
avio_seek(s->pb, mov->next_root_atom, SEEK_SET); avio_seek(s->pb, mov->next_root_atom, SEEK_SET);
mov->next_root_atom = 0; mov->next_root_atom = 0;
if (mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 || if (mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 ||
url_feof(s->pb)) avio_feof(s->pb))
return AVERROR_EOF; return AVERROR_EOF;
av_dlog(s, "read fragments, offset 0x%"PRIx64"\n", avio_tell(s->pb)); av_dlog(s, "read fragments, offset 0x%"PRIx64"\n", avio_tell(s->pb));
goto retry; goto retry;

@ -220,7 +220,7 @@ static int mpc8_read_header(AVFormatContext *s)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
while(!url_feof(pb)){ while(!avio_feof(pb)){
pos = avio_tell(pb); pos = avio_tell(pb);
mpc8_get_chunk_header(pb, &tag, &size); mpc8_get_chunk_header(pb, &tag, &size);
if(tag == TAG_STREAMHDR) if(tag == TAG_STREAMHDR)
@ -275,7 +275,7 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
int tag; int tag;
int64_t pos, size; int64_t pos, size;
while(!url_feof(s->pb)){ while(!avio_feof(s->pb)){
pos = avio_tell(s->pb); pos = avio_tell(s->pb);
/* don't return bogus packets with the ape tag data */ /* don't return bogus packets with the ape tag data */

@ -168,7 +168,7 @@ static int find_next_start_code(AVIOContext *pb, int *size_ptr,
state = *header_state; state = *header_state;
n = *size_ptr; n = *size_ptr;
while (n > 0) { while (n > 0) {
if (url_feof(pb)) if (avio_feof(pb))
break; break;
v = avio_r8(pb); v = avio_r8(pb);
n--; n--;
@ -246,7 +246,7 @@ redo:
startcode = find_next_start_code(s->pb, &size, &m->header_state); startcode = find_next_start_code(s->pb, &size, &m->header_state);
last_sync = avio_tell(s->pb); last_sync = avio_tell(s->pb);
if (startcode < 0) { if (startcode < 0) {
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR_EOF; return AVERROR_EOF;
// FIXME we should remember header_state // FIXME we should remember header_state
return AVERROR(EAGAIN); return AVERROR(EAGAIN);
@ -702,7 +702,7 @@ static int vobsub_read_header(AVFormatContext *s)
} }
av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED); av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED);
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
char line[MAX_LINE_SIZE]; char line[MAX_LINE_SIZE];
int len = ff_get_line(s->pb, line, sizeof(line)); int len = ff_get_line(s->pb, line, sizeof(line));

@ -2192,7 +2192,7 @@ static int mpegts_resync(AVFormatContext *s)
for (i = 0; i < MAX_RESYNC_SIZE; i++) { for (i = 0; i < MAX_RESYNC_SIZE; i++) {
c = avio_r8(pb); c = avio_r8(pb);
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
if (c == 0x47) { if (c == 0x47) {
avio_seek(pb, -1, SEEK_CUR); avio_seek(pb, -1, SEEK_CUR);

@ -83,7 +83,7 @@ static int mpl2_read_header(AVFormatContext *s)
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
st->codec->codec_id = AV_CODEC_ID_MPL2; st->codec->codec_id = AV_CODEC_ID_MPL2;
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
char line[4096]; char line[4096];
char *p = line; char *p = line;
const int64_t pos = avio_tell(s->pb); const int64_t pos = avio_tell(s->pb);

@ -63,7 +63,7 @@ static int mpsub_read_header(AVFormatContext *s)
av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
char line[1024]; char line[1024];
float start, duration; float start, duration;
int fps, len = ff_get_line(s->pb, line, sizeof(line)); int fps, len = ff_get_line(s->pb, line, sizeof(line));

@ -89,9 +89,9 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx)
/* Some files start with "connected\r\n\r\n". /* Some files start with "connected\r\n\r\n".
* So skip until we find the first byte of struct size */ * So skip until we find the first byte of struct size */
while(avio_r8(pb) != HEADER_SIZE && !url_feof(pb)); while(avio_r8(pb) != HEADER_SIZE && !avio_feof(pb));
if(url_feof(pb)) { if(avio_feof(pb)) {
av_log(ctx, AV_LOG_ERROR, "Could not find valid start.\n"); av_log(ctx, AV_LOG_ERROR, "Could not find valid start.\n");
return -1; return -1;
} }

@ -284,7 +284,7 @@ static int64_t klv_decode_ber_length(AVIOContext *pb)
static int mxf_read_sync(AVIOContext *pb, const uint8_t *key, unsigned size) static int mxf_read_sync(AVIOContext *pb, const uint8_t *key, unsigned size)
{ {
int i, b; int i, b;
for (i = 0; i < size && !url_feof(pb); i++) { for (i = 0; i < size && !avio_feof(pb); i++) {
b = avio_r8(pb); b = avio_r8(pb);
if (b == key[0]) if (b == key[0])
i = 0; i = 0;
@ -1874,7 +1874,7 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF
if (!ctx) if (!ctx)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
while (avio_tell(pb) + 4 < klv_end && !url_feof(pb)) { while (avio_tell(pb) + 4 < klv_end && !avio_feof(pb)) {
int ret; int ret;
int tag = avio_rb16(pb); int tag = avio_rb16(pb);
int size = avio_rb16(pb); /* KLV specified by 0x53 */ int size = avio_rb16(pb); /* KLV specified by 0x53 */
@ -2122,7 +2122,7 @@ static int mxf_read_header(AVFormatContext *s)
mxf_read_random_index_pack(s); mxf_read_random_index_pack(s);
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
const MXFMetadataReadTableEntry *metadata; const MXFMetadataReadTableEntry *metadata;
if (avio_tell(s->pb) == last_pos) { if (avio_tell(s->pb) == last_pos) {
av_log(mxf->fc, AV_LOG_ERROR, "MXF structure loop detected\n"); av_log(mxf->fc, AV_LOG_ERROR, "MXF structure loop detected\n");
@ -2450,7 +2450,7 @@ static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt)
skip: skip:
avio_skip(s->pb, klv.length); avio_skip(s->pb, klv.length);
} }
return url_feof(s->pb) ? AVERROR_EOF : ret; return avio_feof(s->pb) ? AVERROR_EOF : ret;
} }
static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)

@ -136,7 +136,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt)
uint8_t *startmarker_ptr, *end, *search_end, marker; uint8_t *startmarker_ptr, *end, *search_end, marker;
MXGContext *mxg = s->priv_data; MXGContext *mxg = s->priv_data;
while (!url_feof(s->pb) && !s->pb->error){ while (!avio_feof(s->pb) && !s->pb->error){
if (mxg->cache_size <= OVERREAD_SIZE) { if (mxg->cache_size <= OVERREAD_SIZE) {
/* update internal buffer */ /* update internal buffer */
ret = mxg_update_cache(s, DEFAULT_PACKET_SIZE + OVERREAD_SIZE); ret = mxg_update_cache(s, DEFAULT_PACKET_SIZE + OVERREAD_SIZE);

@ -67,7 +67,7 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt)
uint32_t state=-1; uint32_t state=-1;
while (state != NC_VIDEO_FLAG) { while (state != NC_VIDEO_FLAG) {
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR(EIO); return AVERROR(EIO);
state = (state<<8) + avio_r8(s->pb); state = (state<<8) + avio_r8(s->pb);
} }

@ -51,7 +51,7 @@ static int nist_read_header(AVFormatContext *s)
if (header_size <= 0) if (header_size <= 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
ff_get_line(s->pb, buffer, sizeof(buffer)); ff_get_line(s->pb, buffer, sizeof(buffer));
if (avio_tell(s->pb) >= header_size) if (avio_tell(s->pb) >= header_size)

@ -232,7 +232,7 @@ static int nsv_resync(AVFormatContext *s)
//nsv->state = NSV_UNSYNC; //nsv->state = NSV_UNSYNC;
for (i = 0; i < NSV_MAX_RESYNC; i++) { for (i = 0; i < NSV_MAX_RESYNC; i++) {
if (url_feof(pb)) { if (avio_feof(pb)) {
av_dlog(s, "NSV EOF\n"); av_dlog(s, "NSV EOF\n");
nsv->state = NSV_UNSYNC; nsv->state = NSV_UNSYNC;
return -1; return -1;
@ -299,7 +299,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s)
table_entries_used = avio_rl32(pb); table_entries_used = avio_rl32(pb);
av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n", av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n",
strings_size, table_entries, table_entries_used); strings_size, table_entries, table_entries_used);
if (url_feof(pb)) if (avio_feof(pb))
return -1; return -1;
av_dlog(s, "NSV got header; filepos %"PRId64"\n", avio_tell(pb)); av_dlog(s, "NSV got header; filepos %"PRId64"\n", avio_tell(pb));
@ -336,7 +336,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s)
} }
av_free(strings); av_free(strings);
} }
if (url_feof(pb)) if (avio_feof(pb))
return -1; return -1;
av_dlog(s, "NSV got infos; filepos %"PRId64"\n", avio_tell(pb)); av_dlog(s, "NSV got infos; filepos %"PRId64"\n", avio_tell(pb));
@ -368,7 +368,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s)
avio_seek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra bytes) */ avio_seek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra bytes) */
if (url_feof(pb)) if (avio_feof(pb))
return -1; return -1;
nsv->state = NSV_HAS_READ_NSVF; nsv->state = NSV_HAS_READ_NSVF;
return 0; return 0;
@ -546,7 +546,7 @@ static int nsv_read_chunk(AVFormatContext *s, int fill_header)
return 0; //-1; /* hey! eat what you've in your plate first! */ return 0; //-1; /* hey! eat what you've in your plate first! */
null_chunk_retry: null_chunk_retry:
if (url_feof(pb)) if (avio_feof(pb))
return -1; return -1;
for (i = 0; i < NSV_MAX_RESYNC_TRIES && nsv->state < NSV_FOUND_NSVS && !err; i++) for (i = 0; i < NSV_MAX_RESYNC_TRIES && nsv->state < NSV_FOUND_NSVS && !err; i++)
@ -581,7 +581,7 @@ null_chunk_retry:
vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming braindead */ vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming braindead */
} }
if (url_feof(pb)) if (avio_feof(pb))
return -1; return -1;
if (!vsize && !asize) { if (!vsize && !asize) {
nsv->state = NSV_UNSYNC; nsv->state = NSV_UNSYNC;

@ -146,7 +146,7 @@ static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos)
/* Note, this may fail if the stream is not seekable, but that should /* Note, this may fail if the stream is not seekable, but that should
* not matter, as in this case we simply start where we currently are */ * not matter, as in this case we simply start where we currently are */
avio_seek(bc, pos, SEEK_SET); avio_seek(bc, pos, SEEK_SET);
while (!url_feof(bc)) { while (!avio_feof(bc)) {
state = (state << 8) | avio_r8(bc); state = (state << 8) | avio_r8(bc);
if ((state >> 56) != 'N') if ((state >> 56) != 'N')
continue; continue;
@ -1056,7 +1056,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
pos -= 8; pos -= 8;
} else { } else {
frame_code = avio_r8(bc); frame_code = avio_r8(bc);
if (url_feof(bc)) if (avio_feof(bc))
return AVERROR_EOF; return AVERROR_EOF;
if (frame_code == 'N') { if (frame_code == 'N') {
tmp = frame_code; tmp = frame_code;

@ -72,7 +72,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst,
if (!vst && !myth) if (!vst && !myth)
return 1; // no codec data needed return 1; // no codec data needed
while (!url_feof(pb)) { while (!avio_feof(pb)) {
int size, subtype; int size, subtype;
frametype = avio_r8(pb); frametype = avio_r8(pb);
@ -236,7 +236,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt)
nuv_frametype frametype; nuv_frametype frametype;
int ret, size; int ret, size;
while (!url_feof(pb)) { while (!avio_feof(pb)) {
int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0; int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0;
uint64_t pos = avio_tell(pb); uint64_t pos = avio_tell(pb);
@ -309,7 +309,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt)
static int nuv_resync(AVFormatContext *s, int64_t pos_limit) { static int nuv_resync(AVFormatContext *s, int64_t pos_limit) {
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
uint32_t tag = 0; uint32_t tag = 0;
while(!url_feof(pb) && avio_tell(pb) < pos_limit) { while(!avio_feof(pb) && avio_tell(pb) < pos_limit) {
tag = (tag << 8) | avio_r8(pb); tag = (tag << 8) | avio_r8(pb);
if (tag == MKBETAG('R','T','j','j') && if (tag == MKBETAG('R','T','j','j') &&
(tag = avio_rb32(pb)) == MKBETAG('j','j','j','j') && (tag = avio_rb32(pb)) == MKBETAG('j','j','j','j') &&
@ -339,7 +339,7 @@ static int64_t nuv_read_dts(AVFormatContext *s, int stream_index,
if (!nuv_resync(s, pos_limit)) if (!nuv_resync(s, pos_limit))
return AV_NOPTS_VALUE; return AV_NOPTS_VALUE;
while (!url_feof(pb) && avio_tell(pb) < pos_limit) { while (!avio_feof(pb) && avio_tell(pb) < pos_limit) {
if (avio_read(pb, hdr, HDRSIZE) < HDRSIZE) if (avio_read(pb, hdr, HDRSIZE) < HDRSIZE)
return AV_NOPTS_VALUE; return AV_NOPTS_VALUE;
frametype = hdr[0]; frametype = hdr[0];

@ -331,7 +331,7 @@ static int ogg_read_page(AVFormatContext *s, int *sid)
c = avio_r8(bc); c = avio_r8(bc);
if (url_feof(bc)) if (avio_feof(bc))
return AVERROR_EOF; return AVERROR_EOF;
sync[sp++ & 3] = c; sync[sp++ & 3] = c;

@ -199,7 +199,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
if (p->current_frame >= p->nb_frames) if (p->current_frame >= p->nb_frames)
return AVERROR_EOF; return AVERROR_EOF;
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
if (p->got_audio) { if (p->got_audio) {

@ -73,7 +73,7 @@ static int pjs_read_header(AVFormatContext *s)
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
st->codec->codec_id = AV_CODEC_ID_PJS; st->codec->codec_id = AV_CODEC_ID_PJS;
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
char line[4096]; char line[4096];
char *p = line; char *p = line;
const int64_t pos = avio_tell(s->pb); const int64_t pos = avio_tell(s->pb);

@ -97,7 +97,7 @@ static int pmp_header(AVFormatContext *s)
for (i = 0; i < index_cnt; i++) { for (i = 0; i < index_cnt; i++) {
uint32_t size = avio_rl32(pb); uint32_t size = avio_rl32(pb);
int flags = size & 1 ? AVINDEX_KEYFRAME : 0; int flags = size & 1 ? AVINDEX_KEYFRAME : 0;
if (url_feof(pb)) { if (avio_feof(pb)) {
av_log(s, AV_LOG_FATAL, "Encountered EOF while reading index.\n"); av_log(s, AV_LOG_FATAL, "Encountered EOF while reading index.\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
@ -133,7 +133,7 @@ static int pmp_packet(AVFormatContext *s, AVPacket *pkt)
int ret = 0; int ret = 0;
int i; int i;
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
if (pmp->cur_stream == 0) { if (pmp->cur_stream == 0) {
int num_packets; int num_packets;

@ -292,7 +292,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
break; break;
} }
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR(EIO); return AVERROR(EIO);
} }
} }

@ -139,7 +139,7 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt)
QCPContext *c = s->priv_data; QCPContext *c = s->priv_data;
unsigned int chunk_size, tag; unsigned int chunk_size, tag;
while(!url_feof(pb)) { while(!avio_feof(pb)) {
if (c->data_size) { if (c->data_size) {
int pkt_size, ret, mode = avio_r8(pb); int pkt_size, ret, mode = avio_r8(pb);

@ -72,7 +72,7 @@ static int realtext_read_header(AVFormatContext *s)
av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
AVPacket *sub; AVPacket *sub;
const int64_t pos = avio_tell(s->pb) - (c != 0); const int64_t pos = avio_tell(s->pb) - (c != 0);
int n = ff_smil_extract_next_chunk(s->pb, &buf, &c); int n = ff_smil_extract_next_chunk(s->pb, &buf, &c);

@ -143,7 +143,7 @@ static int redspark_read_packet(AVFormatContext *s, AVPacket *pkt)
uint32_t size = 8 * codec->channels; uint32_t size = 8 * codec->channels;
int ret; int ret;
if (url_feof(s->pb) || redspark->samples_count == s->streams[0]->duration) if (avio_feof(s->pb) || redspark->samples_count == s->streams[0]->duration)
return AVERROR_EOF; return AVERROR_EOF;
ret = av_get_packet(s->pb, pkt, size); ret = av_get_packet(s->pb, pkt, size);

@ -191,7 +191,7 @@ int ff_read_riff_info(AVFormatContext *s, int64_t size)
chunk_code = avio_rl32(pb); chunk_code = avio_rl32(pb);
chunk_size = avio_rl32(pb); chunk_size = avio_rl32(pb);
if (url_feof(pb)) { if (avio_feof(pb)) {
if (chunk_code || chunk_size) { if (chunk_code || chunk_size) {
av_log(s, AV_LOG_WARNING, "INFO subchunk truncated\n"); av_log(s, AV_LOG_WARNING, "INFO subchunk truncated\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;

@ -494,7 +494,7 @@ static int rm_read_header(AVFormatContext *s)
avio_skip(pb, tag_size - 8); avio_skip(pb, tag_size - 8);
for(;;) { for(;;) {
if (url_feof(pb)) if (avio_feof(pb))
return -1; return -1;
tag = avio_rl32(pb); tag = avio_rl32(pb);
tag_size = avio_rb32(pb); tag_size = avio_rb32(pb);
@ -601,7 +601,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
AVStream *st; AVStream *st;
uint32_t state=0xFFFFFFFF; uint32_t state=0xFFFFFFFF;
while(!url_feof(pb)){ while(!avio_feof(pb)){
int len, num, i; int len, num, i;
*pos= avio_tell(pb) - 3; *pos= avio_tell(pb) - 3;
if(rm->remaining_len > 0){ if(rm->remaining_len > 0){
@ -953,7 +953,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
st = s->streams[i]; st = s->streams[i];
} }
if(len<0 || url_feof(s->pb)) if(len<0 || avio_feof(s->pb))
return AVERROR(EIO); return AVERROR(EIO);
res = ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt, res = ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt,

@ -60,7 +60,7 @@ static int read_line(AVIOContext * pb, char* line, int bufsize)
break; break;
if (b == '\n') { if (b == '\n') {
line[i] = '\0'; line[i] = '\0';
return url_feof(pb) ? -1 : 0; return avio_feof(pb) ? -1 : 0;
} }
line[i] = b; line[i] = b;
} }

@ -137,7 +137,7 @@ static int rsd_read_packet(AVFormatContext *s, AVPacket *pkt)
AVCodecContext *codec = s->streams[0]->codec; AVCodecContext *codec = s->streams[0]->codec;
int ret, size = 1024; int ret, size = 1024;
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR_EOF; return AVERROR_EOF;
if (codec->codec_id == AV_CODEC_ID_ADPCM_IMA_RAD) if (codec->codec_id == AV_CODEC_ID_ADPCM_IMA_RAD)

@ -62,7 +62,7 @@ static int sami_read_header(AVFormatContext *s)
av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
av_bprint_init(&hdr_buf, 0, AV_BPRINT_SIZE_UNLIMITED); av_bprint_init(&hdr_buf, 0, AV_BPRINT_SIZE_UNLIMITED);
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
AVPacket *sub; AVPacket *sub;
const int64_t pos = avio_tell(s->pb) - (c != 0); const int64_t pos = avio_tell(s->pb) - (c != 0);
int is_sync, n = ff_smil_extract_next_chunk(s->pb, &buf, &c); int is_sync, n = ff_smil_extract_next_chunk(s->pb, &buf, &c);

@ -257,7 +257,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
int frame_size = 0; int frame_size = 0;
int palchange = 0; int palchange = 0;
if (url_feof(s->pb) || smk->cur_frame >= smk->frames) if (avio_feof(s->pb) || smk->cur_frame >= smk->frames)
return AVERROR_EOF; return AVERROR_EOF;
/* if we demuxed all streams, pass another frame */ /* if we demuxed all streams, pass another frame */

@ -58,7 +58,7 @@ static int smjpeg_read_header(AVFormatContext *s)
duration = avio_rb32(pb); // in msec duration = avio_rb32(pb); // in msec
while (!url_feof(pb)) { while (!avio_feof(pb)) {
htype = avio_rl32(pb); htype = avio_rl32(pb);
switch (htype) { switch (htype) {
case SMJPEG_TXT: case SMJPEG_TXT:
@ -141,7 +141,7 @@ static int smjpeg_read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t pos; int64_t pos;
int ret; int ret;
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR_EOF; return AVERROR_EOF;
pos = avio_tell(s->pb); pos = avio_tell(s->pb);
dtype = avio_rl32(s->pb); dtype = avio_rl32(s->pb);

@ -102,7 +102,7 @@ static int smush_read_header(AVFormatContext *ctx)
while (!got_audio && ((read + 8) < size)) { while (!got_audio && ((read + 8) < size)) {
uint32_t sig, chunk_size; uint32_t sig, chunk_size;
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
sig = avio_rb32(pb); sig = avio_rb32(pb);
@ -196,7 +196,7 @@ static int smush_read_packet(AVFormatContext *ctx, AVPacket *pkt)
while (!done) { while (!done) {
uint32_t sig, size; uint32_t sig, size;
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
sig = avio_rb32(pb); sig = avio_rb32(pb);

@ -131,7 +131,7 @@ static int sol_read_packet(AVFormatContext *s,
{ {
int ret; int ret;
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR(EIO); return AVERROR(EIO);
ret= av_get_packet(s->pb, pkt, MAX_SIZE); ret= av_get_packet(s->pb, pkt, MAX_SIZE);
if (ret < 0) if (ret < 0)

@ -176,7 +176,7 @@ int ff_spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
while (state != (AV_BSWAP16C(SYNCWORD1) << 16 | AV_BSWAP16C(SYNCWORD2))) { while (state != (AV_BSWAP16C(SYNCWORD1) << 16 | AV_BSWAP16C(SYNCWORD2))) {
state = (state << 8) | avio_r8(pb); state = (state << 8) | avio_r8(pb);
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
} }

@ -88,7 +88,7 @@ static int srt_read_header(AVFormatContext *s)
av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
ff_subtitles_read_chunk(s->pb, &buf); ff_subtitles_read_chunk(s->pb, &buf);
if (buf.len) { if (buf.len) {

@ -53,7 +53,7 @@ static int subviewer1_read_header(AVFormatContext *s)
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
st->codec->codec_id = AV_CODEC_ID_SUBVIEWER1; st->codec->codec_id = AV_CODEC_ID_SUBVIEWER1;
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
char line[4096]; char line[4096];
int len = ff_get_line(s->pb, line, sizeof(line)); int len = ff_get_line(s->pb, line, sizeof(line));
int hh, mm, ss; int hh, mm, ss;

@ -84,7 +84,7 @@ static int subviewer_read_header(AVFormatContext *s)
av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED); av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED);
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
char line[2048]; char line[2048];
int64_t pos = 0; int64_t pos = 0;
int len = ff_get_line(s->pb, line, sizeof(line)); int len = ff_get_line(s->pb, line, sizeof(line));

@ -39,7 +39,7 @@ static int get_swf_tag(AVIOContext *pb, int *len_ptr)
{ {
int tag, len; int tag, len;
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
tag = avio_rl16(pb); tag = avio_rl16(pb);

@ -68,7 +68,7 @@ static int tak_read_header(AVFormatContext *s)
return 0; return 0;
} }
while (!url_feof(pb)) { while (!avio_feof(pb)) {
enum TAKMetaDataType type; enum TAKMetaDataType type;
int size; int size;

@ -154,7 +154,7 @@ static int tmv_read_packet(AVFormatContext *s, AVPacket *pkt)
int ret, pkt_size = tmv->stream_index ? int ret, pkt_size = tmv->stream_index ?
tmv->audio_chunk_size : tmv->video_chunk_size; tmv->audio_chunk_size : tmv->video_chunk_size;
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
ret = av_get_packet(pb, pkt, pkt_size); ret = av_get_packet(pb, pkt, pkt_size);

@ -113,7 +113,7 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt)
TtyDemuxContext *s = avctx->priv_data; TtyDemuxContext *s = avctx->priv_data;
int n; int n;
if (url_feof(avctx->pb)) if (avio_feof(avctx->pb))
return AVERROR_EOF; return AVERROR_EOF;
n = s->chars_per_frame; n = s->chars_per_frame;

@ -63,7 +63,7 @@ next_chunk:
chunk_size = avio_rl32(pb); chunk_size = avio_rl32(pb);
marker = avio_rl32(pb); marker = avio_rl32(pb);
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR_EOF; return AVERROR_EOF;
if (marker != TXD_MARKER && marker != TXD_MARKER2) { if (marker != TXD_MARKER && marker != TXD_MARKER2) {
av_log(s, AV_LOG_ERROR, "marker does not match\n"); av_log(s, AV_LOG_ERROR, "marker does not match\n");

@ -91,7 +91,7 @@ static int vc1t_read_packet(AVFormatContext *s,
int keyframe = 0; int keyframe = 0;
uint32_t pts; uint32_t pts;
if(url_feof(pb)) if(avio_feof(pb))
return AVERROR(EIO); return AVERROR(EIO);
frame_size = avio_rl24(pb); frame_size = avio_rl24(pb);

@ -75,7 +75,7 @@ static int vivo_get_packet_header(AVFormatContext *s)
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned c, get_length = 0; unsigned c, get_length = 0;
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
c = avio_r8(pb); c = avio_r8(pb);
@ -250,7 +250,7 @@ static int vivo_read_packet(AVFormatContext *s, AVPacket *pkt)
restart: restart:
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
switch (vivo->type) { switch (vivo->type) {
@ -281,7 +281,7 @@ restart:
while (vivo->sequence == old_sequence && while (vivo->sequence == old_sequence &&
(((vivo->type - 1) >> 1) == ((old_type - 1) >> 1))) { (((vivo->type - 1) >> 1) == ((old_type - 1) >> 1))) {
if (url_feof(pb)) { if (avio_feof(pb)) {
ret = AVERROR_EOF; ret = AVERROR_EOF;
break; break;
} }

@ -65,7 +65,7 @@ static int vplayer_read_header(AVFormatContext *s)
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
st->codec->codec_id = AV_CODEC_ID_VPLAYER; st->codec->codec_id = AV_CODEC_ID_VPLAYER;
while (!url_feof(s->pb)) { while (!avio_feof(s->pb)) {
char line[4096]; char line[4096];
char *p = line; char *p = line;
const int64_t pos = avio_tell(s->pb); const int64_t pos = avio_tell(s->pb);

@ -166,7 +166,7 @@ static int vqf_read_header(AVFormatContext *s)
header_size -= len; header_size -= len;
} while (header_size >= 0 && !url_feof(s->pb)); } while (header_size >= 0 && !avio_feof(s->pb));
switch (rate_flag) { switch (rate_flag) {
case -1: case -1:

@ -82,7 +82,7 @@ static int64_t find_tag(WAVDemuxContext * wav, AVIOContext *pb, uint32_t tag1)
int64_t size; int64_t size;
for (;;) { for (;;) {
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR_EOF; return AVERROR_EOF;
size = next_tag(pb, &tag); size = next_tag(pb, &tag);
if (tag == tag1) if (tag == tag1)
@ -291,7 +291,7 @@ static int wav_read_header(AVFormatContext *s)
size = next_tag(pb, &tag); size = next_tag(pb, &tag);
next_tag_ofs = avio_tell(pb) + size; next_tag_ofs = avio_tell(pb) + size;
if (url_feof(pb)) if (avio_feof(pb))
break; break;
switch (tag) { switch (tag) {
@ -434,7 +434,7 @@ static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16])
uint8_t guid[16]; uint8_t guid[16];
int64_t size; int64_t size;
while (!url_feof(pb)) { while (!avio_feof(pb)) {
avio_read(pb, guid, 16); avio_read(pb, guid, 16);
size = avio_rl64(pb); size = avio_rl64(pb);
if (size <= 24) if (size <= 24)
@ -652,7 +652,7 @@ static int w64_read_header(AVFormatContext *s)
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
while (!url_feof(pb)) { while (!avio_feof(pb)) {
if (avio_read(pb, guid, 16) != 16) if (avio_read(pb, guid, 16) != 16)
break; break;
size = avio_rl64(pb); size = avio_rl64(pb);
@ -692,7 +692,7 @@ static int w64_read_header(AVFormatContext *s)
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
char chunk_key[5], *value; char chunk_key[5], *value;
if (url_feof(pb) || (cur = avio_tell(pb)) < 0 || cur > end - 8 /* = tag + size */) if (avio_feof(pb) || (cur = avio_tell(pb)) < 0 || cur > end - 8 /* = tag + size */)
break; break;
chunk_key[4] = 0; chunk_key[4] = 0;

@ -159,7 +159,7 @@ static int wc3_read_header(AVFormatContext *s)
fourcc_tag = avio_rl32(pb); fourcc_tag = avio_rl32(pb);
/* chunk sizes are 16-bit aligned */ /* chunk sizes are 16-bit aligned */
size = (avio_rb32(pb) + 1) & (~1); size = (avio_rb32(pb) + 1) & (~1);
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR(EIO); return AVERROR(EIO);
} while (fourcc_tag != BRCH_TAG); } while (fourcc_tag != BRCH_TAG);
@ -211,7 +211,7 @@ static int wc3_read_packet(AVFormatContext *s,
fourcc_tag = avio_rl32(pb); fourcc_tag = avio_rl32(pb);
/* chunk sizes are 16-bit aligned */ /* chunk sizes are 16-bit aligned */
size = (avio_rb32(pb) + 1) & (~1); size = (avio_rb32(pb) + 1) & (~1);
if (url_feof(pb)) if (avio_feof(pb))
return AVERROR(EIO); return AVERROR(EIO);
switch (fourcc_tag) { switch (fourcc_tag) {

@ -76,7 +76,7 @@ static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size)
if (wf->error || pb->error) if (wf->error || pb->error)
return -1; return -1;
if (wf->position >= wf->length || url_feof(pb)) if (wf->position >= wf->length || avio_feof(pb))
return 0; return 0;
buf_size = FFMIN(buf_size, wf->length - wf->position); buf_size = FFMIN(buf_size, wf->length - wf->position);
@ -533,7 +533,7 @@ static void parse_legacy_attrib(AVFormatContext *s, AVIOContext *pb)
{ {
ff_asf_guid guid; ff_asf_guid guid;
int length, type; int length, type;
while(!url_feof(pb)) { while(!avio_feof(pb)) {
char key[1024]; char key[1024];
ff_get_guid(pb, &guid); ff_get_guid(pb, &guid);
type = avio_rl32(pb); type = avio_rl32(pb);
@ -761,7 +761,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
{ {
WtvContext *wtv = s->priv_data; WtvContext *wtv = s->priv_data;
AVIOContext *pb = wtv->pb; AVIOContext *pb = wtv->pb;
while (!url_feof(pb)) { while (!avio_feof(pb)) {
ff_asf_guid g; ff_asf_guid g;
int len, sid, consumed; int len, sid, consumed;
@ -981,7 +981,7 @@ static int read_header(AVFormatContext *s)
while(1) { while(1) {
uint64_t timestamp = avio_rl64(pb); uint64_t timestamp = avio_rl64(pb);
uint64_t frame_nb = avio_rl64(pb); uint64_t frame_nb = avio_rl64(pb);
if (url_feof(pb)) if (avio_feof(pb))
break; break;
ff_add_index_entry(&wtv->index_entries, &wtv->nb_index_entries, &wtv->index_entries_allocated_size, ff_add_index_entry(&wtv->index_entries, &wtv->nb_index_entries, &wtv->index_entries_allocated_size,
0, timestamp, frame_nb, 0, AVINDEX_KEYFRAME); 0, timestamp, frame_nb, 0, AVINDEX_KEYFRAME);
@ -995,7 +995,7 @@ static int read_header(AVFormatContext *s)
while (1) { while (1) {
uint64_t frame_nb = avio_rl64(pb); uint64_t frame_nb = avio_rl64(pb);
uint64_t position = avio_rl64(pb); uint64_t position = avio_rl64(pb);
if (url_feof(pb)) if (avio_feof(pb))
break; break;
for (i = wtv->nb_index_entries - 1; i >= 0; i--) { for (i = wtv->nb_index_entries - 1; i >= 0; i--) {
AVIndexEntry *e = wtv->index_entries + i; AVIndexEntry *e = wtv->index_entries + i;

@ -260,7 +260,7 @@ static int wv_read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t pos; int64_t pos;
uint32_t block_samples; uint32_t block_samples;
if (url_feof(s->pb)) if (avio_feof(s->pb))
return AVERROR_EOF; return AVERROR_EOF;
if (wc->block_parsed) { if (wc->block_parsed) {
if ((ret = wv_read_block_header(s, s->pb)) < 0) if ((ret = wv_read_block_header(s, s->pb)) < 0)

Loading…
Cancel
Save