Commit 1d111d75 authored by Andy Gatward's avatar Andy Gatward Committed by Christophe Massiot

* dvblast.c, util.c: Quietness.

parent 43b27d60
......@@ -56,6 +56,7 @@ char *psz_modulation = NULL;
int b_budget_mode = 0;
int b_output_udp = 0;
volatile int b_hup_received = 0;
int i_verbose = DEFAULT_VERBOSITY;
/*****************************************************************************
* Configuration files
......@@ -182,15 +183,16 @@ static void SigHandler( int i_signal )
*****************************************************************************/
void usage()
{
msg_Err( NULL, "Usage: dvblast -c <config file> [-r <remote socket>] [-t <ttl>] [-o <SSRC IP>] [-i <RT priority>] [-a <adapter>][-n <frontend_num>] -f <frequency> [-s <symbol rate>] [-v <0|13|18>] [-p] [-b <bandwidth>] [-m <modulation] [-u] [-U] [-d <dest IP:port>]" );
msg_Err( NULL, "-v: voltage to apply to the LNB (QPSK)" );
msg_Err( NULL, "-p: force 22kHz pulses for high-band selection (DVB-S)" );
msg_Err( NULL, "-m: DVB-C qpsk|qam_16|qam_32|qam_64|qam_128|qam_256 (default qam_auto)" );
msg_Err( NULL, " DVB-T qam_16|qam_32|qam_64|qam_128|qam_256 (default qam_auto)" );
msg_Err( NULL, " DVB-S2 qpsk|psk_8 (default legacy DVB-S)" );
msg_Err( NULL, "-u: turn on budget mode (no hardware PID filtering)" );
msg_Err( NULL, "-U: use raw UDP rather than RTP (required by some IPTV set top boxes)" );
msg_Err( NULL, "-d: duplicate all received packets to a given port" );
msg_Raw( NULL, "Usage: dvblast [-q] -c <config file> [-r <remote socket>] [-t <ttl>] [-o <SSRC IP>] [-i <RT priority>] [-a <adapter>][-n <frontend_num>] -f <frequency> [-s <symbol rate>] [-v <0|13|18>] [-p] [-b <bandwidth>] [-m <modulation] [-u] [-U] [-d <dest IP:port>]" );
msg_Raw( NULL, " -q: be quiet (less verbosity, repeat or use number for even quieter)" );
msg_Raw( NULL, " -v: voltage to apply to the LNB (QPSK)" );
msg_Raw( NULL, " -p: force 22kHz pulses for high-band selection (DVB-S)" );
msg_Raw( NULL, " -m: DVB-C qpsk|qam_16|qam_32|qam_64|qam_128|qam_256 (default qam_auto)" );
msg_Raw( NULL, " DVB-T qam_16|qam_32|qam_64|qam_128|qam_256 (default qam_auto)" );
msg_Raw( NULL, " DVB-S2 qpsk|psk_8 (default legacy DVB-S)" );
msg_Raw( NULL, " -u: turn on budget mode (no hardware PID filtering)" );
msg_Raw( NULL, " -U: use raw UDP rather than RTP (required by some IPTV set top boxes)" );
msg_Raw( NULL, " -d: duplicate all received packets to a given port" );
exit(1);
}
......@@ -202,17 +204,40 @@ int main( int i_argc, char **pp_argv )
if ( i_argc == 1 )
usage();
msg_Err( NULL, "restarting" );
msg_Warn( NULL, "restarting" );
for ( ; ; )
{
char c;
if ( (c = getopt(i_argc, pp_argv, "c:r:t:o:i:a:n:f:s:v:pb:m:uUd:h")) == -1 )
if ( (c = getopt(i_argc, pp_argv, "q::c:r:t:o:i:a:n:f:s:v:pb:m:uUd:h")) == -1 )
break;
switch ( c )
{
case 'q':
if ( optarg )
{
if ( *optarg == 'q' ) /* e.g. -qqq */
{
i_verbose--;
while ( *optarg == 'q' )
{
i_verbose--;
optarg++;
}
}
else
{
i_verbose -= atoi( optarg ); /* e.g. -q2 */
}
}
else
{
i_verbose--; /* -q */
}
break;
case 'c':
psz_conf_file = optarg;
break;
......
......@@ -33,6 +33,7 @@
#define PADDING_PID 8191
#define WATCHDOG_WAIT 10000000LL
#define MAX_ERRORS 100000
#define DEFAULT_VERBOSITY 3
typedef int64_t mtime_t;
......@@ -73,6 +74,7 @@ typedef struct output_t
int b_still_present;
} output_t;
extern int i_verbose;
extern output_t **pp_outputs;
extern int i_nb_outputs;
extern output_t output_dup;
......@@ -100,6 +102,7 @@ void msg_Info( void *_unused, const char *psz_format, ... );
void msg_Err( void *_unused, const char *psz_format, ... );
void msg_Warn( void *_unused, const char *psz_format, ... );
void msg_Dbg( void *_unused, const char *psz_format, ... );
void msg_Raw( void *_unused, const char *psz_format, ... );
mtime_t mdate( void );
void msleep( mtime_t delay );
......
......@@ -38,9 +38,11 @@
#include "en50221.h"
#include "comm.h"
int i_verbose = 3;
void usage()
{
msg_Err( NULL, "Usage: dvblastctl -r <remote socket> reload|shutdown|fe_status|mmi_status|mmi_open|mmi_close|mmi_get|mmi_send_text|mmi_send_choice [<CAM slot>] [<text/choice>]" );
msg_Raw( NULL, "Usage: dvblastctl -r <remote socket> reload|shutdown|fe_status|mmi_status|mmi_open|mmi_close|mmi_get|mmi_send_text|mmi_send_choice [<CAM slot>] [<text/choice>]" );
exit(1);
}
......
......@@ -38,18 +38,24 @@
* Local declarations
*****************************************************************************/
#define MAX_MSG 1024
#define VERB_DBG 3
#define VERB_INFO 2
#define VERB_WARN 1
/*****************************************************************************
* msg_Info
*****************************************************************************/
void msg_Info( void *_unused, const char *psz_format, ... )
{
if ( i_verbose >= VERB_INFO )
{
va_list args;
char psz_fmt[MAX_MSG];
va_start( args, psz_format );
snprintf( psz_fmt, MAX_MSG, "dvblast info: %s\n", psz_format );
vfprintf( stderr, psz_fmt, args );
}
}
/*****************************************************************************
......@@ -70,12 +76,15 @@ void msg_Err( void *_unused, const char *psz_format, ... )
*****************************************************************************/
void msg_Warn( void *_unused, const char *psz_format, ... )
{
if ( i_verbose >= VERB_WARN )
{
va_list args;
char psz_fmt[MAX_MSG];
va_start( args, psz_format );
snprintf( psz_fmt, MAX_MSG, "dvblast warning: %s\n", psz_format );
vfprintf( stderr, psz_fmt, args );
}
}
/*****************************************************************************
......@@ -83,12 +92,28 @@ void msg_Warn( void *_unused, const char *psz_format, ... )
*****************************************************************************/
void msg_Dbg( void *_unused, const char *psz_format, ... )
{
if ( i_verbose >= VERB_DBG )
{
va_list args;
char psz_fmt[MAX_MSG];
va_start( args, psz_format );
snprintf( psz_fmt, MAX_MSG, "dvblast debug: %s\n", psz_format );
vfprintf( stderr, psz_fmt, args );
}
}
/*****************************************************************************
* msg_Raw
*****************************************************************************/
void msg_Raw( void *_unused, const char *psz_format, ... )
{
va_list args;
char psz_fmt[MAX_MSG];
va_start( args, psz_format );
snprintf( psz_fmt, MAX_MSG, "%s\n", psz_format );
vfprintf( stderr, psz_fmt, args );
}
/*****************************************************************************
......
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