[vlc-commits] hxxx_sei: refactor and pass cc format directly
Francois Cartegnie
git at videolan.org
Thu Nov 17 18:05:45 CET 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Nov 17 10:11:59 2016 +0100| [4473980e931a4e69e289cd85a0dc72b284a9b861] | committer: Francois Cartegnie
hxxx_sei: refactor and pass cc format directly
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4473980e931a4e69e289cd85a0dc72b284a9b861
---
modules/packetizer/hxxx_common.c | 4 +--
modules/packetizer/hxxx_sei.c | 53 +++++++++++++++++++++++-----------------
2 files changed, 32 insertions(+), 25 deletions(-)
diff --git a/modules/packetizer/hxxx_common.c b/modules/packetizer/hxxx_common.c
index 0c5845a..70708a6 100644
--- a/modules/packetizer/hxxx_common.c
+++ b/modules/packetizer/hxxx_common.c
@@ -66,9 +66,9 @@ void cc_storage_reset( cc_storage_t *p_ccs )
}
void cc_storage_append( cc_storage_t *p_ccs, bool b_top_field_first,
- const uint8_t *p_buf, size_t i_buf )
+ const uint8_t *p_buf, size_t i_buf )
{
- cc_ProbeAndExtract( &p_ccs->next, b_top_field_first, p_buf, i_buf );
+ cc_Extract( &p_ccs->next, CC_PAYLOAD_GA94, b_top_field_first, p_buf, i_buf );
}
void cc_storage_commit( cc_storage_t *p_ccs, block_t *p_pic )
diff --git a/modules/packetizer/hxxx_sei.c b/modules/packetizer/hxxx_sei.c
index 04550e5..e83528c 100644
--- a/modules/packetizer/hxxx_sei.c
+++ b/modules/packetizer/hxxx_sei.c
@@ -92,20 +92,7 @@ void HxxxParseSEI(const uint8_t *p_buf, size_t i_buf,
/* Look for user_data_registered_itu_t_t35 */
case HXXX_SEI_USER_DATA_REGISTERED_ITU_T_T35:
{
- /* TS 101 154 Auxiliary Data and H264/AVC video */
- static const uint8_t p_DVB1_data_start_code[] = {
- 0xb5, /* United States */
- 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 */
- };
-
- unsigned i_t35;
+ size_t i_t35;
uint8_t *p_t35 = malloc( i_size );
if( !p_t35 )
break;
@@ -113,16 +100,36 @@ void HxxxParseSEI(const uint8_t *p_buf, size_t i_buf,
for( i_t35 = 0; i_t35<i_size && bs_remain( &s ) >= 8; i_t35++ )
p_t35[i_t35] = bs_read( &s, 8 );
- /* Check for we have DVB1_data() */
- if( ( i_t35 >= sizeof(p_DVB1_data_start_code) &&
- !memcmp( p_t35, p_DVB1_data_start_code, sizeof(p_DVB1_data_start_code) ) ) ||
- ( i_t35 >= sizeof(p_DIRECTV_data_start_code) &&
- !memcmp( p_t35, p_DIRECTV_data_start_code, sizeof(p_DIRECTV_data_start_code) ) ) )
+ /* TS 101 154 Auxiliary Data and H264/AVC video */
+ if( i_t35 > 4 && p_t35[0] == 0xb5 /* United States */ )
{
- sei_data.itu_t35.type = HXXX_ITU_T35_TYPE_CC;
- sei_data.itu_t35.u.cc.i_data = i_t35 - 3;
- sei_data.itu_t35.u.cc.p_data = &p_t35[3];
- b_continue = pf_callback( &sei_data, cbdata );
+ if( p_t35[1] == 0x00 && p_t35[2] == 0x31 && /* US provider code for ATSC / DVB1 */
+ i_t35 > 7 )
+ {
+ switch( VLC_FOURCC(p_t35[3],p_t35[4],p_t35[5],p_t35[6]) )
+ {
+ case VLC_FOURCC('G', 'A', '9', '4'):
+ if( p_t35[7] == 0x03 )
+ {
+ sei_data.itu_t35.type = HXXX_ITU_T35_TYPE_CC;
+ sei_data.itu_t35.u.cc.i_data = i_t35 - 8;
+ sei_data.itu_t35.u.cc.p_data = &p_t35[8];
+ b_continue = pf_callback( &sei_data, cbdata );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ else if( p_t35[1] == 0x00 && p_t35[2] == 0x2f && /* US provider code for DirecTV */
+ p_t35[3] == 0x03 )
+ {
+ /* DirecTV does not use GA94 user_data identifier */
+ sei_data.itu_t35.type = HXXX_ITU_T35_TYPE_CC;
+ sei_data.itu_t35.u.cc.i_data = i_t35 - 4;
+ sei_data.itu_t35.u.cc.p_data = &p_t35[4];
+ b_continue = pf_callback( &sei_data, cbdata );
+ }
}
free( p_t35 );
More information about the vlc-commits
mailing list