aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2020-05-26 13:29:07 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2020-05-26 13:29:07 +0200
commit52fbcaacb80b4081d9bfeaeca011279080cb8282 (patch)
treec713d71592615e2ce842d0fcb181fb3c93d70842 /src
parent808c7a7cd6004b0c039b00e0e9830027f424ab62 (diff)
downloadODR-AudioEnc-52fbcaacb80b4081d9bfeaeca011279080cb8282.tar.gz
ODR-AudioEnc-52fbcaacb80b4081d9bfeaeca011279080cb8282.tar.bz2
ODR-AudioEnc-52fbcaacb80b4081d9bfeaeca011279080cb8282.zip
Add --version option
Diffstat (limited to 'src')
-rw-r--r--src/odr-audioenc.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/odr-audioenc.cpp b/src/odr-audioenc.cpp
index 9264ac7..c6887da 100644
--- a/src/odr-audioenc.cpp
+++ b/src/odr-audioenc.cpp
@@ -206,6 +206,7 @@ static void usage(const char* name)
" -S, --stats=SOCKET_NAME Connect to the specified UNIX Datagram socket and send statistics.\n"
" This allows external tools to collect audio and drift compensation stats.\n"
" -s, --silence=TIMEOUT Abort encoding after TIMEOUT seconds of silence.\n"
+ " --version Show version and quit.\n"
"\n"
"Only the tcp:// zeromq transport has been tested until now,\n"
" but epgm://, pgm:// and ipc:// are also accepted\n"
@@ -1357,8 +1358,6 @@ shared_ptr<InputInterface> AudioEnc::initialise_input()
int main(int argc, char *argv[])
{
- AudioEnc audio_enc;
-
const struct option longopts[] = {
{"bitrate", required_argument, 0, 'b'},
{"bandwidth", required_argument, 0, 'B'},
@@ -1401,6 +1400,17 @@ int main(int argc, char *argv[])
{0, 0, 0, 0},
};
+ if (argc == 2 and strcmp(argv[1], "--version") == 0) {
+ fprintf(stdout, "%s\n",
+#if defined(GITVERSION)
+ GITVERSION
+#else
+ PACKAGE_VERSION
+#endif
+ );
+ return 0;
+ }
+
fprintf(stderr,
"Welcome to %s %s, compiled at %s, %s",
PACKAGE_NAME,
@@ -1419,6 +1429,8 @@ int main(int argc, char *argv[])
return 1;
}
+ AudioEnc audio_enc;
+
int ch=0;
int index;
while(ch != -1) {