# HG changeset patch # User reimar # Date 1333829333 0 # Node ID 02a03e00341ebb91e686b7f5707bd00948cded01 # Parent ca982f21b1e46771cdaa6695f8759f33317a3122 Support EIA-608 captions in MOV. diff -r ca982f21b1e4 -r 02a03e00341e libmpdemux/demux_lavf.c --- a/libmpdemux/demux_lavf.c Sat Apr 07 19:37:11 2012 +0000 +++ b/libmpdemux/demux_lavf.c Sat Apr 07 20:08:53 2012 +0000 @@ -439,6 +439,12 @@ type = 'd'; else if(codec->codec_id == CODEC_ID_HDMV_PGS_SUBTITLE) type = 'p'; +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 14, 100) + else if(codec->codec_id == CODEC_ID_EIA_608) + type = 'c'; +#endif + else if(codec->codec_tag == MKTAG('c', '6', '0', '8')) + type = 'c'; else break; sh_sub = new_sh_sub_sid(demuxer, i, priv->sub_streams, lang ? lang->value : NULL); diff -r ca982f21b1e4 -r 02a03e00341e mpcommon.c --- a/mpcommon.c Sat Apr 07 19:37:11 2012 +0000 +++ b/mpcommon.c Sat Apr 07 20:08:53 2012 +0000 @@ -46,6 +46,7 @@ #include "sub/ass_mp.h" #include "sub/vobsub.h" #include "sub/av_sub.h" +#include "sub/sub_cc.h" #include "libmpcodecs/dec_teletext.h" #include "libavutil/intreadwrite.h" #include "m_option.h" @@ -181,6 +182,7 @@ if (is_av_sub(type)) reset_avsub(d_dvdsub->sh); #endif + subcc_reset(); } // find sub if (subdata) { @@ -240,7 +242,7 @@ if (vo_vobsub || timestamp >= 0) spudec_assemble(vo_spudec, packet, len, timestamp); } - } else if (is_text_sub(type) || is_av_sub(type) || type == 'd') { + } else if (is_text_sub(type) || is_av_sub(type) || type == 'd' || type == 'c') { int orig_type = type; double endpts; if (type == 'd' && !d_dvdsub->demuxer->teletext) { @@ -287,6 +289,10 @@ } continue; } + if (type == 'c') { + subcc_process_data(packet, len); + continue; + } #ifdef CONFIG_ASS if (ass_enabled) { sh_sub_t* sh = d_dvdsub->sh; diff -r ca982f21b1e4 -r 02a03e00341e sub/sub_cc.c --- a/sub/sub_cc.c Sat Apr 07 19:37:11 2012 +0000 +++ b/sub/sub_cc.c Sat Apr 07 20:08:53 2012 +0000 @@ -126,6 +126,13 @@ initialized=1; } +void subcc_reset(void) +{ + if (!initialized) + return; + clear_buffer(&buf1); + clear_buffer(&buf2); +} static void display_buffer(subtitle *buf) { diff -r ca982f21b1e4 -r 02a03e00341e sub/sub_cc.h --- a/sub/sub_cc.h Sat Apr 07 19:37:11 2012 +0000 +++ b/sub/sub_cc.h Sat Apr 07 20:08:53 2012 +0000 @@ -24,6 +24,7 @@ extern int subcc_enabled; void subcc_init(void); +void subcc_reset(void); void subcc_process_data(const uint8_t *inputdata, unsigned int len); void subcc_process_eia708(const uint8_t *data, int len);