From 5c6b9fb58d66b01c660798d33c3e7704dada49e6 Mon Sep 17 00:00:00 2001 From: Stefan Pöschel Date: Sat, 18 Apr 2015 19:29:47 +0200 Subject: MOT encoder protocol change: transmit used PAD bytes --- src/dabplus-enc.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/dabplus-enc.cpp') diff --git a/src/dabplus-enc.cpp b/src/dabplus-enc.cpp index 7ab23d1..a91e4c9 100644 --- a/src/dabplus-enc.cpp +++ b/src/dabplus-enc.cpp @@ -624,7 +624,7 @@ int main(int argc, char *argv[]) uint8_t outbuf[24*120]; - unsigned char pad_buf[padlen]; + unsigned char pad_buf[padlen + 1]; if(outbuf_size % 5 != 0) { fprintf(stderr, "(outbuf_size mod 5) = %d\n", outbuf_size % 5); @@ -683,7 +683,7 @@ int main(int argc, char *argv[]) // --------------- Read data from the PAD fifo int ret; if (padlen != 0) { - ret = read(pad_fd, pad_buf, padlen); + ret = read(pad_fd, pad_buf, padlen + 1); } else { ret = 0; @@ -802,11 +802,11 @@ int main(int argc, char *argv[]) // -------------- AAC Encoding - int calculated_padlen = ret > 0 ? padlen : 0; + int calculated_padlen = ret > 0 ? pad_buf[padlen] : 0; in_ptr[0] = input_buf; - in_ptr[1] = pad_buf; + in_ptr[1] = pad_buf + (padlen - calculated_padlen); // offset due to unused PAD bytes in_size[0] = read; in_size[1] = calculated_padlen; in_elem_size[0] = BYTES_PER_SAMPLE; -- cgit v1.2.3