diff options
author | Marton Balint <cus@passwd.hu> | 2017-06-18 14:38:39 +0200 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2017-06-24 18:51:29 +0200 |
commit | 09891c53916224abfb07c91064654189c46d034c (patch) | |
tree | 51af6b9caedb8f3f376abe7f5efec4595b75e8c0 /libavformat/aviobuf.c | |
parent | c14fa7a330f634738003bee731f17ff4c5717228 (diff) |
avformat/aviobuf: add support for specifying minimum packet size and marking flush points
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r-- | libavformat/aviobuf.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index dcb91570d8..7f4e740a33 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -104,6 +104,7 @@ int ffio_init_context(AVIOContext *s, s->eof_reached = 0; s->error = 0; s->seekable = seek ? AVIO_SEEKABLE_NORMAL : 0; + s->min_packet_size = 0; s->max_packet_size = 0; s->update_checksum = NULL; s->short_seek_threshold = SHORT_SEEK_THRESHOLD; @@ -489,6 +490,11 @@ void avio_wb24(AVIOContext *s, unsigned int val) void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type) { + if (type == AVIO_DATA_MARKER_FLUSH_POINT) { + if (s->buf_ptr - s->buffer >= s->min_packet_size) + avio_flush(s); + return; + } if (!s->write_data_type) return; // If ignoring boundary points, just treat it as unknown @@ -941,6 +947,7 @@ int ffio_fdopen(AVIOContext **s, URLContext *h) (*s)->seekable = h->is_streamed ? 0 : AVIO_SEEKABLE_NORMAL; (*s)->max_packet_size = max_packet_size; + (*s)->min_packet_size = h->min_packet_size; if(h->prot) { (*s)->read_pause = io_read_pause; (*s)->read_seek = io_read_seek; |