summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libAACenc/src/bitenc.cpp7
-rw-r--r--src/dabplus-enc.cpp35
-rw-r--r--src/utils.c7
-rw-r--r--src/utils.h2
4 files changed, 31 insertions, 20 deletions
diff --git a/libAACenc/src/bitenc.cpp b/libAACenc/src/bitenc.cpp
index 0823ef2..4552457 100644
--- a/libAACenc/src/bitenc.cpp
+++ b/libAACenc/src/bitenc.cpp
@@ -1462,8 +1462,11 @@ AAC_ENCODER_ERROR FDKaacEnc_WriteBitstream(HANDLE_TRANSPORTENC hTpEnc,
/* Write global extension payload and fill data */
for (n = 0; (n < qcOut->nExtensions) && (n < (2+2)); n++)
{
- if ( (syntaxFlags & AC_DAB) &&
- (qcOut->extension[n].type != EXT_DATA_ELEMENT) ) {
+ if ( !(syntaxFlags & AC_DAB) ||
+ ( (syntaxFlags & AC_DAB) &&
+ (qcOut->extension[n].type != EXT_DATA_ELEMENT)
+ )
+ ) {
FDKaacEnc_writeExtensionData( hTpEnc,
&qcOut->extension[n],
0,
diff --git a/src/dabplus-enc.cpp b/src/dabplus-enc.cpp
index 1117277..0862690 100644
--- a/src/dabplus-enc.cpp
+++ b/src/dabplus-enc.cpp
@@ -102,7 +102,7 @@ void usage(const char* name) {
" --ps Force the usage of PS\n"
" Output and pad parameters:\n"
" -o, --output=URI Output zmq uri. (e.g. 'tcp://localhost:9000')\n"
- " -or- Output file uri. (e.g. 'file.dab')\n"
+ " -or- Output file uri. (e.g. 'file.dabp')\n"
" -or- a single dash '-' to denote stdout\n"
" -k, --secret-key=FILE Enable ZMQ encryption with the given secret key.\n"
" -p, --pad=BYTES Set PAD size in bytes.\n"
@@ -832,24 +832,35 @@ int main(int argc, char *argv[])
}
}
- if (out_args.numOutBytes + row*10 == outbuf_size) {
- if (show_level) {
+ if (show_level) {
+ if (channels == 1) {
+ fprintf(stderr, "\rIn: [%-6s] %1s %1s %1s",
+ level(1, MAX(peak_right, peak_left)),
+ status & STATUS_PAD_INSERTED ? "P" : " ",
+ status & STATUS_UNDERRUN ? "U" : " ",
+ status & STATUS_OVERRUN ? "O" : " ");
+ }
+ else if (channels == 2) {
fprintf(stderr, "\rIn: [%6s|%-6s] %1s %1s %1s",
- level(0, &peak_left),
- level(1, &peak_right),
+ level(0, peak_left),
+ level(1, peak_right),
status & STATUS_PAD_INSERTED ? "P" : " ",
status & STATUS_UNDERRUN ? "U" : " ",
status & STATUS_OVERRUN ? "O" : " ");
}
- else {
- if (status & STATUS_OVERRUN) {
- fprintf(stderr, "O");
- }
- if (status & STATUS_UNDERRUN) {
- fprintf(stderr, "U");
- }
+ peak_right = 0;
+ peak_left = 0;
+ }
+ else {
+ if (status & STATUS_OVERRUN) {
+ fprintf(stderr, "O");
}
+
+ if (status & STATUS_UNDERRUN) {
+ fprintf(stderr, "U");
+ }
+
}
status = 0;
diff --git a/src/utils.c b/src/utils.c
index a9aefbe..0168a23 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -4,7 +4,7 @@
#include <math.h>
/* Taken from sox */
-const char* level(int channel, int* peak)
+const char* level(int channel, int peak)
{
static char const * const text[][2] = {
/* White: 2dB steps */
@@ -17,7 +17,7 @@ const char* level(int channel, int* peak)
};
int const red = 1, white = NUMOF(text) - red;
- double linear = (double)(*peak) / INT16_MAX;
+ double linear = ((double)peak) / INT16_MAX;
int vu_dB = linear ? floor(2 * white + red + linear_to_dB(linear)) : 0;
@@ -25,9 +25,6 @@ const char* level(int channel, int* peak)
MAX(vu_dB / 2, 0) :
MIN(vu_dB - white, red + white - 1);
- *peak = 0;
-
return text[index][channel];
-
}
diff --git a/src/utils.h b/src/utils.h
index 7cd9a96..c75935f 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -14,7 +14,7 @@
/* Calculate the little string containing a bargraph
* 'VU-meter' from the peak value measured
*/
-const char* level(int channel, int* peak);
+const char* level(int channel, int peak);
/* This defines the on-wire representation of a ZMQ message header.
*