Loading media/extractors/mp3/Android.bp +1 −2 Original line number Diff line number Diff line Loading @@ -12,14 +12,13 @@ cc_library_shared { shared_libs: [ "liblog", "libmediaextractor", "libmediandk", "libstagefright_foundation", ], static_libs: [ "libutils", "libstagefright_id3", "libstagefright_foundation", ], name: "libmp3extractor", Loading media/extractors/mp3/MP3Extractor.cpp +15 −21 Original line number Diff line number Diff line Loading @@ -207,7 +207,7 @@ static bool Resync( return valid; } class MP3Source : public MediaTrackHelperV2 { class MP3Source : public MediaTrackHelperV3 { public: MP3Source( AMediaFormat *meta, DataSourceHelper *source, Loading @@ -220,7 +220,7 @@ public: virtual media_status_t getFormat(AMediaFormat *meta); virtual media_status_t read( MediaBufferBase **buffer, const ReadOptions *options = NULL); MediaBufferHelperV3 **buffer, const ReadOptions *options = NULL); protected: virtual ~MP3Source(); Loading @@ -235,7 +235,6 @@ private: int64_t mCurrentTimeUs; bool mStarted; MP3Seeker *mSeeker; MediaBufferGroup *mGroup; int64_t mBasisTimeUs; int64_t mSamplesRead; Loading Loading @@ -414,7 +413,7 @@ size_t MP3Extractor::countTracks() { return mInitCheck != OK ? 0 : 1; } MediaTrackHelperV2 *MP3Extractor::getTrack(size_t index) { MediaTrackHelperV3 *MP3Extractor::getTrack(size_t index) { if (mInitCheck != OK || index != 0) { return NULL; } Loading Loading @@ -455,7 +454,6 @@ MP3Source::MP3Source( mCurrentTimeUs(0), mStarted(false), mSeeker(seeker), mGroup(NULL), mBasisTimeUs(0), mSamplesRead(0) { } Loading @@ -469,9 +467,7 @@ MP3Source::~MP3Source() { media_status_t MP3Source::start() { CHECK(!mStarted); mGroup = new MediaBufferGroup; mGroup->add_buffer(MediaBufferBase::Create(kMaxFrameSize)); mBufferGroup->add_buffer(kMaxFrameSize); mCurrentPos = mFirstFramePos; mCurrentTimeUs = 0; Loading @@ -487,9 +483,6 @@ media_status_t MP3Source::start() { media_status_t MP3Source::stop() { CHECK(mStarted); delete mGroup; mGroup = NULL; mStarted = false; return AMEDIA_OK; Loading @@ -500,7 +493,7 @@ media_status_t MP3Source::getFormat(AMediaFormat *meta) { } media_status_t MP3Source::read( MediaBufferBase **out, const ReadOptions *options) { MediaBufferHelperV3 **out, const ReadOptions *options) { *out = NULL; int64_t seekTimeUs; Loading Loading @@ -530,8 +523,8 @@ media_status_t MP3Source::read( mSamplesRead = 0; } MediaBufferBase *buffer; status_t err = mGroup->acquire_buffer(&buffer); MediaBufferHelperV3 *buffer; status_t err = mBufferGroup->acquire_buffer(&buffer); if (err != OK) { return AMEDIA_ERROR_UNKNOWN; } Loading Loading @@ -597,8 +590,9 @@ media_status_t MP3Source::read( buffer->set_range(0, frame_size); buffer->meta_data().setInt64(kKeyTime, mCurrentTimeUs); buffer->meta_data().setInt32(kKeyIsSyncFrame, 1); AMediaFormat *meta = buffer->meta_data(); AMediaFormat_setInt64(meta, AMEDIAFORMAT_KEY_TIME_US, mCurrentTimeUs); AMediaFormat_setInt32(meta, AMEDIAFORMAT_KEY_IS_SYNC_FRAME, 1); mCurrentPos += frame_size; Loading Loading @@ -674,14 +668,14 @@ media_status_t MP3Extractor::getMetaData(AMediaFormat *meta) { return AMEDIA_OK; } static CMediaExtractorV2* CreateExtractor( static CMediaExtractorV3* CreateExtractor( CDataSource *source, void *meta) { Mp3Meta *metaData = static_cast<Mp3Meta *>(meta); return wrapV2(new MP3Extractor(new DataSourceHelper(source), metaData)); return wrapV3(new MP3Extractor(new DataSourceHelper(source), metaData)); } static CreatorFuncV2 Sniff( static CreatorFuncV3 Sniff( CDataSource *source, float *confidence, void **meta, FreeMetaFunc *freeMeta) { off64_t pos = 0; Loading Loading @@ -718,11 +712,11 @@ extern "C" { __attribute__ ((visibility ("default"))) ExtractorDef GETEXTRACTORDEF() { return { EXTRACTORDEF_VERSION_CURRENT, EXTRACTORDEF_VERSION_CURRENT + 1, UUID("812a3f6c-c8cf-46de-b529-3774b14103d4"), 1, // version "MP3 Extractor", { .v2 = Sniff } { .v3 = Sniff } }; } Loading media/extractors/mp3/MP3Extractor.h +2 −2 Original line number Diff line number Diff line Loading @@ -32,13 +32,13 @@ struct MP3Seeker; class String8; struct Mp3Meta; class MP3Extractor : public MediaExtractorPluginHelperV2 { class MP3Extractor : public MediaExtractorPluginHelperV3 { public: MP3Extractor(DataSourceHelper *source, Mp3Meta *meta); ~MP3Extractor(); virtual size_t countTracks(); virtual MediaTrackHelperV2 *getTrack(size_t index); virtual MediaTrackHelperV3 *getTrack(size_t index); virtual media_status_t getTrackMetaData(AMediaFormat *meta, size_t index, uint32_t flags); virtual media_status_t getMetaData(AMediaFormat *meta); Loading media/extractors/wav/WAVExtractor.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -383,7 +383,6 @@ WAVSource::WAVSource( } WAVSource::~WAVSource() { ALOGI("~WAVSource"); if (mStarted) { stop(); } Loading media/libstagefright/MediaTrack.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -212,9 +212,13 @@ status_t MediaTrackCUnwrapperV3::read(MediaBufferBase **buffer, const ReadOption // only convert the keys we're actually expecting, as doing // the full convertMessageToMetadata() for every buffer is // too expensive int64_t val; if (format->mFormat->findInt64("timeUs", &val)) { meta.setInt64(kKeyTime, val); int64_t val64; if (format->mFormat->findInt64("timeUs", &val64)) { meta.setInt64(kKeyTime, val64); } int32_t val32; if (format->mFormat->findInt32("is-sync-frame", &val32)) { meta.setInt32(kKeyIsSyncFrame, val32); } } else { *buffer = nullptr; Loading Loading
media/extractors/mp3/Android.bp +1 −2 Original line number Diff line number Diff line Loading @@ -12,14 +12,13 @@ cc_library_shared { shared_libs: [ "liblog", "libmediaextractor", "libmediandk", "libstagefright_foundation", ], static_libs: [ "libutils", "libstagefright_id3", "libstagefright_foundation", ], name: "libmp3extractor", Loading
media/extractors/mp3/MP3Extractor.cpp +15 −21 Original line number Diff line number Diff line Loading @@ -207,7 +207,7 @@ static bool Resync( return valid; } class MP3Source : public MediaTrackHelperV2 { class MP3Source : public MediaTrackHelperV3 { public: MP3Source( AMediaFormat *meta, DataSourceHelper *source, Loading @@ -220,7 +220,7 @@ public: virtual media_status_t getFormat(AMediaFormat *meta); virtual media_status_t read( MediaBufferBase **buffer, const ReadOptions *options = NULL); MediaBufferHelperV3 **buffer, const ReadOptions *options = NULL); protected: virtual ~MP3Source(); Loading @@ -235,7 +235,6 @@ private: int64_t mCurrentTimeUs; bool mStarted; MP3Seeker *mSeeker; MediaBufferGroup *mGroup; int64_t mBasisTimeUs; int64_t mSamplesRead; Loading Loading @@ -414,7 +413,7 @@ size_t MP3Extractor::countTracks() { return mInitCheck != OK ? 0 : 1; } MediaTrackHelperV2 *MP3Extractor::getTrack(size_t index) { MediaTrackHelperV3 *MP3Extractor::getTrack(size_t index) { if (mInitCheck != OK || index != 0) { return NULL; } Loading Loading @@ -455,7 +454,6 @@ MP3Source::MP3Source( mCurrentTimeUs(0), mStarted(false), mSeeker(seeker), mGroup(NULL), mBasisTimeUs(0), mSamplesRead(0) { } Loading @@ -469,9 +467,7 @@ MP3Source::~MP3Source() { media_status_t MP3Source::start() { CHECK(!mStarted); mGroup = new MediaBufferGroup; mGroup->add_buffer(MediaBufferBase::Create(kMaxFrameSize)); mBufferGroup->add_buffer(kMaxFrameSize); mCurrentPos = mFirstFramePos; mCurrentTimeUs = 0; Loading @@ -487,9 +483,6 @@ media_status_t MP3Source::start() { media_status_t MP3Source::stop() { CHECK(mStarted); delete mGroup; mGroup = NULL; mStarted = false; return AMEDIA_OK; Loading @@ -500,7 +493,7 @@ media_status_t MP3Source::getFormat(AMediaFormat *meta) { } media_status_t MP3Source::read( MediaBufferBase **out, const ReadOptions *options) { MediaBufferHelperV3 **out, const ReadOptions *options) { *out = NULL; int64_t seekTimeUs; Loading Loading @@ -530,8 +523,8 @@ media_status_t MP3Source::read( mSamplesRead = 0; } MediaBufferBase *buffer; status_t err = mGroup->acquire_buffer(&buffer); MediaBufferHelperV3 *buffer; status_t err = mBufferGroup->acquire_buffer(&buffer); if (err != OK) { return AMEDIA_ERROR_UNKNOWN; } Loading Loading @@ -597,8 +590,9 @@ media_status_t MP3Source::read( buffer->set_range(0, frame_size); buffer->meta_data().setInt64(kKeyTime, mCurrentTimeUs); buffer->meta_data().setInt32(kKeyIsSyncFrame, 1); AMediaFormat *meta = buffer->meta_data(); AMediaFormat_setInt64(meta, AMEDIAFORMAT_KEY_TIME_US, mCurrentTimeUs); AMediaFormat_setInt32(meta, AMEDIAFORMAT_KEY_IS_SYNC_FRAME, 1); mCurrentPos += frame_size; Loading Loading @@ -674,14 +668,14 @@ media_status_t MP3Extractor::getMetaData(AMediaFormat *meta) { return AMEDIA_OK; } static CMediaExtractorV2* CreateExtractor( static CMediaExtractorV3* CreateExtractor( CDataSource *source, void *meta) { Mp3Meta *metaData = static_cast<Mp3Meta *>(meta); return wrapV2(new MP3Extractor(new DataSourceHelper(source), metaData)); return wrapV3(new MP3Extractor(new DataSourceHelper(source), metaData)); } static CreatorFuncV2 Sniff( static CreatorFuncV3 Sniff( CDataSource *source, float *confidence, void **meta, FreeMetaFunc *freeMeta) { off64_t pos = 0; Loading Loading @@ -718,11 +712,11 @@ extern "C" { __attribute__ ((visibility ("default"))) ExtractorDef GETEXTRACTORDEF() { return { EXTRACTORDEF_VERSION_CURRENT, EXTRACTORDEF_VERSION_CURRENT + 1, UUID("812a3f6c-c8cf-46de-b529-3774b14103d4"), 1, // version "MP3 Extractor", { .v2 = Sniff } { .v3 = Sniff } }; } Loading
media/extractors/mp3/MP3Extractor.h +2 −2 Original line number Diff line number Diff line Loading @@ -32,13 +32,13 @@ struct MP3Seeker; class String8; struct Mp3Meta; class MP3Extractor : public MediaExtractorPluginHelperV2 { class MP3Extractor : public MediaExtractorPluginHelperV3 { public: MP3Extractor(DataSourceHelper *source, Mp3Meta *meta); ~MP3Extractor(); virtual size_t countTracks(); virtual MediaTrackHelperV2 *getTrack(size_t index); virtual MediaTrackHelperV3 *getTrack(size_t index); virtual media_status_t getTrackMetaData(AMediaFormat *meta, size_t index, uint32_t flags); virtual media_status_t getMetaData(AMediaFormat *meta); Loading
media/extractors/wav/WAVExtractor.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -383,7 +383,6 @@ WAVSource::WAVSource( } WAVSource::~WAVSource() { ALOGI("~WAVSource"); if (mStarted) { stop(); } Loading
media/libstagefright/MediaTrack.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -212,9 +212,13 @@ status_t MediaTrackCUnwrapperV3::read(MediaBufferBase **buffer, const ReadOption // only convert the keys we're actually expecting, as doing // the full convertMessageToMetadata() for every buffer is // too expensive int64_t val; if (format->mFormat->findInt64("timeUs", &val)) { meta.setInt64(kKeyTime, val); int64_t val64; if (format->mFormat->findInt64("timeUs", &val64)) { meta.setInt64(kKeyTime, val64); } int32_t val32; if (format->mFormat->findInt32("is-sync-frame", &val32)) { meta.setInt32(kKeyIsSyncFrame, val32); } } else { *buffer = nullptr; Loading