1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-11-03 04:17:18 -05:00

Add -r command line option: explicitly enable real-time status line

This commit is contained in:
Moritz Grimm 2015-05-12 17:35:04 +02:00
parent 1115ab16db
commit bd04a66c79
6 changed files with 29 additions and 6 deletions

2
NEWS
View File

@ -7,6 +7,8 @@ Changes in X.X.X, released on XXXX-XX-XX:
to be provided.
* The command line options -m and -n have been removed, and new configuration
file settings have been added accordingly.
* The real-time status information is now enabled explicitly with the new
command line option -r.
* The configuration file structure has changed.

View File

@ -222,6 +222,14 @@ cfg_set_program_quiet_stderr(int quiet_stderr, const char **not_used)
return (0);
}
int
cfg_set_program_rtstatus_output(int rtstatus_output, const char **not_used)
{
(void)not_used;
cfg.program.rtstatus_output = rtstatus_output ? 1 : 0;
return (0);
}
int
cfg_set_program_verbosity(unsigned int verbosity, const char **not_used)
{
@ -554,6 +562,12 @@ cfg_get_program_quiet_stderr(void)
return (cfg.program.quiet_stderr);
}
int
cfg_get_program_rtstatus_output(void)
{
return (cfg.program.rtstatus_output);
}
unsigned int
cfg_get_program_verbosity(void)
{

View File

@ -75,6 +75,7 @@ int cfg_set_program_name(const char *, const char **);
int cfg_set_program_config_type(enum cfg_config_type, const char **);
int cfg_set_program_config_file(const char *, const char **);
int cfg_set_program_quiet_stderr(int, const char **);
int cfg_set_program_rtstatus_output(int, const char **);
int cfg_set_program_verbosity(unsigned int, const char **);
int cfg_set_server_protocol(const char *, const char **);
@ -119,6 +120,7 @@ enum cfg_config_type
const char *
cfg_get_program_config_file(void);
int cfg_get_program_quiet_stderr(void);
int cfg_get_program_rtstatus_output(void);
unsigned int
cfg_get_program_verbosity(void);

View File

@ -35,6 +35,7 @@ struct cfg {
enum cfg_config_type config_type;
char config_file[PATH_MAX];
int quiet_stderr;
int rtstatus_output;
unsigned int verbosity;
} program;
struct server {

View File

@ -32,11 +32,12 @@
#include "cmdline.h"
#include "playlist.h"
#define OPTSTRING "c:hqs:Vv"
#define OPTSTRING "c:hqrs:Vv"
enum opt_vals {
OPT_CONFIGFILE = 'c',
OPT_HELP = 'h',
OPT_QUIETSTDERR = 'q',
OPT_RTSTATUS = 'r',
OPT_SHUFFLEFILE = 's',
OPT_VERSION = 'V',
OPT_VERBOSE = 'v',
@ -50,9 +51,9 @@ static void _set_program_name(const char *);
static void
_usage(void)
{
fprintf(stderr, "usage: %s [-ghqVv] -c cfgfile\n",
fprintf(stderr, "usage: %s [-hqrVv] -c cfgfile\n",
cfg_get_program_name());
fprintf(stderr, " %s [-ghV] -s file\n",
fprintf(stderr, " %s -s file\n",
cfg_get_program_name());
}
@ -63,9 +64,10 @@ _usage_help(void)
fprintf(stderr, " -c cfgfile use XML configuration in cfgfile\n");
fprintf(stderr, " -h print this help and exit\n");
fprintf(stderr, " -q suppress STDERR output from external en-/decoders\n");
fprintf(stderr, " -r show real-time stream information on stdout\n");
fprintf(stderr, " -s file read lines from file, shuffle, print to STDOUT, then exit\n");
fprintf(stderr, " -V print the version number and exit\n");
fprintf(stderr, " -v verbose output (use twice for more effect)\n");
fprintf(stderr, " -v increase logging verbosity\n");
}
static void
@ -121,6 +123,9 @@ cmdline_parse(int argc, char *argv[], int *ret_p)
_usage_help();
*ret_p = 0;
return (-1);
case OPT_RTSTATUS:
cfg_set_program_rtstatus_output(1, NULL);
/* FALLTHROUGH */
case OPT_QUIETSTDERR:
cfg_set_program_quiet_stderr(1, NULL);
break;

View File

@ -758,8 +758,7 @@ sendStream(shout_t *shout, FILE *filepstream, const char *fileName,
}
total += bytes_read;
if (cfg_get_program_quiet_stderr() &&
cfg_get_program_verbosity()) {
if (cfg_get_program_rtstatus_output()) {
double oldTime, newTime;
if (!isStdin && playlistMode) {