[FFmpeg-devel] [PATCH] avio: deprecate url_fgetc and remove all it uses
Anton Khirnov
anton
Sun Mar 6 19:59:29 CET 2011
---
libavformat/avio.h | 6 ++----
libavformat/aviobuf.c | 10 ++++++----
libavformat/mpegts.c | 4 ++--
libavformat/oggdec.c | 10 +++++-----
4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/libavformat/avio.h b/libavformat/avio.h
index b3bcebf..c4a229b 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -427,6 +427,8 @@ attribute_deprecated int64_t url_fsize(AVIOContext *s);
attribute_deprecated int url_feof(AVIOContext *s);
attribute_deprecated int url_ferror(AVIOContext *s);
attribute_deprecated int url_setbufsize(AVIOContext *s, int buf_size);
+#define URL_EOF (-1)
+attribute_deprecated int url_fgetc(AVIOContext *s);
/**
* @}
*/
@@ -504,10 +506,6 @@ 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);
-#define URL_EOF (-1)
-/** @note return URL_EOF (-1) if EOF */
-int url_fgetc(AVIOContext *s);
-
/** @warning currently size is limited */
#ifdef __GNUC__
int url_fprintf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index a7e6f2a..dc575b8 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -551,6 +551,7 @@ int avio_r8(AVIOContext *s)
return 0;
}
+#if FF_API_OLD_AVIO
int url_fgetc(AVIOContext *s)
{
if (s->buf_ptr >= s->buf_end)
@@ -559,6 +560,7 @@ int url_fgetc(AVIOContext *s)
return *s->buf_ptr++;
return URL_EOF;
}
+#endif
int avio_read(AVIOContext *s, unsigned char *buf, int size)
{
@@ -931,16 +933,16 @@ char *url_fgets(AVIOContext *s, char *buf, int buf_size)
int c;
char *q;
- c = url_fgetc(s);
- if (c == EOF)
+ c = avio_r8(s);
+ if (avio_eof(s))
return NULL;
q = buf;
for(;;) {
- if (c == EOF || c == '\n')
+ if (avio_eof(s) || c == '\n')
break;
if ((q - buf) < buf_size - 1)
*q++ = c;
- c = url_fgetc(s);
+ c = avio_r8(s);
}
if (buf_size > 0)
*q = '\0';
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index b1b329e..5bb1234 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1312,8 +1312,8 @@ static int mpegts_resync(AVFormatContext *s)
int c, i;
for(i = 0;i < MAX_RESYNC_SIZE; i++) {
- c = url_fgetc(pb);
- if (c < 0)
+ c = avio_r8(pb);
+ if (avio_eof(pb))
return -1;
if (c == 0x47) {
avio_seek(pb, -1, SEEK_CUR);
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 5d34fab..eef466f 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -218,8 +218,8 @@ ogg_read_page (AVFormatContext * s, int *str)
sync[(sp + 2) & 3] == 'g' && sync[(sp + 3) & 3] == 'S')
break;
- c = url_fgetc (bc);
- if (c < 0)
+ c = avio_r8(bc);
+ if (avio_eof(bc))
return -1;
sync[sp++ & 3] = c;
}while (i++ < MAX_PAGE_SIZE);
@@ -229,15 +229,15 @@ ogg_read_page (AVFormatContext * s, int *str)
return -1;
}
- if (url_fgetc (bc) != 0) /* version */
+ if (avio_r8(bc) != 0) /* version */
return -1;
- flags = url_fgetc (bc);
+ flags = avio_r8(bc);
gp = avio_rl64 (bc);
serial = avio_rl32 (bc);
seq = avio_rl32 (bc);
crc = avio_rl32 (bc);
- nsegs = url_fgetc (bc);
+ nsegs = avio_r8(bc);
idx = ogg_find_stream (ogg, serial);
if (idx < 0){
--
1.7.4.1
More information about the ffmpeg-devel
mailing list