[FFmpeg-devel] [PATCH 3/3] matroska: Support for SeekPreRoll in the demuxer
Vignesh Venkatasubramanian
vigneshv at google.com
Tue Sep 24 21:05:19 CEST 2013
This patch exports the value of SeekPreRoll container element in
the AVStream structure's seek_preroll field. This indicates the
number of samples to skip after a discontinuity.
Signed-off-by: Vignesh Venkatasubramanian <vigneshv at google.com>
---
libavformat/matroskadec.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index a1b7f56..d94ec46 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -163,6 +163,7 @@ typedef struct {
uint64_t default_duration;
uint64_t flag_default;
uint64_t flag_forced;
+ uint64_t seek_preroll;
MatroskaTrackVideo video;
MatroskaTrackAudio audio;
MatroskaTrackOperation operation;
@@ -410,6 +411,7 @@ static EbmlSyntax matroska_track[] = {
{ MATROSKA_ID_TRACKOPERATION, EBML_NEST, 0, offsetof(MatroskaTrack,operation), {.n=matroska_track_operation} },
{ MATROSKA_ID_TRACKCONTENTENCODINGS,EBML_NEST, 0, 0, {.n=matroska_track_encodings} },
{ MATROSKA_ID_TRACKMAXBLKADDID, EBML_UINT, 0, offsetof(MatroskaTrack,max_block_additional_id) },
+ { MATROSKA_ID_SEEKPREROLL, EBML_UINT, 0, offsetof(MatroskaTrack,seek_preroll) },
{ MATROSKA_ID_TRACKFLAGENABLED, EBML_NONE },
{ MATROSKA_ID_TRACKFLAGLACING, EBML_NONE },
{ MATROSKA_ID_CODECNAME, EBML_NONE },
@@ -1874,6 +1876,11 @@ static int matroska_read_header(AVFormatContext *s)
st->codec->bits_per_coded_sample = track->audio.bitdepth;
if (st->codec->codec_id != AV_CODEC_ID_AAC)
st->need_parsing = AVSTREAM_PARSE_HEADERS;
+ if (track->seek_preroll > 0) {
+ st->seek_preroll = av_rescale_q(track->seek_preroll,
+ (AVRational){1, 1000000000},
+ (AVRational){1, st->codec->sample_rate});
+ }
} else if (codec_id == AV_CODEC_ID_WEBVTT) {
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
--
1.8.4
More information about the ffmpeg-devel
mailing list