#define DUMPSIZE_TEXT N_("Dump buffer size")
#define DUMPSIZE_LONGTEXT N_( \
- "Tweak the buffer size for reading and writing an integer number of packets." \
+ "Tweak the buffer size for reading and writing an integer number of packets. " \
"Specify the size of the buffer here and not the number of packets." )
#define SPLIT_ES_TEXT N_("Separate sub-streams")
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_DEMUX )
- add_string( "ts-extra-pmt", NULL, NULL, PMT_TEXT, PMT_LONGTEXT, true )
- add_bool( "ts-es-id-pid", true, NULL, PID_TEXT, PID_LONGTEXT, true )
- add_string( "ts-out", NULL, NULL, TSOUT_TEXT, TSOUT_LONGTEXT, true )
- add_integer( "ts-out-mtu", 1400, NULL, MTUOUT_TEXT,
+ add_string( "ts-extra-pmt", NULL, PMT_TEXT, PMT_LONGTEXT, true )
+ add_bool( "ts-es-id-pid", true, PID_TEXT, PID_LONGTEXT, true )
+ add_string( "ts-out", NULL, TSOUT_TEXT, TSOUT_LONGTEXT, true )
+ add_integer( "ts-out-mtu", 1400, MTUOUT_TEXT,
MTUOUT_LONGTEXT, true )
- add_string( "ts-csa-ck", NULL, NULL, CSA_TEXT, CSA_LONGTEXT, true )
- add_string( "ts-csa2-ck", NULL, NULL, CSA_TEXT, CSA_LONGTEXT, true )
- add_integer( "ts-csa-pkt", 188, NULL, CPKT_TEXT, CPKT_LONGTEXT, true )
- add_bool( "ts-silent", false, NULL, SILENT_TEXT, SILENT_LONGTEXT, true )
-
- add_file( "ts-dump-file", NULL, NULL, TSDUMP_TEXT, TSDUMP_LONGTEXT, false )
- add_bool( "ts-dump-append", false, NULL, APPEND_TEXT, APPEND_LONGTEXT, false )
- add_integer( "ts-dump-size", 16384, NULL, DUMPSIZE_TEXT,
+ add_string( "ts-csa-ck", NULL, CSA_TEXT, CSA_LONGTEXT, true )
+ add_string( "ts-csa2-ck", NULL, CSA_TEXT, CSA_LONGTEXT, true )
+ add_integer( "ts-csa-pkt", 188, CPKT_TEXT, CPKT_LONGTEXT, true )
+ add_bool( "ts-silent", false, SILENT_TEXT, SILENT_LONGTEXT, true )
+
+ add_savefile( "ts-dump-file", NULL, TSDUMP_TEXT, TSDUMP_LONGTEXT, false )
+ add_bool( "ts-dump-append", false, APPEND_TEXT, APPEND_LONGTEXT, false )
+ add_integer( "ts-dump-size", 16384, DUMPSIZE_TEXT,
DUMPSIZE_LONGTEXT, true )
- add_bool( "ts-split-es", true, NULL, SPLIT_ES_TEXT, SPLIT_ES_LONGTEXT, false )
+ add_bool( "ts-split-es", true, SPLIT_ES_TEXT, SPLIT_ES_LONGTEXT, false )
set_capability( "demux", 10 )
set_callbacks( Open, Close )
p_list = (vlc_list_t *)va_arg( args, vlc_list_t * );
msg_Dbg( p_demux, "DEMUX_SET_GROUP %d %p", i_int, p_list );
- if( i_int > 0 )
+ if( i_int == 0 && p_sys->i_current_program > 0 )
+ i_int = p_sys->i_current_program;
+
+ if( p_sys->i_current_program > 0 )
{
- if( i_int != p_sys->i_current_program )
- {
+ if( p_sys->i_current_program != i_int )
SetPrgFilter( p_demux, p_sys->i_current_program, false );
+ }
+ else if( p_sys->i_current_program < 0 )
+ {
+ for( int i = 0; i < p_sys->programs_list.i_count; i++ )
+ SetPrgFilter( p_demux, p_sys->programs_list.p_values[i].i_int, false );
+ }
- p_sys->i_current_program = i_int;
- SetPrgFilter( p_demux, p_sys->i_current_program, true );
- }
+ if( i_int > 0 )
+ {
+ p_sys->i_current_program = i_int;
+ SetPrgFilter( p_demux, p_sys->i_current_program, true );
}
- else
+ else if( i_int < 0 )
{
p_sys->i_current_program = -1;
p_sys->programs_list.i_count = 0;
{
p_dst->i_count = p_list->i_count;
for( int i = 0; i < p_list->i_count; i++ )
+ {
p_dst->p_values[i] = p_list->p_values[i];
+ SetPrgFilter( p_demux, p_dst->p_values[i].i_int, true );
+ }
}
}
}
if( !b_old_valid )
{
pid->psi = xmalloc( sizeof( ts_psi_t ) );
- if( pid->psi )
- {
- pid->psi->handle = NULL;
- TAB_INIT( pid->psi->i_prg, pid->psi->prg );
- }
+ pid->psi->handle = NULL;
+ TAB_INIT( pid->psi->i_prg, pid->psi->prg );
}
assert( pid->psi );
if( header[0] != 0 || header[1] != 0 || header[2] != 1 )
{
if( !p_demux->p_sys->b_silent )
- msg_Warn( p_demux, "invalid header [0x%x:%x:%x:%x] (pid: %d)",
+ msg_Warn( p_demux, "invalid header [0x%02x:%02x:%02x:%02x] (pid: %d)",
header[0], header[1],header[2],header[3], pid->i_pid );
block_ChainRelease( p_pes );
return;
bool b_broken )
{
const char *psz_encoding;
- char *psz_outstring;
char psz_encbuf[sizeof( "ISO_8859-123" )];
- size_t i_in, i_out, offset = 1;
- vlc_iconv_t iconv_handle;
+ size_t offset = 1;
if( i_length < 1 ) return NULL;
if( psz_instring[0] >= 0x20 )
offset = 0;
}
- i_in = i_length - offset;
- i_out = i_in * 6 + 1;
+ psz_instring += offset;
+ i_length -= offset;
- psz_outstring = malloc( i_out );
- if( !psz_outstring )
- {
- return NULL;
+ char *psz = FromCharset( psz_encoding, psz_instring, i_length );
+ if( psz == NULL )
+ { /* Invalid character set (e.g. ISO_8859-12) */
+ psz = strndup( (const char *)psz_instring, i_length );
+ if( unlikely(psz == NULL) )
+ return NULL;
+ EnsureUTF8( psz );
}
- iconv_handle = vlc_iconv_open( "UTF-8", psz_encoding );
- if( iconv_handle == (vlc_iconv_t)(-1) )
- {
- /* Invalid character set (e.g. ISO_8859-12) */
- memcpy( psz_outstring, &psz_instring[offset], i_in );
- psz_outstring[i_in] = '\0';
- EnsureUTF8( psz_outstring );
- }
- else
+ /* Convert EIT-coded CR/LFs */
+ for(char *p = strstr( psz, "\xc2\x8a" ); p != NULL;
+ p = strstr( p, "\xc2\x8a" ))
{
- const char *psz_in = (const char *)&psz_instring[offset];
- char *psz_out = psz_outstring;
-
- while( vlc_iconv( iconv_handle, &psz_in, &i_in,
- &psz_out, &i_out ) == (size_t)(-1) )
- {
- /* skip naughty byte. This may fail terribly for multibyte stuff,
- * but what can we do anyway? */
- psz_in++;
- i_in--;
- vlc_iconv( iconv_handle, NULL, NULL, NULL, NULL ); /* reset */
- }
- vlc_iconv_close( iconv_handle );
-
- *psz_out = '\0';
-
- /* Convert EIT-coded CR/LFs */
- unsigned char *pbuf = (unsigned char *)psz_outstring;
- for( ; pbuf < (unsigned char *)psz_out ; pbuf++)
- {
- if( pbuf[0] == 0xc2 && pbuf[1] == 0x8a )
- {
- pbuf[0] = ' ';
- pbuf[1] = '\n';
- }
- }
-
-
+ p[0] = ' ';
+ p[1] = '\n';
}
- return psz_outstring;
+ return psz;
}
static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t *p_sdt )
p_srv->b_eit_present, p_srv->i_running_status,
p_srv->b_free_ca );
- if( p_sys->i_current_program != -1 && p_sys->i_current_program != p_srv->i_service_id )
- continue;
-
p_meta = vlc_meta_New();
for( p_dr = p_srv->p_first_descriptor; p_dr; p_dr = p_dr->p_next )
{
vlc_epg_t *p_epg;
msg_Dbg( p_demux, "EITCallBack called" );
- if( !p_eit->b_current_next || ( p_sys->i_current_program != -1 && p_sys->i_current_program != p_eit->i_service_id ) )
+ if( !p_eit->b_current_next )
{
dvbpsi_DeleteEIT( p_eit );
return;
ts_teletext_page_t p_page[2 * 64 + 20];
unsigned i_page = 0;
- /* Gather pages informations */
+ /* Gather pages information */
#if defined _DVBPSI_DR_56_H_ && \
defined DVBPSI_VERSION && DVBPSI_VERSION_INT > ((0<<16)+(1<<8)+5)
for( unsigned i_tag_idx = 0; i_tag_idx < 2; i_tag_idx++ )
switch( p_decoded->code[0].i_audio_type )
{
case 0:
+ pid->es->fmt.i_priority = 1; // prioritize normal audio tracks
pid->es->fmt.psz_description = NULL;
break;
case 1:
/* Set demux filter */
SetPIDFilter( p_demux, prg->i_pid_pcr, true );
}
- else
- {
- msg_Warn( p_demux, "skipping program (not selected)" );
- dvbpsi_DeletePMT(p_pmt);
- return;
- }
/* Parse descriptor */
for( p_dr = p_pmt->p_first_descriptor; p_dr != NULL; p_dr = p_dr->p_next )