From 44d8ec9272ad265aae02b064a0c5f4a80db5a107 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Thu, 16 Aug 2012 18:21:21 +0300 Subject: sd_lavc: use subtitle framework for former av_sub.c code Change libavcodec subtitle decoding code (used for some bitmap subtitle types) to use the same decoding framework as sd_ass. The functionality that was previously in av_sub.c and was directly called from mplayer.c is now in sd_lavc.c. Conflicts: mplayer.c sub/av_sub.h sub/sd_lavc.c Merged from mplayer2. The remaining use of is_av_sub() is replaced by a check whether a subtitle decoder is active, which should give the same results. --- mplayer.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index b17b13c9c3..497517077c 100644 --- a/mplayer.c +++ b/mplayer.c @@ -80,7 +80,6 @@ #include "screenshot.h" #include "sub/sub.h" -#include "sub/av_sub.h" #include "cpudetect.h" #ifdef CONFIG_X11 @@ -587,8 +586,6 @@ static void uninit_subs(struct demuxer *demuxer) struct sh_sub *sh = demuxer->s_streams[i]; if (sh && sh->initialized) sub_uninit(sh); - if (sh && is_av_sub(sh->type)) - reset_avsub(sh); } } @@ -1747,7 +1744,6 @@ double playing_audio_pts(struct MPContext *mpctx) static void reset_subtitles(struct MPContext *mpctx) { struct sh_sub *sh_sub = mpctx->sh_sub; - int type = sh_sub ? sh_sub->type : '\0'; if (sh_sub) sub_reset(sh_sub, mpctx->osd); @@ -1758,8 +1754,6 @@ static void reset_subtitles(struct MPContext *mpctx) spudec_reset(vo_spudec); vo_osd_changed(OSDTYPE_SPU); } - if (sh_sub && is_av_sub(type)) - reset_avsub(sh_sub); } static void update_subtitles(struct MPContext *mpctx, double refpts_tl) @@ -1836,7 +1830,7 @@ static void update_subtitles(struct MPContext *mpctx, double refpts_tl) if (track->vobsub_id_plus_one || timestamp >= 0) spudec_assemble(vo_spudec, packet, len, timestamp); } - } else if (d_sub && (is_text_sub(type) || is_av_sub(type))) { + } else if (d_sub && (is_text_sub(type) || (sh_sub && sh_sub->active))) { if (d_sub->non_interleaved) ds_get_next_pts(d_sub); @@ -1852,13 +1846,6 @@ static void update_subtitles(struct MPContext *mpctx, double refpts_tl) } double duration = d_sub->first->duration; len = ds_get_packet_sub(d_sub, &packet); - if (is_av_sub(type)) { - int ret = decode_avsub(sh_sub, packet, len, subpts_s, duration); - if (ret < 0) - mp_msg(MSGT_SPUDEC, MSGL_WARN, "lavc failed decoding " - "subtitle\n"); - continue; - } if (type == 'm') { if (len < 2) continue; @@ -1869,6 +1856,7 @@ static void update_subtitles(struct MPContext *mpctx, double refpts_tl) sub_decode(sh_sub, mpctx->osd, packet, len, subpts_s, duration); continue; } + // is_text_sub() case if (subpts_s != MP_NOPTS_VALUE) { if (duration < 0) sub_clear_text(&mpctx->subs, MP_NOPTS_VALUE); -- cgit v1.2.3