summaryrefslogtreecommitdiffstats
path: root/src/dabplus-enc.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-12-27 22:10:24 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-12-27 22:10:24 +0100
commit8cb340e29b8302679fa3e2a37118f92044a99cea (patch)
tree4668143d69b40864b4b46b368f9ccfa329d236d1 /src/dabplus-enc.cpp
parentfdeb98597d4aa2c222df72691ba1cae2a70ceb74 (diff)
downloadfdk-aac-dabplus-8cb340e29b8302679fa3e2a37118f92044a99cea.tar.gz
fdk-aac-dabplus-8cb340e29b8302679fa3e2a37118f92044a99cea.tar.bz2
fdk-aac-dabplus-8cb340e29b8302679fa3e2a37118f92044a99cea.zip
Simplify prepare_aac_encoder()
Diffstat (limited to 'src/dabplus-enc.cpp')
-rw-r--r--src/dabplus-enc.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/dabplus-enc.cpp b/src/dabplus-enc.cpp
index 015884c..9b1810a 100644
--- a/src/dabplus-enc.cpp
+++ b/src/dabplus-enc.cpp
@@ -141,8 +141,6 @@ int prepare_aac_encoder(
int afterburner,
int *aot)
{
- HANDLE_AACENCODER handle = *encoder;
-
CHANNEL_MODE mode;
switch (channels) {
case 1: mode = MODE_1; break;
@@ -153,13 +151,11 @@ int prepare_aac_encoder(
}
- if (aacEncOpen(&handle, 0x01|0x02|0x04, channels) != AACENC_OK) {
+ if (aacEncOpen(encoder, 0x01|0x02|0x04, channels) != AACENC_OK) {
fprintf(stderr, "Unable to open encoder\n");
return 1;
}
- *encoder = handle;
-
if (*aot == AOT_NONE) {
if(channels == 2 && subchannel_index <= 6) {
@@ -180,32 +176,32 @@ int prepare_aac_encoder(
*aot == AOT_DABPLUS_AAC_LC ? "AAC-LC" : "",
channels, sample_rate);
- if (aacEncoder_SetParam(handle, AACENC_AOT, *aot) != AACENC_OK) {
+ if (aacEncoder_SetParam(*encoder, AACENC_AOT, *aot) != AACENC_OK) {
fprintf(stderr, "Unable to set the AOT\n");
return 1;
}
- if (aacEncoder_SetParam(handle, AACENC_SAMPLERATE, sample_rate) != AACENC_OK) {
+ if (aacEncoder_SetParam(*encoder, AACENC_SAMPLERATE, sample_rate) != AACENC_OK) {
fprintf(stderr, "Unable to set the sample rate\n");
return 1;
}
- if (aacEncoder_SetParam(handle, AACENC_CHANNELMODE, mode) != AACENC_OK) {
+ if (aacEncoder_SetParam(*encoder, AACENC_CHANNELMODE, mode) != AACENC_OK) {
fprintf(stderr, "Unable to set the channel mode\n");
return 1;
}
- if (aacEncoder_SetParam(handle, AACENC_CHANNELORDER, 1) != AACENC_OK) {
+ if (aacEncoder_SetParam(*encoder, AACENC_CHANNELORDER, 1) != AACENC_OK) {
fprintf(stderr, "Unable to set the wav channel order\n");
return 1;
}
- if (aacEncoder_SetParam(handle, AACENC_GRANULE_LENGTH, 960) != AACENC_OK) {
+ if (aacEncoder_SetParam(*encoder, AACENC_GRANULE_LENGTH, 960) != AACENC_OK) {
fprintf(stderr, "Unable to set the granule length\n");
return 1;
}
- if (aacEncoder_SetParam(handle, AACENC_TRANSMUX, TT_DABPLUS) != AACENC_OK) {
+ if (aacEncoder_SetParam(*encoder, AACENC_TRANSMUX, TT_DABPLUS) != AACENC_OK) {
fprintf(stderr, "Unable to set the RAW transmux\n");
return 1;
}
- /*if (aacEncoder_SetParam(handle, AACENC_BITRATEMODE, AACENC_BR_MODE_SFR)
+ /*if (aacEncoder_SetParam(*encoder, AACENC_BITRATEMODE, AACENC_BR_MODE_SFR)
* != AACENC_OK) {
fprintf(stderr, "Unable to set the bitrate mode\n");
return 1;
@@ -213,18 +209,18 @@ int prepare_aac_encoder(
fprintf(stderr, "AAC bitrate set to: %d\n", subchannel_index*8000);
- if (aacEncoder_SetParam(handle, AACENC_BITRATE, subchannel_index*8000) != AACENC_OK) {
+ if (aacEncoder_SetParam(*encoder, AACENC_BITRATE, subchannel_index*8000) != AACENC_OK) {
fprintf(stderr, "Unable to set the bitrate\n");
return 1;
}
- if (aacEncoder_SetParam(handle, AACENC_AFTERBURNER, afterburner) != AACENC_OK) {
+ if (aacEncoder_SetParam(*encoder, AACENC_AFTERBURNER, afterburner) != AACENC_OK) {
fprintf(stderr, "Unable to set the afterburner mode\n");
return 1;
}
if (!afterburner) {
fprintf(stderr, "Warning: Afterburned disabled!\n");
}
- if (aacEncEncode(handle, NULL, NULL, NULL, NULL) != AACENC_OK) {
+ if (aacEncEncode(*encoder, NULL, NULL, NULL, NULL) != AACENC_OK) {
fprintf(stderr, "Unable to initialize the encoder\n");
return 1;
}