1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-15 03:27:35 +00:00

Simplify subtitle handling with -ass

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25884 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2008-01-27 16:36:35 +00:00
parent 4ddc96baae
commit f87af1b8cc

View File

@ -116,20 +116,17 @@ void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, int reset)
packet += 2; packet += 2;
} }
#ifdef USE_ASS #ifdef USE_ASS
if (type == 'a' && ass_enabled) { // ssa/ass subs with libass if (ass_enabled) {
sh_sub_t* sh = d_dvdsub->sh; sh_sub_t* sh = d_dvdsub->sh;
ass_track = sh ? sh->ass_track : NULL; ass_track = sh ? sh->ass_track : NULL;
if (ass_track) if (!ass_track) continue;
if (type == 'a') { // ssa/ass subs with libass
ass_process_chunk(ass_track, packet, len, ass_process_chunk(ass_track, packet, len,
(long long)(pts*1000 + 0.5), (long long)(pts*1000 + 0.5),
(long long)((endpts-pts)*1000 + 0.5)); (long long)((endpts-pts)*1000 + 0.5));
continue; } else { // plaintext subs with libass
}
if ((type == 't' || type == 'm') && ass_enabled) { // plaintext subs with libass
sh_sub_t* sh = d_dvdsub->sh;
ass_track = sh ? sh->ass_track : NULL;
vo_sub = NULL; vo_sub = NULL;
if (ass_track && pts != MP_NOPTS_VALUE) { if (pts != MP_NOPTS_VALUE) {
if (endpts == MP_NOPTS_VALUE) endpts = pts + 3; if (endpts == MP_NOPTS_VALUE) endpts = pts + 3;
sub_clear_text(&subs, MP_NOPTS_VALUE); sub_clear_text(&subs, MP_NOPTS_VALUE);
sub_add_text(&subs, packet, len, endpts); sub_add_text(&subs, packet, len, endpts);
@ -137,6 +134,7 @@ void update_subtitles(sh_video_t *sh_video, demux_stream_t *d_dvdsub, int reset)
subs.end = endpts * 100; subs.end = endpts * 100;
ass_process_subtitle(ass_track, &subs); ass_process_subtitle(ass_track, &subs);
} }
}
continue; continue;
} }
#endif #endif