diff options
author | Steve Kondik <steve@cyngn.com> | 2015-12-12 21:28:57 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-12-13 13:16:01 -0800 |
commit | 0c19cf7478f4dc10f2739bf6eefa1887a79b48cf (patch) | |
tree | db6eef718afc558b8036530512beb5f7cd5d8a27 | |
parent | 6dde130280d6ead297170211b005cc809e7f7bde (diff) | |
download | frameworks_av-0c19cf7478f4dc10f2739bf6eefa1887a79b48cf.zip frameworks_av-0c19cf7478f4dc10f2739bf6eefa1887a79b48cf.tar.gz frameworks_av-0c19cf7478f4dc10f2739bf6eefa1887a79b48cf.tar.bz2 |
stagefright: Add support for FLAC offloading
* New Qualcomm DSPs support FLAC decoding, but the offload code is
stubbed out in M. Unstub it from what used to be open source.
Change-Id: I03c129c42ebc6909a3392e42a7f96791c8fabd28
-rw-r--r-- | media/libavextensions/Android.mk | 6 | ||||
-rw-r--r-- | media/libavextensions/mediaplayerservice/AVNuUtils.cpp | 3 | ||||
-rw-r--r-- | media/libavextensions/stagefright/AVExtensions.h | 2 | ||||
-rw-r--r-- | media/libavextensions/stagefright/AVUtils.cpp | 17 | ||||
-rw-r--r-- | media/libstagefright/Android.mk | 6 | ||||
-rw-r--r-- | media/libstagefright/FLACExtractor.cpp | 17 |
6 files changed, 44 insertions, 7 deletions
diff --git a/media/libavextensions/Android.mk b/media/libavextensions/Android.mk index a39a76e..8099ad4 100644 --- a/media/libavextensions/Android.mk +++ b/media/libavextensions/Android.mk @@ -17,9 +17,15 @@ LOCAL_C_INCLUDES:= \ LOCAL_CFLAGS += -Wno-multichar -Werror +ifeq ($(call is-vendor-board-platform,QCOM),true) +LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio ifeq ($(TARGET_ENABLE_QC_AV_ENHANCEMENTS),true) LOCAL_CFLAGS += -DENABLE_AV_ENHANCEMENTS endif +ifeq ($(strip $(AUDIO_FEATURE_ENABLED_FLAC_OFFLOAD)),true) + LOCAL_CFLAGS += -DFLAC_OFFLOAD_ENABLED +endif +endif LOCAL_MODULE:= libavextensions LOCAL_CFLAGS += -DLOG_NDEBUG=0 diff --git a/media/libavextensions/mediaplayerservice/AVNuUtils.cpp b/media/libavextensions/mediaplayerservice/AVNuUtils.cpp index 8a78767..c475fd3 100644 --- a/media/libavextensions/mediaplayerservice/AVNuUtils.cpp +++ b/media/libavextensions/mediaplayerservice/AVNuUtils.cpp @@ -228,6 +228,9 @@ void AVNuUtils::setPCMFormat(const sp<AMessage> &format, audio_format_t audioFor } void AVNuUtils::setSourcePCMFormat(const sp<MetaData> &audioMeta) { + if (!isRAWFormat(audioMeta)) + return; + audio_format_t pcmFormat = getKeyPCMFormat(audioMeta); ALOGI("setSourcePCMFormat fmt=%x", pcmFormat); audioMeta->dumpToLog(); diff --git a/media/libavextensions/stagefright/AVExtensions.h b/media/libavextensions/stagefright/AVExtensions.h index 0b70c08..9474d19 100644 --- a/media/libavextensions/stagefright/AVExtensions.h +++ b/media/libavextensions/stagefright/AVExtensions.h @@ -35,10 +35,10 @@ #include <camera/ICamera.h> #include <media/mediarecorder.h> #include <media/IOMX.h> +#include <media/AudioParameter.h> namespace android { -class AudioParameter; class MetaData; class MediaExtractor; class MPEG4Writer; diff --git a/media/libavextensions/stagefright/AVUtils.cpp b/media/libavextensions/stagefright/AVUtils.cpp index c36e0bb..02648fb 100644 --- a/media/libavextensions/stagefright/AVUtils.cpp +++ b/media/libavextensions/stagefright/AVUtils.cpp @@ -42,6 +42,9 @@ #ifdef QCOM_HARDWARE #include "QCMediaDefs.h" #include "QCMetaData.h" +#ifdef FLAC_OFFLOAD_ENABLED +#include "audio_defs.h" +#endif #endif #include "common/ExtensionsLoader.hpp" @@ -84,6 +87,12 @@ static const MetaKeyEntry MetaKeyTable[] { {kKeyUseArbitraryMode , "use-arbitrary-mode" , INT32}, //bool (int32_t) {kKeySmoothStreaming , "smooth-streaming" , INT32}, //bool (int32_t) {kKeyHFR , "hfr" , INT32}, // int32_t +#ifdef FLAC_OFFLOAD_ENABLED + {kKeyMinBlkSize , "min-block-size" , INT32}, + {kKeyMaxBlkSize , "max-block-size" , INT32}, + {kKeyMinFrmSize , "min-frame-size" , INT32}, + {kKeyMaxFrmSize , "max-frame-size" , INT32}, +#endif #endif @@ -221,16 +230,16 @@ status_t AVUtils::sendMetaDataToHal( #ifdef FLAC_OFFLOAD_ENABLED int32_t minBlkSize, maxBlkSize, minFrmSize, maxFrmSize; //FLAC params if (meta->findInt32(kKeyMinBlkSize, &minBlkSize)) { - param.addInt(String8(AUDIO_OFFLOAD_CODEC_FLAC_MIN_BLK_SIZE), minBlkSize); + param->addInt(String8(AUDIO_OFFLOAD_CODEC_FLAC_MIN_BLK_SIZE), minBlkSize); } if (meta->findInt32(kKeyMaxBlkSize, &maxBlkSize)) { - param.addInt(String8(AUDIO_OFFLOAD_CODEC_FLAC_MAX_BLK_SIZE), maxBlkSize); + param->addInt(String8(AUDIO_OFFLOAD_CODEC_FLAC_MAX_BLK_SIZE), maxBlkSize); } if (meta->findInt32(kKeyMinFrmSize, &minFrmSize)) { - param.addInt(String8(AUDIO_OFFLOAD_CODEC_FLAC_MIN_FRAME_SIZE), minFrmSize); + param->addInt(String8(AUDIO_OFFLOAD_CODEC_FLAC_MIN_FRAME_SIZE), minFrmSize); } if (meta->findInt32(kKeyMaxFrmSize, &maxFrmSize)) { - param.addInt(String8(AUDIO_OFFLOAD_CODEC_FLAC_MAX_FRAME_SIZE), maxFrmSize); + param->addInt(String8(AUDIO_OFFLOAD_CODEC_FLAC_MAX_FRAME_SIZE), maxFrmSize); } #else (void)meta; diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk index 0238952..381ef6c 100644 --- a/media/libstagefright/Android.mk +++ b/media/libstagefright/Android.mk @@ -155,7 +155,7 @@ LOCAL_SHARED_LIBRARIES += \ libdl \ libRScpp \ -LOCAL_CFLAGS += -Wno-multichar -Werror -Wno-error=deprecated-declarations -Wall +LOCAL_CFLAGS += -Werror -Wno-multichar -Wno-error=deprecated-declarations ifeq ($(TARGET_USES_QCOM_BSP), true) LOCAL_C_INCLUDES += $(call project-path-for,qcom-display)/libgralloc @@ -174,9 +174,13 @@ LOCAL_CFLAGS += -DBOARD_CANT_REALLOCATE_OMX_BUFFERS endif ifeq ($(call is-vendor-board-platform,QCOM),true) +LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio ifeq ($(strip $(AUDIO_FEATURE_ENABLED_EXTN_FLAC_DECODER)),true) LOCAL_CFLAGS += -DQTI_FLAC_DECODER endif +ifeq ($(strip $(AUDIO_FEATURE_ENABLED_FLAC_OFFLOAD)),true) + LOCAL_CFLAGS += -DFLAC_OFFLOAD_ENABLED +endif endif LOCAL_CLANG := true diff --git a/media/libstagefright/FLACExtractor.cpp b/media/libstagefright/FLACExtractor.cpp index 91f0e65..51a502d 100644 --- a/media/libstagefright/FLACExtractor.cpp +++ b/media/libstagefright/FLACExtractor.cpp @@ -32,7 +32,7 @@ #include <media/stagefright/MediaSource.h> #include <media/stagefright/MediaBuffer.h> -#ifdef ENABLE_AV_ENHANCEMENTS +#ifdef FLAC_OFFLOAD_ENABLED #include "QCMediaDefs.h" #include "QCMetaData.h" #endif @@ -93,9 +93,18 @@ public: } // stream properties + unsigned getMinBlockSize() const { + return mStreamInfo.min_blocksize; + } unsigned getMaxBlockSize() const { return mStreamInfo.max_blocksize; } + unsigned getMinFrameSize() const { + return mStreamInfo.min_framesize; + } + unsigned getMaxFrameSize() const { + return mStreamInfo.max_framesize; + } unsigned getSampleRate() const { return mStreamInfo.sample_rate; } @@ -544,6 +553,12 @@ status_t FLACParser::init() mTrackMetadata->setInt64(kKeyDuration, (getTotalSamples() * 1000000LL) / getSampleRate()); mTrackMetadata->setInt32(kKeyBitsPerSample, getBitsPerSample()); +#ifdef FLAC_OFFLOAD_ENABLED + mTrackMetadata->setInt32(kKeyMinBlkSize, getMinBlockSize()); + mTrackMetadata->setInt32(kKeyMaxBlkSize, getMaxBlockSize()); + mTrackMetadata->setInt32(kKeyMinFrmSize, getMinFrameSize()); + mTrackMetadata->setInt32(kKeyMaxFrmSize, getMaxFrameSize()); +#endif } } else { ALOGE("missing STREAMINFO"); |