diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-03-10 20:37:44 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-03-10 20:37:44 +0100 |
commit | bb71d575b41e646d7c4f4ea6a679b2c696a3cfa4 (patch) | |
tree | bda2fa64ca6130de7c4e5f033a4b234de87b8057 | |
parent | 8be635ec17df0b8246ede6575ea91bdb1ad9bfa3 (diff) | |
download | ODR-AudioEnc-bb71d575b41e646d7c4f4ea6a679b2c696a3cfa4.tar.gz ODR-AudioEnc-bb71d575b41e646d7c4f4ea6a679b2c696a3cfa4.tar.bz2 ODR-AudioEnc-bb71d575b41e646d7c4f4ea6a679b2c696a3cfa4.zip |
add pad length option to mot-encoder
-rw-r--r-- | src/mot-encoder.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mot-encoder.c b/src/mot-encoder.c index 4d67acb..efa8f68 100644 --- a/src/mot-encoder.c +++ b/src/mot-encoder.c @@ -113,6 +113,8 @@ void usage(char* name) " Default: /tmp/pad.fifo\n" " -t, --dls=FILENAME Fifo or file to read DLS text from.\n" " Default: /tmp/dls.txt\n" + " -p, --pad=LENGTH Set the pad length. Max value:53\n" + " Default: 53\n" ); } @@ -136,6 +138,7 @@ int main(int argc, char *argv[]) {"dir", required_argument, 0, 'd'}, {"output", required_argument, 0, 'o'}, {"dls", required_argument, 0, 't'}, + {"pad", required_argument, 0, 'p'}, {"help", no_argument, 0, 'h'}, {0,0,0,0}, }; @@ -149,7 +152,7 @@ int main(int argc, char *argv[]) int ch=0; int index; while(ch != -1) { - ch = getopt_long(argc, argv, "hd:o:t:", longopts, &index); + ch = getopt_long(argc, argv, "hd:o:t:p:", longopts, &index); switch (ch) { case 'd': dir = optarg; @@ -160,6 +163,9 @@ int main(int argc, char *argv[]) case 't': dls_file = optarg; break; + case 'p': + padlen = atoi(optarg); + break; case '?': case 'h': usage(argv[0]); @@ -167,10 +173,16 @@ int main(int argc, char *argv[]) } } + if (padlen <= 0 || padlen > 53) { + fprintf(stderr, "Error: pad length %d out of bounds (0 < padlen <= 53)\n", + padlen); + return 2; + } + if (!dir) { fprintf(stderr, "Error: image directory not defined!\n"); usage(argv[0]); - return 3; + return 2; } int output_fd = open(output, O_WRONLY); |