diff options
author | Preetam Singh Ranawat <apranawat@codeaurora.org> | 2015-07-23 08:59:47 +0530 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2015-10-06 03:24:28 -0600 |
commit | fd42e7afbe43eca5ab6835f8b2720b7e0e8302e0 (patch) | |
tree | 13b03bf4eb20ffbf7740e96078f218c63fe6652a /media/libavextensions | |
parent | ab9bb1594982ad1affed948711d6f487e1c90271 (diff) | |
download | frameworks_av-fd42e7afbe43eca5ab6835f8b2720b7e0e8302e0.zip frameworks_av-fd42e7afbe43eca5ab6835f8b2720b7e0e8302e0.tar.gz frameworks_av-fd42e7afbe43eca5ab6835f8b2720b7e0e8302e0.tar.bz2 |
AVCustomizations: Enable 16 and 24 bit PCM offload.
-create extended decoder and renderer
-add change to pass bit width and format info to renderer.
-add change for PCM conversions
-add changes for time calucation
Conflicts:
media/libmediaplayerservice/nuplayer/NuPlayer.cpp
Change-Id: I3363140fad441a7746884076c40b46e777f2e06e
Diffstat (limited to 'media/libavextensions')
-rw-r--r-- | media/libavextensions/media/AVMediaExtensions.h | 12 | ||||
-rw-r--r-- | media/libavextensions/mediaplayerservice/AVNuExtensions.h | 27 | ||||
-rw-r--r-- | media/libavextensions/mediaplayerservice/AVNuFactory.cpp | 18 | ||||
-rw-r--r-- | media/libavextensions/mediaplayerservice/AVNuUtils.cpp | 52 | ||||
-rw-r--r-- | media/libavextensions/stagefright/AVExtensions.h | 14 | ||||
-rw-r--r-- | media/libavextensions/stagefright/AVUtils.cpp | 27 |
6 files changed, 149 insertions, 1 deletions
diff --git a/media/libavextensions/media/AVMediaExtensions.h b/media/libavextensions/media/AVMediaExtensions.h index ad907a1..4338d5e 100644 --- a/media/libavextensions/media/AVMediaExtensions.h +++ b/media/libavextensions/media/AVMediaExtensions.h @@ -39,6 +39,18 @@ namespace android { */ struct AVMediaUtils { + virtual bool AudioTrackIsPcmOffloaded(const audio_format_t /*format*/) { + return false; + } + virtual status_t AudioTrackGetPosition(AudioTrack* /*track*/, + uint32_t* /*position*/) { + return NO_INIT; + } + + virtual status_t AudioTrackGetTimestamp(AudioTrack* /*track*/, + AudioTimestamp /*timestamp*/) { + return NO_INIT; + } // ----- NO TRESSPASSING BEYOND THIS LINE ------ DECLARE_LOADABLE_SINGLETON(AVMediaUtils); }; diff --git a/media/libavextensions/mediaplayerservice/AVNuExtensions.h b/media/libavextensions/mediaplayerservice/AVNuExtensions.h index cc69ecf..ccf3615 100644 --- a/media/libavextensions/mediaplayerservice/AVNuExtensions.h +++ b/media/libavextensions/mediaplayerservice/AVNuExtensions.h @@ -34,7 +34,6 @@ namespace android { struct NuPlayer; - /* * Factory to create extended NuPlayer objects */ @@ -46,6 +45,17 @@ struct AVNuFactory { const sp<NuPlayer::Source> &source, const sp<NuPlayer::Renderer> &renderer); + virtual sp<NuPlayer::DecoderBase> createDecoder( + const sp<AMessage> ¬ify, + const sp<NuPlayer::Source> &source, + pid_t pid, + const sp<NuPlayer::Renderer> &renderer); + + virtual sp<NuPlayer::Renderer> createRenderer( + const sp<MediaPlayerBase::AudioSink> &sink, + const sp<AMessage> ¬ify, + uint32_t flags); + // ----- NO TRESSPASSING BEYOND THIS LINE ------ DECLARE_LOADABLE_SINGLETON(AVNuFactory); }; @@ -55,6 +65,21 @@ struct AVNuFactory { */ struct AVNuUtils { + virtual sp<MetaData> createPCMMetaFromSource(const sp<MetaData> &); + virtual bool pcmOffloadException(const sp<MetaData> &); + virtual bool isRAWFormat(const sp<MetaData> &); + virtual bool isRAWFormat(const sp<AMessage> &); + virtual int updateAudioBitWidth(audio_format_t audioFormat, + const sp<AMessage> &); + virtual audio_format_t getKeyPCMFormat(const sp<MetaData> &); + virtual void setKeyPCMFormat(const sp<MetaData> &, audio_format_t audioFormat); + virtual audio_format_t getPCMFormat(const sp<AMessage> &); + virtual void setPCMFormat(const sp<AMessage> &, audio_format_t audioFormat); + virtual void setSourcePCMFormat(const sp<MetaData> &); + virtual void setDecodedPCMFormat(const sp<AMessage> &); + virtual status_t convertToSinkFormatIfNeeded(const sp<ABuffer> &, sp<ABuffer> &, + audio_format_t sinkFormat, bool isOffload); + // ----- NO TRESSPASSING BEYOND THIS LINE ------ DECLARE_LOADABLE_SINGLETON(AVNuUtils); }; diff --git a/media/libavextensions/mediaplayerservice/AVNuFactory.cpp b/media/libavextensions/mediaplayerservice/AVNuFactory.cpp index 6e1f1e9..ff7c074 100644 --- a/media/libavextensions/mediaplayerservice/AVNuFactory.cpp +++ b/media/libavextensions/mediaplayerservice/AVNuFactory.cpp @@ -37,6 +37,9 @@ #include <nuplayer/NuPlayer.h> #include <nuplayer/NuPlayerDecoderBase.h> #include <nuplayer/NuPlayerDecoderPassThrough.h> +#include <nuplayer/NuPlayerDecoder.h> +#include <nuplayer/NuPlayerCCDecoder.h> +#include <gui/Surface.h> #include <nuplayer/NuPlayerSource.h> #include <nuplayer/NuPlayerRenderer.h> @@ -56,6 +59,21 @@ sp<NuPlayer::DecoderBase> AVNuFactory::createPassThruDecoder( return new NuPlayer::DecoderPassThrough(notify, source, renderer); } +sp<NuPlayer::DecoderBase> AVNuFactory::createDecoder( + const sp<AMessage> ¬ify, + const sp<NuPlayer::Source> &source, + pid_t pid, + const sp<NuPlayer::Renderer> &renderer) { + return new NuPlayer::Decoder(notify, source, pid, renderer); +} + +sp<NuPlayer::Renderer> AVNuFactory::createRenderer( + const sp<MediaPlayerBase::AudioSink> &sink, + const sp<AMessage> ¬ify, + uint32_t flags) { + return new NuPlayer::Renderer(sink, notify, flags); +} + // ----- NO TRESSPASSING BEYOND THIS LINE ------ AVNuFactory::AVNuFactory() { } diff --git a/media/libavextensions/mediaplayerservice/AVNuUtils.cpp b/media/libavextensions/mediaplayerservice/AVNuUtils.cpp index 563cd29..e890a61 100644 --- a/media/libavextensions/mediaplayerservice/AVNuUtils.cpp +++ b/media/libavextensions/mediaplayerservice/AVNuUtils.cpp @@ -44,6 +44,58 @@ namespace android { + +sp<MetaData> AVNuUtils::createPCMMetaFromSource(const sp<MetaData> &sMeta) { + return sMeta; +} + +bool AVNuUtils::pcmOffloadException(const sp<MetaData> &) { + return true; +} + +bool AVNuUtils::isRAWFormat(const sp<MetaData> &) { + return false; +} + +bool AVNuUtils::isRAWFormat(const sp<AMessage> &) { + return false; +} + + +int AVNuUtils::updateAudioBitWidth(audio_format_t /*audioFormat*/, + const sp<AMessage> &){ + return 16; +} + +audio_format_t AVNuUtils::getKeyPCMFormat(const sp<MetaData> &) { + return AUDIO_FORMAT_INVALID; +} + +void AVNuUtils::setKeyPCMFormat(const sp<MetaData> &, audio_format_t /*audioFormat*/) { + +} + +audio_format_t AVNuUtils::getPCMFormat(const sp<AMessage> &) { + return AUDIO_FORMAT_PCM_16_BIT; +} + +void AVNuUtils::setPCMFormat(const sp<AMessage> &, audio_format_t /*audioFormat*/) { + +} + +void AVNuUtils::setSourcePCMFormat(const sp<MetaData> &) { + +} + +void AVNuUtils::setDecodedPCMFormat(const sp<AMessage> &) { + +} +status_t AVNuUtils::convertToSinkFormatIfNeeded(const sp<ABuffer> &, sp<ABuffer> &, + audio_format_t /*sinkFormat*/, bool /*isOffload*/) { + return INVALID_OPERATION; +} + + // ----- NO TRESSPASSING BEYOND THIS LINE ------ AVNuUtils::AVNuUtils() { } diff --git a/media/libavextensions/stagefright/AVExtensions.h b/media/libavextensions/stagefright/AVExtensions.h index 29f4cbc..f9f4cf1 100644 --- a/media/libavextensions/stagefright/AVExtensions.h +++ b/media/libavextensions/stagefright/AVExtensions.h @@ -65,6 +65,20 @@ struct AVUtils { virtual sp<MediaCodec> createCustomComponentByName(const sp<ALooper> &looper, const char* mime, bool encoder); + + virtual bool is24bitPCMOffloadEnabled(); + virtual bool is16bitPCMOffloadEnabled(); + virtual int getPcmSampleBits(const sp<MetaData> &); + virtual int getPcmSampleBits(const sp<AMessage> &); + virtual void setPcmSampleBits(const sp<MetaData> &, int32_t /*bitWidth*/); + virtual void setPcmSampleBits(const sp<AMessage> &, int32_t /*bitWidth*/); + + virtual audio_format_t updateAudioFormat(audio_format_t audioFormat, + const sp<MetaData> &); + + virtual audio_format_t updateAudioFormat(audio_format_t audioFormat, + const sp<AMessage> &); + // ----- NO TRESSPASSING BEYOND THIS LINE ------ DECLARE_LOADABLE_SINGLETON(AVUtils); }; diff --git a/media/libavextensions/stagefright/AVUtils.cpp b/media/libavextensions/stagefright/AVUtils.cpp index d767f45..a4100c5 100644 --- a/media/libavextensions/stagefright/AVUtils.cpp +++ b/media/libavextensions/stagefright/AVUtils.cpp @@ -59,6 +59,33 @@ status_t AVUtils::sendMetaDataToHal( return OK; } +bool AVUtils::is24bitPCMOffloadEnabled() {return false;} +bool AVUtils::is16bitPCMOffloadEnabled() {return false;} + +int AVUtils::getPcmSampleBits(const sp<MetaData> &) { + return 16; +} + +int AVUtils::getPcmSampleBits(const sp<AMessage> &) { + return 16; +} + +void AVUtils::setPcmSampleBits(const sp<AMessage> &, int32_t /*bitWidth*/) { +} + +void AVUtils::setPcmSampleBits(const sp<MetaData> &, int32_t /*bitWidth*/) { +} + +audio_format_t AVUtils::updateAudioFormat(audio_format_t audioFormat, + const sp<MetaData> &){ + return audioFormat; +} + +audio_format_t AVUtils::updateAudioFormat(audio_format_t audioFormat, + const sp<AMessage> &){ + return audioFormat; +} + static bool dumbSniffer( const sp<DataSource> &, String8 *, float *, sp<AMessage> *) { |