aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2018-08-31 15:45:42 +0300
committerMartin Storsjo <martin@martin.st>2018-09-02 23:25:42 +0300
commitab052fada03e6f024eb9f75cfba85b7097a712d5 (patch)
tree05c01bc0cbf620f3efe4f935a5993ca4bb0eec3e
parente646f07dbb5fb6630e5d577aa98ec58054305eba (diff)
downloadfdk-aac-ab052fada03e6f024eb9f75cfba85b7097a712d5.tar.gz
fdk-aac-ab052fada03e6f024eb9f75cfba85b7097a712d5.tar.bz2
fdk-aac-ab052fada03e6f024eb9f75cfba85b7097a712d5.zip
Adjust the aac-enc.c encoding example to fix flushing the encoder with FDKv2
Even with numInSamples == -1, all the buffer pointers need to be non-null.
-rw-r--r--aac-enc.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/aac-enc.c b/aac-enc.c
index e773700..c90ff12 100644
--- a/aac-enc.c
+++ b/aac-enc.c
@@ -196,20 +196,17 @@ int main(int argc, char *argv[]) {
const uint8_t* in = &input_buf[2*i];
convert_buf[i] = in[0] | (in[1] << 8);
}
- if (read <= 0) {
- in_args.numInSamples = -1;
- } else {
- in_ptr = convert_buf;
- in_size = read;
- in_elem_size = 2;
+ in_ptr = convert_buf;
+ in_size = read;
+ in_elem_size = 2;
+
+ in_args.numInSamples = read <= 0 ? -1 : read/2;
+ in_buf.numBufs = 1;
+ in_buf.bufs = &in_ptr;
+ in_buf.bufferIdentifiers = &in_identifier;
+ in_buf.bufSizes = &in_size;
+ in_buf.bufElSizes = &in_elem_size;
- in_args.numInSamples = read/2;
- in_buf.numBufs = 1;
- in_buf.bufs = &in_ptr;
- in_buf.bufferIdentifiers = &in_identifier;
- in_buf.bufSizes = &in_size;
- in_buf.bufElSizes = &in_elem_size;
- }
out_ptr = outbuf;
out_size = sizeof(outbuf);
out_elem_size = 1;