diff options
author | wm4 <wm4@nowhere> | 2016-08-29 13:13:37 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-08-29 13:15:54 +0200 |
commit | 251ecf6e4b3d4215450a977315afa85f1cb781ab (patch) | |
tree | 1019fc6b12ee67589d8625774c464b42f361a6bf | |
parent | edbb8f6286806945e87afd23f30c409c8774d1df (diff) | |
download | mpv-251ecf6e4b3d4215450a977315afa85f1cb781ab.tar.bz2 mpv-251ecf6e4b3d4215450a977315afa85f1cb781ab.tar.xz |
sd_lavc: always set decoder timebase
Like it's done for audio and video. Just to be uniform.
I'm sorry for deleting the anti-ffmpeg vitriol. It's still all true, but
since we decided to always set the timebase, the crappiness is isolated
to FFmpeg internals.
-rw-r--r-- | sub/sd_lavc.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index 9c217a6936..f310367734 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -123,25 +123,9 @@ static int init(struct sd *sd) if (!ctx) goto error; mp_lavc_set_extradata(ctx, sd->codec->extradata, sd->codec->extradata_size); + priv->pkt_timebase = mp_get_codec_timebase(sd->codec); #if LIBAVCODEC_VERSION_MICRO >= 100 - if (cid == AV_CODEC_ID_HDMV_PGS_SUBTITLE) { - // We don't always want to set this, because the ridiculously shitty - // libavcodec API will mess with certain fields (end_display_time) - // when setting it. On the other hand, PGS in particular needs PTS - // mangling. While the PGS decoder doesn't modify the timestamps (just - // reorder it), the ridiculously shitty libavcodec wants a timebase - // anyway and for no good reason. It always sets end_display_time to - // UINT32_MAX (which is a broken and undocumented way to say "unknown"), - // which coincidentally won't be overridden by the ridiculously shitty - // pkt_timebase code. also, Libav doesn't have the pkt_timebase field, - // because Libav tends to avoid _adding_ ridiculously shitty APIs. - priv->pkt_timebase = (AVRational){1, AV_TIME_BASE}; - ctx->pkt_timebase = priv->pkt_timebase; - } else { - // But old ffmpeg releases have a buggy pkt_timebase check, because the - // shit above wasn't bad enough! - ctx->pkt_timebase = (AVRational){0, 0}; - } + ctx->pkt_timebase = priv->pkt_timebase; #endif if (avcodec_open2(ctx, sub_codec, NULL) < 0) goto error; |