summaryrefslogtreecommitdiffstats
path: root/libSYS/src/wav_file.cpp
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2013-08-08 17:32:50 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2013-08-20 14:51:53 -0700
commit577fcbb570d023be4cea9564292dd2bd95f40c3b (patch)
treee085192cbca5f68a6d7897d3869b46a5fc5f83c7 /libSYS/src/wav_file.cpp
parent4f0d97057c5c640b25518358886f8c47da9fc052 (diff)
downloadfdk-aac-dabplus-577fcbb570d023be4cea9564292dd2bd95f40c3b.tar.gz
fdk-aac-dabplus-577fcbb570d023be4cea9564292dd2bd95f40c3b.tar.bz2
fdk-aac-dabplus-577fcbb570d023be4cea9564292dd2bd95f40c3b.zip
Decode and SYS lib cleanup
* AAC-Encoder - Remove source snippets related to unsupported frame length of 960. - Adjust minBits initialization for disabled VBR configuration. Modified file(s): libAACenc/src/aacenc.h libAACenc/src/aacenc_lib.cpp libAACenc/src/aacenc_tns.cpp libAACenc/src/bandwidth.cpp libAACenc/src/psy_const.h libAACenc/src/transform.h - Revise encoder parameter restrictions: "Error Resilient(ER) AAC Low Complexity" is not supported. Where the AAC part of the FDK encoder threw an initialization error, now the aacEncoder_SetParam() returns an error before initialization if the application tries to configure this audio object type. Modified file(s): libAACenc/src/aacenc_lib.cpp * SYS-Library - Portability fix for Mingw32. Modified file(s): libSYS/include/machine_type.h - Minor changes. Modified file(s): libSYS/include/wav_file.h libSYS/src/wav_file.cpp libSYS/src/cmdl_parser.cpp libSYS/src/genericStds.cpp Bug 9428126 Change-Id: I9fa44923d34f033d0dc607f2b85abacb8a85eb61
Diffstat (limited to 'libSYS/src/wav_file.cpp')
-rw-r--r--libSYS/src/wav_file.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/libSYS/src/wav_file.cpp b/libSYS/src/wav_file.cpp
index 38b4a37..58bcfaa 100644
--- a/libSYS/src/wav_file.cpp
+++ b/libSYS/src/wav_file.cpp
@@ -174,7 +174,6 @@ INT WAV_InputOpen (HANDLE_WAV *pWav, const char *filename)
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
};
USHORT extraFormatBytes, validBitsPerSample;
- UINT channelMask;
UCHAR guid[16];
INT i;
@@ -184,7 +183,7 @@ INT WAV_InputOpen (HANDLE_WAV *pWav, const char *filename)
if (extraFormatBytes >= 22) {
FDKfread_EL(&(validBitsPerSample), 2, 1, wav->fp);
- FDKfread_EL(&(channelMask), 4, 1, wav->fp);
+ FDKfread_EL(&(wav->channelMask), 4, 1, wav->fp);
FDKfread_EL(&(guid), 16, 1, wav->fp);
/* check for PCM GUID */
@@ -228,12 +227,12 @@ INT WAV_InputOpen (HANDLE_WAV *pWav, const char *filename)
/* Error path */
error:
- if (wav->fp) {
- FDKfclose(wav->fp);
- wav->fp = NULL;
- }
if (wav) {
+ if (wav->fp) {
+ FDKfclose(wav->fp);
+ wav->fp = NULL;
+ }
FDKfree(wav);
}
@@ -388,6 +387,11 @@ INT WAV_OutputOpen(HANDLE_WAV *pWav, const char *outputFilename, INT sampleRate,
HANDLE_WAV wav = (HANDLE_WAV)FDKcalloc(1, sizeof(struct WAV));
UINT size = 0;
+ if (wav == NULL) {
+ FDKprintfErr("WAV_OutputOpen(): Unable to allocate WAV struct.\n");
+ goto bail;
+ }
+
if (bitsPerSample != 16 && bitsPerSample != 24 && bitsPerSample != 32)
{
FDKprintfErr("WAV_OutputOpen(): Invalid argument (bitsPerSample).\n");
@@ -433,10 +437,12 @@ INT WAV_OutputOpen(HANDLE_WAV *pWav, const char *outputFilename, INT sampleRate,
return 0;
bail:
- if (wav->fp)
- FDKfclose(wav->fp);
- if (wav)
+ if (wav) {
+ if (wav->fp) {
+ FDKfclose(wav->fp);
+ }
FDKfree(wav);
+ }
pWav = NULL;