Commit 47131cf3 authored by Martin Storsjo's avatar Martin Storsjo

Allow enabling DTX in the example program

parent c80472d1
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "wavreader.h" #include "wavreader.h"
void usage(const char* name) { void usage(const char* name) {
fprintf(stderr, "%s [-r bitrate] in.wav out.amr\n", name); fprintf(stderr, "%s [-r bitrate] [-d] in.wav out.amr\n", name);
} }
int findMode(const char* str) { int findMode(const char* str) {
...@@ -60,18 +60,21 @@ int findMode(const char* str) { ...@@ -60,18 +60,21 @@ int findMode(const char* str) {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
int mode = 8; int mode = 8;
int ch; int ch, dtx = 0;
const char *infile, *outfile; const char *infile, *outfile;
FILE* out; FILE* out;
void *wav, *amr; void *wav, *amr;
int format, sampleRate, channels, bitsPerSample; int format, sampleRate, channels, bitsPerSample;
int inputSize; int inputSize;
uint8_t* inputBuf; uint8_t* inputBuf;
while ((ch = getopt(argc, argv, "r:")) != -1) { while ((ch = getopt(argc, argv, "r:d")) != -1) {
switch (ch) { switch (ch) {
case 'r': case 'r':
mode = findMode(optarg); mode = findMode(optarg);
break; break;
case 'd':
dtx = 1;
break;
case '?': case '?':
default: default:
usage(argv[0]); usage(argv[0]);
...@@ -132,7 +135,7 @@ int main(int argc, char *argv[]) { ...@@ -132,7 +135,7 @@ int main(int argc, char *argv[]) {
const uint8_t* in = &inputBuf[2*channels*i]; const uint8_t* in = &inputBuf[2*channels*i];
buf[i] = in[0] | (in[1] << 8); buf[i] = in[0] | (in[1] << 8);
} }
n = E_IF_encode(amr, mode, buf, outbuf, 0); n = E_IF_encode(amr, mode, buf, outbuf, dtx);
fwrite(outbuf, 1, n, out); fwrite(outbuf, 1, n, out);
} }
free(inputBuf); free(inputBuf);
......
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