vlc | branch: master | Rafaël Carré <[email protected]> | Tue Nov 3 19:06:04 2015 +0100| [99d4a4fd7488c75cb574d5019506d260ad8200cf] | committer: Rafaël Carré
Extract captions from DIRECTV > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=99d4a4fd7488c75cb574d5019506d260ad8200cf --- modules/codec/cc.h | 12 ++++++++++-- modules/packetizer/h264.c | 11 +++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/modules/codec/cc.h b/modules/codec/cc.h index d13bfd2..d92602b 100644 --- a/modules/codec/cc.h +++ b/modules/codec/cc.h @@ -112,6 +112,8 @@ static inline void cc_Extract( cc_data_t *c, bool b_top_field_first, const uint8 { /* CC from DVB/ATSC TS */ i_payload_type = CC_PAYLOAD_GA94; + i_src -= 5; + p_src += 5; } else if( !memcmp( p_cc_dvd, p_src, 4 ) && i_src > 4+1 ) { @@ -128,6 +130,12 @@ static inline void cc_Extract( cc_data_t *c, bool b_top_field_first, const uint8 { i_payload_type = CC_PAYLOAD_SCTE20; } + else if (p_src[0] == 0x03 && p_src[1] == i_src - 2) /* DIRECTV */ + { + i_payload_type = CC_PAYLOAD_GA94; + i_src -= 2; + p_src += 2; + } else { #if 0 @@ -174,13 +182,13 @@ static inline void cc_Extract( cc_data_t *c, bool b_top_field_first, const uint8 * 0x00: field 1 * 0x01: field 2 */ - const uint8_t *cc = &p_src[5]; + const uint8_t *cc = &p_src[0]; const int i_count_cc = cc[0]&0x1f; int i; if( !(cc[0]&0x40) ) // process flag return; - if( i_src < 5 + 1+1 + i_count_cc*3 + 1) // broken packet + if( i_src < 1+1 + i_count_cc*3 + 1) // broken packet return; if( i_count_cc <= 0 ) // no cc present return; diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c index c87a411..7047465 100644 --- a/modules/packetizer/h264.c +++ b/modules/packetizer/h264.c @@ -1058,6 +1058,13 @@ static void ParseSei( decoder_t *p_dec, block_t *p_frag ) 0x00, 0x31, /* US provider code */ 0x47, 0x41, 0x39, 0x34 /* user identifier */ }; + + static const uint8_t p_DIRECTV_data_start_code[] = { + 0xb5, /* United States */ + 0x00, 0x2f, /* US provider code */ + 0x03 /* Captions */ + }; + const unsigned i_t35 = i_size; const uint8_t *p_t35 = &pb_dec[i_used]; @@ -1066,6 +1073,10 @@ static void ParseSei( decoder_t *p_dec, block_t *p_frag ) !memcmp( p_t35, p_DVB1_data_start_code, sizeof(p_DVB1_data_start_code) ) ) { cc_Extract( &p_sys->cc_next, true, &p_t35[3], i_t35 - 3 ); + } else if( i_t35 >= sizeof(p_DIRECTV_data_start_code) && + !memcmp( p_t35, p_DIRECTV_data_start_code, sizeof(p_DIRECTV_data_start_code) ) ) + { + cc_Extract( &p_sys->cc_next, true, &p_t35[3], i_t35 - 3 ); } } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
