[FFmpeg-cvslog] r20330 - in trunk/libavformat: avio.h aviobuf.c
benoit
subversion
Tue Oct 20 08:40:01 CEST 2009
Author: benoit
Date: Tue Oct 20 08:40:01 2009
New Revision: 20330
Log:
Make url_resetbuf() assert on wrong flags passed and make it static on next
version bump.
See thread: [FFmpeg-devel] & vs. &&
Date: Mon, 12 Oct 2009 14:21:06 +0200
Modified:
trunk/libavformat/avio.h
trunk/libavformat/aviobuf.c
Modified: trunk/libavformat/avio.h
==============================================================================
--- trunk/libavformat/avio.h Tue Oct 20 01:22:23 2009 (r20329)
+++ trunk/libavformat/avio.h Tue Oct 20 08:40:01 2009 (r20330)
@@ -333,11 +333,13 @@ int url_fdopen(ByteIOContext **s, URLCon
/** @warning must be called before any I/O */
int url_setbufsize(ByteIOContext *s, int buf_size);
+#if LIBAVFORMAT_VERSION_MAJOR < 53
/** Reset the buffer for reading or writing.
* @note Will drop any data currently in the buffer without transmitting it.
* @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY
* to set up the buffer for writing. */
int url_resetbuf(ByteIOContext *s, int flags);
+#endif
/** @note when opened as read/write, the buffers are only used for
writing */
Modified: trunk/libavformat/aviobuf.c
==============================================================================
--- trunk/libavformat/aviobuf.c Tue Oct 20 01:22:23 2009 (r20329)
+++ trunk/libavformat/aviobuf.c Tue Oct 20 08:40:01 2009 (r20330)
@@ -28,6 +28,9 @@
#define IO_BUFFER_SIZE 32768
static void fill_buffer(ByteIOContext *s);
+#if LIBAVFORMAT_VERSION_MAJOR >= 53
+static int url_resetbuf(ByteIOContext *s, int flags);
+#endif
int init_put_byte(ByteIOContext *s,
unsigned char *buffer,
@@ -583,11 +586,19 @@ int url_setbufsize(ByteIOContext *s, int
return 0;
}
+#if LIBAVFORMAT_VERSION_MAJOR < 53
int url_resetbuf(ByteIOContext *s, int flags)
+#else
+static int url_resetbuf(ByteIOContext *s, int flags)
+#endif
{
+#if LIBAVFORMAT_VERSION_MAJOR < 53
URLContext *h = s->opaque;
if ((flags & URL_RDWR) || (h && h->flags != flags && !h->flags & URL_RDWR))
return AVERROR(EINVAL);
+#else
+ assert(flags == URL_WRONLY || flags == URL_RDONLY);
+#endif
if (flags & URL_WRONLY) {
s->buf_end = s->buffer + s->buffer_size;
More information about the ffmpeg-cvslog
mailing list