aboutsummaryrefslogtreecommitdiffstats
path: root/libtoolame-dab
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-03-29 21:23:13 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-03-29 21:23:13 +0200
commit08f8a684919ae05a3be6365bc69c5b3cfa57cc17 (patch)
treea30a741bf038cdb19a1be29f65772632e310da50 /libtoolame-dab
parent568f0147eb85e572f3a04d66fd4922a218f22e17 (diff)
downloadODR-AudioEnc-08f8a684919ae05a3be6365bc69c5b3cfa57cc17.tar.gz
ODR-AudioEnc-08f8a684919ae05a3be6365bc69c5b3cfa57cc17.tar.bz2
ODR-AudioEnc-08f8a684919ae05a3be6365bc69c5b3cfa57cc17.zip
Fix libtoolame-dab PAD insertion
Diffstat (limited to 'libtoolame-dab')
-rw-r--r--libtoolame-dab/toolame.c9
-rw-r--r--libtoolame-dab/toolame.h2
2 files changed, 8 insertions, 3 deletions
diff --git a/libtoolame-dab/toolame.c b/libtoolame-dab/toolame.c
index 02cedf6..7dc5aa5 100644
--- a/libtoolame-dab/toolame.c
+++ b/libtoolame-dab/toolame.c
@@ -88,7 +88,6 @@ void global_init (void)
static frame_info frame;
static frame_header header;
static int frameNum;
-static int xpad_len;
static int psycount;
static int model;
static unsigned int crc;
@@ -257,12 +256,15 @@ int toolame_set_samplerate(long sample_rate)
int toolame_set_pad(int pad_len)
{
- header.dab_length = pad_len;
- if (header.dab_length <= 0) {
+ if (pad_len < 0) {
fprintf(stderr, "Invalid XPAD length specified\n");
return 1;
}
+ if (pad_len) {
+ header.dab_length = pad_len;
+ }
+
return 0;
}
@@ -272,6 +274,7 @@ static int encode_first_call = 1;
int toolame_encode_frame(
short buffer[2][1152],
unsigned char *xpad_data,
+ size_t xpad_len,
unsigned char *output_buffer,
size_t output_buffer_size)
{
diff --git a/libtoolame-dab/toolame.h b/libtoolame-dab/toolame.h
index 1c29e24..5450ca0 100644
--- a/libtoolame-dab/toolame.h
+++ b/libtoolame-dab/toolame.h
@@ -1,5 +1,6 @@
#ifndef __TOOLAME_H_
#define __TOOLAME_H_
+#include <stdlib.h>
/* All exported functions shown here return zero
* on success */
@@ -38,6 +39,7 @@ int toolame_set_pad(int pad_len);
int toolame_encode_frame(
short buffer[2][1152],
unsigned char *xpad_data,
+ size_t xpad_len,
unsigned char *output_buffer,
size_t output_buffer_size);