Commit 99d4a4fd authored by Rafaël Carré's avatar Rafaël Carré

Extract captions from DIRECTV

parent 24d5b1e1
......@@ -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;
......
......@@ -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 );
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment