AAC player and file recognition

AAC player and file recognition

Have AAC audio file that plays with a number of COTS players.

But UMC::Splitter::GetStreamType concludes that dot-AAC file is type MPEGx_SYSTEM_STREAM and thus requires ThreadedDemuxer.

AndUMC::Splitter::GetInfo data UMC::SplitterInfo indicates that m_ppTrackInfo m_type is TRACK_MPEGA and not TRACK_AAC and stream_type is 0x110 = MP1L1_AUDIO and not AAC_AUDIO.

Attempts to then decode the AAC data immediately fail with -897 UMC_ERR_SYNC.

Here is starting data in file:

00000000: FF F1 58 40 19 22 9C A0 B0 80 00 04 00 01 00 21 * X@ " !*
00000010: 20 05 20 A4 1B B7 78 00 84 00 00 00 00 00 40 30 * x @0*
00000020: 00 06 00 37 CA 80 00 00 00 00 00 00 00 00 00 00 * 7 *
00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * *
00000040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * *
00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * *
00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * *
00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * *
00000080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * *
00000090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * *
000000A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * *
000000B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * *
000000C0: 00 00 00 00 00 00 00 00 70 FF F1 58 40 24 42 70 * p X@$Bp*
000000D0: 21 4B 6C FA 1F 7F FF 60 7C 93 41 E2 21 E5 2D C1 *!Kl `| A ! - *
000000E0: C2 F1 4A 20 0A D8 AA D4 04 61 40 66 86 84 52 A1 * J a@f R *
000000F0: 08 A8 4E D0 82 94 26 4A F9 4F 0D 9C A4 69 06 83 * N &J O i *

It appears that splitter is misidentifying the file. Can AAC files be processed and played by UMC library?

Thanks.

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

UMC library supports decoding of AAC files, but current version of IPP samples doesn't have such application. If you have access to old version of IPP samples you can find application audio_codec_con (don't supported now). It's a simple audio decoder/encoder.Using this application as an example you can implement your own audio decoder.

Yes, you are rigth, splitter is misidentifying the file. It is impossibel to distinguish MP3 file and AAC file in ADTS container automatically because they have a very similar headers. To play audio file you should specifyaudio format explicitly. Usually, audio players define audio files formats by it's extensions.

Dmitry: Thank you.

I am not adverse to enhancing umc_splitter.cpp function GetStreamType to recognize ADTS_STREAM or ADIF_STREAM [there appears to be no code in GetStreamType to recognize any pure audio stream including MP3].

But having so recognized, which stream specific splitter should be used? MP4Splitter? ThreadedDemuxer? If MP4Splitter, this worries me because an AAC file is of course not an MPEG-4 formatted file with 32 bit box lengths and 32 bit box names, etc.

And what codec and buffer handler should be used? Presumably AACDecoder, correct? And SampleBuffer, correct?

I tried forcing MP4Splitter and AACDecoder and SampleBuffer, regardless of the value returned by the present implementation of GetStreamType, but MP4Splitter::Init returns -882 UMC_ERR_INVALID_STREAM.

My guess is that no present existing stream specific splitter implementation knows how to handle a pure AAC file, with FF-F1 sync, etc., andif I need to play an AAC file, I'll have to write my own splitter.Is that correct?

Thanks for your time.

There is no need to use any splitter to decode ADTS_SRTEAM and ADIF_STREAM streams.AACDecoder will decode itwithout splitters. For buffer handling I would suggest to use LinearBuffer. Below is an example of main decoder loop. (Just an example:))

....

pAudioCodec = CreateAACDecoder();

pMediaBuffer

= DynamicCast < MediaBuffer > (new LinearBuffer);

pOut

= new MediaData(audio_codec_params->m_SuggestedOutputSize);

.....

do {

sts = pMediaBuffer->LockInputBuffer(&inMediaBuffer);

if (sts == UMC_OK) {

size_t needSize = inMediaBuffer.GetBufferSize();

size = p_in_file->Read(inMediaBuffer.GetBufferPointer(), needSize);

inMediaBuffer.SetDataSize(size);

if (size == needSize)

StreamStatus = UMC_OK;

else

StreamStatus = UMC_ERR_END_OF_STREAM;

pMediaBuffer->UnLockInputBuffer(&inMediaBuffer, StreamStatus);

do {

sts = pMediaBuffer->LockOutputBuffer(&outMediaBuffer);

if (sts == UMC_OK) {

sts = pAudioCodec->GetFrame(&outMediaBuffer, pOut);

pMediaBuffer->UnLockOutputBuffer(&outMediaBuffer);

if (sts == UMC_OK) {

p_out_file->Write(pOut->GetDataPointer(), pOut->GetDataSize());

}

}

}

} while (sts == UMC_OK);

} while ((size) && (sts != UMC_ERR_INVALID_STREAM));

Leave a Comment

Please sign in to add a comment. Not a member? Join today