* Copyright (C) 1998-2003 VideoLAN
*
* Authors: Johan Bilien <jobi@via.ecp.fr>
- * Jean-Paul Saman <saman@natlab.research.philips.com>
+ * Jean-Paul Saman <jpsaman@wxs.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
char * psz_parser;
char * psz_next;
int i_fd = 0;
- unsigned int u_adapter = 1;
- unsigned int u_device = 0;
+ unsigned int u_adapter = 1;
+ unsigned int u_device = 0;
unsigned int u_freq = 0;
unsigned int u_srate = 0;
+ unsigned int u_lnb_lof1;
+ unsigned int u_lnb_lof2;
+ unsigned int u_lnb_slof;
+ int i_bandwidth = 0;
+ int i_modulation = 0;
+ int i_guard = 0;
+ int i_transmission = 0;
+ int i_hierarchy = 0;
vlc_bool_t b_polarisation = 0;
int i_fec = 0;
- fe_code_rate_t fe_fec = FEC_NONE;
+ int i_code_rate_HP = 0;
+ int i_code_rate_LP = 0;
vlc_bool_t b_diseqc;
- vlc_bool_t b_probe;
- int i_lnb_lof1;
- int i_lnb_lof2;
- int i_lnb_slof;
- char dvr[] = DVR;
- char frontend[] = FRONTEND;
- int i_len = 0;
-
+ vlc_bool_t b_probe;
+ char dvr[] = DVR;
+ char frontend[] = FRONTEND;
+ int i_len = 0;
+ vlc_value_t val;
+ int i_test;
+
+
/* parse the options passed in command line : */
psz_parser = strdup( p_input->psz_name );
// Get adapter and device number to use for this dvb card
u_adapter = config_GetInt( p_input, "adapter" );
u_device = config_GetInt( p_input, "device" );
+
+ /* Get antenna configuration options */
+ b_diseqc = config_GetInt( p_input, "diseqc" );
+ u_lnb_lof1 = config_GetInt( p_input, "lnb-lof1" );
+ u_lnb_lof2 = config_GetInt( p_input, "lnb-lof2" );
+ u_lnb_slof = config_GetInt( p_input, "lnb-slof" );
+
+ /*Get modulation parameters*/
+ i_bandwidth = config_GetInt( p_input, "bandwidth");
+ i_code_rate_HP = config_GetInt(p_input, "code-rate-hp");
+ i_code_rate_LP = config_GetInt(p_input, "code-rate-lp");
+ i_modulation = config_GetInt(p_input, "modulation");
+ i_transmission = config_GetInt(p_input, "transmission");
+ i_guard = config_GetInt(p_input, "guard");
+ i_hierarchy = config_GetInt(p_input, "hierarchy");
+
/* Determine frontend device information and capabilities */
b_probe = config_GetInt( p_input, "probe" );
if (b_probe)
- {
+ {
if ( ioctl_InfoFrontend(p_input, &frontend_info, u_adapter, u_device) < 0 )
{
- msg_Err( p_input, "(access) cannot determine frontend info" );
- return -1;
- }
- if (frontend_info.type != FE_QPSK)
- {
- msg_Err( p_input, "frontend not of type satellite" );
+ msg_Err( p_input, "(access) cannot determine frontend info" );
return -1;
}
}
- else /* no frontend probing is done so use default values. */
- {
- int i_len;
-
- msg_Dbg( p_input, "using default values for frontend info" );
- i_len = sizeof(FRONTEND);
- if (snprintf(frontend, sizeof(FRONTEND), FRONTEND, u_adapter, u_device) >= i_len)
- {
- msg_Err( p_input, "snprintf() truncated string for FRONTEND" );
- frontend[sizeof(FRONTEND)] = '\0';
+ else /* no frontend probing is done so use default border values. */
+ {
+ msg_Dbg( p_input, "using default values for frontend info" );
+ i_len = sizeof(FRONTEND);
+ if (snprintf(frontend, sizeof(FRONTEND), FRONTEND, u_adapter, u_device) >= i_len)
+ {
+ msg_Err( p_input, "snprintf() truncated string for FRONTEND" );
+ frontend[sizeof(FRONTEND)] = '\0';
}
- strncpy(frontend_info.name, frontend, 128);
- frontend_info.type = FE_QPSK;
- frontend_info.frequency_max = 12999;
- frontend_info.frequency_min = 10000;
- frontend_info.symbol_rate_max = 30000;
- frontend_info.symbol_rate_min = 1000;
- /* b_polarisation */
+ strncpy(frontend_info.name, frontend, 128);
+
+ msg_Dbg(p_input, "method of access is %s", p_input->psz_access);
+
+ frontend_info.type = FE_QPSK;
+ if (strncmp( p_input->psz_access, "qpsk",4 ) ==0)
+ frontend_info.type = FE_QPSK;
+ else if (strncmp( p_input->psz_access, "cable",5 ) ==0)
+ frontend_info.type = FE_QAM;
+ else if (strncmp( p_input->psz_access, "terrestrial",11) ==0)
+ frontend_info.type = FE_OFDM;
+
+ frontend_info.frequency_max = 12999000; /* KHz */
+ frontend_info.frequency_min = 9750000;
+ frontend_info.symbol_rate_max = 30000000;
+ frontend_info.symbol_rate_min = 1000000;
}
-
+
/* Register Callback functions */
p_input->pf_read = SatelliteRead;
p_input->pf_set_program = SatelliteSetProgram;
p_input->pf_set_area = SatelliteSetArea;
p_input->pf_seek = SatelliteSeek;
- u_freq = (unsigned int)strtol( psz_parser, &psz_next, 10 );
- if( *psz_next )
+ i_test = strtol( psz_parser, &psz_next, 10 );
+ if ( psz_next == psz_parser )
+ {
+ for ( ;; )
+ {
+ if( !strncmp( psz_parser, "frequency=",
+ strlen( "frequency=" ) ) )
+ {
+ u_freq =
+ strtol( psz_parser + strlen( "frequency=" ),
+ &psz_parser, 0 );
+ }
+ else if( !strncmp( psz_parser, "polarization=",
+ strlen( "polarization=" ) ) )
+ {
+ char *psz_parser_init;
+ psz_parser += strlen( "polarization=" );
+ psz_parser_init = psz_parser;
+ while ( *psz_parser != ':')
+ {
+ psz_parser++;
+ }
+ if ((!strncmp( psz_parser_init, "V" ,
+ psz_parser - psz_parser_init ) ) ||
+ (!strncmp( psz_parser_init, "V" ,
+ psz_parser - psz_parser_init ) ) )
+ {
+ b_polarisation = VLC_FALSE;
+ }
+ else if ((!strncmp( psz_parser_init, "H" ,
+ psz_parser - psz_parser_init ) ) ||
+ (!strncmp( psz_parser_init, "h" ,
+ psz_parser - psz_parser_init ) ) )
+
+ {
+ b_polarisation = VLC_TRUE;
+ }
+ }
+ else if( !strncmp( psz_parser, "fec=",
+ strlen( "fec=" ) ) )
+ {
+ i_fec =
+ (int)strtol( psz_parser + strlen( "fec=" ),
+ &psz_parser, 0 );
+ }
+ else if( !strncmp( psz_parser, "srate=",
+ strlen( "srate=" ) ) )
+ {
+ u_srate =
+ (unsigned int)strtol( psz_parser + strlen( "srate=" ),
+ &psz_parser, 0 );
+ }
+ else if( !strncmp( psz_parser, "program=",
+ strlen( "program=" ) ) )
+ {
+ val.i_int = (int)strtol( psz_parser + strlen( "program=" ),
+ &psz_parser, 0 );
+ var_Set( p_input, "program", val );
+ }
+ else if( !strncmp( psz_parser, "diseqc",
+ strlen( "disecq" ) ) )
+ {
+ psz_parser += strlen("disecq");
+ b_diseqc = VLC_TRUE;
+ }
+ else if( !strncmp( psz_parser, "lnb-lof1=",
+ strlen( "lnb-lof1=" ) ) )
+ {
+ u_lnb_lof1 =
+ (unsigned int)strtol( psz_parser + strlen( "lnb_lof1=" ),
+ &psz_parser, 0 );
+ }
+ else if( !strncmp( psz_parser, "lnb-lof2=",
+ strlen( "lnb-lof2=" ) ) )
+ {
+ u_lnb_lof2 =
+ (unsigned int)strtol( psz_parser + strlen( "lnb_lof2=" ),
+ &psz_parser, 0 );
+ }
+ else if( !strncmp( psz_parser, "lnb-slof=",
+ strlen( "lnb-slof=" ) ) )
+ {
+ u_lnb_slof =
+ (unsigned int)strtol( psz_parser + strlen( "lnb_slof=" ),
+ &psz_parser, 0 );
+ }
+ else if( !strncmp( psz_parser, "device=",
+ strlen( "device=" ) ) )
+ {
+ u_device =
+ (unsigned int)strtol( psz_parser + strlen( "device=" ),
+ &psz_parser, 0 );
+ }
+ else if( !strncmp( psz_parser, "adapter=",
+ strlen( "adapter=" ) ) )
+ {
+ u_adapter =
+ (unsigned int)strtol( psz_parser + strlen( "adapter=" ),
+ &psz_parser, 0 );
+ }
+ else if (!strncmp( psz_parser, "modulation=",
+ strlen( "modulation=" ) ) )
+ {
+ i_modulation = (int)strtol( psz_parser + strlen( "modulation=" ),
+ &psz_parser, 0 );
+ }
+ else if (!strncmp( psz_parser, "bandwidth=",
+ strlen( "bandwidth=" ) ) )
+ {
+ i_bandwidth = (int)strtol( psz_parser + strlen( "bandwidth=" ),
+ &psz_parser, 0 );
+ }
+ else if (!strncmp( psz_parser, "guard=",
+ strlen( "guard=" ) ) )
+ {
+ i_guard = (int)strtol( psz_parser + strlen( "guard=" ),
+ &psz_parser, 0 );
+ }
+ else if (!strncmp( psz_parser, "transmission=",
+ strlen( "transmission=" ) ) )
+ {
+ i_transmission = (int)strtol( psz_parser +
+ strlen( "transmission=" ),&psz_parser, 0 );
+ }
+ else if (!strncmp( psz_parser, "hierarchy=",
+ strlen( "hierarchy=" ) ) )
+ {
+ i_hierarchy = (int)strtol( psz_parser +
+ strlen( "hierarchy=" ),&psz_parser, 0 );
+ }
+ else if (!strncmp( psz_parser, "code-rate-HP=",
+ strlen( "code-rate-HP=" ) ) )
+ {
+ i_code_rate_HP = (int)strtol( psz_parser +
+ strlen( "code-rate-HP=" ),&psz_parser, 0 );
+ }
+ else if (!strncmp( psz_parser, "code-rate-LP=",
+ strlen( "code-rate-LP=" ) ) )
+ {
+ i_code_rate_LP = (int)strtol( psz_parser +
+ strlen( "code-rate-LP=" ),&psz_parser, 0 );
+ }
+ else if( !strncmp( psz_parser, "probe",
+ strlen( "probe" ) ) )
+ {
+ psz_parser += strlen("probe");
+ b_probe = VLC_TRUE;
+ }
+ if( *psz_parser )
+ psz_parser++;
+ else
+ break;
+ }
+ }
+ else
{
- psz_parser = psz_next + 1;
- b_polarisation = (vlc_bool_t)strtol( psz_parser, &psz_next, 10 );
+ msg_Warn(p_input,"DVV Input syntax has changed, please see documentation for further informations");
+ u_freq = (unsigned int)i_test;
if( *psz_next )
{
psz_parser = psz_next + 1;
- i_fec = (int)strtol( psz_parser, &psz_next, 10 );
+ b_polarisation = (vlc_bool_t)strtol( psz_parser, &psz_next, 10 );
if( *psz_next )
{
psz_parser = psz_next + 1;
- u_srate = (unsigned int)strtol( psz_parser, &psz_next, 10 );
+ i_fec = (int)strtol( psz_parser, &psz_next, 10 );
+ if( *psz_next )
+ {
+ psz_parser = psz_next + 1;
+ u_srate = (unsigned int)strtol( psz_parser, &psz_next, 10 );
+ }
}
}
}
+ /* Workaround for backwards compatibility */
+ if (strncmp( p_input->psz_access, "satellite",9 ) ==0)
+ {
+ msg_Warn( p_input, "invalid frequency %d possibly in kHz, trying value *1000 Hz", u_freq );
+ u_freq *= 1000;
+ }
+
+ /* Validating input values */
if ( ((u_freq) > frontend_info.frequency_max) ||
((u_freq) < frontend_info.frequency_min) )
{
- msg_Warn( p_input, "invalid frequency %d, using default one", u_freq );
+ msg_Warn( p_input, "invalid frequency %d (Hz), using default one", u_freq );
u_freq = config_GetInt( p_input, "frequency" );
if ( ((u_freq) > frontend_info.frequency_max) ||
((u_freq) < frontend_info.frequency_min) )
}
}
+ /* Workaround for backwards compatibility */
+ if (strncmp( p_input->psz_access, "satellite", 9 ) ==0)
+ {
+ msg_Warn( p_input, "invalid symbol rate %d possibly specified in kHz, trying value *1000 Hz", u_freq );
+ u_srate *= 1000;
+ }
+
if ( ((u_srate) > frontend_info.symbol_rate_max) ||
((u_srate) < frontend_info.symbol_rate_min) )
{
return -1;
}
}
-
- switch( i_fec )
- {
- case 1:
- fe_fec = FEC_1_2;
- break;
- case 2:
- fe_fec = FEC_2_3;
- break;
- case 3:
- fe_fec = FEC_3_4;
- break;
- case 4:
- fe_fec = FEC_4_5;
- break;
- case 5:
- fe_fec = FEC_5_6;
- break;
- case 6:
- fe_fec = FEC_6_7;
- break;
- case 7:
- fe_fec = FEC_7_8;
- break;
- case 8:
- fe_fec = FEC_8_9;
- break;
- case 9:
- fe_fec = FEC_AUTO;
- break;
- default:
- /* cannot happen */
- fe_fec = FEC_NONE;
- msg_Err( p_input, "invalid FEC (unknown)" );
- break;
- }
-
+ /* Setting frontend parameters for tuning the hardware */
switch( frontend_info.type )
{
- case FE_QPSK:
- fep.frequency = u_freq * 1000;
- fep.inversion = INVERSION_AUTO;
- fep.u.qpsk.symbol_rate = u_srate * 1000;
- fep.u.qpsk.fec_inner = fe_fec;
- msg_Dbg( p_input, "satellite frontend found on %s", frontend_info.name );
+ /* DVB-S: satellite and budget cards (nova) */
+ case FE_QPSK:
+ fep.frequency = u_freq; /* KHz */
+ fep.inversion = dvb_DecodeInversion(p_input, (int) b_polarisation);
+ fep.u.qpsk.symbol_rate = u_srate;
+ fep.u.qpsk.fec_inner = dvb_DecodeFEC(p_input, i_fec);
+ msg_Dbg( p_input, "satellite (QPSK) frontend found on %s", frontend_info.name );
break;
- case FE_QAM:
- msg_Dbg( p_input, "cable frontend found on %s", frontend_info.name );
+
+ /* DVB-C */
+ case FE_QAM:
+ fep.frequency = u_freq; /* KHz */
+ fep.inversion = dvb_DecodeInversion(p_input, (int) b_polarisation);
+ fep.u.qam.symbol_rate = u_srate;
+ fep.u.qam.fec_inner = dvb_DecodeFEC(p_input, i_fec);
+ fep.u.qam.modulation = dvb_DecodeModulation(p_input, i_modulation);
+ msg_Dbg( p_input, "cable (QAM) frontend found on %s", frontend_info.name );
break;
+
+ /* DVB-T */
case FE_OFDM:
- msg_Dbg( p_input, "terrestrial frontend found on %s", frontend_info.name );
+ fep.frequency = u_freq; /* KHz */
+ fep.inversion = dvb_DecodeInversion(p_input, (int) b_polarisation);
+ fep.u.ofdm.bandwidth = dvb_DecodeBandwidth(p_input, i_bandwidth);
+ fep.u.ofdm.code_rate_HP = dvb_DecodeFEC(p_input, i_code_rate_HP);
+ fep.u.ofdm.code_rate_LP = dvb_DecodeFEC(p_input, i_code_rate_LP);
+ fep.u.ofdm.constellation = dvb_DecodeModulation(p_input, i_modulation);
+ fep.u.ofdm.transmission_mode = dvb_DecodeTransmission(p_input, i_transmission);
+ fep.u.ofdm.guard_interval = dvb_DecodeGuardInterval(p_input, i_guard);
+ fep.u.ofdm.hierarchy_information = dvb_DecodeHierarchy(p_input, i_hierarchy);
+ msg_Dbg( p_input, "terrestrial (OFDM) frontend found on %s", frontend_info.name );
break;
+
default:
msg_Err( p_input, "Could not determine frontend type on %s", frontend_info.name );
return -1;
p_input->p_access_data = (void *)p_satellite;
/* Open the DVR device */
- i_len = sizeof(DVR);
- if (snprintf(dvr, sizeof(DVR), DVR, u_adapter, u_device) >= i_len)
- {
- msg_Err( p_input, "snprintf() truncated string for DVR" );
- dvr[sizeof(DVR)] = '\0';
+ i_len = sizeof(DVR);
+ if (snprintf(dvr, sizeof(DVR), DVR, u_adapter, u_device) >= i_len)
+ {
+ msg_Err( p_input, "snprintf() truncated string for DVR" );
+ dvr[sizeof(DVR)] = '\0';
}
msg_Dbg( p_input, "opening DVR device '%s'", dvr );
return -1;
}
- /* Get antenna configuration options */
- b_diseqc = config_GetInt( p_input, "diseqc" );
- i_lnb_lof1 = config_GetInt( p_input, "lnb-lof1" );
- i_lnb_lof2 = config_GetInt( p_input, "lnb-lof2" );
- i_lnb_slof = config_GetInt( p_input, "lnb-slof" );
-
/* Initialize the Satellite Card */
- msg_Dbg( p_input, "initializing Sat Card with Freq: %u, Pol: %d, "
- "FEC: %d, Srate: %u", u_freq, b_polarisation, fe_fec, u_srate );
-
- switch (ioctl_SetQPSKFrontend (p_input, fep, b_polarisation, u_adapter, u_device ))
+ switch (ioctl_SetFrontend (p_input, fep, b_polarisation,
+ u_lnb_lof1, u_lnb_lof2, u_lnb_slof,
+ u_adapter, u_device ))
{
case -2:
msg_Err( p_input, "frontend returned an unexpected event" );
msg_Dbg( p_input, "setting filter on PAT" );
- if ( ioctl_SetDMXFilter(p_input, 0, &i_fd, 3, u_adapter, u_device ) < 0 )
+ /* Set Filter on PAT packet */
+ if ( ioctl_SetDMXFilter(p_input, 0, &i_fd, 21, u_adapter, u_device ) < 0 )
{
# ifdef HAVE_ERRNO_H
msg_Err( p_input, "an error occured when setting filter on PAT (%s)", strerror(errno) );
{
input_socket_t * p_access_data = (input_socket_t *)p_input->p_access_data;
ssize_t i_ret;
- unsigned int u_adapter = 1;
- unsigned int u_device = 0;
+ unsigned int u_adapter = 1;
+ unsigned int u_device = 0;
unsigned int i;
// Get adapter and device number to use for this dvb card
{
ioctl_SetDMXFilter(p_input, p_input->stream.pp_programs[i]->pp_es[0]->i_id,
&p_input->stream.pp_programs[i]->pp_es[0]->i_demux_fd,
- 3, u_adapter, u_device );
+ 21, u_adapter, u_device );
}
}
* and makes the appropriate changes to stream structure.
*****************************************************************************/
int SatelliteSetProgram( input_thread_t * p_input,
- pgrm_descriptor_t * p_new_prg )
+ pgrm_descriptor_t * p_new_prg )
{
unsigned int i_es_index;
- unsigned int u_adapter = 1;
- unsigned int u_device = 0;
+ vlc_value_t val;
+ unsigned int u_adapter = 1;
+ unsigned int u_device = 0;
+ unsigned int u_video_type = 1; /* default video type */
+ unsigned int u_audio_type = 2; /* default audio type */
- // Get adapter and device number to use for this dvb card
+ /* Get adapter and device number to use for this dvb card */
u_adapter = config_GetInt( p_input, "adapter" );
u_device = config_GetInt( p_input, "device" );
{
input_UnselectES( p_input , p_es );
}
- if ( p_es->i_demux_fd )
+ if ( p_es->i_demux_fd > 0)
{
ioctl_UnsetDMXFilter(p_input, p_es->i_demux_fd );
p_es->i_demux_fd = 0;
{
case MPEG1_VIDEO_ES:
case MPEG2_VIDEO_ES:
+ case MPEG2_MOTO_VIDEO_ES:
if ( input_SelectES( p_input , p_es ) == 0 )
{
- ioctl_SetDMXFilter(p_input, p_es->i_id, &p_es->i_demux_fd, 1, u_adapter, u_device);
+ ioctl_SetDMXFilter(p_input, p_es->i_id, &p_es->i_demux_fd, u_video_type,
+ u_adapter, u_device);
+ u_video_type += 5;
}
break;
case MPEG1_AUDIO_ES:
case MPEG2_AUDIO_ES:
if ( input_SelectES( p_input , p_es ) == 0 )
{
- ioctl_SetDMXFilter(p_input, p_es->i_id, &p_es->i_demux_fd, 2, u_adapter, u_device);
+ ioctl_SetDMXFilter(p_input, p_es->i_id, &p_es->i_demux_fd, u_audio_type,
+ u_adapter, u_device);
input_SelectES( p_input , p_es );
+ u_audio_type += 5;
}
break;
default:
- ioctl_SetDMXFilter(p_input, p_es->i_id, &p_es->i_demux_fd, 3, u_adapter, u_device);
+ ioctl_SetDMXFilter(p_input, p_es->i_id, &p_es->i_demux_fd, 21, u_adapter, u_device);
input_SelectES( p_input , p_es );
+ msg_Warn(p_input, "ES streamtype 0x%d found used as DMX_PES_OTHER !!",(int) p_es->i_cat);
break;
#undef p_es
}
p_input->stream.p_selected_program = p_new_prg;
+ /* Update the navigation variables without triggering a callback */
+ val.i_int = p_new_prg->i_number;
+ var_Change( p_input, "program", VLC_VAR_SETVALUE, &val, NULL );
+
return 0;
}