Commit e4980db2 authored by Laurent Aimar's avatar Laurent Aimar

Removed non const static variable in TS demuxer.

Please, be careful to NOT commit such hacks.
parent 997f1d45
...@@ -378,6 +378,7 @@ struct demux_sys_t ...@@ -378,6 +378,7 @@ struct demux_sys_t
int64_t i_tdt_delta; int64_t i_tdt_delta;
int64_t i_dvb_start; int64_t i_dvb_start;
int64_t i_dvb_length; int64_t i_dvb_length;
bool b_broken_charset; /* True if broken encoding is used in EPG/SDT */
/* */ /* */
int i_current_program; int i_current_program;
...@@ -393,8 +394,6 @@ struct demux_sys_t ...@@ -393,8 +394,6 @@ struct demux_sys_t
bool b_start_record; bool b_start_record;
}; };
static int i_broken_epg;
static int Demux ( demux_t *p_demux ); static int Demux ( demux_t *p_demux );
static int DemuxFile( demux_t *p_demux ); static int DemuxFile( demux_t *p_demux );
static int Control( demux_t *p_demux, int i_query, va_list args ); static int Control( demux_t *p_demux, int i_query, va_list args );
...@@ -646,6 +645,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -646,6 +645,8 @@ static int Open( vlc_object_t *p_this )
p_sys->i_dvb_start = 0; p_sys->i_dvb_start = 0;
p_sys->i_dvb_length = 0; p_sys->i_dvb_length = 0;
p_sys->b_broken_charset = false;
for( i = 0; i < 8192; i++ ) for( i = 0; i < 8192; i++ )
{ {
ts_pid_t *pid = &p_sys->pid[i]; ts_pid_t *pid = &p_sys->pid[i];
...@@ -2613,7 +2614,8 @@ static void ValidateDVBMeta( demux_t *p_demux, int i_pid ) ...@@ -2613,7 +2614,8 @@ static void ValidateDVBMeta( demux_t *p_demux, int i_pid )
#ifdef TS_USE_DVB_SI #ifdef TS_USE_DVB_SI
/* FIXME same than dvbsi_to_utf8 from dvb access */ /* FIXME same than dvbsi_to_utf8 from dvb access */
static char *EITConvertToUTF8( const unsigned char *psz_instring, static char *EITConvertToUTF8( const unsigned char *psz_instring,
size_t i_length ) size_t i_length,
bool b_broken )
{ {
const char *psz_encoding; const char *psz_encoding;
char *psz_outstring; char *psz_outstring;
...@@ -2626,14 +2628,10 @@ static char *EITConvertToUTF8( const unsigned char *psz_instring, ...@@ -2626,14 +2628,10 @@ static char *EITConvertToUTF8( const unsigned char *psz_instring,
{ {
/* According to ETSI EN 300 468 Annex A, this should be ISO6937, /* According to ETSI EN 300 468 Annex A, this should be ISO6937,
* but some broadcasters use different charset... */ * but some broadcasters use different charset... */
if ( i_broken_epg == 1 ) if( b_broken )
{
psz_encoding = "ISO_8859-1"; psz_encoding = "ISO_8859-1";
}
else else
{
psz_encoding = "ISO_6937"; psz_encoding = "ISO_6937";
}
offset = 0; offset = 0;
} }
...@@ -2781,7 +2779,7 @@ static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t *p_sdt ) ...@@ -2781,7 +2779,7 @@ static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t *p_sdt )
p_sdt->i_ts_id, p_sdt->i_version, p_sdt->b_current_next, p_sdt->i_ts_id, p_sdt->i_version, p_sdt->b_current_next,
p_sdt->i_network_id ); p_sdt->i_network_id );
i_broken_epg = 0; p_sys->b_broken_charset = false;
for( p_srv = p_sdt->p_first_service; p_srv; p_srv = p_srv->p_next ) for( p_srv = p_sdt->p_first_service; p_srv; p_srv = p_srv->p_next )
{ {
...@@ -2830,19 +2828,20 @@ static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t *p_sdt ) ...@@ -2830,19 +2828,20 @@ static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t *p_sdt )
/* Workarounds for broadcasters with broken EPG */ /* Workarounds for broadcasters with broken EPG */
if ( p_sdt->i_network_id == 133 ) if( p_sdt->i_network_id == 133 )
i_broken_epg = 1; /* SKY DE & BetaDigital use ISO8859-1 */ p_sys->b_broken_charset = true; /* SKY DE & BetaDigital use ISO8859-1 */
else if( (pD->i_service_provider_name_length == 4) &&
if ( (pD->i_service_provider_name_length == 4) &&
!strncmp(pD->i_service_provider_name, "CSAT", 4) ) !strncmp(pD->i_service_provider_name, "CSAT", 4) )
i_broken_epg = 1; /* CanalSat FR uses ISO8859-1 */ p_sys->b_broken_charset = true; /* CanalSat FR uses ISO8859-1 */
/* FIXME: Digital+ ES also uses ISO8859-1 */ /* FIXME: Digital+ ES also uses ISO8859-1 */
str1 = EITConvertToUTF8(pD->i_service_provider_name, str1 = EITConvertToUTF8(pD->i_service_provider_name,
pD->i_service_provider_name_length); pD->i_service_provider_name_length,
p_sys->b_broken_charset );
str2 = EITConvertToUTF8(pD->i_service_name, str2 = EITConvertToUTF8(pD->i_service_name,
pD->i_service_name_length); pD->i_service_name_length,
p_sys->b_broken_charset );
msg_Dbg( p_demux, " - type=%d provider=%s name=%s", msg_Dbg( p_demux, " - type=%d provider=%s name=%s",
pD->i_service_type, str1, str2 ); pD->i_service_type, str1, str2 );
...@@ -3001,8 +3000,10 @@ static void EITCallBack( demux_t *p_demux, ...@@ -3001,8 +3000,10 @@ static void EITCallBack( demux_t *p_demux,
if( pE ) if( pE )
{ {
psz_name = EITConvertToUTF8( pE->i_event_name, pE->i_event_name_length); psz_name = EITConvertToUTF8( pE->i_event_name, pE->i_event_name_length,
psz_text = EITConvertToUTF8( pE->i_text, pE->i_text_length ); p_sys->b_broken_charset );
psz_text = EITConvertToUTF8( pE->i_text, pE->i_text_length,
p_sys->b_broken_charset );
msg_Dbg( p_demux, " - short event lang=%3.3s '%s' : '%s'", msg_Dbg( p_demux, " - short event lang=%3.3s '%s' : '%s'",
pE->i_iso_639_code, psz_name, psz_text ); pE->i_iso_639_code, psz_name, psz_text );
} }
...@@ -3018,7 +3019,8 @@ static void EITCallBack( demux_t *p_demux, ...@@ -3018,7 +3019,8 @@ static void EITCallBack( demux_t *p_demux,
if( pE->i_text_length > 0 ) if( pE->i_text_length > 0 )
{ {
char *psz_text = EITConvertToUTF8( pE->i_text, pE->i_text_length ); char *psz_text = EITConvertToUTF8( pE->i_text, pE->i_text_length,
p_sys->b_broken_charset );
if( psz_text ) if( psz_text )
{ {
msg_Dbg( p_demux, " - text='%s'", psz_text ); msg_Dbg( p_demux, " - text='%s'", psz_text );
...@@ -3033,8 +3035,10 @@ static void EITCallBack( demux_t *p_demux, ...@@ -3033,8 +3035,10 @@ static void EITCallBack( demux_t *p_demux,
for( int i = 0; i < pE->i_entry_count; i++ ) for( int i = 0; i < pE->i_entry_count; i++ )
{ {
char *psz_dsc = EITConvertToUTF8( pE->i_item_description[i], char *psz_dsc = EITConvertToUTF8( pE->i_item_description[i],
pE->i_item_description_length[i] ); pE->i_item_description_length[i],
char *psz_itm = EITConvertToUTF8( pE->i_item[i], pE->i_item_length[i] ); p_sys->b_broken_charset );
char *psz_itm = EITConvertToUTF8( pE->i_item[i], pE->i_item_length[i],
p_sys->b_broken_charset );
if( psz_dsc && psz_itm ) if( psz_dsc && psz_itm )
{ {
......
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