Seems there isn't a way to do this on android. Most major apps seem to use libstagefright for their decoding.
Is it possible to decode mp3 data stored in a byte array?
Question
Is it possible to decode mp3 data stored in a buffer?
I know I can decode to a buffer after API version 14. But I have been unable to create a SimpleBufferQueue to use as an input to the decoder.
This is the code as it is currently. I have been able to get a simplebufferqueue working elsewhere to feed the final audio output and can play Wavs for byte arrays happily, so I know that there isnt anything wrong with opensl/es, the files, the tablet, etc etc.
// THIS CODE CRAHES THE PROGRAM WHEN YOU REALIZE THE PLAYER
//inbound
SLDataLocator_AndroidSimpleBufferQueue locIBQ = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2};
SLDataFormat_MIME format = {SL_DATAFORMAT_MIME, NULL, SL_CONTAINERTYPE_UNSPECIFIED};
SLDataSource audioSource = {&locIBQ, &format};
//outbound
SLDataLocator_AndroidSimpleBufferQueue locatorOutBufferQueue = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2};
SLDataSink audioSink = { &locatorOutBufferQueue, NULL };
//player
const SLInterfaceID playIds[2] = {SL_IID_PLAY, SL_IID_ANDROIDSIMPLEBUFFERQUEUE};
const SLboolean playReq[2] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE};
SLresult result = (*engineEngine)->CreateAudioPlayer(engineEngine, &(bqPlayerObject), &audioSource, &audioSink, 2, playIds, playReq);
Thanks all
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow