avio: deprecate url_feof

AVIOContext.eof_reached should be used directly instead.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
oldabi
Anton Khirnov 14 years ago committed by Ronald S. Bultje
parent 6a7e074eb9
commit 66e5b1df36
  1. 2
      ffplay.c
  2. 2
      libavformat/4xm.c
  3. 2
      libavformat/aiffdec.c
  4. 2
      libavformat/amr.c
  5. 2
      libavformat/anm.c
  6. 2
      libavformat/ape.c
  7. 4
      libavformat/applehttp.c
  8. 2
      libavformat/applehttpproto.c
  9. 12
      libavformat/asfdec.c
  10. 2
      libavformat/assdec.c
  11. 12
      libavformat/avidec.c
  12. 11
      libavformat/avio.h
  13. 10
      libavformat/aviobuf.c
  14. 2
      libavformat/bethsoftvid.c
  15. 4
      libavformat/bfi.c
  16. 6
      libavformat/cafdec.c
  17. 2
      libavformat/daud.c
  18. 2
      libavformat/dsicin.c
  19. 2
      libavformat/dv.c
  20. 4
      libavformat/dxa.c
  21. 4
      libavformat/electronicarts.c
  22. 2
      libavformat/ffmdec.c
  23. 4
      libavformat/ffmetadec.c
  24. 2
      libavformat/filmstripdec.c
  25. 2
      libavformat/flacdec.c
  26. 2
      libavformat/flvdec.c
  27. 6
      libavformat/gxf.c
  28. 2
      libavformat/idcin.c
  29. 2
      libavformat/idroqdec.c
  30. 2
      libavformat/iff.c
  31. 2
      libavformat/img2.c
  32. 6
      libavformat/ipmovie.c
  33. 2
      libavformat/lxfdec.c
  34. 2
      libavformat/matroskadec.c
  35. 2
      libavformat/mmf.c
  36. 4
      libavformat/mov.c
  37. 4
      libavformat/mpc8.c
  38. 4
      libavformat/mpeg.c
  39. 2
      libavformat/mpegts.c
  40. 4
      libavformat/msnwc_tcp.c
  41. 6
      libavformat/mxfdec.c
  42. 2
      libavformat/mxg.c
  43. 2
      libavformat/ncdec.c
  44. 12
      libavformat/nsvdec.c
  45. 4
      libavformat/nutdec.c
  46. 4
      libavformat/nuv.c
  47. 2
      libavformat/oggdec.c
  48. 2
      libavformat/psxstr.c
  49. 2
      libavformat/qcp.c
  50. 6
      libavformat/rmdec.c
  51. 2
      libavformat/smacker.c
  52. 2
      libavformat/sol.c
  53. 2
      libavformat/soxdec.c
  54. 2
      libavformat/spdifdec.c
  55. 2
      libavformat/srtdec.c
  56. 2
      libavformat/swfdec.c
  57. 2
      libavformat/tmv.c
  58. 2
      libavformat/tty.c
  59. 2
      libavformat/txd.c
  60. 2
      libavformat/vc1test.c
  61. 6
      libavformat/wav.c
  62. 4
      libavformat/wc3movie.c
  63. 10
      libavformat/wtv.c
  64. 2
      libavformat/wv.c

@ -2568,7 +2568,7 @@ static int decode_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 || ic->pb->eof_reached)
eof=1; eof=1;
if (url_ferror(ic->pb)) if (url_ferror(ic->pb))
break; break;

@ -259,7 +259,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 (pb->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
switch (fourcc_tag) { switch (fourcc_tag) {

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

@ -122,7 +122,7 @@ static int amr_read_packet(AVFormatContext *s,
AVCodecContext *enc = s->streams[0]->codec; AVCodecContext *enc = s->streams[0]->codec;
int read, size = 0, toc, mode; int read, size = 0, toc, mode;
if (url_feof(s->pb)) if (s->pb->eof_reached)
{ {
return AVERROR(EIO); return AVERROR(EIO);
} }

@ -181,7 +181,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 (s->pb->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
if (anm->page < 0) if (anm->page < 0)

@ -337,7 +337,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 (s->pb->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
if (ape->currentframe > ape->totalframes) if (ape->currentframe > ape->totalframes)
return AVERROR(EIO); return AVERROR(EIO);

@ -224,7 +224,7 @@ static int parse_playlist(AppleHTTPContext *c, const char *url,
if (var) if (var)
free_segment_list(var); free_segment_list(var);
c->finished = 0; c->finished = 0;
while (!url_feof(in)) { while (!in->eof_reached) {
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}};
@ -457,7 +457,7 @@ start:
if (var->pb && !var->pkt.data) { if (var->pb && !var->pkt.data) {
ret = av_read_frame(var->ctx, &var->pkt); ret = av_read_frame(var->ctx, &var->pkt);
if (ret < 0) { if (ret < 0) {
if (!url_feof(var->pb)) if (!var->pb->eof_reached)
return ret; return ret;
reset_packet(&var->pkt); reset_packet(&var->pkt);
} }

@ -174,7 +174,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 (!in->eof_reached) {
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}};

@ -639,7 +639,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
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 (pb->eof_reached) {
return -1; return -1;
} else { } else {
if (!s->keylen) { if (!s->keylen) {
@ -660,7 +660,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_rl64(pb); avio_rl64(pb);
avio_r8(pb); avio_r8(pb);
avio_r8(pb); avio_r8(pb);
if (url_feof(pb)) if (pb->eof_reached)
return -1; return -1;
asf->data_offset = avio_tell(pb); asf->data_offset = avio_tell(pb);
asf->packet_size_left = 0; asf->packet_size_left = 0;
@ -745,12 +745,12 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
*/ */
if (url_ferror(pb) == AVERROR(EAGAIN)) if (url_ferror(pb) == AVERROR(EAGAIN))
return AVERROR(EAGAIN); return AVERROR(EAGAIN);
if (!url_feof(pb)) if (!pb->eof_reached)
av_log(s, AV_LOG_ERROR, "ff asf bad header %x at:%"PRId64"\n", c, avio_tell(pb)); av_log(s, AV_LOG_ERROR, "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 (!pb->eof_reached)
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 -1; return -1;
} }
@ -886,7 +886,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
ASFStream *asf_st = 0; ASFStream *asf_st = 0;
for (;;) { for (;;) {
int ret; int ret;
if(url_feof(pb)) if(pb->eof_reached)
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_segments < 1) {
@ -1195,7 +1195,7 @@ static void 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, &index_guid)) { while (ff_guidcmp(&g, &index_guid)) {
int64_t gsize= avio_rl64(s->pb); int64_t gsize= avio_rl64(s->pb);
if (gsize < 24 || url_feof(s->pb)) { if (gsize < 24 || s->pb->eof_reached) {
avio_seek(s->pb, current_pos, SEEK_SET); avio_seek(s->pb, current_pos, SEEK_SET);
return; return;
} }

@ -92,7 +92,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
header_remaining= INT_MAX; header_remaining= INT_MAX;
dst[0] = &st->codec->extradata; dst[0] = &st->codec->extradata;
dst[1] = &ass->event_buffer; dst[1] = &ass->event_buffer;
while(!url_feof(pb)){ while(!pb->eof_reached){
uint8_t line[MAX_LINESIZE]; uint8_t line[MAX_LINESIZE];
len = ff_get_line(pb, line, sizeof(line)); len = ff_get_line(pb, line, sizeof(line));

@ -178,7 +178,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(pb->eof_reached)
return -1; return -1;
if(last_pos == pos || pos == base - 8) if(last_pos == pos || pos == base - 8)
@ -195,7 +195,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(pb->eof_reached)
return -1; return -1;
pos = avio_tell(pb); pos = avio_tell(pb);
@ -360,7 +360,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec_type = -1; codec_type = -1;
frame_period = 0; frame_period = 0;
for(;;) { for(;;) {
if (url_feof(pb)) if (pb->eof_reached)
goto fail; goto fail;
tag = avio_rl32(pb); tag = avio_rl32(pb);
size = avio_rl32(pb); size = avio_rl32(pb);
@ -989,7 +989,7 @@ resync:
} }
memset(d, -1, sizeof(int)*8); memset(d, -1, sizeof(int)*8);
for(i=sync=avio_tell(pb); !url_feof(pb); i++) { for(i=sync=avio_tell(pb); !pb->eof_reached; i++) {
int j; int j;
for(j=0; j<7; j++) for(j=0; j<7; j++)
@ -1145,7 +1145,7 @@ static int avi_read_idx1(AVFormatContext *s, int size)
#if defined(DEBUG_SEEK) #if defined(DEBUG_SEEK)
av_log(s, AV_LOG_DEBUG, "%d cum_len=%"PRId64"\n", len, ast->cum_len); av_log(s, AV_LOG_DEBUG, "%d cum_len=%"PRId64"\n", len, ast->cum_len);
#endif #endif
if(url_feof(pb)) if(pb->eof_reached)
return -1; return -1;
if(last_pos == pos) if(last_pos == pos)
@ -1203,7 +1203,7 @@ static int avi_load_index(AVFormatContext *s)
printf("movi_end=0x%"PRIx64"\n", avi->movi_end); printf("movi_end=0x%"PRIx64"\n", avi->movi_end);
#endif #endif
for(;;) { for(;;) {
if (url_feof(pb)) if (pb->eof_reached)
break; break;
tag = avio_rl32(pb); tag = avio_rl32(pb);
size = avio_rl32(pb); size = avio_rl32(pb);

@ -432,6 +432,11 @@ attribute_deprecated int url_fgetc(AVIOContext *s);
/** /**
* @} * @}
*/ */
/**
* @deprecated use AVIOContext.eof_reached
*/
attribute_deprecated int url_feof(AVIOContext *s);
#endif #endif
AVIOContext *avio_alloc_context( AVIOContext *avio_alloc_context(
@ -494,12 +499,6 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
*/ */
int64_t avio_size(AVIOContext *s); int64_t avio_size(AVIOContext *s);
/**
* feof() equivalent for AVIOContext.
* @return non zero if and only if end of file
*/
int url_feof(AVIOContext *s);
int url_ferror(AVIOContext *s); int url_ferror(AVIOContext *s);
int av_url_read_fpause(AVIOContext *h, int pause); int av_url_read_fpause(AVIOContext *h, int pause);

@ -265,12 +265,14 @@ int64_t avio_size(AVIOContext *s)
return size; return size;
} }
#if FF_API_OLD_AVIO
int url_feof(AVIOContext *s) int url_feof(AVIOContext *s)
{ {
if(!s) if(!s)
return 0; return 0;
return s->eof_reached; return s->eof_reached;
} }
#endif
int url_ferror(AVIOContext *s) int url_ferror(AVIOContext *s)
{ {
@ -598,7 +600,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size)
} }
if (size1 == size) { if (size1 == size) {
if (url_ferror(s)) return url_ferror(s); if (url_ferror(s)) return url_ferror(s);
if (url_feof(s)) return AVERROR_EOF; if (s->eof_reached) return AVERROR_EOF;
} }
return size1 - size; return size1 - size;
} }
@ -621,7 +623,7 @@ int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size)
s->buf_ptr += len; s->buf_ptr += len;
if (!len) { if (!len) {
if (url_ferror(s)) return url_ferror(s); if (url_ferror(s)) return url_ferror(s);
if (url_feof(s)) return AVERROR_EOF; if (s->eof_reached) return AVERROR_EOF;
} }
return len; return len;
} }
@ -928,11 +930,11 @@ char *url_fgets(AVIOContext *s, char *buf, int buf_size)
char *q; char *q;
c = avio_r8(s); c = avio_r8(s);
if (url_feof(s)) if (s->eof_reached)
return NULL; return NULL;
q = buf; q = buf;
for(;;) { for(;;) {
if (url_feof(s) || c == '\n') if (s->eof_reached || c == '\n')
break; break;
if ((q - buf) < buf_size - 1) if ((q - buf) < buf_size - 1)
*q++ = c; *q++ = c;

@ -179,7 +179,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 || pb->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
block_type = avio_r8(pb); block_type = avio_r8(pb);

@ -109,7 +109,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 || pb->eof_reached) {
return AVERROR(EIO); return AVERROR(EIO);
} }
@ -117,7 +117,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 (pb->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
state = 256*state + avio_r8(pb); state = 256*state + avio_r8(pb);
} }

@ -219,7 +219,7 @@ static int read_header(AVFormatContext *s,
/* parse each chunk */ /* parse each chunk */
found_data = 0; found_data = 0;
while (!url_feof(pb)) { while (!pb->eof_reached) {
/* 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 */
@ -228,7 +228,7 @@ static int read_header(AVFormatContext *s,
tag = avio_rb32(pb); tag = avio_rb32(pb);
size = avio_rb64(pb); size = avio_rb64(pb);
if (url_feof(pb)) if (pb->eof_reached)
break; break;
switch (tag) { switch (tag) {
@ -307,7 +307,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 (pb->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
/* don't read past end of data chunk */ /* don't read past end of data chunk */

@ -38,7 +38,7 @@ static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {
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 (pb->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
size = avio_rb16(pb); size = avio_rb16(pb);
avio_rb16(pb); // unknown avio_rb16(pb); // unknown

@ -147,7 +147,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) || url_ferror(pb)) if (pb->eof_reached || url_ferror(pb))
return AVERROR(EIO); return AVERROR(EIO);
if (avio_rl32(pb) != 0xAA55AA55) if (avio_rl32(pb) != 0xAA55AA55)

@ -412,7 +412,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 (s->pb->eof_reached) {
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;
} }

@ -104,7 +104,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1; return -1;
ff_get_wav_header(pb, ast->codec, fsize); ff_get_wav_header(pb, ast->codec, fsize);
// find 'data' chunk // find 'data' chunk
while(avio_tell(pb) < c->vidpos && !url_feof(pb)){ while(avio_tell(pb) < c->vidpos && !pb->eof_reached){
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;
@ -162,7 +162,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(!s->pb->eof_reached && c->frames){
avio_read(s->pb, buf, 4); avio_read(s->pb, buf, 4);
switch(AV_RL32(buf)){ switch(AV_RL32(buf)){
case MKTAG('N', 'U', 'L', 'L'): case MKTAG('N', 'U', 'L', 'L'):

@ -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) && inHeader) { while (!pb->eof_reached && inHeader) {
int inSubheader; int inSubheader;
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");
inSubheader = 1; inSubheader = 1;
while (!url_feof(pb) && inSubheader) { while (!pb->eof_reached && inSubheader) {
uint8_t subbyte; uint8_t subbyte;
subbyte = avio_r8(pb); subbyte = avio_r8(pb);

@ -91,7 +91,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 (s->pb->eof_reached) {
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;
} }

@ -48,7 +48,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 (!s->eof_reached && (buf[0] == ';' || buf[0] == '#' || buf[0] == 0));
} }
static AVChapter *read_chapter(AVFormatContext *s) static AVChapter *read_chapter(AVFormatContext *s)
@ -126,7 +126,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
AVMetadata **m = &s->metadata; AVMetadata **m = &s->metadata;
uint8_t line[1024]; uint8_t line[1024];
while(!url_feof(s->pb)) { while(!s->pb->eof_reached) {
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 (s->pb->eof_reached)
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);

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

@ -311,7 +311,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_log(s, AV_LOG_DEBUG, "type:%d, size:%d, dts:%d\n", type, size, dts); // av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, dts:%d\n", type, size, dts);
if (url_feof(s->pb)) if (s->pb->eof_reached)
return AVERROR_EOF; return AVERROR_EOF;
avio_seek(s->pb, 3, SEEK_CUR); /* stream id, always 0 */ avio_seek(s->pb, 3, SEEK_CUR); /* stream id, always 0 */
flags = 0; flags = 0;

@ -368,7 +368,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
#define READ_ONE() \ #define READ_ONE() \
{ \ { \
if (!max_interval-- || url_feof(pb)) \ if (!max_interval-- || pb->eof_reached) \
goto out; \ goto out; \
tmp = tmp << 8 | avio_r8(pb); \ tmp = tmp << 8 | avio_r8(pb); \
} }
@ -422,13 +422,13 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
GXFPktType pkt_type; GXFPktType pkt_type;
int pkt_len; int pkt_len;
while (!url_feof(pb)) { while (!pb->eof_reached) {
AVStream *st; AVStream *st;
int track_type, track_id, ret; int track_type, track_id, ret;
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 (!pb->eof_reached)
av_log(s, AV_LOG_ERROR, "sync lost\n"); av_log(s, AV_LOG_ERROR, "sync lost\n");
return -1; return -1;
} }

@ -227,7 +227,7 @@ static int idcin_read_packet(AVFormatContext *s,
unsigned char r, g, b; unsigned char r, g, b;
unsigned char palette_buffer[768]; unsigned char palette_buffer[768];
if (url_feof(s->pb)) if (s->pb->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
if (idcin->next_chunk_is_video) { if (idcin->next_chunk_is_video) {

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

@ -138,7 +138,7 @@ static int iff_read_header(AVFormatContext *s,
// codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content // codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content
st->codec->codec_tag = avio_rl32(pb); st->codec->codec_tag = avio_rl32(pb);
while(!url_feof(pb)) { while(!pb->eof_reached) {
uint64_t orig_pos; uint64_t orig_pos;
int res; int res;
const char *metadata_tag = NULL; const char *metadata_tag = NULL;

@ -287,7 +287,7 @@ static int 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 (f[0]->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
size[0]= 4096; size[0]= 4096;
} }

@ -225,7 +225,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 (pb->eof_reached)
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)
@ -271,7 +271,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 (pb->eof_reached) {
chunk_type = CHUNK_EOF; chunk_type = CHUNK_EOF;
break; break;
} }
@ -532,7 +532,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 (pb->eof_reached)
return AVERROR_EOF; return AVERROR_EOF;
} }
/* initialize private context members */ /* initialize private context members */

@ -90,7 +90,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 (s->pb->eof_reached)
return AVERROR_EOF; return AVERROR_EOF;
memmove(buf, &buf[1], LXF_IDENT_LENGTH-1); memmove(buf, &buf[1], LXF_IDENT_LENGTH-1);

@ -548,7 +548,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 (!pb->eof_reached) {
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",

@ -266,7 +266,7 @@ static int mmf_read_packet(AVFormatContext *s,
AVStream *st; AVStream *st;
int ret, size; int ret, size;
if (url_feof(s->pb)) if (s->pb->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
st = s->streams[0]; st = s->streams[0];

@ -259,7 +259,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 && !pb->eof_reached) {
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;
@ -2411,7 +2411,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
mov->found_mdat = 0; mov->found_mdat = 0;
if (!url_is_streamed(s->pb) || if (!url_is_streamed(s->pb) ||
mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 || mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 ||
url_feof(s->pb)) s->pb->eof_reached)
return AVERROR_EOF; return AVERROR_EOF;
av_dlog(s, "read fragments, offset 0x%llx\n", avio_tell(s->pb)); av_dlog(s, "read fragments, offset 0x%llx\n", avio_tell(s->pb));
goto retry; goto retry;

@ -200,7 +200,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1; return -1;
} }
while(!url_feof(pb)){ while(!pb->eof_reached){
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)
@ -247,7 +247,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(!s->pb->eof_reached){
pos = avio_tell(s->pb); pos = avio_tell(s->pb);
mpc8_get_chunk_header(s->pb, &tag, &size); mpc8_get_chunk_header(s->pb, &tag, &size);
if (size < 0) if (size < 0)

@ -143,7 +143,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 (pb->eof_reached)
break; break;
v = avio_r8(pb); v = avio_r8(pb);
n--; n--;
@ -253,7 +253,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
last_sync = avio_tell(s->pb); last_sync = avio_tell(s->pb);
//printf("startcode=%x pos=0x%"PRIx64"\n", startcode, avio_tell(s->pb)); //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, avio_tell(s->pb));
if (startcode < 0){ if (startcode < 0){
if(url_feof(s->pb)) if(s->pb->eof_reached)
return AVERROR_EOF; return AVERROR_EOF;
//FIXME we should remember header_state //FIXME we should remember header_state
return AVERROR(EAGAIN); return AVERROR(EAGAIN);

@ -1329,7 +1329,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 (pb->eof_reached)
return -1; return -1;
if (c == 0x47) { if (c == 0x47) {
avio_seek(pb, -1, SEEK_CUR); avio_seek(pb, -1, SEEK_CUR);

@ -88,9 +88,9 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap)
/* 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 && !pb->eof_reached);
if(url_feof(pb)) { if(pb->eof_reached) {
av_log(ctx, AV_LOG_ERROR, "Could not find valid start."); av_log(ctx, AV_LOG_ERROR, "Could not find valid start.");
return -1; return -1;
} }

@ -179,7 +179,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 && !pb->eof_reached; i++) {
b = avio_r8(pb); b = avio_r8(pb);
if (b == key[0]) if (b == key[0])
i = 0; i = 0;
@ -305,7 +305,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
KLVPacket klv; KLVPacket klv;
while (!url_feof(s->pb)) { while (!s->pb->eof_reached) {
if (klv_read_packet(&klv, s->pb) < 0) if (klv_read_packet(&klv, s->pb) < 0)
return -1; return -1;
PRINT_KEY(s, "read packet", klv.key); PRINT_KEY(s, "read packet", klv.key);
@ -914,7 +914,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
} }
avio_seek(s->pb, -14, SEEK_CUR); avio_seek(s->pb, -14, SEEK_CUR);
mxf->fc = s; mxf->fc = s;
while (!url_feof(s->pb)) { while (!s->pb->eof_reached) {
const MXFMetadataReadTableEntry *metadata; const MXFMetadataReadTableEntry *metadata;
if (klv_read_packet(&klv, s->pb) < 0) if (klv_read_packet(&klv, s->pb) < 0)

@ -132,7 +132,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) && !url_ferror(s->pb)){ while (!s->pb->eof_reached && !url_ferror(s->pb)){
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);

@ -66,7 +66,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 (s->pb->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
state = (state<<8) + avio_r8(s->pb); state = (state<<8) + avio_r8(s->pb);
} }

@ -230,7 +230,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 (pb->eof_reached) {
av_dlog(s, "NSV EOF\n"); av_dlog(s, "NSV EOF\n");
nsv->state = NSV_UNSYNC; nsv->state = NSV_UNSYNC;
return -1; return -1;
@ -296,7 +296,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
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 (pb->eof_reached)
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));
@ -331,7 +331,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
} }
av_free(strings); av_free(strings);
} }
if (url_feof(pb)) if (pb->eof_reached)
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));
@ -378,7 +378,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
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 (pb->eof_reached)
return -1; return -1;
nsv->state = NSV_HAS_READ_NSVF; nsv->state = NSV_HAS_READ_NSVF;
return 0; return 0;
@ -554,7 +554,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 (pb->eof_reached)
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++)
@ -588,7 +588,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 (pb->eof_reached)
return -1; return -1;
if (!vsize && !asize) { if (!vsize && !asize) {
nsv->state = NSV_UNSYNC; nsv->state = NSV_UNSYNC;

@ -121,7 +121,7 @@ static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos){
if(pos >= 0) if(pos >= 0)
avio_seek(bc, pos, SEEK_SET); //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 avio_seek(bc, pos, SEEK_SET); //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
while(!url_feof(bc)){ while(!bc->eof_reached){
state= (state<<8) | avio_r8(bc); state= (state<<8) | avio_r8(bc);
if((state>>56) != 'N') if((state>>56) != 'N')
continue; continue;
@ -790,7 +790,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(bc->eof_reached)
return -1; return -1;
if(frame_code == 'N'){ if(frame_code == 'N'){
tmp= frame_code; tmp= frame_code;

@ -60,7 +60,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst,
nuv_frametype frametype; nuv_frametype frametype;
if (!vst && !myth) if (!vst && !myth)
return 1; // no codec data needed return 1; // no codec data needed
while (!url_feof(pb)) { while (!pb->eof_reached) {
int size, subtype; int size, subtype;
frametype = avio_r8(pb); frametype = avio_r8(pb);
switch (frametype) { switch (frametype) {
@ -195,7 +195,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
uint8_t hdr[HDRSIZE]; uint8_t hdr[HDRSIZE];
nuv_frametype frametype; nuv_frametype frametype;
int ret, size; int ret, size;
while (!url_feof(pb)) { while (!pb->eof_reached) {
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);
ret = avio_read(pb, hdr, HDRSIZE); ret = avio_read(pb, hdr, HDRSIZE);

@ -219,7 +219,7 @@ ogg_read_page (AVFormatContext * s, int *str)
break; break;
c = avio_r8(bc); c = avio_r8(bc);
if (url_feof(bc)) if (bc->eof_reached)
return -1; return -1;
sync[sp++ & 3] = c; sync[sp++ & 3] = c;
}while (i++ < MAX_PAGE_SIZE); }while (i++ < MAX_PAGE_SIZE);

@ -241,7 +241,7 @@ static int str_read_packet(AVFormatContext *s,
break; break;
} }
if (url_feof(pb)) if (pb->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
} }
} }

@ -140,7 +140,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(!pb->eof_reached) {
if (c->data_size) { if (c->data_size) {
int pkt_size, ret, mode = avio_r8(pb); int pkt_size, ret, mode = avio_r8(pb);

@ -409,7 +409,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_rb32(pb); /* number of headers */ avio_rb32(pb); /* number of headers */
for(;;) { for(;;) {
if (url_feof(pb)) if (pb->eof_reached)
return -1; return -1;
tag = avio_rl32(pb); tag = avio_rl32(pb);
tag_size = avio_rb32(pb); tag_size = avio_rb32(pb);
@ -515,7 +515,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(!pb->eof_reached){
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){
@ -848,7 +848,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 || s->pb->eof_reached)
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,

@ -235,7 +235,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
int palchange = 0; int palchange = 0;
int pos; int pos;
if (url_feof(s->pb) || smk->cur_frame >= smk->frames) if (s->pb->eof_reached || 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 */

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

@ -127,7 +127,7 @@ static int sox_read_packet(AVFormatContext *s,
{ {
int ret, size; int ret, size;
if (url_feof(s->pb)) if (s->pb->eof_reached)
return AVERROR_EOF; return AVERROR_EOF;
size = SOX_SAMPLES*s->streams[0]->codec->block_align; size = SOX_SAMPLES*s->streams[0]->codec->block_align;

@ -171,7 +171,7 @@ static int 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 (pb->eof_reached)
return AVERROR_EOF; return AVERROR_EOF;
} }

@ -81,7 +81,7 @@ static int srt_read_packet(AVFormatContext *s, AVPacket *pkt)
do { do {
ptr2 = ptr; ptr2 = ptr;
ptr += ff_get_line(s->pb, ptr, sizeof(buffer)+buffer-ptr); ptr += ff_get_line(s->pb, ptr, sizeof(buffer)+buffer-ptr);
} while (!is_eol(*ptr2) && !url_feof(s->pb) && ptr-buffer<sizeof(buffer)-1); } while (!is_eol(*ptr2) && !s->pb->eof_reached && ptr-buffer<sizeof(buffer)-1);
if (buffer[0] && !(res = av_new_packet(pkt, ptr-buffer))) { if (buffer[0] && !(res = av_new_packet(pkt, ptr-buffer))) {
memcpy(pkt->data, buffer, pkt->size); memcpy(pkt->data, buffer, pkt->size);

@ -27,7 +27,7 @@ static int get_swf_tag(AVIOContext *pb, int *len_ptr)
{ {
int tag, len; int tag, len;
if (url_feof(pb)) if (pb->eof_reached)
return -1; return -1;
tag = avio_rl16(pb); tag = avio_rl16(pb);

@ -146,7 +146,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 (pb->eof_reached)
return AVERROR_EOF; return AVERROR_EOF;
ret = av_get_packet(pb, pkt, pkt_size); ret = av_get_packet(pb, pkt, pkt_size);

@ -106,7 +106,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 (avctx->pb->eof_reached)
return AVERROR_EOF; return AVERROR_EOF;
n = s->chars_per_frame; n = s->chars_per_frame;

@ -61,7 +61,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 (s->pb->eof_reached)
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");

@ -92,7 +92,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(pb->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
frame_size = avio_rl24(pb); frame_size = avio_rl24(pb);

@ -155,7 +155,7 @@ static int64_t find_tag(AVIOContext *pb, uint32_t tag1)
int64_t size; int64_t size;
for (;;) { for (;;) {
if (url_feof(pb)) if (pb->eof_reached)
return -1; return -1;
size = next_tag(pb, &tag); size = next_tag(pb, &tag);
if (tag == tag1) if (tag == tag1)
@ -234,7 +234,7 @@ static int wav_read_header(AVFormatContext *s,
av_set_pts_info(st, 64, 1, st->codec->sample_rate); av_set_pts_info(st, 64, 1, st->codec->sample_rate);
for (;;) { for (;;) {
if (url_feof(pb)) if (pb->eof_reached)
return -1; return -1;
size = next_tag(pb, &tag); size = next_tag(pb, &tag);
if (tag == MKTAG('d', 'a', 't', 'a')){ if (tag == MKTAG('d', 'a', 't', 'a')){
@ -269,7 +269,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 (!pb->eof_reached) {
avio_read(pb, guid, 16); avio_read(pb, guid, 16);
size = avio_rl64(pb); size = avio_rl64(pb);
if (size <= 24) if (size <= 24)

@ -157,7 +157,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 (pb->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
} while (fourcc_tag != BRCH_TAG); } while (fourcc_tag != BRCH_TAG);
@ -208,7 +208,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 (pb->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
switch (fourcc_tag) { switch (fourcc_tag) {

@ -79,7 +79,7 @@ static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size)
if (wf->error || url_ferror(pb)) if (wf->error || url_ferror(pb))
return -1; return -1;
if (wf->position >= wf->length || url_feof(pb)) if (wf->position >= wf->length || pb->eof_reached)
return 0; return 0;
buf_size = FFMIN(buf_size, wf->length - wf->position); buf_size = FFMIN(buf_size, wf->length - wf->position);
@ -554,7 +554,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(!pb->eof_reached) {
char key[1024]; char key[1024];
ff_get_guid(pb, &guid); ff_get_guid(pb, &guid);
type = avio_rl32(pb); type = avio_rl32(pb);
@ -770,7 +770,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 (!pb->eof_reached) {
ff_asf_guid g; ff_asf_guid g;
int len, sid, consumed; int len, sid, consumed;
@ -997,7 +997,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
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 (pb->eof_reached)
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);
@ -1011,7 +1011,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
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 (pb->eof_reached)
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;

@ -241,7 +241,7 @@ static int wv_read_packet(AVFormatContext *s,
int ret; int ret;
int size, ver, off; int size, ver, off;
if (url_feof(s->pb)) if (s->pb->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
if(wc->block_parsed){ if(wc->block_parsed){
if(wv_read_block_header(s, s->pb, 0) < 0) if(wv_read_block_header(s, s->pb, 0) < 0)

Loading…
Cancel
Save