Commit 9f3acf60 authored by Rémi Duraffort's avatar Rémi Duraffort

bdagraph: cleaning.

parent 1d0c9675
...@@ -142,12 +142,10 @@ int BDAGraph::SubmitATSCTuneRequest() ...@@ -142,12 +142,10 @@ int BDAGraph::SubmitATSCTuneRequest()
long l_major_channel, l_minor_channel, l_physical_channel; long l_major_channel, l_minor_channel, l_physical_channel;
long l_frequency; long l_frequency;
l_major_channel = l_minor_channel = l_physical_channel = -1; l_major_channel = var_GetInteger( p_access, "dvb-major-channel" );
l_frequency = -1; l_minor_channel = var_GetInteger( p_access, "dvb-minor-channel" );
l_major_channel = var_GetInteger( p_access, "dvb-major-channel" ); l_physical_channel = var_GetInteger( p_access, "dvb-physical-channel" );
l_minor_channel = var_GetInteger( p_access, "dvb-minor-channel" ); l_frequency = var_GetInteger( p_access, "dvb-frequency" );
l_physical_channel = var_GetInteger( p_access, "dvb-physical-channel" );
l_frequency = var_GetInteger( p_access, "dvb-frequency" );
guid_network_type = CLSID_ATSCNetworkProvider; guid_network_type = CLSID_ATSCNetworkProvider;
hr = CreateTuneRequest(); hr = CreateTuneRequest();
...@@ -245,63 +243,81 @@ int BDAGraph::SubmitDVBTTuneRequest() ...@@ -245,63 +243,81 @@ int BDAGraph::SubmitDVBTTuneRequest()
TransmissionMode i_transmission; TransmissionMode i_transmission;
HierarchyAlpha i_hierarchy; HierarchyAlpha i_hierarchy;
l_frequency = l_bandwidth = l_hp_fec = l_lp_fec = l_guard = -1; l_frequency = var_GetInteger( p_access, "dvb-frequency" );
l_transmission = l_hierarchy = -1; l_bandwidth = var_GetInteger( p_access, "dvb-bandwidth" );
l_frequency = var_GetInteger( p_access, "dvb-frequency" ); l_hp_fec = var_GetInteger( p_access, "dvb-code-rate-hp" );
l_bandwidth = var_GetInteger( p_access, "dvb-bandwidth" ); l_lp_fec = var_GetInteger( p_access, "dvb-code-rate-lp" );
l_hp_fec = var_GetInteger( p_access, "dvb-code-rate-hp" ); l_guard = var_GetInteger( p_access, "dvb-guard" );
l_lp_fec = var_GetInteger( p_access, "dvb-code-rate-lp" );
l_guard = var_GetInteger( p_access, "dvb-guard" );
l_transmission = var_GetInteger( p_access, "dvb-transmission" ); l_transmission = var_GetInteger( p_access, "dvb-transmission" );
l_hierarchy = var_GetInteger( p_access, "dvb-hierarchy" ); l_hierarchy = var_GetInteger( p_access, "dvb-hierarchy" );
i_hp_fec = BDA_BCC_RATE_NOT_SET; switch( l_hp_fec )
if( l_hp_fec == 1 ) {
i_hp_fec = BDA_BCC_RATE_1_2; case 1:
if( l_hp_fec == 2 ) i_hp_fec = BDA_BCC_RATE_1_2; break;
i_hp_fec = BDA_BCC_RATE_2_3; case 2:
if( l_hp_fec == 3 ) i_hp_fec = BDA_BCC_RATE_2_3; break;
i_hp_fec = BDA_BCC_RATE_3_4; case 3;
if( l_hp_fec == 4 ) i_hp_fec = BDA_BCC_RATE_3_4; break;
i_hp_fec = BDA_BCC_RATE_5_6; case 4:
if( l_hp_fec == 5 ) i_hp_fec = BDA_BCC_RATE_5_6; break;
i_hp_fec = BDA_BCC_RATE_7_8; case 5:
i_hp_fec = BDA_BCC_RATE_7_8;break;
i_lp_fec = BDA_BCC_RATE_NOT_SET; default:
if( l_lp_fec == 1 ) i_hp_fec = BDA_BCC_RATE_NOT_SET;
i_lp_fec = BDA_BCC_RATE_1_2; }
if( l_lp_fec == 2 )
i_lp_fec = BDA_BCC_RATE_2_3; switch( l_lp_fec )
if( l_lp_fec == 3 ) {
i_lp_fec = BDA_BCC_RATE_3_4; case 1:
if( l_lp_fec == 4 ) i_lp_fec = BDA_BCC_RATE_1_2; break;
i_lp_fec = BDA_BCC_RATE_5_6; case 2:
if( l_lp_fec == 5 ) i_lp_fec = BDA_BCC_RATE_2_3; break;
i_lp_fec = BDA_BCC_RATE_7_8; case 3:
i_lp_fec = BDA_BCC_RATE_3_4; break;
i_guard = BDA_GUARD_NOT_SET; case 4:
if( l_guard == 32 ) i_lp_fec = BDA_BCC_RATE_5_6; break;
i_guard = BDA_GUARD_1_32; case 5:
if( l_guard == 16 ) i_lp_fec = BDA_BCC_RATE_7_8; break;
i_guard = BDA_GUARD_1_16; default:
if( l_guard == 8 ) i_lp_fec = BDA_BCC_RATE_NOT_SET;
i_guard = BDA_GUARD_1_8; }
if( l_guard == 4 )
i_guard = BDA_GUARD_1_4; switch( l_guard )
{
i_transmission = BDA_XMIT_MODE_NOT_SET; case 32:
if( l_transmission == 2 ) i_guard = BDA_GUARD_1_32; break,
i_transmission = BDA_XMIT_MODE_2K; case 16:
if( l_transmission == 8 ) i_guard = BDA_GUARD_1_16; break,
i_transmission = BDA_XMIT_MODE_8K; case 8:
i_guard = BDA_GUARD_1_8; break;
i_hierarchy = BDA_HALPHA_NOT_SET; case 4;
if( l_hierarchy == 1 ) i_guard = BDA_GUARD_1_4; break;
i_hierarchy = BDA_HALPHA_1; default;
if( l_hierarchy == 2 ) i_guard = BDA_GUARD_NOT_SET;
i_hierarchy = BDA_HALPHA_2; }
if( l_hierarchy == 4 )
i_hierarchy = BDA_HALPHA_4; swicth( l_transmission )
{
case 2:
i_transmission = BDA_XMIT_MODE_2K; break;
case 8:
i_transmission = BDA_XMIT_MODE_8K; break;
default:
i_transmission = BDA_XMIT_MODE_NOT_SET;
}
swicth( l_hierarchy )
{
case 1:
i_hierarchy = BDA_HALPHA_1; break;
case 2:
i_hierarchy = BDA_HALPHA_2; break;
case 4:
i_hierarchy = BDA_HALPHA_4; break;
default:
i_hierarchy = BDA_HALPHA_NOT_SET;
}
guid_network_type = CLSID_DVBTNetworkProvider; guid_network_type = CLSID_DVBTNetworkProvider;
hr = CreateTuneRequest(); hr = CreateTuneRequest();
...@@ -408,21 +424,25 @@ int BDAGraph::SubmitDVBCTuneRequest() ...@@ -408,21 +424,25 @@ int BDAGraph::SubmitDVBCTuneRequest()
int i_qam; int i_qam;
ModulationType i_qam_mod; ModulationType i_qam_mod;
l_frequency = l_symbolrate = i_qam = -1; l_frequency = var_GetInteger( p_access, "dvb-frequency" );
l_frequency = var_GetInteger( p_access, "dvb-frequency" );
l_symbolrate = var_GetInteger( p_access, "dvb-srate" ); l_symbolrate = var_GetInteger( p_access, "dvb-srate" );
i_qam = var_GetInteger( p_access, "dvb-modulation" ); i_qam = var_GetInteger( p_access, "dvb-modulation" );
i_qam_mod = BDA_MOD_NOT_SET;
if( i_qam == 16 ) switch( i_qam )
i_qam_mod = BDA_MOD_16QAM; {
if( i_qam == 32 ) case 16:
i_qam_mod = BDA_MOD_32QAM; i_qam_mod = BDA_MOD_16QAM; break;
if( i_qam == 64 ) case 32;
i_qam_mod = BDA_MOD_64QAM; i_qam_mod = BDA_MOD_32QAM; break;
if( i_qam == 128 ) case 64:
i_qam_mod = BDA_MOD_128QAM; i_qam_mod = BDA_MOD_64QAM; break;
if( i_qam == 256 ) case 128:
i_qam_mod = BDA_MOD_256QAM; i_qam_mod = BDA_MOD_128QAM; break;
case 256:
i_qam_mod = BDA_MOD_256QAM; break;
default;
i_qam_mod = BDA_MOD_NOT_SET;
}
guid_network_type = CLSID_DVBCNetworkProvider; guid_network_type = CLSID_DVBCNetworkProvider;
hr = CreateTuneRequest(); hr = CreateTuneRequest();
...@@ -515,7 +535,7 @@ int BDAGraph::SubmitDVBSTuneRequest() ...@@ -515,7 +535,7 @@ int BDAGraph::SubmitDVBSTuneRequest()
int i_range_len; int i_range_len;
localComPtr(): p_dvbs_tune_request(NULL), p_dvbs_locator(NULL), localComPtr(): p_dvbs_tune_request(NULL), p_dvbs_locator(NULL),
p_dvbs_tuning_space(NULL), bstr_input_range(NULL), p_dvbs_tuning_space(NULL), bstr_input_range(NULL),
pwsz_input_range(NULL), i_range_len(NULL), psz_polarisation(NULL), pwsz_input_range(NULL), i_range_len(0), psz_polarisation(NULL),
psz_input_range(NULL) {}; psz_input_range(NULL) {};
~localComPtr() ~localComPtr()
{ {
...@@ -541,72 +561,85 @@ int BDAGraph::SubmitDVBSTuneRequest() ...@@ -541,72 +561,85 @@ int BDAGraph::SubmitDVBSTuneRequest()
BinaryConvolutionCodeRate i_hp_fec; BinaryConvolutionCodeRate i_hp_fec;
ModulationType i_mod_typ; ModulationType i_mod_typ;
l_frequency = l_symbolrate = l_azimuth = l_elevation = l_longitude = -1; l_frequency = var_GetInteger( p_access, "dvb-frequency" );
l_lnb_lof1 = l_lnb_lof2 = l_lnb_slof = l_inversion = l_network_id = -1; l_symbolrate = var_GetInteger( p_access, "dvb-srate" );
l_frequency = var_GetInteger( p_access, "dvb-frequency" ); l_azimuth = var_GetInteger( p_access, "dvb-azimuth" );
l_symbolrate = var_GetInteger( p_access, "dvb-srate" ); l_elevation = var_GetInteger( p_access, "dvb-elevation" );
l_azimuth = var_GetInteger( p_access, "dvb-azimuth" ); l_longitude = var_GetInteger( p_access, "dvb-longitude" );
l_elevation = var_GetInteger( p_access, "dvb-elevation" ); l_lnb_lof1 = var_GetInteger( p_access, "dvb-lnb-lof1" );
l_longitude = var_GetInteger( p_access, "dvb-longitude" ); l_lnb_lof2 = var_GetInteger( p_access, "dvb-lnb-lof2" );
l_lnb_lof1 = var_GetInteger( p_access, "dvb-lnb-lof1" ); l_lnb_slof = var_GetInteger( p_access, "dvb-lnb-slof" );
l_lnb_lof2 = var_GetInteger( p_access, "dvb-lnb-lof2" ); i_mod = var_GetInteger( p_access, "dvb-modulation" );
l_lnb_slof = var_GetInteger( p_access, "dvb-lnb-slof" ); l_hp_fec = var_GetInteger( p_access, "dvb-code-rate-hp" );
l_inversion = var_GetInteger( p_access, "dvb-inversion" );
l_network_id = var_GetInteger( p_access, "dvb-network-id" );
l.psz_input_range = var_GetNonEmptyString( p_access, "dvb-range" );
l.psz_polarisation = var_GetNonEmptyString( p_access, "dvb-polarisation" ); l.psz_polarisation = var_GetNonEmptyString( p_access, "dvb-polarisation" );
i_mod = var_GetInteger( p_access, "dvb-modulation" );
l_hp_fec = var_GetInteger( p_access, "dvb-code-rate-hp" );
l_inversion = var_GetInteger( p_access, "dvb-inversion" );
l_network_id = var_GetInteger( p_access, "dvb-network-id" );
l.psz_input_range = var_GetNonEmptyString( p_access, "dvb-range" );
b_west = ( l_longitude < 0 ) ? TRUE : FALSE; b_west = ( l_longitude < 0 );
i_polar = BDA_POLARISATION_NOT_SET; i_polar = BDA_POLARISATION_NOT_SET;
if( l.psz_polarisation != NULL ) if( l.psz_polarisation != NULL )
{
switch( toupper( l.psz_polarisation[0] ) ) switch( toupper( l.psz_polarisation[0] ) )
{ {
case 'H': case 'H':
i_polar = BDA_POLARISATION_LINEAR_H; i_polar = BDA_POLARISATION_LINEAR_H;
break; break;
case 'V': case 'V':
i_polar = BDA_POLARISATION_LINEAR_V; i_polar = BDA_POLARISATION_LINEAR_V;
break; break;
case 'L': case 'L':
i_polar = BDA_POLARISATION_CIRCULAR_L; i_polar = BDA_POLARISATION_CIRCULAR_L;
break; break;
case 'R': case 'R':
i_polar = BDA_POLARISATION_CIRCULAR_R; i_polar = BDA_POLARISATION_CIRCULAR_R;
break; break;
} }
}
i_inversion = BDA_SPECTRAL_INVERSION_NOT_SET; switch( l_inversion )
if( l_inversion == 0 ) {
i_inversion = BDA_SPECTRAL_INVERSION_NORMAL; case 0:
if( l_inversion == 1 ) i_inversion = BDA_SPECTRAL_INVERSION_NORMAL; break,
i_inversion = BDA_SPECTRAL_INVERSION_INVERTED; case 1:
if( l_inversion == 2 ) i_inversion = BDA_SPECTRAL_INVERSION_INVERTED; break;
i_inversion = BDA_SPECTRAL_INVERSION_AUTOMATIC; case 2:
i_inversion = BDA_SPECTRAL_INVERSION_AUTOMATIC; break;
i_mod_typ = BDA_MOD_NOT_SET; default:
if( i_mod == 16 ) i_inversion = BDA_SPECTRAL_INVERSION_NOT_SET;
i_mod_typ = BDA_MOD_16QAM; }
if( i_mod == 128 )
i_mod_typ = BDA_MOD_128QAM; switch( i_mod )
if( i_mod == 256 ) {
i_mod_typ = BDA_MOD_256QAM; case 16:
if( i_mod == 10004 ) i_mod_typ = BDA_MOD_16QAM; break;
i_mod_typ = BDA_MOD_QPSK; case 128:
i_mod_typ = BDA_MOD_128QAM; break;
i_hp_fec = BDA_BCC_RATE_NOT_SET; case 256:
if( l_hp_fec == 1 ) i_mod_typ = BDA_MOD_256QAM; break;
i_hp_fec = BDA_BCC_RATE_1_2; case 10004:
if( l_hp_fec == 2 ) i_mod_typ = BDA_MOD_QPSK; break;
i_hp_fec = BDA_BCC_RATE_2_3; default:
if( l_hp_fec == 3 ) i_mod_typ = BDA_MOD_NOT_SET;
i_hp_fec = BDA_BCC_RATE_3_4; }
if( l_hp_fec == 4 )
i_hp_fec = BDA_BCC_RATE_5_6; switch( l_hp_fec )
if( l_hp_fec == 5 ) {
i_hp_fec = BDA_BCC_RATE_7_8; case 1:
i_hp_fec = BDA_BCC_RATE_1_2; break;
case 2:
i_hp_fec = BDA_BCC_RATE_2_3; break;
case 3:
i_hp_fec = BDA_BCC_RATE_3_4; break;
case 4:
i_hp_fec = BDA_BCC_RATE_5_6; break;
case 5:
i_hp_fec = BDA_BCC_RATE_7_8; break;
default:
i_hp_fec = BDA_BCC_RATE_NOT_SET;
}
l.i_range_len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, l.i_range_len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
l.psz_input_range, -1, l.pwsz_input_range, 0 ); l.psz_input_range, -1, l.pwsz_input_range, 0 );
...@@ -755,8 +788,8 @@ HRESULT BDAGraph::CreateTuneRequest() ...@@ -755,8 +788,8 @@ HRESULT BDAGraph::CreateTuneRequest()
if( p_this_tuning_space ) if( p_this_tuning_space )
p_this_tuning_space->Release(); p_this_tuning_space->Release();
SysFreeString( bstr_name ); SysFreeString( bstr_name );
delete wpsz_network_name; delete[] wpsz_network_name;
free(psz_network_name); free( psz_network_name );
} }
} l; } l;
...@@ -904,7 +937,7 @@ HRESULT BDAGraph::CreateTuneRequest() ...@@ -904,7 +937,7 @@ HRESULT BDAGraph::CreateTuneRequest()
if( IsEqualCLSID( guid_network_type, CLSID_DVBSNetworkProvider ) ) if( IsEqualCLSID( guid_network_type, CLSID_DVBSNetworkProvider ) )
cls_tuning_space = CLSID_DVBSTuningSpace; cls_tuning_space = CLSID_DVBSTuningSpace;
delete l.wpsz_network_name; delete[] l.wpsz_network_name;
l.i_name_len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, l.i_name_len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
l.psz_network_name, -1, l.wpsz_network_name, 0 ); l.psz_network_name, -1, l.wpsz_network_name, 0 );
if( l.i_name_len > 0 ) if( l.i_name_len > 0 )
...@@ -1170,14 +1203,14 @@ HRESULT BDAGraph::Build() ...@@ -1170,14 +1203,14 @@ HRESULT BDAGraph::Build()
} }
/* Configure the Sample Grabber to buffer the samples continuously */ /* Configure the Sample Grabber to buffer the samples continuously */
hr = p_grabber->SetBufferSamples( TRUE ); hr = p_grabber->SetBufferSamples( true );
if( FAILED( hr ) ) if( FAILED( hr ) )
{ {
msg_Warn( p_access, "Build: "\ msg_Warn( p_access, "Build: "\
"Cannot set Sample Grabber to buffering: hr=0x%8lx", hr ); "Cannot set Sample Grabber to buffering: hr=0x%8lx", hr );
return hr; return hr;
} }
hr = p_grabber->SetOneShot( FALSE ); hr = p_grabber->SetOneShot( false );
if( FAILED( hr ) ) if( FAILED( hr ) )
{ {
msg_Warn( p_access, "Build: "\ msg_Warn( p_access, "Build: "\
......
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