From 966340b31a7bc53e922118da1cd4783d6a06483d Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Wed, 19 Jan 2011 20:13:48 +0200 Subject: subs: use correct font aspect ratio for libass + converted subs Rendering of ASS subtitles tries to be bug compatible with VSFilter and stretches fonts when the video is anamorphic (some scripts try to compensate for this VSFilter behavior, so trying to render them "correctly" would give the wrong result). However this behavior is not appropriate for subtitles we converted to ASS format ourselves for libass rendering, as they certainly don't have VSFilter bug workarounds. Change the code to use different behavior for "native" ASS tracks and converted ones. It's questionable whether the VSFilter-compatible behavior is appropriate for external .ass files either, as there could be anamorphic and non-anamorphic versions of the same video and the bug-compatible behavior can only be correct for one alternative at most. However it's probably better to keep it as a default at least, so that extracting a muxed subtitle track and using that does not give behavior different from the original muxed one. The aspect ratio setting is per ASS_Renderer, and changing it resets libass caches. For that reason this commit adds separate renderer instances to use for the "correct" and "VSFilter bug compatible" cases. --- mplayer.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 00d568b359..90e454961a 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1092,6 +1092,7 @@ void add_subtitles(struct MPContext *mpctx, char *filename, float fps, int noerr struct MPOpts *opts = &mpctx->opts; sub_data *subd = NULL; struct ass_track *asst = NULL; + bool is_native_ass = false; if (filename == NULL || mpctx->set_of_sub_size >= MAX_SUBTITLE_FILES) return; @@ -1103,6 +1104,7 @@ void add_subtitles(struct MPContext *mpctx, char *filename, float fps, int noerr #else asst = ass_read_stream(ass_library, filename, 0); #endif + is_native_ass = asst; if (!asst) { subd = sub_read_file(filename, fps, &mpctx->opts); if (subd) { @@ -1124,6 +1126,7 @@ void add_subtitles(struct MPContext *mpctx, char *filename, float fps, int noerr mpctx->set_of_ass_tracks[mpctx->set_of_sub_size] = asst; mpctx->set_of_subtitles[mpctx->set_of_sub_size] = subd; + mpctx->track_was_native_ass[mpctx->set_of_sub_size] = is_native_ass; mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_FILE_SUB_ID=%d\n", mpctx->set_of_sub_size); mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_FILE_SUB_FILENAME=%s\n", filename_recode(filename)); -- cgit v1.2.3