From 3048fae63c990356f850bcabd9bb65a71faf6b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Wed, 2 Jan 2013 06:05:55 +0100 Subject: [PATCH 1/2] build: Avoid detecting bogus components named 'x' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The function find_things() in configure is confused by component registration calls as part of multiline macros defining combined component registration. Coalesce those macros into one line to work around the issue. Signed-off-by: Diego Biurrun Signed-off-by: Martin Storsjö --- libavcodec/allcodecs.c | 4 +--- libavdevice/alldevices.c | 4 +--- libavformat/allformats.c | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 878d3de3bc..5786719692 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -48,9 +48,7 @@ avcodec_register(&ff_##x##_decoder); \ } -#define REGISTER_ENCDEC(X, x) \ - REGISTER_ENCODER(X, x); \ - REGISTER_DECODER(X,x) +#define REGISTER_ENCDEC(X, x) REGISTER_ENCODER(X, x); REGISTER_DECODER(X, x) #define REGISTER_PARSER(X, x) \ { \ diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c index 5d419b0f40..155f7a8ee6 100644 --- a/libavdevice/alldevices.c +++ b/libavdevice/alldevices.c @@ -36,9 +36,7 @@ av_register_input_format(&ff_##x##_demuxer); \ } -#define REGISTER_INOUTDEV(X, x) \ - REGISTER_OUTDEV(X, x); \ - REGISTER_INDEV(X, x) +#define REGISTER_INOUTDEV(X, x) REGISTER_OUTDEV(X, x); REGISTER_INDEV(X, x) void avdevice_register_all(void) { diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 9a5e2b74ef..34cf566b0f 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -39,9 +39,7 @@ av_register_input_format(&ff_##x##_demuxer); \ } -#define REGISTER_MUXDEMUX(X, x) \ - REGISTER_MUXER(X, x); \ - REGISTER_DEMUXER(X,x) +#define REGISTER_MUXDEMUX(X, x) REGISTER_MUXER(X, x); REGISTER_DEMUXER(X, x) #define REGISTER_PROTOCOL(X, x) \ { \ From a0b7e289075dccf223b7f407790d8a86fc5d77e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 1 Jan 2013 22:57:36 +0200 Subject: [PATCH 2/2] aviobuf: Partial support for reading in read/write contexts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So far, aviocontexts are used either in pure-read or pure-write mode - full read/write mode doesn't work well (and implementing it is a much larger, not totally trivial change). This patch allows using avio_read and ffio_read_partial on read/write aviocontexts, where the read operations are passed through directly unbuffered, while writes are buffered as usual. This is enough to support the operations needed by packet based data transfer like in udp/rtp, where aviocontext is the only public API for hooking up custom IO. Signed-off-by: Martin Storsjö --- libavformat/aviobuf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 0da1e0579b..8f3e511fc4 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -452,7 +452,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size) len = s->buf_end - s->buf_ptr; if (len > size) len = size; - if (len == 0) { + if (len == 0 || s->write_flag) { if(size > s->buffer_size && !s->update_checksum){ if(s->read_packet) len = s->read_packet(s->opaque, buf, size); @@ -497,6 +497,13 @@ int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size) if (size < 0) return -1; + if (s->read_packet && s->write_flag) { + len = s->read_packet(s->opaque, buf, size); + if (len > 0) + s->pos += len; + return len; + } + len = s->buf_end - s->buf_ptr; if (len == 0) { fill_buffer(s);