diff options
author | Martin Storsjö <martin@martin.st> | 2014-05-29 17:39:28 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2014-06-04 12:21:10 +0300 |
commit | 95b7fa1729b93bbb3f4fb85a5c0cb53cf970c3c7 (patch) | |
tree | ae9e14a905f5d7cd900678d77ccb4b1d993cec1c /libavformat | |
parent | d5a55981986ac5d1a31aef3a8d16eaff8534a412 (diff) | |
download | ffmpeg-95b7fa1729b93bbb3f4fb85a5c0cb53cf970c3c7.tar.gz |
oggenc: Support flushing the muxer
This allows the caller to write all buffered data to disk, allowing
the caller to know at what byte position in the file a certain
packet starts (any packet written after the flush will be located
after that byte position).
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/oggenc.c | 21 | ||||
-rw-r--r-- | libavformat/version.h | 2 |
2 files changed, 20 insertions, 3 deletions
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index c30315a920..0d8e239e02 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -545,7 +545,7 @@ static int ogg_write_header(AVFormatContext *s) return 0; } -static int ogg_write_packet(AVFormatContext *s, AVPacket *pkt) +static int ogg_write_packet_internal(AVFormatContext *s, AVPacket *pkt) { AVStream *st = s->streams[pkt->stream_index]; OGGStreamContext *oggstream = st->priv_data; @@ -583,6 +583,23 @@ static int ogg_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; } +static int ogg_write_packet(AVFormatContext *s, AVPacket *pkt) +{ + int i; + + if (pkt) + return ogg_write_packet_internal(s, pkt); + + for (i = 0; i < s->nb_streams; i++) { + OGGStreamContext *oggstream = s->streams[i]->priv_data; + if (oggstream->page.segments_count) + ogg_buffer_page(s, oggstream); + } + + ogg_write_pages(s, 2); + return 0; +} + static int ogg_write_trailer(AVFormatContext *s) { int i; @@ -623,6 +640,6 @@ AVOutputFormat ff_ogg_muxer = { .write_header = ogg_write_header, .write_packet = ogg_write_packet, .write_trailer = ogg_write_trailer, - .flags = AVFMT_TS_NEGATIVE, + .flags = AVFMT_TS_NEGATIVE | AVFMT_ALLOW_FLUSH, .priv_class = &ogg_muxer_class, }; diff --git a/libavformat/version.h b/libavformat/version.h index 0a9cb06f79..57970cd250 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -31,7 +31,7 @@ #define LIBAVFORMAT_VERSION_MAJOR 55 #define LIBAVFORMAT_VERSION_MINOR 19 -#define LIBAVFORMAT_VERSION_MICRO 0 +#define LIBAVFORMAT_VERSION_MICRO 1 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ |