mm-audio: aac: modify aac encoding test app
test app uses input pcm file sample rate for AAC encoding.
Modify test app to perform AAC encoding with sample rate
mentioned by user
Change-Id: I4dde722b8ae91a1312acdf0be63781e28868aa10
diff --git a/mm-audio/aenc-aac/qdsp6/src/omx_aac_aenc.cpp b/mm-audio/aenc-aac/qdsp6/src/omx_aac_aenc.cpp
index d2dd1d0..8b5c480 100644
--- a/mm-audio/aenc-aac/qdsp6/src/omx_aac_aenc.cpp
+++ b/mm-audio/aenc-aac/qdsp6/src/omx_aac_aenc.cpp
@@ -1460,7 +1460,7 @@
case 0:
case 1:
{
- drv_aac_enc_config.stream_format = 65535;
+ drv_aac_enc_config.stream_format = AUDIO_AAC_FORMAT_ADTS;
DEBUG_PRINT("Setting AUDIO_AAC_FORMAT_ADTS\n");
break;
}
diff --git a/mm-audio/aenc-aac/qdsp6/test/omx_aac_enc_test.c b/mm-audio/aenc-aac/qdsp6/test/omx_aac_enc_test.c
index 5f18aa2..43c676b 100644
--- a/mm-audio/aenc-aac/qdsp6/test/omx_aac_enc_test.c
+++ b/mm-audio/aenc-aac/qdsp6/test/omx_aac_enc_test.c
@@ -105,7 +105,8 @@
FILE *F1 = NULL;
-uint32_t samplerate = 44100;
+uint32_t aac_samplerate = 0;
+uint32_t pcm_samplerate = 0;
uint32_t aac_channels = 0;
uint32_t pcm_channels = 0;
uint32_t bitrate = 128000;
@@ -521,7 +522,7 @@
if (argc >= 9) {
in_filename = argv[1];
out_filename = argv[2];
- samplerate = (uint32_t)atoi(argv[3]);
+ aac_samplerate = (uint32_t)atoi(argv[3]);
aac_channels = (uint32_t)atoi(argv[4]);
tunnel = (uint32_t)atoi(argv[5]);
rectime = (uint32_t)atoi(argv[6]);
@@ -529,9 +530,9 @@
format = (uint32_t)atoi(argv[8]);
profile = (uint32_t)atoi(argv[9]);
- DEBUG_PRINT("Input parameters: samplerate = %d, channels = %d, tunnel = %d,"
+ DEBUG_PRINT("Input parameters: aac_samplerate = %d, channels = %d, tunnel = %d,"
" rectime = %d, bitrate = %d, format = %d, profile = %d\n",
- samplerate, aac_channels, tunnel, rectime, bitrate, format, profile);
+ aac_samplerate, aac_channels, tunnel, rectime, bitrate, format, profile);
if (!((profile == 2) || (profile == 5) || (profile == 29))) {
DEBUG_PRINT("profile = %d, not supported. Supported "
@@ -548,17 +549,17 @@
"number of channels are 1 and 2\n", aac_channels);
return 0;
}
- if ((samplerate < 8000) && (samplerate > 48000)) {
+ if ((aac_samplerate < 8000) && (aac_samplerate > 48000)) {
DEBUG_PRINT("samplerate = %d, not supported, Supported "
"samplerates are 8000, 11025, 12000, 16000, 22050, "
- "24000, 32000, 44100, 48000\n", samplerate);
+ "24000, 32000, 44100, 48000\n", aac_samplerate);
return 0;
} else {
if ((profile == 5) || (profile == 29)) {
- if (samplerate < 24000) {
+ if (aac_samplerate < 24000) {
DEBUG_PRINT("samplerate = %d, not supported for AAC+/EAAC+."
" Supported samplerates are 24000, 32000,"
- " 44100, 48000\n", samplerate);
+ " 44100, 48000\n", aac_samplerate);
return 0;
}
}
@@ -793,7 +794,7 @@
pcmparam.nPortIndex = 0;
pcmparam.nChannels = pcm_channels;
- pcmparam.nSamplingRate = samplerate;
+ pcmparam.nSamplingRate = pcm_samplerate;
OMX_SetParameter(aac_enc_handle,OMX_IndexParamAudioPcm,&pcmparam);
@@ -818,7 +819,7 @@
aacparam.nPortIndex = 1;
aacparam.nChannels = aac_channels; //2 ; /* 1-> mono 2-> stereo*/
aacparam.nBitRate = bitrate;
- aacparam.nSampleRate = samplerate;
+ aacparam.nSampleRate = aac_samplerate;
aacparam.eChannelMode = OMX_AUDIO_ChannelModeStereo;
aacparam.eAACStreamFormat = (OMX_AUDIO_AACSTREAMFORMATTYPE)format;
aacparam.eAACProfile = (OMX_AUDIO_AACPROFILETYPE)profile;
@@ -1142,7 +1143,7 @@
adts_sample_index srate_enum;
uint32 value;
- uint32 sample_index = samplerate;
+ uint32 sample_index = (uint32)aac_samplerate;
uint8 channel_config = (uint8)aac_channels;
/* Store Sync word first */
@@ -1154,8 +1155,8 @@
if ((format == OMX_AUDIO_AACStreamFormatRAW) &&
((profile == OMX_AUDIO_AACObjectHE) ||
(profile == OMX_AUDIO_AACObjectHE_PS))){
- if (samplerate >= 24000)
- sample_index = samplerate/2;
+ if (aac_samplerate >= 24000)
+ sample_index = aac_samplerate/2;
}
/* ID field, 1 bit */
@@ -1287,7 +1288,7 @@
DEBUG_PRINT("Channel Count is %d\n", hdr.num_channels);
DEBUG_PRINT("\n***************************************************************\n");
- samplerate = hdr.sample_rate;
+ pcm_samplerate = hdr.sample_rate;
pcm_channels = hdr.num_channels;
return OMX_ErrorNone;