1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-11 08:37:59 +00:00

sub: add stupid hack for vobsub decoding with Libav

If we detect Libav, always use the old builtin vobsub decoder (in
spudec.c). Note that we do not want to use it for newer ffmpeg, as
spudec.c can't handle the vobsub packets as generated by the .idx
demuxer, and we want to get rid of spudec.c in general anyway.
This commit is contained in:
wm4 2013-01-24 12:25:58 +01:00
parent 458c41c5c7
commit 64b0395e21

View File

@ -29,6 +29,8 @@
#include <libavutil/intreadwrite.h>
#include <libavutil/attributes.h>
#include <libavcodec/version.h>
#include "config.h"
#include "talloc.h"
@ -2014,8 +2016,15 @@ static void reinit_subs(struct MPContext *mpctx)
struct stream *s = track->demuxer ? track->demuxer->stream : NULL;
if (s && s->type == STREAMTYPE_DVD)
set_dvdsub_fake_extradata(mpctx->sh_sub, s, mpctx->sh_video);
// lavc dvdsubdec doesn't read color/resolution on Libav 9.1 and below
// Don't use it for new ffmpeg; spudec can't handle ffmpeg .idx demuxing
// (ffmpeg added .idx demuxing during lavc 54.79.100)
bool broken_lavc = false;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 40, 0)
broken_lavc = true;
#endif
if (mpctx->sh_sub->type == 'v' && track->demuxer
&& track->demuxer->type == DEMUXER_TYPE_MPEG_PS)
&& (track->demuxer->type == DEMUXER_TYPE_MPEG_PS || broken_lavc))
init_vo_spudec(mpctx);
else
sub_init(mpctx->sh_sub, mpctx->osd);