aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergio <sergio@sergione.(none)>2014-06-13 12:28:32 +0200
committerSergio <sergio@sergione.(none)>2014-06-13 12:28:32 +0200
commitcb5211684e8d4300641f36830ed3445e72a3f8bd (patch)
tree5889800d2cc867d5fecbfe935701b287aa29c2ca
parenteedf902dde96026057fb71e0743864d3257f4a20 (diff)
downloadfdk-aac-dabplus-cb5211684e8d4300641f36830ed3445e72a3f8bd.tar.gz
fdk-aac-dabplus-cb5211684e8d4300641f36830ed3445e72a3f8bd.tar.bz2
fdk-aac-dabplus-cb5211684e8d4300641f36830ed3445e72a3f8bd.zip
Added option to ignore EOF fifo and generates silence
-rw-r--r--README.md12
-rw-r--r--src/FileInput.cpp2
-rw-r--r--src/dabplus-enc.cpp15
3 files changed, 26 insertions, 3 deletions
diff --git a/README.md b/README.md
index c1ccff2..533ef02 100644
--- a/README.md
+++ b/README.md
@@ -138,8 +138,20 @@ arecord.
Here we are using the ALSA plughw feature.
+
Scenario 5
----------
+Live Stream resampling (to 32KHz) and encoding from FIFO and preparing for DAB muxer, with FIFO to odr-dabmux
+using mplayer. If there are no data in FIFO, encoder generates silence.
+
+ mplayer -quiet -loop 0 -af resample=32000:nowaveheader,format=s16le,channels=2 -ao pcm:file=/tmp/aac.fifo:fast <FILE/URL> &
+ dabplus-enc -l -f raw --fifo-silence -i /tmp/aac.fifo -r 32000 -c 2 -b 72 -o /dev/stdout \
+ mbuffer -q -m 10k -P 100 -s 1080 > station1.fifo
+
+*Note*: Do not use /dev/stdout for pcm oputput in mplayer. Mplayer log messages on stdout.
+
+Scenario 6
+----------
Wave file encoding, for non-realtime processing
dabplus-enc -a -b $BITRATE -i wave_file.wav -o station1.dabp
diff --git a/src/FileInput.cpp b/src/FileInput.cpp
index c8023dd..9ec988b 100644
--- a/src/FileInput.cpp
+++ b/src/FileInput.cpp
@@ -85,7 +85,7 @@ ssize_t FileInput::read(uint8_t* buf, size_t length)
pcmread = length;
}
else {
- fprintf(stderr, "Unable to read from input!\n");
+ //fprintf(stderr, "Unable to read from input!\n");
return 0;
}
}
diff --git a/src/dabplus-enc.cpp b/src/dabplus-enc.cpp
index c409acb..f186dbe 100644
--- a/src/dabplus-enc.cpp
+++ b/src/dabplus-enc.cpp
@@ -84,6 +84,7 @@ void usage(const char* name) {
" For the file input:\n"
" -i, --input=FILENAME Input filename (default: stdin).\n"
" -f, --format={ wav, raw } Set input file format (default: wav).\n"
+ " --fifo-silence Input file is fifo and encoder generates silence when fifo is empty. Ignore EOF.\n"
" Encoder parameters:\n"
" -b, --bitrate={ 8, 16, ..., 192 } Output bitrate in kbps. Must be 8 multiple.\n"
" -a, --afterburner Turn on AAC encoder quality increaser.\n"
@@ -231,6 +232,7 @@ int main(int argc, char *argv[])
const int bytes_per_sample = 2;
void *rs_handler = NULL;
bool afterburner = false;
+ bool inFifoSilence = false;
bool drift_compensation = false;
AACENC_InfoStruct info = { 0 };
int aot = AOT_NONE;
@@ -273,6 +275,7 @@ int main(int argc, char *argv[])
{"aaclc", no_argument, 0, 0 },
{"sbr", no_argument, 0, 1 },
{"ps", no_argument, 0, 2 },
+ {"fifo-silence", no_argument, 0, 3 },
{0,0,0,0},
};
@@ -294,6 +297,9 @@ int main(int argc, char *argv[])
case 2: // PS
aot = AOT_DABPLUS_PS;
break;
+ case 3: // FIFO SILENCE
+ inFifoSilence = true;
+ break;
case 'a':
afterburner = true;
break;
@@ -591,8 +597,13 @@ int main(int argc, char *argv[])
break;
}
else if (read != input_size) {
- fprintf(stderr, "Short file read !\n");
- break;
+ if (inFifoSilence && ((errno==EAGAIN)||(errno==0))) {
+ memset(input_buf, 0, input_size);
+ read = input_size;
+ } else {
+ fprintf(stderr, "Short file read !\n");
+ break;
+ }
}
}
else if (drift_compensation) {