mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-27 09:52:17 +00:00
matroskadec: Demux support for SeekPreRoll and CodecDelay
Adds support for demuxing SeekPreRoll and CodecDelay container elements. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
42a8d8aee8
commit
d6f86d74ed
@ -163,6 +163,8 @@ typedef struct {
|
||||
uint64_t default_duration;
|
||||
uint64_t flag_default;
|
||||
uint64_t flag_forced;
|
||||
uint64_t codec_delay;
|
||||
uint64_t seek_preroll;
|
||||
MatroskaTrackVideo video;
|
||||
MatroskaTrackAudio audio;
|
||||
MatroskaTrackOperation operation;
|
||||
@ -410,6 +412,8 @@ 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_CODECDELAY, EBML_UINT, 0, offsetof(MatroskaTrack,codec_delay) },
|
||||
{ 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 },
|
||||
@ -1878,6 +1882,17 @@ 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->codec_delay > 0) {
|
||||
st->codec->delay = av_rescale_q(track->codec_delay,
|
||||
(AVRational){1, 1000000000},
|
||||
(AVRational){1, st->codec->sample_rate});
|
||||
}
|
||||
if (track->seek_preroll > 0) {
|
||||
av_codec_set_seek_preroll(st->codec,
|
||||
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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user