[vlc-devel] [vlc-commits] access: dvb: use DTV_ENUM_DELSYS when possible
Rémi Denis-Courmont
remi at remlab.net
Mon Apr 11 09:59:23 CEST 2016
Le 2016-04-10 13:56, git at videolan.org a écrit :
> vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri
> Apr 8 16:54:52 2016 +0200|
> [41e4d492fc453995b86c031f92a526621464ae68]
> | committer: Francois Cartegnie
>
> access: dvb: use DTV_ENUM_DELSYS when possible
And where exactly does this commit use DTV_ENUM_DELSYS?
I mean, apart from the '#ifdef DTV_ENUM_DELSYS' line.
> diff --git a/modules/access/dvb/linux_dvb.c
> b/modules/access/dvb/linux_dvb.c
> index 8bc68e9..0e68983 100644
> --- a/modules/access/dvb/linux_dvb.c
> +++ b/modules/access/dvb/linux_dvb.c
> @@ -468,20 +468,90 @@ static int ScanParametersDvbT( access_t
> *p_access, scan_parameter_t *p_scan )
> return VLC_SUCCESS;
> }
>
> -int FrontendFillScanParameter( access_t *p_access, scan_parameter_t
> *p_scan )
> +static enum fe_delivery_system FrontEndGetDeliverySys( access_t
> *p_access )
> {
> access_sys_t *p_sys = p_access->p_sys;
> - const frontend_t *p_frontend = p_sys->p_frontend;
> -
> - if( p_frontend->info.type == FE_OFDM ) /* DVB-T */
> - return ScanParametersDvbT( p_access, p_scan );
> - else if( p_frontend->info.type == FE_QAM ) /* DVB-C */
> - return ScanParametersDvbC( p_access, p_scan );
> +#ifdef DTV_ENUM_DELSYS
> + /* Determine type of frontend */
> + struct dtv_property prop = { .cmd = DTV_DELIVERY_SYSTEM };
> + struct dtv_properties tuple = { .num = 1, .props = &prop };
> + if( ioctl( p_sys->i_frontend_handle, FE_GET_PROPERTY, &tuple ) <
> 0 )
> + {
> + msg_Err( p_access, "frontend info request error: %s",
> + vlc_strerror_c(errno) );
> + return SYS_UNDEFINED;
> + }
The DTV_DELIVERY_SYSTEM property is the system that the tuner is
currently set to use. It's normally undefined. This commit makes no
sense IMHO.
> + return prop.u.data;
> +#else
> + frontend_t *p_frontend = p_sys->p_frontend;
> + /* DTV_ENUM_DELSYS requires linux dvb api >= 5.05
> + kernel commit ba2780c796badfc3741c7cb499a575ca49f17e6d */
> + const bool b_2g = ( p_frontend->info.caps & FE_CAN_2G_MODULATION
> );
> + if( p_frontend->info.type == FE_OFDM )
> + {
> + return ( b_2g ) ? SYS_DVBT2 : SYS_DVBT;
> + }
> + else if( p_frontend->info.type == FE_QAM )
> + {
> + return SYS_DVBC_ANNEX_C;
> + }
> else if( p_frontend->info.type == FE_QPSK )
> - return ScanParametersDvbS( p_access, p_scan ); /* DVB-S */
> + {
> + return ( b_2g ) ? SYS_DVBS2 : SYS_DVBS;
> + }
> + else if( p_frontend->info.type == FE_ATSC )
> + {
> + if ( p_frontend->info.caps &
> + (FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_128 |
> FE_CAN_QAM_256) )
> + return SYS_DVBC_ANNEX_B;
> +
> + if ( p_frontend->info.caps & (FE_CAN_8VSB | FE_CAN_16VSB) )
> + return SYS_ATSC;
> + }
> + return SYS_UNDEFINED;
> +#endif
> +}
> +
> +int FrontendFillScanParameter( access_t *p_access, scan_parameter_t
> *p_scan )
> +{
> + int i_ret = VLC_EGENERIC;
> +
> + switch( FrontEndGetDeliverySys( p_access ) )
> + {
> + case SYS_DVBC_ANNEX_A:
> + case SYS_DVBC_ANNEX_B:
Pretty sure this is incorret.
> + case SYS_DVBC_ANNEX_C:
Probably wrong.
> + case SYS_ISDBC:
Wrong.
> + i_ret = ScanParametersDvbC( p_access, p_scan );
> + break;
> +
> + case SYS_DVBT:
> + case SYS_DVBT2:
You can't do DVB-T2 properly with DVBv3 API.
> + case SYS_ISDBT:
Ditto. There are some backward compatibility hacks to use DVB-T
parameters for ISDBT but...
> + i_ret = ScanParametersDvbT( p_access, p_scan );
> + break;
> +
> + case SYS_DVBS:
> + case SYS_DVBS2:
Ditto.
> + case SYS_ISDBS:
Ditto.
> + i_ret = ScanParametersDvbS( p_access, p_scan );
> + break;
> +
> + /* FIXME or unsupported */
> + case SYS_ATSC:
> + case SYS_ATSCMH:
> +
> + case SYS_DSS:
> + case SYS_DTMB:
> + case SYS_CMMB:
> + case SYS_DAB:
> + case SYS_TURBO:
> + default:
> + msg_Err( p_access, "frontend scanning not supported" );
> + break;
> + }
>
> - msg_Err( p_access, "frontend scanning not supported" );
> - return VLC_EGENERIC;
> + return i_ret;
> }
>
>
>
> /*****************************************************************************
>
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> https://mailman.videolan.org/listinfo/vlc-commits
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list