[FFmpeg-cvslog] lavf: make avio_read_partial() public
wm4
git at videolan.org
Sat Nov 11 15:14:48 EET 2017
ffmpeg | branch: master | wm4 <nfxjfg at googlemail.com> | Thu Aug 17 15:01:44 2017 +0200| [173b56218f39c6463be0e182259e2deead106936] | committer: Luca Barbato
lavf: make avio_read_partial() public
Main use-case is proxying avio through a foreign I/O layer and a custom
AVIO context, without losing latency and performance characteristics.
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=173b56218f39c6463be0e182259e2deead106936
---
doc/APIchanges | 3 +++
libavformat/avio.h | 9 +++++++++
libavformat/avio_internal.h | 8 --------
libavformat/aviobuf.c | 2 +-
libavformat/rawdec.c | 2 +-
libavformat/rtsp.c | 2 +-
libavformat/version.h | 2 +-
7 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 463247f48e..ed90be890d 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2017-03-23
API changes, most recent first:
+2016-xx-xx - xxxxxxx - lavf 58.1.0 - avio.h
+ Add avio_read_partial().
+
2017-xx-xx - xxxxxxx - lavu 56.4.0 - imgutils.h
Add av_image_fill_black().
diff --git a/libavformat/avio.h b/libavformat/avio.h
index e65135ed99..f604c4ad41 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -332,6 +332,15 @@ void avio_flush(AVIOContext *s);
int avio_read(AVIOContext *s, unsigned char *buf, int size);
/**
+ * Read size bytes from AVIOContext into buf. Unlike avio_read(), this is allowed
+ * to read fewer bytes than requested. The missing bytes can be read in the next
+ * call. This always tries to read at least 1 byte.
+ * Useful to reduce latency in certain cases.
+ * @return number of bytes read or AVERROR
+ */
+int avio_read_partial(AVIOContext *s, unsigned char *buf, int size);
+
+/**
* @name Functions for reading from AVIOContext
* @{
*
diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index 8616499867..dda1dad3dd 100644
--- a/libavformat/avio_internal.h
+++ b/libavformat/avio_internal.h
@@ -53,14 +53,6 @@ int ffio_init_context(AVIOContext *s,
*/
int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, const unsigned char **data);
-/**
- * Read size bytes from AVIOContext into buf.
- * This reads at most 1 packet. If that is not enough fewer bytes will be
- * returned.
- * @return number of bytes read or AVERROR
- */
-int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size);
-
void ffio_fill(AVIOContext *s, int b, int count);
static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 31476d3f6d..98e35f776c 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -621,7 +621,7 @@ int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, const unsig
}
}
-int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size)
+int avio_read_partial(AVIOContext *s, unsigned char *buf, int size)
{
int len;
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index 3b1bea6429..a72a53d550 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -42,7 +42,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
pkt->pos= avio_tell(s->pb);
pkt->stream_index = 0;
- ret = ffio_read_partial(s->pb, pkt->data, size);
+ ret = avio_read_partial(s->pb, pkt->data, size);
if (ret < 0) {
av_packet_unref(pkt);
return ret;
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index fb6203d585..17a25a310e 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -2077,7 +2077,7 @@ static int read_packet(AVFormatContext *s,
wait_end && wait_end < av_gettime_relative())
len = AVERROR(EAGAIN);
else
- len = ffio_read_partial(s->pb, rt->recvbuf, RECVBUF_SIZE);
+ len = avio_read_partial(s->pb, rt->recvbuf, RECVBUF_SIZE);
len = pick_stream(s, rtsp_st, rt->recvbuf, len);
if (len > 0 && (*rtsp_st)->transport_priv && rt->transport == RTSP_TRANSPORT_RTP)
ff_rtp_check_and_send_back_rr((*rtsp_st)->transport_priv, NULL, s->pb, len);
diff --git a/libavformat/version.h b/libavformat/version.h
index 7060375c1a..28fb076a31 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFORMAT_VERSION_MAJOR 58
-#define LIBAVFORMAT_VERSION_MINOR 0
+#define LIBAVFORMAT_VERSION_MINOR 1
#define LIBAVFORMAT_VERSION_MICRO 0
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
More information about the ffmpeg-cvslog
mailing list