]> git.sesse.net Git - ffmpeg/commitdiff
lavf: make avio_read_partial() public
authorwm4 <nfxjfg@googlemail.com>
Thu, 17 Aug 2017 13:01:44 +0000 (15:01 +0200)
committerwm4 <nfxjfg@googlemail.com>
Fri, 1 Sep 2017 15:56:33 +0000 (17:56 +0200)
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@gentoo.org>
Merged from Libav commit 173b56218f39c64.

doc/APIchanges
libavformat/avio.h
libavformat/avio_internal.h
libavformat/aviobuf.c
libavformat/rawdec.c
libavformat/rtsp.c
libavformat/version.h

index 1e9b29fdbb92387e397d2ae011d5fb2e3e52bcfb..4effbf936455673a4484cf731f5723338bf9089b 100644 (file)
@@ -15,6 +15,9 @@ libavutil:     2015-08-28
 
 API changes, most recent first:
 
+2017-09-01 - xxxxxxx - lavf 57.81.100 - avio.h
+  Add avio_read_partial().
+
 2017-09-01 - xxxxxxx - lavf 57.80.100 / 57.11.0 - avio.h
   Add avio_context_free(). From now on it must be used for freeing AVIOContext.
 
index 89ad5c04ea3f1d3a3991cb3f187ccf0f4592c1b4..f9c5972adae65d47d29a5cdc9c186694b1ce5f2f 100644 (file)
@@ -598,6 +598,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
  * @{
index fdb323c8f1e5e3b9221ab52215fd0128bc34e5b6..c01835df96fc120904557416e0050eaff493dee7 100644 (file)
@@ -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)
index 716c42eda9c02a1be35946613f0cdc5a15d51cca..636cb46161ad05dae0fbac1397c79c774836e8e4 100644 (file)
@@ -703,7 +703,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;
 
index 876a6e6a7532a21ff9bf1596eaa54b388c215562..e926549a60332c19fd3b2969e6e83530885cf1f0 100644 (file)
@@ -43,7 +43,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;
index 261e970b75a28d69a746db570d0d9452583a7c5d..0bd72dc5ce35201c08c924ac44ffc3dfbb939a64 100644 (file)
@@ -2136,7 +2136,7 @@ redo:
             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);
index 0af524c16bfe433240c7fbfa021e621ab8ce3203..9cca76ee00276f7a1a63c205c74cf95c5789dc85 100644 (file)
@@ -32,7 +32,7 @@
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  57
-#define LIBAVFORMAT_VERSION_MINOR  80
+#define LIBAVFORMAT_VERSION_MINOR  81
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \