avio: deprecate url_feof

AVIOContext.eof_reached should be used directly instead.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
This commit is contained in:
Anton Khirnov 2011-03-07 21:50:25 +01:00 committed by Ronald S. Bultje
parent 6a7e074eb9
commit 66e5b1df36
64 changed files with 116 additions and 115 deletions

View File

@ -2568,7 +2568,7 @@ static int decode_thread(void *arg)
}
ret = av_read_frame(ic, pkt);
if (ret < 0) {
if (ret == AVERROR_EOF || url_feof(ic->pb))
if (ret == AVERROR_EOF || ic->pb->eof_reached)
eof=1;
if (url_ferror(ic->pb))
break;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -224,7 +224,7 @@ static int parse_playlist(AppleHTTPContext *c, const char *url,
if (var)
free_segment_list(var);
c->finished = 0;
while (!url_feof(in)) {
while (!in->eof_reached) {
read_chomp_line(in, line, sizeof(line));
if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
struct variant_info info = {{0}};
@ -457,7 +457,7 @@ start:
if (var->pb && !var->pkt.data) {
ret = av_read_frame(var->ctx, &var->pkt);
if (ret < 0) {
if (!url_feof(var->pb))
if (!var->pb->eof_reached)
return ret;
reset_packet(&var->pkt);
}

View File

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

View File

@ -639,7 +639,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
continue;
} else if (!ff_guidcmp(&g, &ff_asf_marker_header)) {
asf_read_marker(s, gsize);
} else if (url_feof(pb)) {
} else if (pb->eof_reached) {
return -1;
} else {
if (!s->keylen) {
@ -660,7 +660,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_rl64(pb);
avio_r8(pb);
avio_r8(pb);
if (url_feof(pb))
if (pb->eof_reached)
return -1;
asf->data_offset = avio_tell(pb);
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))
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));
}
if ((c & 0x8f) == 0x82) {
if (d || e) {
if (!url_feof(pb))
if (!pb->eof_reached)
av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n");
return -1;
}
@ -886,7 +886,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
ASFStream *asf_st = 0;
for (;;) {
int ret;
if(url_feof(pb))
if(pb->eof_reached)
return AVERROR_EOF;
if (asf->packet_size_left < FRAME_HEADER_SIZE
|| 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 */
while (ff_guidcmp(&g, &index_guid)) {
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);
return;
}

View File

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

View File

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

View File

@ -432,6 +432,11 @@ attribute_deprecated int url_fgetc(AVIOContext *s);
/**
* @}
*/
/**
* @deprecated use AVIOContext.eof_reached
*/
attribute_deprecated int url_feof(AVIOContext *s);
#endif
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);
/**
* 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 av_url_read_fpause(AVIOContext *h, int pause);

View File

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

View File

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

View File

@ -109,7 +109,7 @@ 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 || pb->eof_reached) {
return AVERROR(EIO);
}
@ -117,7 +117,7 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
if (!bfi->avflag) {
uint32_t state = 0;
while(state != MKTAG('S','A','V','I')){
if (url_feof(pb))
if (pb->eof_reached)
return AVERROR(EIO);
state = 256*state + avio_r8(pb);
}

View File

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

View File

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

View File

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

View File

@ -412,7 +412,7 @@ static int dv_read_header(AVFormatContext *s,
state = avio_rb32(s->pb);
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");
return -1;
}

View File

@ -104,7 +104,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1;
ff_get_wav_header(pb, ast->codec, fsize);
// 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);
fsize = avio_rl32(pb);
if(tag == MKTAG('d', 'a', 't', 'a')) break;
@ -162,7 +162,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(!s->pb->eof_reached && c->frames){
avio_read(s->pb, buf, 4);
switch(AV_RL32(buf)){
case MKTAG('N', 'U', 'L', 'L'):

View File

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

View File

@ -91,7 +91,7 @@ static int ffm_resync(AVFormatContext *s, int state)
{
av_log(s, AV_LOG_ERROR, "resyncing\n");
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");
return -1;
}

View File

@ -48,7 +48,7 @@ static void get_line(AVIOContext *s, uint8_t *buf, int size)
buf[i++] = c;
}
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)
@ -126,7 +126,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
AVMetadata **m = &s->metadata;
uint8_t line[1024];
while(!url_feof(s->pb)) {
while(!s->pb->eof_reached) {
get_line(s->pb, line, sizeof(line));
if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) {

View File

@ -80,7 +80,7 @@ static int read_packet(AVFormatContext *s,
FilmstripDemuxContext *film = s->priv_data;
AVStream *st = s->streams[0];
if (url_feof(s->pb))
if (s->pb->eof_reached)
return AVERROR(EIO);
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);

View File

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

View File

@ -311,7 +311,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
dts = avio_rb24(s->pb);
dts |= avio_r8(s->pb) << 24;
// 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;
avio_seek(s->pb, 3, SEEK_CUR); /* stream id, always 0 */
flags = 0;

View File

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

View File

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

View File

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

View File

@ -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
st->codec->codec_tag = avio_rl32(pb);
while(!url_feof(pb)) {
while(!pb->eof_reached) {
uint64_t orig_pos;
int res;
const char *metadata_tag = NULL;

View File

@ -287,7 +287,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
infer_size(&codec->width, &codec->height, size[0]);
} else {
f[0] = s1->pb;
if (url_feof(f[0]))
if (f[0]->eof_reached)
return AVERROR(EIO);
size[0]= 4096;
}

View File

@ -225,7 +225,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
return chunk_type;
/* read the next chunk, wherever the file happens to be pointing */
if (url_feof(pb))
if (pb->eof_reached)
return CHUNK_EOF;
if (avio_read(pb, chunk_preamble, 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)) {
/* read the next chunk, wherever the file happens to be pointing */
if (url_feof(pb)) {
if (pb->eof_reached) {
chunk_type = CHUNK_EOF;
break;
}
@ -532,7 +532,7 @@ static int ipmovie_read_header(AVFormatContext *s,
while (memcmp(signature_buffer, signature, sizeof(signature))) {
memmove(signature_buffer, signature_buffer + 1, sizeof(signature_buffer) - 1);
signature_buffer[sizeof(signature_buffer) - 1] = avio_r8(pb);
if (url_feof(pb))
if (pb->eof_reached)
return AVERROR_EOF;
}
/* initialize private context members */

View File

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

View File

@ -548,7 +548,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb,
* use it safely here to catch EOS. */
if (!(total = avio_r8(pb))) {
/* we might encounter EOS here */
if (!url_feof(pb)) {
if (!pb->eof_reached) {
int64_t pos = avio_tell(pb);
av_log(matroska->ctx, AV_LOG_ERROR,
"Read error at pos. %"PRIu64" (0x%"PRIx64")\n",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -88,9 +88,9 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap)
/* Some files start with "connected\r\n\r\n".
* 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.");
return -1;
}

View File

@ -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)
{
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);
if (b == key[0])
i = 0;
@ -305,7 +305,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
{
KLVPacket klv;
while (!url_feof(s->pb)) {
while (!s->pb->eof_reached) {
if (klv_read_packet(&klv, s->pb) < 0)
return -1;
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);
mxf->fc = s;
while (!url_feof(s->pb)) {
while (!s->pb->eof_reached) {
const MXFMetadataReadTableEntry *metadata;
if (klv_read_packet(&klv, s->pb) < 0)

View File

@ -132,7 +132,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt)
uint8_t *startmarker_ptr, *end, *search_end, marker;
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) {
/* update internal buffer */
ret = mxg_update_cache(s, DEFAULT_PACKET_SIZE + OVERREAD_SIZE);

View File

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

View File

@ -230,7 +230,7 @@ static int nsv_resync(AVFormatContext *s)
//nsv->state = NSV_UNSYNC;
for (i = 0; i < NSV_MAX_RESYNC; i++) {
if (url_feof(pb)) {
if (pb->eof_reached) {
av_dlog(s, "NSV EOF\n");
nsv->state = NSV_UNSYNC;
return -1;
@ -296,7 +296,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
table_entries_used = avio_rl32(pb);
av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n",
strings_size, table_entries, table_entries_used);
if (url_feof(pb))
if (pb->eof_reached)
return -1;
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);
}
if (url_feof(pb))
if (pb->eof_reached)
return -1;
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) */
if (url_feof(pb))
if (pb->eof_reached)
return -1;
nsv->state = NSV_HAS_READ_NSVF;
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! */
null_chunk_retry:
if (url_feof(pb))
if (pb->eof_reached)
return -1;
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 */
}
if (url_feof(pb))
if (pb->eof_reached)
return -1;
if (!vsize && !asize) {
nsv->state = NSV_UNSYNC;

View File

@ -121,7 +121,7 @@ static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos){
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
while(!url_feof(bc)){
while(!bc->eof_reached){
state= (state<<8) | avio_r8(bc);
if((state>>56) != 'N')
continue;
@ -790,7 +790,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
pos-=8;
}else{
frame_code = avio_r8(bc);
if(url_feof(bc))
if(bc->eof_reached)
return -1;
if(frame_code == 'N'){
tmp= frame_code;

View File

@ -60,7 +60,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst,
nuv_frametype frametype;
if (!vst && !myth)
return 1; // no codec data needed
while (!url_feof(pb)) {
while (!pb->eof_reached) {
int size, subtype;
frametype = avio_r8(pb);
switch (frametype) {
@ -195,7 +195,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
uint8_t hdr[HDRSIZE];
nuv_frametype frametype;
int ret, size;
while (!url_feof(pb)) {
while (!pb->eof_reached) {
int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0;
uint64_t pos = avio_tell(pb);
ret = avio_read(pb, hdr, HDRSIZE);

View File

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

View File

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

View File

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

View File

@ -409,7 +409,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_rb32(pb); /* number of headers */
for(;;) {
if (url_feof(pb))
if (pb->eof_reached)
return -1;
tag = avio_rl32(pb);
tag_size = avio_rb32(pb);
@ -515,7 +515,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
AVStream *st;
uint32_t state=0xFFFFFFFF;
while(!url_feof(pb)){
while(!pb->eof_reached){
int len, num, i;
*pos= avio_tell(pb) - 3;
if(rm->remaining_len > 0){
@ -848,7 +848,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
st = s->streams[i];
}
if(len<0 || url_feof(s->pb))
if(len<0 || s->pb->eof_reached)
return AVERROR(EIO);
res = ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt,

View File

@ -235,7 +235,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
int palchange = 0;
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;
/* if we demuxed all streams, pass another frame */

View File

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

View File

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

View File

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

View File

@ -81,7 +81,7 @@ static int srt_read_packet(AVFormatContext *s, AVPacket *pkt)
do {
ptr2 = 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))) {
memcpy(pkt->data, buffer, pkt->size);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -155,7 +155,7 @@ static int64_t find_tag(AVIOContext *pb, uint32_t tag1)
int64_t size;
for (;;) {
if (url_feof(pb))
if (pb->eof_reached)
return -1;
size = next_tag(pb, &tag);
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);
for (;;) {
if (url_feof(pb))
if (pb->eof_reached)
return -1;
size = next_tag(pb, &tag);
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];
int64_t size;
while (!url_feof(pb)) {
while (!pb->eof_reached) {
avio_read(pb, guid, 16);
size = avio_rl64(pb);
if (size <= 24)

View File

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

View File

@ -79,7 +79,7 @@ static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size)
if (wf->error || url_ferror(pb))
return -1;
if (wf->position >= wf->length || url_feof(pb))
if (wf->position >= wf->length || pb->eof_reached)
return 0;
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;
int length, type;
while(!url_feof(pb)) {
while(!pb->eof_reached) {
char key[1024];
ff_get_guid(pb, &guid);
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;
AVIOContext *pb = wtv->pb;
while (!url_feof(pb)) {
while (!pb->eof_reached) {
ff_asf_guid g;
int len, sid, consumed;
@ -997,7 +997,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
while(1) {
uint64_t timestamp = avio_rl64(pb);
uint64_t frame_nb = avio_rl64(pb);
if (url_feof(pb))
if (pb->eof_reached)
break;
ff_add_index_entry(&wtv->index_entries, &wtv->nb_index_entries, &wtv->index_entries_allocated_size,
0, timestamp, frame_nb, 0, AVINDEX_KEYFRAME);
@ -1011,7 +1011,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
while (1) {
uint64_t frame_nb = avio_rl64(pb);
uint64_t position = avio_rl64(pb);
if (url_feof(pb))
if (pb->eof_reached)
break;
for (i = wtv->nb_index_entries - 1; i >= 0; i--) {
AVIndexEntry *e = wtv->index_entries + i;

View File

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