Skip to content

Commit

Permalink
avio: deprecate url_ferror
Browse files Browse the repository at this point in the history
AVIOContext.error should be used directly instead.

Signed-off-by: Ronald S. Bultje <[email protected]>
  • Loading branch information
elenril authored and rbultje committed Mar 15, 2011
1 parent 75b9ed0 commit 3e68b3b
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ffplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -2570,7 +2570,7 @@ static int decode_thread(void *arg)
if (ret < 0) {
if (ret == AVERROR_EOF || ic->pb->eof_reached)
eof=1;
if (url_ferror(ic->pb))
if (ic->pb->error)
break;
SDL_Delay(100); /* wait for user event */
continue;
Expand Down
2 changes: 1 addition & 1 deletion libavformat/asfdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
* imply complete -EAGAIN handling support at random positions in
* the stream.
*/
if (url_ferror(pb) == AVERROR(EAGAIN))
if (pb->error == AVERROR(EAGAIN))
return AVERROR(EAGAIN);
if (!pb->eof_reached)
av_log(s, AV_LOG_ERROR, "ff asf bad header %x at:%"PRId64"\n", c, avio_tell(pb));
Expand Down
3 changes: 1 addition & 2 deletions libavformat/avio.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ attribute_deprecated int url_fgetc(AVIOContext *s);
* @deprecated use AVIOContext.eof_reached
*/
attribute_deprecated int url_feof(AVIOContext *s);
attribute_deprecated int url_ferror(AVIOContext *s);
#endif

AVIOContext *avio_alloc_context(
Expand Down Expand Up @@ -499,8 +500,6 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
*/
int64_t avio_size(AVIOContext *s);

int url_ferror(AVIOContext *s);

int av_url_read_fpause(AVIOContext *h, int pause);
int64_t av_url_read_fseek(AVIOContext *h, int stream_index,
int64_t timestamp, int flags);
Expand Down
6 changes: 3 additions & 3 deletions libavformat/aviobuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,14 +272,14 @@ int url_feof(AVIOContext *s)
return 0;
return s->eof_reached;
}
#endif

int url_ferror(AVIOContext *s)
{
if(!s)
return 0;
return s->error;
}
#endif

void avio_wl32(AVIOContext *s, unsigned int val)
{
Expand Down Expand Up @@ -599,7 +599,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size)
}
}
if (size1 == size) {
if (url_ferror(s)) return url_ferror(s);
if (s->error) return s->error;
if (s->eof_reached) return AVERROR_EOF;
}
return size1 - size;
Expand All @@ -622,7 +622,7 @@ int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size)
memcpy(buf, s->buf_ptr, len);
s->buf_ptr += len;
if (!len) {
if (url_ferror(s)) return url_ferror(s);
if (s->error) return s->error;
if (s->eof_reached) return AVERROR_EOF;
}
return len;
Expand Down
2 changes: 1 addition & 1 deletion libavformat/dsicin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 (pb->eof_reached || url_ferror(pb))
if (pb->eof_reached || pb->error)
return AVERROR(EIO);

if (avio_rl32(pb) != 0xAA55AA55)
Expand Down
2 changes: 1 addition & 1 deletion libavformat/mxg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 (!s->pb->eof_reached && !url_ferror(s->pb)){
while (!s->pb->eof_reached && !s->pb->error){
if (mxg->cache_size <= OVERREAD_SIZE) {
/* update internal buffer */
ret = mxg_update_cache(s, DEFAULT_PACKET_SIZE + OVERREAD_SIZE);
Expand Down
2 changes: 1 addition & 1 deletion libavformat/wtv.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size)
AVIOContext *pb = wf->pb_filesystem;
int nread = 0;

if (wf->error || url_ferror(pb))
if (wf->error || pb->error)
return -1;
if (wf->position >= wf->length || pb->eof_reached)
return 0;
Expand Down

0 comments on commit 3e68b3b

Please sign in to comment.