Skip to content

Commit

Permalink
replace calls to url_feof() with avio_feof()
Browse files Browse the repository at this point in the history
Signed-off-by: James Almer <[email protected]>
Signed-off-by: Michael Niedermayer <[email protected]>
  • Loading branch information
jamrial authored and michaelni committed Aug 7, 2014
1 parent 5c3c671 commit d34ec64
Show file tree
Hide file tree
Showing 96 changed files with 160 additions and 160 deletions.
4 changes: 2 additions & 2 deletions ffplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -2824,7 +2824,7 @@ static int read_thread(void *arg)
av_freep(&opts);

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)
seek_by_bytes = !!(ic->iformat->flags & AVFMT_TS_DISCONT) && strcmp("ogg", ic->iformat->name);
Expand Down Expand Up @@ -3013,7 +3013,7 @@ static int read_thread(void *arg)
}
ret = av_read_frame(ic, pkt);
if (ret < 0) {
if (ret == AVERROR_EOF || url_feof(ic->pb))
if (ret == AVERROR_EOF || avio_feof(ic->pb))
eof = 1;
if (ic->pb && ic->pb->error)
break;
Expand Down
2 changes: 1 addition & 1 deletion libavformat/4xm.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ static int fourxm_read_packet(AVFormatContext *s,
return ret;
fourcc_tag = AV_RL32(&header[0]);
size = AV_RL32(&header[4]);
if (url_feof(pb))
if (avio_feof(pb))
return AVERROR(EIO);
switch (fourcc_tag) {
case LIST_TAG:
Expand Down
2 changes: 1 addition & 1 deletion libavformat/adp.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static int adp_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int ret, size = 1024;

if (url_feof(s->pb))
if (avio_feof(s->pb))
return AVERROR_EOF;

ret = av_get_packet(s->pb, pkt, size);
Expand Down
2 changes: 1 addition & 1 deletion libavformat/aiffdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static int get_tag(AVIOContext *pb, uint32_t * tag)
{
int size;

if (url_feof(pb))
if (avio_feof(pb))
return AVERROR(EIO);

*tag = avio_rl32(pb);
Expand Down
2 changes: 1 addition & 1 deletion libavformat/amr.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static int amr_read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t pos = avio_tell(s->pb);
AMRContext *amr = s->priv_data;

if (url_feof(s->pb)) {
if (avio_feof(s->pb)) {
return AVERROR(EIO);
}

Expand Down
2 changes: 1 addition & 1 deletion libavformat/anm.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static int read_packet(AVFormatContext *s,
Page *p;
int tmp, record_size;

if (url_feof(s->pb))
if (avio_feof(s->pb))
return AVERROR(EIO);

if (anm->page < 0)
Expand Down
2 changes: 1 addition & 1 deletion libavformat/ape.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
APEContext *ape = s->priv_data;
uint32_t extra_size = 8;

if (url_feof(s->pb))
if (avio_feof(s->pb))
return AVERROR_EOF;
if (ape->currentframe >= ape->totalframes)
return AVERROR_EOF;
Expand Down
2 changes: 1 addition & 1 deletion libavformat/aqtitledec.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static int aqt_read_header(AVFormatContext *s)
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
st->codec->codec_id = AV_CODEC_ID_TEXT;

while (!url_feof(s->pb)) {
while (!avio_feof(s->pb)) {
char line[4096];
int len = ff_get_line(s->pb, line, sizeof(line));

Expand Down
16 changes: 8 additions & 8 deletions libavformat/asfdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ static int asf_read_header(AVFormatContext *s)
continue;
} else if (!ff_guidcmp(&g, &ff_asf_marker_header)) {
asf_read_marker(s, gsize);
} else if (url_feof(pb)) {
} else if (avio_feof(pb)) {
return AVERROR_EOF;
} else {
if (!s->keylen) {
Expand Down Expand Up @@ -822,7 +822,7 @@ static int asf_read_header(AVFormatContext *s)
avio_rl64(pb);
avio_r8(pb);
avio_r8(pb);
if (url_feof(pb))
if (avio_feof(pb))
return AVERROR_EOF;
asf->data_offset = avio_tell(pb);
asf->packet_size_left = 0;
Expand Down Expand Up @@ -922,20 +922,20 @@ static int asf_get_packet(AVFormatContext *s, AVIOContext *pb)
* the stream. */
if (pb->error == AVERROR(EAGAIN))
return AVERROR(EAGAIN);
if (!url_feof(pb))
if (!avio_feof(pb))
av_log(s, AV_LOG_ERROR,
"ff asf bad header %x at:%"PRId64"\n", c, avio_tell(pb));
}
if ((c & 0x8f) == 0x82) {
if (d || e) {
if (!url_feof(pb))
if (!avio_feof(pb))
av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n");
return AVERROR_INVALIDDATA;
}
c = avio_r8(pb);
d = avio_r8(pb);
rsize += 3;
} else if(!url_feof(pb)) {
} else if(!avio_feof(pb)) {
avio_seek(pb, -1, SEEK_CUR); // FIXME
}

Expand Down Expand Up @@ -1126,7 +1126,7 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
ASFStream *asf_st = 0;
for (;;) {
int ret;
if (url_feof(pb))
if (avio_feof(pb))
return AVERROR_EOF;
if (asf->packet_size_left < FRAME_HEADER_SIZE ||
asf->packet_segments < 1 && asf->packet_time_start == 0) {
Expand Down Expand Up @@ -1494,7 +1494,7 @@ static int asf_build_simple_index(AVFormatContext *s, int stream_index)
* skip them until the simple index object is reached */
while (ff_guidcmp(&g, &ff_asf_simple_index_header)) {
int64_t gsize = avio_rl64(s->pb);
if (gsize < 24 || url_feof(s->pb)) {
if (gsize < 24 || avio_feof(s->pb)) {
goto end;
}
avio_skip(s->pb, gsize - 24);
Expand Down Expand Up @@ -1532,7 +1532,7 @@ static int asf_build_simple_index(AVFormatContext *s, int stream_index)
asf->index_read = ict > 1;
}
end:
// if (url_feof(s->pb)) {
// if (avio_feof(s->pb)) {
// ret = 0;
// }
avio_seek(s->pb, current_pos, SEEK_SET);
Expand Down
2 changes: 1 addition & 1 deletion libavformat/astdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static int ast_read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t pos;
int ret;

if (url_feof(s->pb))
if (avio_feof(s->pb))
return AVERROR_EOF;

pos = avio_tell(s->pb);
Expand Down
12 changes: 6 additions & 6 deletions libavformat/avidec.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num)
#ifdef DEBUG_SEEK
av_log(s, AV_LOG_ERROR, "pos:%"PRId64", len:%X\n", pos, len);
#endif
if (url_feof(pb))
if (avio_feof(pb))
return AVERROR_INVALIDDATA;

if (last_pos == pos || pos == base - 8)
Expand All @@ -237,7 +237,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num)
avio_rl32(pb); /* size */
duration = avio_rl32(pb);

if (url_feof(pb))
if (avio_feof(pb))
return AVERROR_INVALIDDATA;

pos = avio_tell(pb);
Expand Down Expand Up @@ -492,7 +492,7 @@ static int avi_read_header(AVFormatContext *s)
codec_type = -1;
frame_period = 0;
for (;;) {
if (url_feof(pb))
if (avio_feof(pb))
goto fail;
tag = avio_rl32(pb);
size = avio_rl32(pb);
Expand Down Expand Up @@ -1111,7 +1111,7 @@ static int avi_sync(AVFormatContext *s, int exit_early)

start_sync:
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;

for (j = 0; j < 7; j++)
Expand Down Expand Up @@ -1506,7 +1506,7 @@ static int avi_read_idx1(AVFormatContext *s, int size)

/* Read the entries and sort them in each stream component. */
for (i = 0; i < nb_index_entries; i++) {
if (url_feof(pb))
if (avio_feof(pb))
return -1;

tag = avio_rl32(pb);
Expand Down Expand Up @@ -1662,7 +1662,7 @@ static int avi_load_index(AVFormatContext *s)
for (;;) {
tag = avio_rl32(pb);
size = avio_rl32(pb);
if (url_feof(pb))
if (avio_feof(pb))
break;
next = avio_tell(pb) + size + (size & 1);

Expand Down
2 changes: 1 addition & 1 deletion libavformat/bethsoftvid.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ static int vid_read_packet(AVFormatContext *s,
int audio_length;
int ret_value;

if(vid->is_finished || url_feof(pb))
if(vid->is_finished || avio_feof(pb))
return AVERROR_EOF;

block_type = avio_r8(pb);
Expand Down
4 changes: 2 additions & 2 deletions libavformat/bfi.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
BFIContext *bfi = s->priv_data;
AVIOContext *pb = s->pb;
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;
}

/* If all previous chunks were completely read, then find a new one... */
if (!bfi->avflag) {
uint32_t state = 0;
while(state != MKTAG('S','A','V','I')){
if (url_feof(pb))
if (avio_feof(pb))
return AVERROR(EIO);
state = 256*state + avio_r8(pb);
}
Expand Down
2 changes: 1 addition & 1 deletion libavformat/bintext.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ static int read_packet(AVFormatContext *s,
return AVERROR(EIO);
bin->fsize = -1; /* done */
} else if (!bin->fsize) {
if (url_feof(s->pb))
if (avio_feof(s->pb))
return AVERROR(EIO);
if (av_get_packet(s->pb, pkt, bin->chars_per_frame) < 0)
return AVERROR(EIO);
Expand Down
2 changes: 1 addition & 1 deletion libavformat/bit.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static int read_packet(AVFormatContext *s,
int i, j, ret;
int64_t pos= avio_tell(pb);

if(url_feof(pb))
if(avio_feof(pb))
return AVERROR_EOF;

avio_rl16(pb); // sync word
Expand Down
4 changes: 2 additions & 2 deletions libavformat/brstm.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ static int read_header(AVFormatContext *s)
}
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);
size = avio_rb32(s->pb);
if (size < 8) {
Expand Down Expand Up @@ -244,7 +244,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
uint32_t samples, size;
int ret;

if (url_feof(s->pb))
if (avio_feof(s->pb))
return AVERROR_EOF;
b->current_block++;
if (b->current_block == b->block_count) {
Expand Down
6 changes: 3 additions & 3 deletions libavformat/cafdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ static int read_header(AVFormatContext *s)

/* parse each chunk */
found_data = 0;
while (!url_feof(pb)) {
while (!avio_feof(pb)) {

/* stop at data chunk if seeking is not supported or
data chunk size is unknown */
Expand All @@ -251,7 +251,7 @@ static int read_header(AVFormatContext *s)
tag = avio_rb32(pb);
size = avio_rb64(pb);
pos = avio_tell(pb);
if (url_feof(pb))
if (avio_feof(pb))
break;

switch (tag) {
Expand Down Expand Up @@ -339,7 +339,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
int res, pkt_size = 0, pkt_frames = 0;
int64_t left = CAF_MAX_PKT_SIZE;

if (url_feof(pb))
if (avio_feof(pb))
return AVERROR_EOF;

/* don't read past end of data chunk */
Expand Down
2 changes: 1 addition & 1 deletion libavformat/cdxl.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t pos;
int ret;

if (url_feof(pb))
if (avio_feof(pb))
return AVERROR_EOF;

pos = avio_tell(pb);
Expand Down
2 changes: 1 addition & 1 deletion libavformat/dauddec.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static int daud_header(AVFormatContext *s) {
static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
AVIOContext *pb = s->pb;
int ret, size;
if (url_feof(pb))
if (avio_feof(pb))
return AVERROR(EIO);
size = avio_rb16(pb);
avio_rb16(pb); // unknown
Expand Down
2 changes: 1 addition & 1 deletion libavformat/dsicin.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static int cin_read_frame_header(CinDemuxContext *cin, AVIOContext *pb) {
hdr->video_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);

if (avio_rl32(pb) != 0xAA55AA55)
Expand Down
2 changes: 1 addition & 1 deletion libavformat/dtshddec.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static int dtshd_read_header(AVFormatContext *s)
st->codec->codec_id = AV_CODEC_ID_DTS;
st->need_parsing = AVSTREAM_PARSE_FULL_RAW;

while (!url_feof(pb)) {
while (!avio_feof(pb)) {
chunk_type = avio_rb64(pb);
chunk_size = avio_rb64(pb);

Expand Down
2 changes: 1 addition & 1 deletion libavformat/dv.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ static int dv_read_header(AVFormatContext *s)

state = avio_rb32(s->pb);
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");
return -1;
}
Expand Down
4 changes: 2 additions & 2 deletions libavformat/dxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static int dxa_read_header(AVFormatContext *s)
if (ast->codec->sample_rate > 0)
avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
// 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);
fsize = avio_rl32(pb);
if(tag == MKTAG('d', 'a', 't', 'a')) break;
Expand Down Expand Up @@ -170,7 +170,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
}
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) {
av_log(s, AV_LOG_ERROR, "failed reading chunk type\n");
return ret < 0 ? ret : AVERROR_INVALIDDATA;
Expand Down
4 changes: 2 additions & 2 deletions libavformat/electronicarts.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static int process_audio_header_elements(AVFormatContext *s)
ea->sample_rate = -1;
ea->num_channels = 1;

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

Expand Down
Loading

0 comments on commit d34ec64

Please sign in to comment.