From c3a72f6afafcb876329dfd001ce3050021486b2f Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 21 Apr 2014 15:46:17 +0200 Subject: Add option to suppress the little dots --- src/dabplus-enc-alsa-zmq.cpp | 32 ++++++++++++++++++++------------ src/dabplus-enc-file-zmq.c | 32 ++++++++++++++++++++------------ 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/src/dabplus-enc-alsa-zmq.cpp b/src/dabplus-enc-alsa-zmq.cpp index 92980e2..f9ff3a4 100644 --- a/src/dabplus-enc-alsa-zmq.cpp +++ b/src/dabplus-enc-alsa-zmq.cpp @@ -86,6 +86,7 @@ void usage(const char* name) { " -c, --channels={ 1, 2 } Nb of input channels for raw input (default: 2).\n" " -r, --rate={ 32000, 48000 } Sample rate for raw input (default: 48000).\n" " -k, --secret-key=FILE Set the secret key for encryption.\n" + " -s, --suppress-dots Do not show the little dots.\n" //" -V, --version Print version and exit.\n" "\n" "Only the tcp:// zeromq transport has been tested until now.\n" @@ -235,23 +236,26 @@ int main(int argc, char *argv[]) unsigned char pad_buf[128]; int padlen; + int show_dots = 1; + /* Data for ZMQ CURVE authentication */ char* keyfile = NULL; char secretkey[CURVE_KEYLEN+1]; const struct option longopts[] = { - {"bitrate", required_argument, 0, 'b'}, - {"output", required_argument, 0, 'o'}, - {"device", required_argument, 0, 'd'}, - {"rate", required_argument, 0, 'r'}, - {"channels", required_argument, 0, 'c'}, - {"pad", required_argument, 0, 'p'}, - {"pad-fifo", required_argument, 0, 'P'}, - {"secret-key", required_argument, 0, 'k'}, - {"drift-comp", no_argument, 0, 'D'}, - {"afterburner", no_argument, 0, 'a'}, - {"help", no_argument, 0, 'h'}, + {"bitrate", required_argument, 0, 'b'}, + {"output", required_argument, 0, 'o'}, + {"device", required_argument, 0, 'd'}, + {"rate", required_argument, 0, 'r'}, + {"channels", required_argument, 0, 'c'}, + {"pad", required_argument, 0, 'p'}, + {"pad-fifo", required_argument, 0, 'P'}, + {"secret-key", required_argument, 0, 'k'}, + {"drift-comp", no_argument, 0, 'D'}, + {"afterburner", no_argument, 0, 'a'}, + {"help", no_argument, 0, 'h'}, + {"suppress-dots", no_argument, 0, 's'}, {0,0,0,0}, }; @@ -294,6 +298,9 @@ int main(int argc, char *argv[]) case 'P': pad_fifo = optarg; break; + case 's': + show_dots = 0; + break; case '?': case 'h': usage(argv[0]); @@ -609,7 +616,8 @@ int main(int argc, char *argv[]) break; } - if (out_args.numOutBytes + row*10 == outbuf_size) + if (show_dots && + out_args.numOutBytes + row*10 == outbuf_size) print_status(".", &remaining_line_len); } diff --git a/src/dabplus-enc-file-zmq.c b/src/dabplus-enc-file-zmq.c index b677d5c..76aa74a 100644 --- a/src/dabplus-enc-file-zmq.c +++ b/src/dabplus-enc-file-zmq.c @@ -78,6 +78,7 @@ void usage(const char* name) { " -c, --channels={ 1, 2 } Nb of input channels for raw input (default: 2).\n" " -r, --rate={ 32000, 48000 } Sample rate for raw input (default: 48000).\n" " -k, --secret-key=FILE Set the secret key for encryption.\n" + " -s, --suppress-dots Do not show the little dots.\n" //" -v, --verbose=LEVEL Set verbosity level.\n" "\n" "Only the tcp:// zeromq transport has been tested until now.\n" @@ -117,22 +118,25 @@ int main(int argc, char *argv[]) { void *zmq_context = zmq_ctx_new(); void *zmq_sock = NULL; + int show_dots = 1; + /* Data for ZMQ CURVE authentication */ char* keyfile = NULL; char secretkey[CURVE_KEYLEN+1]; const struct option longopts[] = { - {"bitrate", required_argument, 0, 'b'}, - {"input", required_argument, 0, 'i'}, - {"output", required_argument, 0, 'o'}, - {"format", required_argument, 0, 'f'}, - {"rate", required_argument, 0, 'r'}, - {"channels", required_argument, 0, 'c'}, - {"pad", required_argument, 0, 'p'}, - {"pad-fifo", required_argument, 0, 'P'}, - {"secret-key", required_argument, 0, 'k'}, - {"afterburner", no_argument, 0, 'a'}, - {"help", no_argument, 0, 'h'}, + {"bitrate", required_argument, 0, 'b'}, + {"input", required_argument, 0, 'i'}, + {"output", required_argument, 0, 'o'}, + {"format", required_argument, 0, 'f'}, + {"rate", required_argument, 0, 'r'}, + {"channels", required_argument, 0, 'c'}, + {"pad", required_argument, 0, 'p'}, + {"pad-fifo", required_argument, 0, 'P'}, + {"secret-key", required_argument, 0, 'k'}, + {"afterburner", no_argument, 0, 'a'}, + {"help", no_argument, 0, 'h'}, + {"suppress-dots", no_argument, 0, 's'}, {0,0,0,0}, }; @@ -178,6 +182,9 @@ int main(int argc, char *argv[]) { case 'P': pad_fifo = optarg; break; + case 's': + show_dots = 0; + break; case '?': case 'h': usage(argv[0]); @@ -556,7 +563,8 @@ int main(int argc, char *argv[]) { } //fwrite(outbuf, 1, /*out_args.numOutBytes*/ outbuf_size, out_fh); //fprintf(stderr, "Written %d/%d bytes!\n", out_args.numOutBytes + row*10, outbuf_size); - if(out_args.numOutBytes + row*10 == outbuf_size) + if (show_dots && + out_args.numOutBytes + row*10 == outbuf_size) fprintf(stderr, "."); // if(frame > 10) -- cgit v1.2.3