matroskadec_haali: parse CodecDelay and SeekPreRoll
This commit is contained in:
parent
a1246dd8ba
commit
0c8a3c12fe
|
@ -1397,6 +1397,12 @@ static void parseTrackEntry(MatroskaFile *mf,ulonglong toplen) {
|
|||
errorjmp(mf,"Track number in TrackOverlay is too large: %d",(int)v);
|
||||
t.TrackOverlay = (unsigned char)v;
|
||||
break;
|
||||
case 0x56aa: // CodecDelay
|
||||
t.CodecDelay = readUInt(mf, (unsigned)len);
|
||||
break;
|
||||
case 0x56bb: // SeekPreRoll
|
||||
t.SeekPreRoll = readUInt(mf, (unsigned)len);
|
||||
break;
|
||||
case 0xe0: // VideoInfo
|
||||
parseVideoInfo(mf,len,&t);
|
||||
break;
|
||||
|
|
|
@ -121,6 +121,8 @@ struct TrackInfo {
|
|||
ulonglong MinCache;
|
||||
ulonglong MaxCache;
|
||||
ulonglong DefaultDuration;
|
||||
ulonglong CodecDelay;
|
||||
ulonglong SeekPreRoll;
|
||||
MKFLOAT TimecodeScale;
|
||||
void *CodecPrivate;
|
||||
unsigned CodecPrivateSize;
|
||||
|
|
|
@ -1170,6 +1170,12 @@ static int mkv_read_header(AVFormatContext *s)
|
|||
st->codec->channels = info->AV.Audio.Channels;
|
||||
if (st->codec->codec_id != AV_CODEC_ID_AAC && st->codec->codec_id != AV_CODEC_ID_MLP && st->codec->codec_id != AV_CODEC_ID_TRUEHD)
|
||||
st->need_parsing = AVSTREAM_PARSE_HEADERS;
|
||||
if (track->info->CodecDelay > 0) {
|
||||
st->codec->delay = av_rescale_q(track->info->CodecDelay, (AVRational){1, 1000000000}, (AVRational){1, st->codec->sample_rate});
|
||||
}
|
||||
if (track->info->SeekPreRoll > 0) {
|
||||
av_codec_set_seek_preroll(st->codec, av_rescale_q(track->info->SeekPreRoll, (AVRational){1, 1000000000}, (AVRational){1, st->codec->sample_rate}));
|
||||
}
|
||||
} else if (info->Type == TT_SUB) {
|
||||
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
|
||||
if (st->codec->codec_id == AV_CODEC_ID_SSA) {
|
||||
|
@ -1543,9 +1549,9 @@ again:
|
|||
|
||||
if (!(flags & FRAME_UNKNOWN_START)) {
|
||||
if (track->ms_compat)
|
||||
pkt->dts = start_time;
|
||||
pkt->dts = start_time - track->info->CodecDelay;
|
||||
else
|
||||
pkt->pts = start_time;
|
||||
pkt->pts = start_time - track->info->CodecDelay;
|
||||
|
||||
if (track->info->Type == TT_SUB)
|
||||
pkt->convergence_duration = end_time - start_time;
|
||||
|
|
Loading…
Reference in New Issue