History

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.

wm4 committed 9 years ago

Commit 173b5621 parent 5e3f6dc7 files · +16 −12Browse files

Unified · Split

7 files
  1. doc/APIchanges +3 −0
  2. libavformat/avio.h +9 −0
  3. libavformat/avio_internal.h +0 −8
  4. libavformat/aviobuf.c +1 −1
  5. libavformat/rawdec.c +1 −1
  6. libavformat/rtsp.c +1 −1
  7. libavformat/version.h +1 −1
doc/APIchanges+3−0
@@ -13,6 +13,9 @@ libavutil: 2017-03-23 · 12 unmodified lines
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162016-xx-xx - xxxxxxx - lavf 58.1.0 - avio.h
17 Add avio_read_partial().
18
162017-xx-xx - xxxxxxx - lavu 56.4.0 - imgutils.h192017-xx-xx - xxxxxxx - lavu 56.4.0 - imgutils.h
17 Add av_image_fill_black().20 Add av_image_fill_black().
18 21
libavformat/avio.h+9−0
@@ -331,6 +331,15 @@ void avio_flush(AVIOContext *s); · 330 unmodified lines
331 */331 */
332int avio_read(AVIOContext *s, unsigned char *buf, int size);332int avio_read(AVIOContext *s, unsigned char *buf, int size);
333 333
334/**
335 * Read size bytes from AVIOContext into buf. Unlike avio_read(), this is allowed
336 * to read fewer bytes than requested. The missing bytes can be read in the next
337 * call. This always tries to read at least 1 byte.
338 * Useful to reduce latency in certain cases.
339 * @return number of bytes read or AVERROR
340 */
341int avio_read_partial(AVIOContext *s, unsigned char *buf, int size);
342
334/**343/**
335 * @name Functions for reading from AVIOContext344 * @name Functions for reading from AVIOContext
336 * @{345 * @{
libavformat/avio_internal.h+0−8
@@ -53,14 +53,6 @@ int ffio_init_context(AVIOContext *s, · 52 unmodified lines
53 */53 */
54int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, const unsigned char **data);54int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, const unsigned char **data);
55 55
56/**
57 * Read size bytes from AVIOContext into buf.
58 * This reads at most 1 packet. If that is not enough fewer bytes will be
59 * returned.
60 * @return number of bytes read or AVERROR
61 */
62int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size);
63
64void ffio_fill(AVIOContext *s, int b, int count);56void ffio_fill(AVIOContext *s, int b, int count);
65 57
66static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)58static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)
libavformat/aviobuf.c+1−1
@@ -621,7 +621,7 @@ int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, const unsig · 620 unmodified lines
621 }621 }
622}622}
623 623
624int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size)624int avio_read_partial(AVIOContext *s, unsigned char *buf, int size)
625{625{
626 int len;626 int len;
627 627
libavformat/rawdec.c+1−1
@@ -42,7 +42,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) · 41 unmodified lines
42 42
43 pkt->pos= avio_tell(s->pb);43 pkt->pos= avio_tell(s->pb);
44 pkt->stream_index = 0;44 pkt->stream_index = 0;
45 ret = ffio_read_partial(s->pb, pkt->data, size);45 ret = avio_read_partial(s->pb, pkt->data, size);
46 if (ret < 0) {46 if (ret < 0) {
47 av_packet_unref(pkt);47 av_packet_unref(pkt);
48 return ret;48 return ret;
libavformat/rtsp.c+1−1
@@ -2077,7 +2077,7 @@ static int read_packet(AVFormatContext *s, · 2076 unmodified lines
2077 wait_end && wait_end < av_gettime_relative())2077 wait_end && wait_end < av_gettime_relative())
2078 len = AVERROR(EAGAIN);2078 len = AVERROR(EAGAIN);
2079 else2079 else
2080 len = ffio_read_partial(s->pb, rt->recvbuf, RECVBUF_SIZE);2080 len = avio_read_partial(s->pb, rt->recvbuf, RECVBUF_SIZE);
2081 len = pick_stream(s, rtsp_st, rt->recvbuf, len);2081 len = pick_stream(s, rtsp_st, rt->recvbuf, len);
2082 if (len > 0 && (*rtsp_st)->transport_priv && rt->transport == RTSP_TRANSPORT_RTP)2082 if (len > 0 && (*rtsp_st)->transport_priv && rt->transport == RTSP_TRANSPORT_RTP)
2083 ff_rtp_check_and_send_back_rr((*rtsp_st)->transport_priv, NULL, s->pb, len);2083 ff_rtp_check_and_send_back_rr((*rtsp_st)->transport_priv, NULL, s->pb, len);
libavformat/version.h+1−1
@@ -30,7 +30,7 @@ · 29 unmodified lines
30#include "libavutil/version.h"30#include "libavutil/version.h"
31 31
32#define LIBAVFORMAT_VERSION_MAJOR 5832#define LIBAVFORMAT_VERSION_MAJOR 58
33#define LIBAVFORMAT_VERSION_MINOR 033#define LIBAVFORMAT_VERSION_MINOR 1
34#define LIBAVFORMAT_VERSION_MICRO 034#define LIBAVFORMAT_VERSION_MICRO 0
35 35
36#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \36#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t