0

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

Community
  • 1
  • 1
Baggers
  • 3,183
  • 20
  • 31
  • Did you ever figure out if that was possible? I'm currently searching about doing that... It almost seems as you could. – Jona Feb 25 '14 at 14:50
  • No I didnt find a way, sucks as I really needed that. Unfortunately some major apps (xbmc, firefox, etc) seem use libstagefright for their media decoding instead of opensl/es. stagefright is outside the ndk and thus is a real PITA to get working. I havent tried doing that yet or found any good guides for doing it. Sorry – Baggers Mar 18 '14 at 14:30

1 Answers1

0

Seems there isn't a way to do this on android. Most major apps seem to use libstagefright for their decoding.

Baggers
  • 3,183
  • 20
  • 31