diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index 56377b213e..ab1b659ede 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -118,6 +118,7 @@ static int init(struct sd *sd) if (!ctx) goto error; mp_lavc_set_extradata(ctx, sd->codec->extradata, sd->codec->extradata_size); +#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) @@ -129,11 +130,14 @@ static int init(struct sd *sd) // 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. -#if LIBAVCODEC_VERSION_MICRO >= 100 priv->pkt_timebase = (AVRational){1, AV_TIME_BASE}; ctx->pkt_timebase = priv->pkt_timebase; -#endif + } 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}; } +#endif if (avcodec_open2(ctx, sub_codec, NULL) < 0) goto error; priv->avctx = ctx;