diff options
author | Sergii Doroshenko <x0163979@ti.com> | 2012-07-20 16:46:23 -0500 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-10-23 12:38:46 -0500 |
commit | 227de4e6a0be638b78386050ba188dc33cc30427 (patch) | |
tree | b2ba66c4322de92009a11f3e3f417e2d25b9b9f7 /media/libstagefright/AACExtractor.cpp | |
parent | ae81d6674eff215876309df39d3159a79fe83e36 (diff) | |
download | frameworks_av-227de4e6a0be638b78386050ba188dc33cc30427.zip frameworks_av-227de4e6a0be638b78386050ba188dc33cc30427.tar.gz frameworks_av-227de4e6a0be638b78386050ba188dc33cc30427.tar.bz2 |
AACExtractor: Added support for APE tag
To support aac audio with APE tag we need parse
this tag. Otherwise AACExtractor stops reading of
audio file.
DR: OMAPS00267689
Change-Id: Ic697b90dbc9f2b93aeb227411359c36c113cb71e
Signed-off-by: Daniel Levin <dendy@ti.com>
Diffstat (limited to 'media/libstagefright/AACExtractor.cpp')
-rw-r--r-- | media/libstagefright/AACExtractor.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/media/libstagefright/AACExtractor.cpp b/media/libstagefright/AACExtractor.cpp index f6434b4..1353e3f 100644 --- a/media/libstagefright/AACExtractor.cpp +++ b/media/libstagefright/AACExtractor.cpp @@ -136,7 +136,8 @@ AACExtractor::AACExtractor( const sp<DataSource> &source, const sp<AMessage> &_meta) : mDataSource(source), mInitCheck(NO_INIT), - mFrameDurationUs(0) { + mFrameDurationUs(0), + mApeMeta(new MetaData) { sp<AMessage> meta = _meta; if (meta == NULL) { @@ -170,9 +171,23 @@ AACExtractor::AACExtractor( off64_t streamSize, numFrames = 0; size_t frameSize = 0; int64_t duration = 0; + uint8_t apeTag[8]; if (mDataSource->getSize(&streamSize) == OK) { while (offset < streamSize) { + mDataSource->readAt(offset, &apeTag, 8); + if (ape.isAPE(apeTag)) { + size_t apeSize = 0; + mDataSource->readAt(offset + 8 + 4, &apeSize, 1); + + if (ape.parseAPE(source, offset, mApeMeta) == false) { + break; + } + + mOffsetVector.push(offset); + offset += apeSize; + continue; + } if ((frameSize = getAdtsFrameLength(source, offset, NULL)) == 0) { break; } @@ -196,15 +211,13 @@ AACExtractor::~AACExtractor() { } sp<MetaData> AACExtractor::getMetaData() { - sp<MetaData> meta = new MetaData; if (mInitCheck != OK) { - return meta; + return mApeMeta; } + mApeMeta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_AAC_ADTS); - meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_AAC_ADTS); - - return meta; + return mApeMeta; } size_t AACExtractor::countTracks() { |