From 4d7c8c742d5b09895e7ce3d07d314b6ada56123d Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Sun, 10 Oct 2010 15:04:20 -0700 Subject: [PATCH] Test cleanup Fix bug in QueryEffect test - was not re-initializing the name length. Add QueryEffect test for over-writing the name buffer. Don't create output with VOLUME or NULL interfaces. Use symbolic names for exit codes instead of 0 and 1. Remove Android-style logging from examples; use only printf. Remove extra blank lines in test output. Remove the MAX_NUMBER_OUTPUT_DEVICES macro. Use to declare usleep. Remove obsolete #include statements. Fix build warnings. Change-Id: I8d198a317246b3894f104edf7c9f317a51593d07 --- opensles/tests/examples/slesTestBassBoostPath.cpp | 19 ++-------- .../tests/examples/slesTestEffectCapabilities.cpp | 29 ++++++++------- opensles/tests/examples/slesTestEqFdPath.cpp | 19 ++-------- opensles/tests/examples/slesTestEqOutputPath.cpp | 18 ++-------- opensles/tests/examples/slesTestPlayFdPath.cpp | 22 ++++-------- opensles/tests/examples/slesTestRecBuffQueue.cpp | 10 ++---- .../tests/examples/slesTestSawtoothBufferQueue.cpp | 29 ++++----------- .../tests/examples/slesTestSendToPresetReverb.cpp | 19 ++-------- .../tests/examples/slesTestVirtualizerPath.cpp | 21 +++-------- opensles/tests/listening/slesTest_playMuteSolo.cpp | 21 +++-------- opensles/tests/mimeUri/Android.mk | 2 +- opensles/tests/mimeUri/slesTestLoopUri.cpp | 22 +++--------- opensles/tests/mimeUri/slesTestPlayStreamType.cpp | 20 +++-------- opensles/tests/mimeUri/slesTestPlayUri.cpp | 42 ++++++++-------------- opensles/tests/mimeUri/slesTestPlayUri2.cpp | 24 +++---------- opensles/tests/mimeUri/slesTestSlowDownUri.cpp | 22 +++--------- opensles/tests/mimeUri/slesTest_playStates.cpp | 16 +++------ opensles/tests/mimeUri_test.cpp | 2 +- opensles/tests/sandbox/configbq.c | 1 + opensles/tests/sandbox/multiplay.c | 5 ++- opensles/tests/sandbox/reverb.c | 1 + opensles/tests/sandbox/urimime.c | 1 + 22 files changed, 100 insertions(+), 265 deletions(-) diff --git a/opensles/tests/examples/slesTestBassBoostPath.cpp b/opensles/tests/examples/slesTestBassBoostPath.cpp index 00a76681..e4806332 100644 --- a/opensles/tests/examples/slesTestBassBoostPath.cpp +++ b/opensles/tests/examples/slesTestBassBoostPath.cpp @@ -14,16 +14,6 @@ * limitations under the License. */ -#ifdef ANDROID -#define LOG_NDEBUG 0 -#define LOG_TAG "slesTest_bassboost" - -#include -#else -#define LOGV printf -#endif - -#include #include #include #include @@ -49,7 +39,7 @@ void ExitOnErrorFunc( SLresult result , int line) { if (SL_RESULT_SUCCESS != result) { fprintf(stderr, "%lu error code encountered at line %d, exiting\n", result, line); - exit(1); + exit(EXIT_FAILURE); } } @@ -255,8 +245,6 @@ void TestBassBoostPathFromFD( SLObjectItf sl, const char* path, int16_t boostStr //----------------------------------------------------------------- int main(int argc, char* const argv[]) { - LOGV("Starting %s\n", argv[0]); - SLresult result; SLObjectItf sl; @@ -271,7 +259,7 @@ int main(int argc, char* const argv[]) if (argc < 3) { fprintf(stdout, "Usage: \t%s path bass_boost_strength\n", argv[0]); fprintf(stdout, "Example: \"%s /sdcard/my.mp3 1000\" \n", argv[0]); - exit(1); + exit(EXIT_FAILURE); } SLEngineOption EngineOption[] = { @@ -290,7 +278,6 @@ int main(int argc, char* const argv[]) /* Shutdown OpenSL ES */ (*sl)->Destroy(sl); - exit(0); - return 0; + return EXIT_SUCCESS; } diff --git a/opensles/tests/examples/slesTestEffectCapabilities.cpp b/opensles/tests/examples/slesTestEffectCapabilities.cpp index ef71b780..9239f08e 100644 --- a/opensles/tests/examples/slesTestEffectCapabilities.cpp +++ b/opensles/tests/examples/slesTestEffectCapabilities.cpp @@ -14,11 +14,6 @@ * limitations under the License. */ -#define LOG_NDEBUG 0 -#define LOG_TAG "slesTest_virtualizer" - -#include -#include #include #include #include @@ -30,7 +25,7 @@ #include "SLES/OpenSLES_Android.h" -#define MAX_NUMBER_INTERFACES 3 +#define MAX_NUMBER_INTERFACES 1 #define GUID_DISPLAY_LENGTH 35 #define FX_NAME_LENGTH 64 @@ -44,7 +39,7 @@ void ExitOnErrorFunc( SLresult result , int line) { if (SL_RESULT_SUCCESS != result) { fprintf(stderr, "%lu error code encountered at line %d, exiting\n", result, line); - exit(1); + exit(EXIT_FAILURE); } } @@ -122,7 +117,7 @@ void TestGenericFxCapabilities( ) ExitOnError(result); fprintf(stdout, "Effect library contains %ld effects:\n", nbEffects); - SLchar effectName[FX_NAME_LENGTH]; + SLchar effectName[FX_NAME_LENGTH+1]; SLuint16 effectNameLength = FX_NAME_LENGTH; char typeString[GUID_DISPLAY_LENGTH]; char implString[GUID_DISPLAY_LENGTH]; @@ -130,12 +125,24 @@ void TestGenericFxCapabilities( ) SLInterfaceID effectType, effectImplementation; for (SLuint32 i = 0 ; i < nbEffects ; i++ ) { fprintf(stdout,"- effect %ld: ", i); + memset(effectName, 'Z', FX_NAME_LENGTH+1); + effectNameLength = FX_NAME_LENGTH; result = (*EffectLibItf)->QueryEffect(EffectLibItf, i, &effectType, &effectImplementation, effectName, &effectNameLength); + if ('Z' != effectName[FX_NAME_LENGTH]) { + fprintf(stderr, "QueryEffect wrote beyond end of buffer\n"); + continue; + } ExitOnError(result); + printf("length=%u ", effectNameLength); + if (FX_NAME_LENGTH < effectNameLength) { + printf(" (>max) "); + effectNameLength = FX_NAME_LENGTH; + } guidToString(effectType, typeString); guidToString(effectImplementation, implString); - fprintf(stdout, "type = %s impl = %s name = %s \n", typeString, implString, effectName); + effectName[FX_NAME_LENGTH - 1] = '\0'; + fprintf(stdout, " type=%s, impl=%s name=%.*s \n", typeString, implString, effectNameLength, effectName); } /* Shutdown OpenSL ES */ @@ -145,8 +152,6 @@ void TestGenericFxCapabilities( ) //----------------------------------------------------------------- int main(int argc, char* const argv[]) { - LOGV("Starting %s\n", argv[0]); - SLresult result; SLObjectItf sl; @@ -154,5 +159,5 @@ int main(int argc, char* const argv[]) TestGenericFxCapabilities(); - return 0; + return EXIT_SUCCESS; } diff --git a/opensles/tests/examples/slesTestEqFdPath.cpp b/opensles/tests/examples/slesTestEqFdPath.cpp index c6c28361..99605011 100644 --- a/opensles/tests/examples/slesTestEqFdPath.cpp +++ b/opensles/tests/examples/slesTestEqFdPath.cpp @@ -14,16 +14,6 @@ * limitations under the License. */ -#ifdef ANDROID -#define LOG_NDEBUG 0 -#define LOG_TAG "slesTest_seekFdPath" - -#include -#else -#define LOGV printf -#endif - -#include #include #include #include @@ -49,7 +39,7 @@ void ExitOnErrorFunc( SLresult result , int line) { if (SL_RESULT_SUCCESS != result) { fprintf(stderr, "%lu error code encountered at line %d, exiting\n", result, line); - exit(1); + exit(EXIT_FAILURE); } } @@ -283,8 +273,6 @@ void TestEQPathFromFD( SLObjectItf sl, const char* path //----------------------------------------------------------------- int main(int argc, char* const argv[]) { - LOGV("Starting %s\n", argv[0]); - SLresult result; SLObjectItf sl; @@ -304,7 +292,7 @@ int main(int argc, char* const argv[]) { fprintf(stdout, "Usage: \t%s path offsetInBytes [sizeInBytes]\n", argv[0]); fprintf(stdout, "Example: \"%s /sdcard/my.mp3 0 344460\" \n", argv[0]); - exit(1); + exit(EXIT_FAILURE); } SLEngineOption EngineOption[] = { @@ -332,7 +320,6 @@ int main(int argc, char* const argv[]) /* Shutdown OpenSL ES */ (*sl)->Destroy(sl); - exit(0); - return 0; + return EXIT_SUCCESS; } diff --git a/opensles/tests/examples/slesTestEqOutputPath.cpp b/opensles/tests/examples/slesTestEqOutputPath.cpp index 7b12a64d..8658668a 100644 --- a/opensles/tests/examples/slesTestEqOutputPath.cpp +++ b/opensles/tests/examples/slesTestEqOutputPath.cpp @@ -14,15 +14,6 @@ * limitations under the License. */ -#ifdef ANDROID -#define LOG_NDEBUG 0 -#define LOG_TAG "slesTest_seekFdPath" - -#include -#else -#define LOGV printf -#endif -#include #include #include #include @@ -48,7 +39,7 @@ void ExitOnErrorFunc( SLresult result , int line) { if (SL_RESULT_SUCCESS != result) { fprintf(stderr, "%lu error code encountered at line %d, exiting\n", result, line); - exit(1); + exit(EXIT_FAILURE); } } @@ -286,8 +277,6 @@ void TestEQPathFromFD( SLObjectItf sl, const char* path //----------------------------------------------------------------- int main(int argc, char* const argv[]) { - LOGV("Starting %s\n", argv[0]); - SLresult result; SLObjectItf sl; @@ -303,7 +292,7 @@ int main(int argc, char* const argv[]) if (argc < 3) { fprintf(stdout, "Usage: \t%s path offsetInBytes [sizeInBytes]\n", argv[0]); fprintf(stdout, "Example: \"%s /sdcard/my.mp3 0 344460\" \n", argv[0]); - exit(1); + exit(EXIT_FAILURE); } #endif @@ -332,7 +321,6 @@ int main(int argc, char* const argv[]) /* Shutdown OpenSL ES */ (*sl)->Destroy(sl); - exit(0); - return 0; + return EXIT_SUCCESS; } diff --git a/opensles/tests/examples/slesTestPlayFdPath.cpp b/opensles/tests/examples/slesTestPlayFdPath.cpp index 395c44c6..e4b8b944 100644 --- a/opensles/tests/examples/slesTestPlayFdPath.cpp +++ b/opensles/tests/examples/slesTestPlayFdPath.cpp @@ -14,11 +14,6 @@ * limitations under the License. */ -#define LOG_NDEBUG 0 -#define LOG_TAG "slesTest_playFdPath" - -#include -#include #include #include #include @@ -31,7 +26,6 @@ #define MAX_NUMBER_INTERFACES 3 -#define MAX_NUMBER_OUTPUT_DEVICES 6 #define TEST_MUTE 0 #define TEST_SOLO 1 @@ -45,7 +39,7 @@ void ExitOnErrorFunc( SLresult result , int line) { if (SL_RESULT_SUCCESS != result) { fprintf(stdout, "%lu error code encountered at line %d, exiting\n", result, line); - exit(1); + exit(EXIT_FAILURE); } } @@ -91,7 +85,7 @@ void TestPlayPathFromFD( SLObjectItf sl, const char* path, SLAint64 offset, SLAi /* Configuration of the output mix */ /* Create Output Mix object to be used by the player */ - result = (*EngineItf)->CreateOutputMix(EngineItf, &outputMix, 1, iidArray, required); + result = (*EngineItf)->CreateOutputMix(EngineItf, &outputMix, 0, iidArray, required); ExitOnError(result); /* Realize the Output Mix object in synchronous mode */ @@ -116,7 +110,8 @@ void TestPlayPathFromFD( SLObjectItf sl, const char* path, SLAint64 offset, SLAi locatorFd.locatorType = SL_DATALOCATOR_ANDROIDFD; int fd = open(path, O_RDONLY); if (fd == -1) { - ExitOnError(SL_RESULT_RESOURCE_ERROR); + perror(path); + exit(EXIT_FAILURE); } locatorFd.fd = (SLint32) fd; locatorFd.length = size; @@ -195,8 +190,6 @@ void TestPlayPathFromFD( SLObjectItf sl, const char* path, SLAint64 offset, SLAi //----------------------------------------------------------------- int main(int argc, char* const argv[]) { - LOGV("Starting %s\n", argv[0]); - SLresult result; SLObjectItf sl; @@ -209,7 +202,7 @@ int main(int argc, char* const argv[]) if (argc < 3) { fprintf(stdout, "Usage: \t%s path offsetInBytes [sizeInBytes]\n", argv[0]); fprintf(stdout, "Example: \"%s /sdcard/my.mp3 0 344460\" \n", argv[0]); - exit(1); + exit(EXIT_FAILURE); } SLEngineOption EngineOption[] = { @@ -224,7 +217,7 @@ int main(int argc, char* const argv[]) ExitOnError(result); if (argc == 3) { - fprintf(stdout, "\nno file size given, using SL_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE\n\n"); + fprintf(stdout, "no file size given, using SL_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE\n"); TestPlayPathFromFD(sl, argv[1], (SLAint64)atoi(argv[2]), SL_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE); } else { @@ -233,7 +226,6 @@ int main(int argc, char* const argv[]) /* Shutdown OpenSL ES */ (*sl)->Destroy(sl); - exit(0); - return 0; + return EXIT_SUCCESS; } diff --git a/opensles/tests/examples/slesTestRecBuffQueue.cpp b/opensles/tests/examples/slesTestRecBuffQueue.cpp index 64f7bc10..6a247620 100644 --- a/opensles/tests/examples/slesTestRecBuffQueue.cpp +++ b/opensles/tests/examples/slesTestRecBuffQueue.cpp @@ -14,7 +14,6 @@ * limitations under the License. */ -#include #include #include #include @@ -50,7 +49,7 @@ void ExitOnErrorFunc( SLresult result , int line) { if (SL_RESULT_SUCCESS != result) { fprintf(stdout, "%lu error code encountered at line %d, exiting\n", result, line); - exit(1); + exit(EXIT_FAILURE); } } @@ -291,8 +290,6 @@ void TestRecToBuffQueue( SLObjectItf sl, const char* path, SLAint64 durationInSe //----------------------------------------------------------------- int main(int argc, char* const argv[]) { - //LOGV("Starting %s\n", argv[0]); - SLresult result; SLObjectItf sl; @@ -303,7 +300,7 @@ int main(int argc, char* const argv[]) if (argc < 2) { fprintf(stdout, "Usage: \t%s destination_file duration_in_seconds\n", argv[0]); fprintf(stdout, "Example: \"%s /sdcard/myrec.raw 4\" \n", argv[0]); - exit(1); + exit(EXIT_FAILURE); } SLEngineOption EngineOption[] = { @@ -321,7 +318,6 @@ int main(int argc, char* const argv[]) /* Shutdown OpenSL ES */ (*sl)->Destroy(sl); - exit(0); - return 0; + return EXIT_SUCCESS; } diff --git a/opensles/tests/examples/slesTestSawtoothBufferQueue.cpp b/opensles/tests/examples/slesTestSawtoothBufferQueue.cpp index c1022ca1..d14f8ec1 100644 --- a/opensles/tests/examples/slesTestSawtoothBufferQueue.cpp +++ b/opensles/tests/examples/slesTestSawtoothBufferQueue.cpp @@ -37,16 +37,6 @@ * MATERIALS. */ -#define LOG_NDEBUG 0 -#define LOG_TAG "Sawtooth" - -#ifdef ANDROID -#include -#else -#define LOGV printf -#endif - -#include #include #include #include @@ -56,13 +46,8 @@ #include "SLES/OpenSLES.h" -/*using namespace android;*/ - -#define SLEEP(x) /* Client system sleep function to sleep x milliseconds -would replace SLEEP macro */ #define MAX_NUMBER_INTERFACES 3 -#define MAX_NUMBER_OUTPUT_DEVICES 6 /* Local storage for Audio data in 16 bit words */ #define AUDIO_DATA_STORAGE_SIZE 4096 * 100 @@ -76,7 +61,7 @@ void CheckErr( SLresult res ) if ( res != SL_RESULT_SUCCESS ) { fprintf(stdout, "%lu SL failure, exiting\n", res); - exit(1); + exit(EXIT_FAILURE); } else { //fprintf(stdout, "%d SL success, proceeding...\n", res); @@ -164,15 +149,17 @@ void TestPlaySawtoothBufferQueue( SLObjectItf sl ) required[0] = SL_BOOLEAN_TRUE; iidArray[0] = SL_IID_VOLUME; // Create Output Mix object to be used by player - res = (*EngineItf)->CreateOutputMix(EngineItf, &OutputMix, 1, + res = (*EngineItf)->CreateOutputMix(EngineItf, &OutputMix, 0, iidArray, required); CheckErr(res); // Realizing the Output Mix object in synchronous mode. res = (*OutputMix)->Realize(OutputMix, SL_BOOLEAN_FALSE); CheckErr(res); +#if 0 res = (*OutputMix)->GetInterface(OutputMix, SL_IID_VOLUME, (void*)&volumeItf); CheckErr(res); +#endif /* Setup the data source structure for the buffer queue */ bufferQueue.locatorType = SL_DATALOCATOR_BUFFERQUEUE; @@ -233,8 +220,10 @@ void TestPlaySawtoothBufferQueue( SLObjectItf sl ) res = (*bufferQueueItf)->RegisterCallback(bufferQueueItf, BufferQueueCallback, &cntxt); CheckErr(res); +#if 0 /* Before we start set volume to -3dB (-300mB) */ res = (*volumeItf)->SetVolumeLevel(volumeItf, -300); CheckErr(res); +#endif /* Enqueue a few buffers to get the ball rolling */ res = (*bufferQueueItf)->Enqueue(bufferQueueItf, cntxt.pData, @@ -285,8 +274,6 @@ void TestPlaySawtoothBufferQueue( SLObjectItf sl ) int main(int argc, char* const argv[]) { - LOGV("Starting sawtoothPlayer\n"); - SLresult res; SLObjectItf sl; @@ -304,8 +291,6 @@ int main(int argc, char* const argv[]) /* Shutdown OpenSL ES */ (*sl)->Destroy(sl); - exit(0); - - return 0; + return EXIT_SUCCESS; } diff --git a/opensles/tests/examples/slesTestSendToPresetReverb.cpp b/opensles/tests/examples/slesTestSendToPresetReverb.cpp index 3fe8c805..4a717859 100644 --- a/opensles/tests/examples/slesTestSendToPresetReverb.cpp +++ b/opensles/tests/examples/slesTestSendToPresetReverb.cpp @@ -14,16 +14,6 @@ * limitations under the License. */ -#ifdef ANDROID -#define LOG_NDEBUG 0 -#define LOG_TAG "slesTest_sendToPresetReverb" - -#include -#else -#define LOGV printf -#endif - -#include #include #include #include @@ -49,7 +39,7 @@ void ExitOnErrorFunc( SLresult result , int line) { if (SL_RESULT_SUCCESS != result) { fprintf(stderr, "%lu error code encountered at line %d, exiting\n", result, line); - exit(1); + exit(EXIT_FAILURE); } } @@ -259,8 +249,6 @@ void TestSendToPresetReverb( SLObjectItf sl, const char* path, int preset, SLmil //----------------------------------------------------------------- int main(int argc, char* const argv[]) { - LOGV("Starting %s\n", argv[0]); - SLresult result; SLObjectItf sl; @@ -275,7 +263,7 @@ int main(int argc, char* const argv[]) if (argc < 5) { fprintf(stdout, "Usage: \t%s path preset directLevel sendLevel\n", argv[0]); fprintf(stdout, "Example: \"%s /sdcard/my.mp3 6 -2000 0\" \n", argv[0]); - exit(1); + exit(EXIT_FAILURE); } SLEngineOption EngineOption[] = { @@ -295,7 +283,6 @@ int main(int argc, char* const argv[]) /* Shutdown OpenSL ES */ (*sl)->Destroy(sl); - exit(0); - return 0; + return EXIT_SUCCESS; } diff --git a/opensles/tests/examples/slesTestVirtualizerPath.cpp b/opensles/tests/examples/slesTestVirtualizerPath.cpp index c01e315e..87abbaf2 100644 --- a/opensles/tests/examples/slesTestVirtualizerPath.cpp +++ b/opensles/tests/examples/slesTestVirtualizerPath.cpp @@ -14,16 +14,6 @@ * limitations under the License. */ -#ifdef ANDROID -#define LOG_NDEBUG 0 -#define LOG_TAG "slesTest_virtualizer" - -#include -#else -#define LOGV printf -#endif - -#include #include #include #include @@ -49,7 +39,7 @@ void ExitOnErrorFunc( SLresult result , int line) { if (SL_RESULT_SUCCESS != result) { fprintf(stderr, "%lu error code encountered at line %d, exiting\n", result, line); - exit(1); + exit(EXIT_FAILURE); } } @@ -100,7 +90,7 @@ void TestVirtualizerPathFromFD( SLObjectItf sl, const char* path, int16_t virtSt /* Configuration of the output mix */ /* Create Output Mix object to be used by the player */ - result = (*EngineItf)->CreateOutputMix(EngineItf, &outputMix, 1, iidArray, required); + result = (*EngineItf)->CreateOutputMix(EngineItf, &outputMix, 0, iidArray, required); ExitOnError(result); /* Realize the Output Mix object in synchronous mode */ @@ -256,8 +246,6 @@ void TestVirtualizerPathFromFD( SLObjectItf sl, const char* path, int16_t virtSt //----------------------------------------------------------------- int main(int argc, char* const argv[]) { - LOGV("Starting %s\n", argv[0]); - SLresult result; SLObjectItf sl; @@ -272,7 +260,7 @@ int main(int argc, char* const argv[]) if (argc < 3) { fprintf(stdout, "Usage: \t%s path virtualization_strength\n", argv[0]); fprintf(stdout, "Example: \"%s /sdcard/my.mp3 1000\" \n", argv[0]); - exit(1); + exit(EXIT_FAILURE); } SLEngineOption EngineOption[] = { @@ -291,7 +279,6 @@ int main(int argc, char* const argv[]) /* Shutdown OpenSL ES */ (*sl)->Destroy(sl); - exit(0); - return 0; + return EXIT_SUCCESS; } diff --git a/opensles/tests/listening/slesTest_playMuteSolo.cpp b/opensles/tests/listening/slesTest_playMuteSolo.cpp index d142cf4b..94f0c78c 100644 --- a/opensles/tests/listening/slesTest_playMuteSolo.cpp +++ b/opensles/tests/listening/slesTest_playMuteSolo.cpp @@ -14,16 +14,6 @@ * limitations under the License. */ -#define LOG_NDEBUG 0 -#define LOG_TAG "slesTest_playMuteSolo" - -#ifdef ANDROID -#include -#else -#define LOGV printf -#endif - -#include #include #include #include @@ -52,7 +42,7 @@ void ExitOnErrorFunc( SLresult result , int line) { if (SL_RESULT_SUCCESS != result) { fprintf(stdout, "%lu error code encountered at line %d, exiting\n", result, line); - exit(1); + exit(EXIT_FAILURE); } } @@ -158,7 +148,7 @@ void TestPlayUri( SLObjectItf sl, const char* path) /* Configuration of the output mix */ /* Create Output Mix object to be used by the player */ - result = (*EngineItf)->CreateOutputMix(EngineItf, &outputMix, 1, iidArray, required); + result = (*EngineItf)->CreateOutputMix(EngineItf, &outputMix, 0, iidArray, required); ExitOnError(result); /* Realize the Output Mix object in synchronous mode */ @@ -295,8 +285,6 @@ destroyKillKill: //----------------------------------------------------------------- int main(int argc, char* const argv[]) { - LOGV("Starting %s\n", argv[0]); - SLresult result; SLObjectItf sl; @@ -310,7 +298,7 @@ int main(int argc, char* const argv[]) if (argc == 1) { fprintf(stdout, "Usage: \t%s url\n", argv[0]); fprintf(stdout, "Example: \"%s /sdcard/my.mp3\"\n", argv[0]); - exit(1); + exit(EXIT_FAILURE); } SLEngineOption EngineOption[] = { @@ -330,7 +318,6 @@ int main(int argc, char* const argv[]) /* Shutdown OpenSL ES */ (*sl)->Destroy(sl); - exit(0); - return 0; + return EXIT_SUCCESS; } diff --git a/opensles/tests/mimeUri/Android.mk b/opensles/tests/mimeUri/Android.mk index 466e25f3..d19b9d98 100644 --- a/opensles/tests/mimeUri/Android.mk +++ b/opensles/tests/mimeUri/Android.mk @@ -142,4 +142,4 @@ endif LOCAL_MODULE:= slesTest_slowDownUri -include $(BUILD_EXECUTABLE) \ No newline at end of file +include $(BUILD_EXECUTABLE) diff --git a/opensles/tests/mimeUri/slesTestLoopUri.cpp b/opensles/tests/mimeUri/slesTestLoopUri.cpp index 6afba095..8bad9cb5 100644 --- a/opensles/tests/mimeUri/slesTestLoopUri.cpp +++ b/opensles/tests/mimeUri/slesTestLoopUri.cpp @@ -14,15 +14,6 @@ * limitations under the License. */ -#define LOG_NDEBUG 0 -#define LOG_TAG "slesTestLoopUri" - -#ifdef ANDROID -#include -#else -#define LOGV printf -#endif -#include #include #include #include @@ -44,7 +35,7 @@ void ExitOnErrorFunc( SLresult result , int line) { if (SL_RESULT_SUCCESS != result) { fprintf(stderr, "%lu error code encountered at line %d, exiting\n", result, line); - exit(1); + exit(EXIT_FAILURE); } } @@ -60,7 +51,7 @@ void PrefetchEventCallback( SLPrefetchStatusItf caller, void *pContext, SLuint3 if ((event & (SL_PREFETCHEVENT_STATUSCHANGE|SL_PREFETCHEVENT_FILLLEVELCHANGE)) && (level == 0) && (status == SL_PREFETCHSTATUS_UNDERFLOW)) { fprintf(stdout, "\t\tPrefetchEventCallback: Error while prefetching data, exiting\n"); - //exit(1); + //exit(EXIT_FAILURE); } if (event & SL_PREFETCHEVENT_FILLLEVELCHANGE) { fprintf(stdout, "\t\tPrefetchEventCallback: Buffer fill level is = %d\n", level); @@ -114,7 +105,7 @@ void TestLoopUri( SLObjectItf sl, const char* path) required[0] = SL_BOOLEAN_TRUE; iidArray[0] = SL_IID_VOLUME; // Create Output Mix object to be used by player - res = (*EngineItf)->CreateOutputMix(EngineItf, &OutputMix, 1, + res = (*EngineItf)->CreateOutputMix(EngineItf, &OutputMix, 0, iidArray, required); CheckErr(res); // Realizing the Output Mix object in synchronous mode. @@ -241,8 +232,6 @@ destroyRes: //----------------------------------------------------------------- int main(int argc, char* const argv[]) { - LOGV("Starting slesTestLoopUri\n"); - SLresult res; SLObjectItf sl; @@ -254,7 +243,7 @@ int main(int argc, char* const argv[]) fprintf(stdout, "Usage: \n\t%s path \n\t%s url\n", argv[0], argv[0]); fprintf(stdout, "Example: \"%s /sdcard/my.mp3\" or \"%s file:///sdcard/my.mp3\"\n", argv[0], argv[0]); - exit(1); + exit(EXIT_FAILURE); } SLEngineOption EngineOption[] = { @@ -271,7 +260,6 @@ int main(int argc, char* const argv[]) /* Shutdown OpenSL ES */ (*sl)->Destroy(sl); - exit(0); - return 0; + return EXIT_SUCCESS; } diff --git a/opensles/tests/mimeUri/slesTestPlayStreamType.cpp b/opensles/tests/mimeUri/slesTestPlayStreamType.cpp index f726ee59..ad5c3946 100644 --- a/opensles/tests/mimeUri/slesTestPlayStreamType.cpp +++ b/opensles/tests/mimeUri/slesTestPlayStreamType.cpp @@ -14,15 +14,6 @@ * limitations under the License. */ -#ifdef ANDROID -#define LOG_NDEBUG 0 -#define LOG_TAG "slesTest_playStreamType" - -#include -#else -#define LOGV printf -#endif -#include #include #include #include @@ -47,7 +38,7 @@ void ExitOnErrorFunc( SLresult result , int line) { if (SL_RESULT_SUCCESS != result) { fprintf(stdout, "%lu error code encountered at line %d, exiting\n", result, line); - exit(1); + exit(EXIT_FAILURE); } } @@ -96,7 +87,7 @@ void TestStreamTypeConfiguration( SLObjectItf sl, const char* path, const SLint3 /* Configuration of the output mix */ /* Create Output Mix object to be used by the player */ - result = (*EngineItf)->CreateOutputMix(EngineItf, &outputMix, 1, iidArray, required); + result = (*EngineItf)->CreateOutputMix(EngineItf, &outputMix, 0, iidArray, required); ExitOnError(result); /* Realize the Output Mix object in synchronous mode */ @@ -238,8 +229,6 @@ void TestStreamTypeConfiguration( SLObjectItf sl, const char* path, const SLint3 //----------------------------------------------------------------- int main(int argc, char* const argv[]) { - LOGV("Starting %s\n", argv[0]); - SLresult result; SLObjectItf sl; @@ -252,7 +241,7 @@ int main(int argc, char* const argv[]) fprintf(stdout, "Usage: \t%s url stream_type\n", argv[0]); fprintf(stdout, " where stream_type is one of the SL_ANDROID_STREAM_ constants.\n"); fprintf(stdout, "Example: \"%s /sdcard/my.mp3 3\" \n", argv[0]); - exit(1); + return EXIT_FAILURE; } SLEngineOption EngineOption[] = { @@ -270,7 +259,6 @@ int main(int argc, char* const argv[]) /* Shutdown OpenSL ES */ (*sl)->Destroy(sl); - exit(0); - return 0; + return EXIT_SUCCESS; } diff --git a/opensles/tests/mimeUri/slesTestPlayUri.cpp b/opensles/tests/mimeUri/slesTestPlayUri.cpp index ba0ffccd..819f9cf0 100644 --- a/opensles/tests/mimeUri/slesTestPlayUri.cpp +++ b/opensles/tests/mimeUri/slesTestPlayUri.cpp @@ -37,20 +37,11 @@ * MATERIALS. */ -#define LOG_NDEBUG 0 -#define LOG_TAG "slesTestPlayUri" - -#ifdef ANDROID -#include -#else -#define LOGV printf -#endif -#include #include #include -#include +//#include #include -#include +//#include #include "SLES/OpenSLES.h" @@ -65,7 +56,7 @@ void ExitOnErrorFunc( SLresult result , int line) { if (SL_RESULT_SUCCESS != result) { fprintf(stderr, "%lu error code encountered at line %d, exiting\n", result, line); - exit(1); + exit(EXIT_FAILURE); } } @@ -76,18 +67,18 @@ void PrefetchEventCallback( SLPrefetchStatusItf caller, void *pContext, SLuint3 SLpermille level = 0; (*caller)->GetFillLevel(caller, &level); SLuint32 status; - //fprintf(stdout, "\t\tPrefetchEventCallback: received event %lu\n", event); + //fprintf(stdout, "PrefetchEventCallback: received event %lu\n", event); (*caller)->GetPrefetchStatus(caller, &status); if ((event & (SL_PREFETCHEVENT_STATUSCHANGE|SL_PREFETCHEVENT_FILLLEVELCHANGE)) && (level == 0) && (status == SL_PREFETCHSTATUS_UNDERFLOW)) { - fprintf(stdout, "\t\tPrefetchEventCallback: Error while prefetching data, exiting\n"); - //exit(1); + fprintf(stdout, "PrefetchEventCallback: Error while prefetching data, exiting\n"); + //exit(EXIT_FAILURE); } if (event & SL_PREFETCHEVENT_FILLLEVELCHANGE) { - fprintf(stdout, "\t\tPrefetchEventCallback: Buffer fill level is = %d\n", level); + fprintf(stdout, "PrefetchEventCallback: Buffer fill level is = %d\n", level); } if (event & SL_PREFETCHEVENT_STATUSCHANGE) { - fprintf(stdout, "\t\tPrefetchEventCallback: Prefetch Status is = %lu\n", status); + fprintf(stdout, "PrefetchEventCallback: Prefetch Status is = %lu\n", status); } } @@ -138,7 +129,7 @@ void TestPlayUri( SLObjectItf sl, const char* path) required[1] = SL_BOOLEAN_TRUE; iidArray[1] = SL_IID_PREFETCHSTATUS; // Create Output Mix object to be used by player - res = (*EngineItf)->CreateOutputMix(EngineItf, &OutputMix, 1, + res = (*EngineItf)->CreateOutputMix(EngineItf, &OutputMix, 0, iidArray, required); CheckErr(res); // Realizing the Output Mix object in synchronous mode. @@ -204,9 +195,9 @@ void TestPlayUri( SLObjectItf sl, const char* path) /* Play the URI */ /* first cause the player to prefetch the data */ - fprintf(stdout, "\nbefore set to PAUSED\n\n"); + fprintf(stdout, "Before set to PAUSED\n"); res = (*playItf)->SetPlayState( playItf, SL_PLAYSTATE_PAUSED ); - fprintf(stdout, "\nafter set to PAUSED\n\n"); + fprintf(stdout, "After set to PAUSED\n"); CheckErr(res); /* wait until there's data to play */ @@ -220,7 +211,7 @@ void TestPlayUri( SLObjectItf sl, const char* path) } if (timeOutIndex == 0) { - fprintf(stderr, "\nWe\'re done waiting, failed to prefetch data in time, exiting\n"); + fprintf(stderr, "We\'re done waiting, failed to prefetch data in time, exiting\n"); goto destroyRes; } @@ -257,8 +248,6 @@ destroyRes: //----------------------------------------------------------------- int main(int argc, char* const argv[]) { - LOGV("Starting slesTestPlayUri\n"); - SLresult res; SLObjectItf sl; @@ -267,10 +256,10 @@ int main(int argc, char* const argv[]) fprintf(stdout, "Plays a sound and stops after its reported duration\n\n"); if (argc == 1) { - fprintf(stdout, "Usage: \n\t%s path \n\t%s url\n", argv[0], argv[0]); + fprintf(stdout, "Usage: %s path \n\t%s url\n", argv[0], argv[0]); fprintf(stdout, "Example: \"%s /sdcard/my.mp3\" or \"%s file:///sdcard/my.mp3\"\n", argv[0], argv[0]); - exit(1); + exit(EXIT_FAILURE); } SLEngineOption EngineOption[] = { @@ -287,7 +276,6 @@ int main(int argc, char* const argv[]) /* Shutdown OpenSL ES */ (*sl)->Destroy(sl); - exit(0); - return 0; + return EXIT_SUCCESS; } diff --git a/opensles/tests/mimeUri/slesTestPlayUri2.cpp b/opensles/tests/mimeUri/slesTestPlayUri2.cpp index c80f67cf..29a2a9fe 100644 --- a/opensles/tests/mimeUri/slesTestPlayUri2.cpp +++ b/opensles/tests/mimeUri/slesTestPlayUri2.cpp @@ -14,27 +14,14 @@ * limitations under the License. */ -#define LOG_NDEBUG 0 -#define LOG_TAG "slesTestPlayUri" - -#ifdef ANDROID -#include -#else -#define LOGV printf -#endif - -#include #include #include -#include #include -#include #include "SLES/OpenSLES.h" #define MAX_NUMBER_INTERFACES 3 -#define MAX_NUMBER_OUTPUT_DEVICES 6 //----------------------------------------------------------------- @@ -43,7 +30,7 @@ void ExitOnError( SLresult result ) { if (SL_RESULT_SUCCESS != result) { fprintf(stdout, "%lu error code encountered, exiting\n", result); - exit(1); + exit(EXIT_FAILURE); } } @@ -118,7 +105,7 @@ void TestPlayUri( SLObjectItf sl, const char* path, const char* path2) /* Configuration of the output mix */ /* Create Output Mix object to be used each player */ - result = (*EngineItf)->CreateOutputMix(EngineItf, &outputMix, 1, iidArray, required); + result = (*EngineItf)->CreateOutputMix(EngineItf, &outputMix, 0, iidArray, required); ExitOnError(result); /* Realize the Output Mix object in synchronous mode */ @@ -261,8 +248,6 @@ void TestPlayUri( SLObjectItf sl, const char* path, const char* path2) //----------------------------------------------------------------- int main(int argc, char* const argv[]) { - LOGV("Starting %s\n", argv[0]); - SLresult result; SLObjectItf sl; @@ -276,7 +261,7 @@ int main(int argc, char* const argv[]) fprintf(stdout, "Usage: \n\t%s url1 url2 \n\t%s url\n", argv[0], argv[0]); fprintf(stdout, "Example: \"%s /sdcard/my.mp3 http://blabla/my.wav\" ", argv[0]); fprintf(stdout, "or \"%s file:///sdcard/my.mp3\"\n", argv[0]); - exit(1); + exit(EXIT_FAILURE); } SLEngineOption EngineOption[] = { @@ -298,7 +283,6 @@ int main(int argc, char* const argv[]) /* Shutdown OpenSL ES */ (*sl)->Destroy(sl); - exit(0); - return 0; + return EXIT_SUCCESS; } diff --git a/opensles/tests/mimeUri/slesTestSlowDownUri.cpp b/opensles/tests/mimeUri/slesTestSlowDownUri.cpp index fe5aa331..52ba237e 100644 --- a/opensles/tests/mimeUri/slesTestSlowDownUri.cpp +++ b/opensles/tests/mimeUri/slesTestSlowDownUri.cpp @@ -14,15 +14,6 @@ * limitations under the License. */ -#define LOG_NDEBUG 0 -#define LOG_TAG "slesTestSlowDownUri" - -#ifdef ANDROID -#include -#else -#define LOGV printf -#endif -#include #include #include #include @@ -46,7 +37,7 @@ void ExitOnErrorFunc( SLresult result , int line) { if (SL_RESULT_SUCCESS != result) { fprintf(stderr, "%lu error code encountered at line %d, exiting\n", result, line); - exit(1); + exit(EXIT_FAILURE); } } @@ -99,7 +90,7 @@ void PrefetchEventCallback( SLPrefetchStatusItf caller, void *pContext, SLuint3 if ((event & (SL_PREFETCHEVENT_STATUSCHANGE|SL_PREFETCHEVENT_FILLLEVELCHANGE)) && (level == 0) && (status == SL_PREFETCHSTATUS_UNDERFLOW)) { fprintf(stdout, "\t\tPrefetchEventCallback: Error while prefetching data, exiting\n"); - //exit(1); + //exit(EXIT_FAILURE); } if (event & SL_PREFETCHEVENT_FILLLEVELCHANGE) { fprintf(stdout, "\t\tPrefetchEventCallback: Buffer fill level is = %d\n", level); @@ -153,7 +144,7 @@ void TestSlowDownUri( SLObjectItf sl, const char* path) required[0] = SL_BOOLEAN_TRUE; iidArray[0] = SL_IID_VOLUME; // Create Output Mix object to be used by player - res = (*EngineItf)->CreateOutputMix(EngineItf, &OutputMix, 1, + res = (*EngineItf)->CreateOutputMix(EngineItf, &OutputMix, 0, iidArray, required); CheckErr(res); // Realizing the Output Mix object in synchronous mode. @@ -284,8 +275,6 @@ destroyRes: //----------------------------------------------------------------- int main(int argc, char* const argv[]) { - LOGV("Starting slesTestSlowDownUri\n"); - SLresult res; SLObjectItf sl; @@ -299,7 +288,7 @@ int main(int argc, char* const argv[]) fprintf(stdout, "Usage: \n\t%s path \n\t%s url\n", argv[0], argv[0]); fprintf(stdout, "Example: \"%s /sdcard/my.mp3\" or \"%s file:///sdcard/my.mp3\"\n", argv[0], argv[0]); - exit(1); + return EXIT_FAILURE; } SLEngineOption EngineOption[] = { @@ -316,7 +305,6 @@ int main(int argc, char* const argv[]) /* Shutdown OpenSL ES */ (*sl)->Destroy(sl); - exit(0); - return 0; + return EXIT_SUCCESS; } diff --git a/opensles/tests/mimeUri/slesTest_playStates.cpp b/opensles/tests/mimeUri/slesTest_playStates.cpp index b056725c..58356d7c 100644 --- a/opensles/tests/mimeUri/slesTest_playStates.cpp +++ b/opensles/tests/mimeUri/slesTest_playStates.cpp @@ -14,11 +14,6 @@ * limitations under the License. */ -#define LOG_NDEBUG 0 -#define LOG_TAG "slesTest_playStates" - -#include -#include #include #include #include @@ -42,7 +37,7 @@ void ExitOnErrorFunc( SLresult result , int line) { if (SL_RESULT_SUCCESS != result) { fprintf(stdout, "%lu error code encountered at line %d, exiting\n", result, line); - exit(1); + exit(EXIT_FAILURE); } } @@ -89,7 +84,7 @@ void TestPlayUri( SLObjectItf sl, const char* path) /* Configuration of the output mix */ /* Create Output Mix object to be used by the player */ - result = (*EngineItf)->CreateOutputMix(EngineItf, &outputMix, 1, iidArray, required); + result = (*EngineItf)->CreateOutputMix(EngineItf, &outputMix, 0, iidArray, required); ExitOnError(result); /* Realize the Output Mix object in synchronous mode */ @@ -208,8 +203,6 @@ destroyKillKill: //----------------------------------------------------------------- int main(int argc, char* const argv[]) { - LOGV("Starting %s\n", argv[0]); - SLresult result; SLObjectItf sl; @@ -223,7 +216,7 @@ int main(int argc, char* const argv[]) if (argc == 1) { fprintf(stdout, "Usage: \t%s url\n", argv[0]); fprintf(stdout, "Example: \"%s /sdcard/my.mp3\"\n", argv[0]); - exit(1); + exit(EXIT_FAILURE); } SLEngineOption EngineOption[] = { @@ -243,7 +236,6 @@ int main(int argc, char* const argv[]) /* Shutdown OpenSL ES */ (*sl)->Destroy(sl); - exit(0); - return 0; + return EXIT_SUCCESS; } diff --git a/opensles/tests/mimeUri_test.cpp b/opensles/tests/mimeUri_test.cpp index 84543a35..87cc0001 100644 --- a/opensles/tests/mimeUri_test.cpp +++ b/opensles/tests/mimeUri_test.cpp @@ -138,7 +138,7 @@ void TestPlayUri( SLObjectItf sl, const char* path) required[1] = SL_BOOLEAN_TRUE; iidArray[1] = SL_IID_PREFETCHSTATUS; // Create Output Mix object to be used by player - res = (*EngineItf)->CreateOutputMix(EngineItf, &OutputMix, 1, + res = (*EngineItf)->CreateOutputMix(EngineItf, &OutputMix, 0, iidArray, required); CheckErr(res); // Realizing the Output Mix object in synchronous mode. diff --git a/opensles/tests/sandbox/configbq.c b/opensles/tests/sandbox/configbq.c index 0926b594..3e84cc24 100644 --- a/opensles/tests/sandbox/configbq.c +++ b/opensles/tests/sandbox/configbq.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "SLES/OpenSLES.h" diff --git a/opensles/tests/sandbox/multiplay.c b/opensles/tests/sandbox/multiplay.c index 0fe3ada4..f65cf113 100644 --- a/opensles/tests/sandbox/multiplay.c +++ b/opensles/tests/sandbox/multiplay.c @@ -21,6 +21,7 @@ #include #include #include +#include // Describes the state of one player @@ -126,10 +127,11 @@ int main(int argc, char **argv) const SLInterfaceID mix_ids[] = {SL_IID_VOLUME}; const SLboolean mix_req[] = {SL_BOOLEAN_TRUE}; SLObjectItf mixObject; - result = (*engineEngine)->CreateOutputMix(engineEngine, &mixObject, 1, mix_ids, mix_req); + result = (*engineEngine)->CreateOutputMix(engineEngine, &mixObject, 0, mix_ids, mix_req); check(result); result = (*mixObject)->Realize(mixObject, SL_BOOLEAN_FALSE); check(result); +#if 0 SLVolumeItf mixVolume; result = (*mixObject)->GetInterface(mixObject, SL_IID_VOLUME, &mixVolume); check(result); @@ -137,6 +139,7 @@ int main(int argc, char **argv) result = (*mixVolume)->GetVolumeLevel(mixVolume, &mixVolumeLevelDefault); check(result); printf("default mix volume level = %d\n", mixVolumeLevelDefault); +#endif printf("numPathnames=%d\n", numPathnames); printf("numPlayers=%d\n", numPlayers); diff --git a/opensles/tests/sandbox/reverb.c b/opensles/tests/sandbox/reverb.c index 18b69068..df953be9 100644 --- a/opensles/tests/sandbox/reverb.c +++ b/opensles/tests/sandbox/reverb.c @@ -21,6 +21,7 @@ #include #include #include +#include // Table of I3DL2 named environmental reverb settings diff --git a/opensles/tests/sandbox/urimime.c b/opensles/tests/sandbox/urimime.c index b7f9a6e8..c1790329 100644 --- a/opensles/tests/sandbox/urimime.c +++ b/opensles/tests/sandbox/urimime.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "SLES/OpenSLES.h" #ifdef ANDROID -- 2.11.0