[dvblast-devel] Allow disabling frontend tunning using '--frequency -'
Stas Sergeev
git at videolan.org
Tue Oct 29 12:27:07 CET 2013
dvblast | branch: master | Stas Sergeev <stsp at users.sourceforge.net> | Fri Oct 18 20:38:36 2013 +0400| [c59cd39c11f6a24748a3dc44506af8e036183cec] | committer: Georgi Chorbadzhiyski
Allow disabling frontend tunning using '--frequency -'
This introduces the possibility for dvblast to work without ever touching
the frontend which should be controlled by external tool (for example szap).
> http://git.videolan.org/gitweb.cgi/dvblast.git/?a=commit;h=c59cd39c11f6a24748a3dc44506af8e036183cec
---
dvb.c | 43 +++++++++++++++++++++++++++++--------------
dvblast.1 | 4 +++-
dvblast.c | 3 ++-
3 files changed, 34 insertions(+), 16 deletions(-)
diff --git a/dvb.c b/dvb.c
index 9bfff9f..0665d8e 100644
--- a/dvb.c
+++ b/dvb.c
@@ -95,15 +95,22 @@ void dvb_Open( void )
i_wallclock = mdate();
- sprintf( psz_tmp, "/dev/dvb/adapter%d/frontend%d", i_adapter, i_fenum );
- if( (i_frontend = open(psz_tmp, O_RDWR | O_NONBLOCK)) < 0 )
+ if ( i_frequency )
{
- msg_Err( NULL, "opening device %s failed (%s)", psz_tmp,
- strerror(errno) );
- exit(1);
- }
+ sprintf( psz_tmp, "/dev/dvb/adapter%d/frontend%d", i_adapter, i_fenum );
+ if( (i_frontend = open(psz_tmp, O_RDWR | O_NONBLOCK)) < 0 )
+ {
+ msg_Err( NULL, "opening device %s failed (%s)", psz_tmp,
+ strerror(errno) );
+ exit(1);
+ }
- FrontendSet(true);
+ FrontendSet(true);
+ }
+ else
+ {
+ i_frontend = -1;
+ }
sprintf( psz_tmp, "/dev/dvb/adapter%d/dvr%d", i_adapter, i_fenum );
@@ -129,7 +136,8 @@ void dvb_Open( void )
*****************************************************************************/
void dvb_Reset( void )
{
- FrontendSet(true);
+ if ( i_frequency )
+ FrontendSet(true);
}
/*****************************************************************************
@@ -138,14 +146,18 @@ void dvb_Reset( void )
block_t *dvb_Read( mtime_t i_poll_timeout )
{
struct pollfd ufds[4];
- int i_ret, i_nb_fd = 2;
+ int i_ret, i_nb_fd = 1;
block_t *p_blocks = NULL;
memset( ufds, 0, sizeof(ufds) );
ufds[0].fd = i_dvr;
ufds[0].events = POLLIN;
- ufds[1].fd = i_frontend;
- ufds[1].events = POLLERR | POLLPRI;
+ if ( i_frontend != -1 )
+ {
+ ufds[1].fd = i_frontend;
+ ufds[1].events = POLLERR | POLLPRI;
+ i_nb_fd++;
+ }
if ( i_comm_fd != -1 )
{
ufds[i_nb_fd].fd = i_comm_fd;
@@ -185,7 +197,8 @@ block_t *dvb_Read( mtime_t i_poll_timeout )
&& i_wallclock > i_last_packet + DVR_READ_TIMEOUT )
{
msg_Warn( NULL, "no DVR output, resetting" );
- FrontendSet(false);
+ if ( i_frequency )
+ FrontendSet(false);
en50221_Reset();
}
@@ -218,7 +231,8 @@ block_t *dvb_Read( mtime_t i_poll_timeout )
exit(EXIT_STATUS_FRONTEND_TIMEOUT);
}
msg_Warn( NULL, "no lock, tuning again" );
- FrontendSet(false);
+ if ( i_frequency )
+ FrontendSet(false);
}
if ( i_comm_fd != -1 && ufds[2].revents )
@@ -419,7 +433,8 @@ static void FrontendPoll( void )
{
/* The frontend was reinited. */
msg_Warn( NULL, "reiniting frontend");
- FrontendSet(true);
+ if ( i_frequency )
+ FrontendSet(true);
}
}
#undef IF_UP
diff --git a/dvblast.1 b/dvblast.1
index f42d6b3..6dbb0f7 100644
--- a/dvblast.1
+++ b/dvblast.1
@@ -69,7 +69,9 @@ Enable EPG pass through (EIT data)
Maximum retention allowed between input and output (default: 40 ms)
.TP
\fB\-f\fR, \fB\-\-frequency\fR <frequency>
-Frontend frequency
+Frontend frequency. If '\-' is specified instead of a numeric value,
+the frontend will be not be tuned by dvblast and you should use external
+tuning tool (szap) to tune it.
.TP
\fB\-F\fR, \fB\-\-fec\-inner\fR <FEC>
Forward Error Correction used by satellite (FEC Inner)
diff --git a/dvblast.c b/dvblast.c
index 0e744a4..5a4fdc2 100644
--- a/dvblast.c
+++ b/dvblast.c
@@ -739,7 +739,8 @@ int main( int i_argc, char **pp_argv )
break;
case 'f':
- i_frequency = strtol( optarg, NULL, 0 );
+ if (optarg && optarg[0] != '-')
+ i_frequency = strtol( optarg, NULL, 0 );
if ( pf_Open != NULL )
usage();
#ifdef HAVE_DVB_SUPPORT
More information about the dvblast-devel
mailing list