diff options
Diffstat (limited to 'media/libavextensions')
-rw-r--r-- | media/libavextensions/Android.mk | 92 | ||||
-rw-r--r-- | media/libavextensions/common/AVExtensionsCommon.h | 67 | ||||
-rw-r--r-- | media/libavextensions/common/ExtensionsLoader.hpp | 93 | ||||
-rw-r--r-- | media/libavextensions/media/AVMediaExtensions.h | 76 | ||||
-rw-r--r-- | media/libavextensions/media/AVMediaUtils.cpp | 66 | ||||
-rw-r--r-- | media/libavextensions/mediaplayerservice/AVMediaServiceExtensions.h | 92 | ||||
-rw-r--r-- | media/libavextensions/mediaplayerservice/AVMediaServiceFactory.cpp | 72 | ||||
-rw-r--r-- | media/libavextensions/mediaplayerservice/AVMediaServiceUtils.cpp | 103 | ||||
-rw-r--r-- | media/libavextensions/mediaplayerservice/AVNuExtensions.h | 96 | ||||
-rw-r--r-- | media/libavextensions/mediaplayerservice/AVNuFactory.cpp | 89 | ||||
-rw-r--r-- | media/libavextensions/mediaplayerservice/AVNuUtils.cpp | 167 | ||||
-rw-r--r-- | media/libavextensions/stagefright/AVExtensions.h | 215 | ||||
-rw-r--r-- | media/libavextensions/stagefright/AVFactory.cpp | 135 | ||||
-rw-r--r-- | media/libavextensions/stagefright/AVUtils.cpp | 190 | ||||
-rw-r--r-- | media/libavextensions/stagefright/ExtendedMediaDefs.cpp | 68 |
15 files changed, 1621 insertions, 0 deletions
diff --git a/media/libavextensions/Android.mk b/media/libavextensions/Android.mk new file mode 100644 index 0000000..3918857 --- /dev/null +++ b/media/libavextensions/Android.mk @@ -0,0 +1,92 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= \ + stagefright/ExtendedMediaDefs.cpp \ + stagefright/AVUtils.cpp \ + stagefright/AVFactory.cpp \ + +LOCAL_C_INCLUDES:= \ + $(TOP)/frameworks/av/include/media/ \ + $(TOP)/frameworks/av/media/libavextensions \ + $(TOP)/frameworks/native/include/media/hardware \ + $(TOP)/frameworks/native/include/media/openmax \ + $(TOP)/external/flac/include \ + $(TOP)/$(call project-path-for,qcom-media)/mm-core/inc \ + $(TOP)/frameworks/av/media/libstagefright \ + +LOCAL_CFLAGS += -Wno-multichar -Werror + +ifeq ($(TARGET_ENABLE_QC_AV_ENHANCEMENTS),true) + LOCAL_CFLAGS += -DENABLE_AV_ENHANCEMENTS +endif + +LOCAL_MODULE:= libavextensions +LOCAL_CLANG := false + +LOCAL_MODULE_TAGS := optional + +include $(BUILD_STATIC_LIBRARY) + +######################################################## + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= \ + media/AVMediaUtils.cpp \ + +LOCAL_C_INCLUDES:= \ + $(TOP)/frameworks/av/include/media/ \ + $(TOP)/frameworks/av/media/libavextensions \ + $(TOP)/frameworks/native/include/media/hardware \ + $(TOP)/frameworks/native/include/media/openmax \ + $(TOP)/external/flac/include \ + $(TOP)/$(call project-path-for,qcom-media)/mm-core/inc + +LOCAL_CFLAGS += -Wno-multichar -Werror + +ifeq ($(TARGET_ENABLE_QC_AV_ENHANCEMENTS),true) + LOCAL_CFLAGS += -DENABLE_AV_ENHANCEMENTS +endif + +LOCAL_MODULE:= libavmediaextentions +LOCAL_CLANG := false + +LOCAL_MODULE_TAGS := optional + +include $(BUILD_STATIC_LIBRARY) + +######################################################## + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= \ + mediaplayerservice/AVMediaServiceFactory.cpp \ + mediaplayerservice/AVMediaServiceUtils.cpp \ + mediaplayerservice/AVNuFactory.cpp \ + mediaplayerservice/AVNuUtils.cpp \ + +LOCAL_C_INCLUDES:= \ + $(TOP)/frameworks/av/include/media/ \ + $(TOP)/frameworks/av/media/libmediaplayerservice \ + $(TOP)/frameworks/av/media/libavextensions \ + $(TOP)/frameworks/av/media/libstagefright/include \ + $(TOP)/frameworks/av/media/libstagefright/rtsp \ + $(TOP)/frameworks/native/include/media/hardware \ + $(TOP)/frameworks/native/include/media/openmax \ + $(TOP)/external/flac/include \ + $(TOP)/$(call project-path-for,qcom-media)/mm-core/inc + +LOCAL_CFLAGS += -Wno-multichar -Werror + +ifeq ($(TARGET_ENABLE_QC_AV_ENHANCEMENTS),true) + LOCAL_CFLAGS += -DENABLE_AV_ENHANCEMENTS +endif + +LOCAL_MODULE:= libavmediaserviceextensions +LOCAL_CLANG := false + +LOCAL_MODULE_TAGS := optional + +include $(BUILD_STATIC_LIBRARY) + diff --git a/media/libavextensions/common/AVExtensionsCommon.h b/media/libavextensions/common/AVExtensionsCommon.h new file mode 100644 index 0000000..c39872e --- /dev/null +++ b/media/libavextensions/common/AVExtensionsCommon.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2013 - 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _AV_EXTENSIONS_COMMON_H_ +#define _AV_EXTENSIONS_COMMON_H_ + +namespace android { + +typedef void *(*createFunction_t)(void); + +template <typename T> +struct ExtensionsLoader { + + static T *createInstance(const char *createFunctionName); + +private: + static void loadLib(); + static createFunction_t loadCreateFunction(const char *createFunctionName); + static void *mLibHandle; +}; + +/* + * Boiler-plate to declare the class as a singleton (with a static getter) + * which can be loaded (dlopen'd) via ExtensionsLoader + */ +#define DECLARE_LOADABLE_SINGLETON(className) \ +protected: \ + className(); \ + virtual ~className(); \ + static className *sInst; \ +private: \ + className(const className&); \ + className &operator=(className &); \ +public: \ + static className *get() { \ + return sInst; \ + } \ + friend struct ExtensionsLoader<className>; + +} //namespace android + +#endif // _AV_EXTENSIONS_COMMON_H_ diff --git a/media/libavextensions/common/ExtensionsLoader.hpp b/media/libavextensions/common/ExtensionsLoader.hpp new file mode 100644 index 0000000..e03979c --- /dev/null +++ b/media/libavextensions/common/ExtensionsLoader.hpp @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2013 - 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include <dlfcn.h> +#include <common/AVExtensionsCommon.h> + +namespace android { + +static const char * CUSTOMIZATION_LIB_NAME = "libavenhancements.so"; + +/* + * Create strongly-typed objects of type T + * If the customization library exists and does contain a "named" constructor, + * invoke and create an instance + * Else create the object of type T itself + * + * Contains a static instance to dlopen'd library, But may end up + * opening the library mutiple times. Following snip from dlopen man page is + * reassuring "...Only a single copy of an object file is brought into the + * address space, even if dlopen() is invoked multiple times in reference to + * the file, and even if different pathnames are used to reference the file.." + */ + +template <typename T> +T *ExtensionsLoader<T>::createInstance(const char *createFunctionName) { + ALOGV("createInstance(%dbit) : %s", sizeof(intptr_t)*8, createFunctionName); + // create extended object if extensions-lib is available and + // AV_ENHANCEMENTS is enabled +#if ENABLE_AV_ENHANCEMENTS + createFunction_t createFunc = loadCreateFunction(createFunctionName); + if (createFunc) { + return reinterpret_cast<T *>((*createFunc)()); + } +#endif + // Else, create the default object + return new T; +} + +template <typename T> +void ExtensionsLoader<T>::loadLib() { + if (!mLibHandle) { + mLibHandle = ::dlopen(CUSTOMIZATION_LIB_NAME, RTLD_LAZY); + if (!mLibHandle) { + ALOGV("%s", dlerror()); + return; + } + ALOGV("Opened %s", CUSTOMIZATION_LIB_NAME); + } +} + +template <typename T> +createFunction_t ExtensionsLoader<T>::loadCreateFunction(const char *createFunctionName) { + loadLib(); + if (!mLibHandle) { + return NULL; + } + createFunction_t func = (createFunction_t)dlsym(mLibHandle, createFunctionName); + if (!func) { + ALOGW("symbol %s not found: %s",createFunctionName, dlerror()); + } + return func; +} + +//static +template <typename T> +void *ExtensionsLoader<T>::mLibHandle = NULL; + +} //namespace android diff --git a/media/libavextensions/media/AVMediaExtensions.h b/media/libavextensions/media/AVMediaExtensions.h new file mode 100644 index 0000000..ae26143 --- /dev/null +++ b/media/libavextensions/media/AVMediaExtensions.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2013 - 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _AV_MEDIA_EXTENSIONS_H_ +#define _AV_MEDIA_EXTENSIONS_H_ + +#include <common/AVExtensionsCommon.h> +#include <hardware/audio.h> +#include <media/AudioTrack.h> + +namespace android { + +class MediaRecorder; +class Parcel; +/* + * Common delegate to the classes in libstagefright + */ +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; + } + + virtual size_t AudioTrackGetOffloadFrameCount(size_t frameCount) { + return frameCount; + } + + virtual sp<MediaRecorder> createMediaRecorder(const String16& opPackageName); + virtual void writeCustomData( + Parcel * /* reply */, void * /* buffer_data */) {} + virtual void readCustomData( + const Parcel * /* reply */, void ** /*buffer_data */ ) {} + virtual void closeFileDescriptor(void * /* buffer_ptr */) {} + // ----- NO TRESSPASSING BEYOND THIS LINE ------ + DECLARE_LOADABLE_SINGLETON(AVMediaUtils); +}; + +} //namespace android + +#endif //_AV_MEDIA_EXTENSIONS_H_ + diff --git a/media/libavextensions/media/AVMediaUtils.cpp b/media/libavextensions/media/AVMediaUtils.cpp new file mode 100644 index 0000000..0f9e9eb --- /dev/null +++ b/media/libavextensions/media/AVMediaUtils.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2013 - 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +//#define LOG_NDEBUG 0 +#define LOG_TAG "AVMediaUtils" +#include <utils/Log.h> + +#include <media/stagefright/foundation/ADebug.h> +#include <media/stagefright/foundation/AMessage.h> +#include <media/stagefright/foundation/ABuffer.h> +#include <media/stagefright/MediaDefs.h> +#include <media/stagefright/MediaCodecList.h> +#include <media/stagefright/MetaData.h> +#include <media/stagefright/ACodec.h> + +#include <media/AudioTrack.h> +#include <media/mediarecorder.h> + +#include "common/ExtensionsLoader.hpp" +#include "media/AVMediaExtensions.h" + +namespace android { + +// ----- NO TRESSPASSING BEYOND THIS LINE ------ +AVMediaUtils::AVMediaUtils() { +} + +AVMediaUtils::~AVMediaUtils() { +} + +sp<MediaRecorder> AVMediaUtils::createMediaRecorder(const String16& opPackageName) { + return new MediaRecorder(opPackageName); +} + +//static +AVMediaUtils *AVMediaUtils::sInst = + ExtensionsLoader<AVMediaUtils>::createInstance("createExtendedMediaUtils"); + +} //namespace android + diff --git a/media/libavextensions/mediaplayerservice/AVMediaServiceExtensions.h b/media/libavextensions/mediaplayerservice/AVMediaServiceExtensions.h new file mode 100644 index 0000000..f2c789e --- /dev/null +++ b/media/libavextensions/mediaplayerservice/AVMediaServiceExtensions.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2013 - 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _AV_MEDIA_SERVICE_EXTENSIONS_H_ +#define _AV_MEDIA_SERVICE_EXTENSIONS_H_ + +#include <common/AVExtensionsCommon.h> +#include <MediaPlayerFactory.h> + +#include <utils/List.h> +#include <utils/RefBase.h> +#include <utils/String16.h> + +#include <media/Metadata.h> + +namespace android { + +struct StagefrightRecorder; +struct ARTSPConnection; +struct ARTPConnection; +struct AString; +struct MyHandler; +struct ABuffer; + +/* + * Factory to create objects of base-classes in libmediaplayerservice + */ +struct AVMediaServiceFactory { + virtual StagefrightRecorder *createStagefrightRecorder(const String16 &); + + // RTSP extensions + virtual sp<ARTSPConnection> createARTSPConnection(bool uidValid, uid_t uid); + virtual sp<ARTPConnection> createARTPConnection(); + + // ----- NO TRESSPASSING BEYOND THIS LINE ------ + DECLARE_LOADABLE_SINGLETON(AVMediaServiceFactory); +}; + +/* + * Common delegate to the classes in libmediaplayerservice + */ +struct AVMediaServiceUtils { + virtual void getDashPlayerFactory(MediaPlayerFactory::IFactory *&, player_type ) {} + // RTSP IPV6 utils + virtual bool pokeAHole(sp<MyHandler> handler, int rtpSocket, int rtcpSocket, + const AString &transport, const AString &sessionHost); + virtual void makePortPair(int *rtpSocket, int *rtcpSocket, unsigned *rtpPort, + bool isIPV6); + virtual const char* parseURL(AString *host); + // RTSP customization utils + virtual bool parseTrackURL(AString url, AString val); + virtual void appendRange(AString *request); + virtual void setServerTimeoutUs(int64_t timeout); + virtual void appendMeta(media::Metadata *meta); + virtual bool checkNPTMapping(uint32_t *rtpInfoTime, int64_t *playTimeUs, + bool *nptValid, uint32_t rtpTime); + virtual void addH263AdvancedPacket(const sp<ABuffer> &buffer, + List<sp<ABuffer>> *packets, uint32_t rtpTime); + virtual bool parseNTPRange(const char *s, float *npt1, float *npt2); + + // ----- NO TRESSPASSING BEYOND THIS LINE ------ + DECLARE_LOADABLE_SINGLETON(AVMediaServiceUtils); +}; + +} + +#endif // _AV_EXTENSIONS__H_ diff --git a/media/libavextensions/mediaplayerservice/AVMediaServiceFactory.cpp b/media/libavextensions/mediaplayerservice/AVMediaServiceFactory.cpp new file mode 100644 index 0000000..10b66f5 --- /dev/null +++ b/media/libavextensions/mediaplayerservice/AVMediaServiceFactory.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2013 - 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define LOG_TAG "AVMediaServiceFactory" +#include <utils/Log.h> + +#include <media/stagefright/foundation/ADebug.h> +#include <media/stagefright/foundation/AMessage.h> +#include "ARTPConnection.h" +#include "ARTSPConnection.h" + +#include "MediaRecorderClient.h" +#include "MediaPlayerService.h" +#include "StagefrightRecorder.h" + +#include "common/ExtensionsLoader.hpp" +#include "mediaplayerservice/AVMediaServiceExtensions.h" + +namespace android { +StagefrightRecorder *AVMediaServiceFactory::createStagefrightRecorder( + const String16 &opPackageName) { + return new StagefrightRecorder(opPackageName); +} + +sp<ARTSPConnection> AVMediaServiceFactory::createARTSPConnection( + bool uidValid, uid_t uid) { + return new ARTSPConnection(uidValid, uid); +} + +sp<ARTPConnection> AVMediaServiceFactory::createARTPConnection() { + return new ARTPConnection(); +} + +// ----- NO TRESSPASSING BEYOND THIS LINE ------ +AVMediaServiceFactory::AVMediaServiceFactory() { +} + +AVMediaServiceFactory::~AVMediaServiceFactory() { +} + +//static +AVMediaServiceFactory *AVMediaServiceFactory::sInst = + ExtensionsLoader<AVMediaServiceFactory>::createInstance("createExtendedMediaServiceFactory"); + +} //namespace android + diff --git a/media/libavextensions/mediaplayerservice/AVMediaServiceUtils.cpp b/media/libavextensions/mediaplayerservice/AVMediaServiceUtils.cpp new file mode 100644 index 0000000..0e42367 --- /dev/null +++ b/media/libavextensions/mediaplayerservice/AVMediaServiceUtils.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2013 - 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define LOG_TAG "AVMediaServiceUtils" +#include <utils/Log.h> + +#include <media/stagefright/foundation/ADebug.h> +#include "ARTPConnection.h" +#include "ASessionDescription.h" +#include "MyHandler.h" + +#include "common/ExtensionsLoader.hpp" +#include "mediaplayerservice/AVMediaServiceExtensions.h" + +namespace android { + +bool AVMediaServiceUtils::pokeAHole(sp<MyHandler> handler, int rtpSocket, int rtcpSocket, + const AString &transport, const AString &/*sessionHost*/) { + if (handler == NULL) { + ALOGW("MyHandler is NULL"); + return false; + } + return handler->pokeAHole(rtpSocket, rtcpSocket, transport); +} + +void AVMediaServiceUtils::makePortPair(int *rtpSocket, int *rtcpSocket, unsigned *rtpPort, + bool /*isIPV6*/) { + return ARTPConnection::MakePortPair(rtpSocket, rtcpSocket, rtpPort); +} + +const char* AVMediaServiceUtils::parseURL(AString *host) { + return strchr(host->c_str(), ':'); +} + +bool AVMediaServiceUtils::parseTrackURL(AString /*url*/, AString /*val*/) { + return false; +} + +void AVMediaServiceUtils::appendRange(AString * /*request*/) { + return; +} + +void AVMediaServiceUtils::setServerTimeoutUs(int64_t /*timeout*/) { + return; +} + +void AVMediaServiceUtils::addH263AdvancedPacket(const sp<ABuffer> &/*buffer*/, + List<sp<ABuffer>> * /*packets*/, uint32_t /*rtpTime*/) { + return; +} + +void AVMediaServiceUtils::appendMeta(media::Metadata * /*meta*/) { + return; +} + +bool AVMediaServiceUtils::checkNPTMapping(uint32_t * /*rtpInfoTime*/, int64_t * /*playTimeUs*/, + bool * /*nptValid*/, uint32_t /*rtpTime*/) { + return false; +} + +bool AVMediaServiceUtils::parseNTPRange(const char *s, float *npt1, float *npt2) { + return ASessionDescription::parseNTPRange(s, npt1, npt2); +} + +// ----- NO TRESSPASSING BEYOND THIS LINE ------ +AVMediaServiceUtils::AVMediaServiceUtils() { +} + +AVMediaServiceUtils::~AVMediaServiceUtils() { +} + +//static +AVMediaServiceUtils *AVMediaServiceUtils::sInst = + ExtensionsLoader<AVMediaServiceUtils>::createInstance("createExtendedMediaServiceUtils"); + +} //namespace android + diff --git a/media/libavextensions/mediaplayerservice/AVNuExtensions.h b/media/libavextensions/mediaplayerservice/AVNuExtensions.h new file mode 100644 index 0000000..5a7a0cb --- /dev/null +++ b/media/libavextensions/mediaplayerservice/AVNuExtensions.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2013 - 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _AV_NU_EXTENSIONS_H_ +#define _AV_NU_EXTENSIONS_H_ + +#include <common/AVExtensionsCommon.h> + +namespace android { + +struct NuPlayer; +/* + * Factory to create extended NuPlayer objects + */ +struct AVNuFactory { + virtual sp<NuPlayer> createNuPlayer(pid_t pid); + + virtual sp<NuPlayer::DecoderBase> createPassThruDecoder( + const sp<AMessage> ¬ify, + 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); +}; + +/* + * Common delegate to the classes in NuPlayer + */ +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 bool isVorbisFormat(const sp<MetaData> &); + 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); + virtual uint32_t getUseSetBuffersFlag(); + virtual bool canUseSetBuffers(const sp<MetaData> &Meta); + + virtual void printFileName(int fd); + virtual void checkFormatChange(bool *formatChange, const sp<ABuffer> &accessUnit); + virtual void addFlagsInMeta(const sp<ABuffer> &buffer, int32_t flags, bool isAudio); + + // ----- NO TRESSPASSING BEYOND THIS LINE ------ + DECLARE_LOADABLE_SINGLETON(AVNuUtils); +}; + +} + +#endif // _AV_EXTENSIONS__H_ diff --git a/media/libavextensions/mediaplayerservice/AVNuFactory.cpp b/media/libavextensions/mediaplayerservice/AVNuFactory.cpp new file mode 100644 index 0000000..ff7c074 --- /dev/null +++ b/media/libavextensions/mediaplayerservice/AVNuFactory.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2013 - 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +//#define LOG_NDEBUG 0 +#define LOG_TAG "AVNuFactory" +#include <utils/Log.h> + +#include <media/stagefright/foundation/ADebug.h> +#include <media/stagefright/foundation/AMessage.h> + +#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> + +#include "common/ExtensionsLoader.hpp" +#include "mediaplayerservice/AVNuExtensions.h" + +namespace android { + +sp<NuPlayer> AVNuFactory::createNuPlayer(pid_t pid) { + return new NuPlayer(pid); +} + +sp<NuPlayer::DecoderBase> AVNuFactory::createPassThruDecoder( + const sp<AMessage> ¬ify, + const sp<NuPlayer::Source> &source, + const sp<NuPlayer::Renderer> &renderer) { + 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() { +} + +AVNuFactory::~AVNuFactory() { +} + +//static +AVNuFactory *AVNuFactory::sInst = + ExtensionsLoader<AVNuFactory>::createInstance("createExtendedNuFactory"); + +} //namespace android + diff --git a/media/libavextensions/mediaplayerservice/AVNuUtils.cpp b/media/libavextensions/mediaplayerservice/AVNuUtils.cpp new file mode 100644 index 0000000..ba837e4 --- /dev/null +++ b/media/libavextensions/mediaplayerservice/AVNuUtils.cpp @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2013 - 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define LOG_TAG "AVNuUtils" +#include <utils/Log.h> + +#include <media/stagefright/foundation/ADebug.h> +#include <media/stagefright/foundation/AMessage.h> + +#include <media/stagefright/MediaDefs.h> + +#include <nuplayer/NuPlayer.h> +#include <nuplayer/NuPlayerDecoderBase.h> +#include <nuplayer/NuPlayerDecoderPassThrough.h> +#include <nuplayer/NuPlayerSource.h> +#include <nuplayer/NuPlayerRenderer.h> + +#include "common/ExtensionsLoader.hpp" +#include "mediaplayerservice/AVNuExtensions.h" + +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> &meta) { + const char *mime = {0}; + if (meta == NULL) { + return false; + } + CHECK(meta->findCString(kKeyMIMEType, &mime)); + if (!strncasecmp(mime, MEDIA_MIMETYPE_AUDIO_RAW, 9)) + return true; + else + return false; +} + +bool AVNuUtils::isRAWFormat(const sp<AMessage> &format) { + AString mime; + if (format == NULL) { + return false; + } + CHECK(format->findString("mime", &mime)); + if (!strncasecmp(mime.c_str(), MEDIA_MIMETYPE_AUDIO_RAW, 9)) + return true; + else + return false; + +} + +bool AVNuUtils::isVorbisFormat(const sp<MetaData> &) { + return false; +} + +int AVNuUtils::updateAudioBitWidth(audio_format_t /*audioFormat*/, + const sp<AMessage> &){ + return 16; +} + +audio_format_t AVNuUtils::getKeyPCMFormat(const sp<MetaData> &meta) { + int32_t pcmFormat = 0; + if (meta->findInt32('pfmt', &pcmFormat)) + return (audio_format_t)pcmFormat; + + return AUDIO_FORMAT_PCM_16_BIT; +} + +void AVNuUtils::setKeyPCMFormat(const sp<MetaData> &meta, audio_format_t audioFormat) { + if (audio_is_linear_pcm(audioFormat)) + meta->setInt32('pfmt', audioFormat); +} + +audio_format_t AVNuUtils::getPCMFormat(const sp<AMessage> &format) { + int32_t pcmFormat = 0; + if (format->findInt32("pcm-format", &pcmFormat)) + return (audio_format_t)pcmFormat; + + int32_t bits = 16; + if (format->findInt32("bit-width", &bits)) { + if (bits == 8) + return AUDIO_FORMAT_PCM_8_BIT; + if (bits == 24) + return AUDIO_FORMAT_PCM_32_BIT; + if (bits == 32) + return AUDIO_FORMAT_PCM_FLOAT; + } + return AUDIO_FORMAT_PCM_16_BIT; +} + +void AVNuUtils::setPCMFormat(const sp<AMessage> &format, audio_format_t audioFormat) { + if (audio_is_linear_pcm(audioFormat)) + format->setInt32("pcm-format", 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; +} + +void AVNuUtils::printFileName(int) {} + +void AVNuUtils::checkFormatChange(bool * /*formatChange*/, + const sp<ABuffer> & /*accessUnit*/) { +} + +void AVNuUtils::addFlagsInMeta(const sp<ABuffer> & /*buffer*/, + int32_t /*flags*/, bool /*isAudio*/) { +} + +uint32_t AVNuUtils::getUseSetBuffersFlag() { + return 0; +} + +bool AVNuUtils::canUseSetBuffers(const sp<MetaData> &/*Meta*/) { + return false; +} + +// ----- NO TRESSPASSING BEYOND THIS LINE ------ +AVNuUtils::AVNuUtils() {} + +AVNuUtils::~AVNuUtils() {} + +//static +AVNuUtils *AVNuUtils::sInst = + ExtensionsLoader<AVNuUtils>::createInstance("createExtendedNuUtils"); + +} //namespace android + diff --git a/media/libavextensions/stagefright/AVExtensions.h b/media/libavextensions/stagefright/AVExtensions.h new file mode 100644 index 0000000..937180f --- /dev/null +++ b/media/libavextensions/stagefright/AVExtensions.h @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2013 - 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _AV_EXTENSIONS_H_ +#define _AV_EXTENSIONS_H_ + +#include <media/stagefright/DataSource.h> +#include <common/AVExtensionsCommon.h> +#include <system/audio.h> +#include <camera/ICamera.h> +#include <media/mediarecorder.h> +#include <media/IOMX.h> + +namespace android { + +class AudioParameter; +class MetaData; +class MediaExtractor; +class MPEG4Writer; +struct ABuffer; +struct ACodec; +struct ALooper; +struct IMediaHTTPConnection; +struct MediaCodec; +struct MediaSource; +struct MediaHTTP; +struct NuCachedSource2; +class CameraParameters; +class MediaBuffer; +struct AudioSource; +class CameraSource; +class CameraSourceTimeLapse; +class ICamera; +class ICameraRecordingProxy; +class String16; +class IGraphicBufferProducer; +struct Size; + +/* + * Factory to create objects of base-classes in libstagefright + */ +struct AVFactory { + virtual sp<ACodec> createACodec(); + virtual MediaExtractor* createExtendedExtractor( + const sp<DataSource> &source, const char *mime, + const sp<AMessage> &meta, const uint32_t flags); + virtual sp<MediaExtractor> updateExtractor( + sp<MediaExtractor> ext, const sp<DataSource> &source, + const char *mime, const sp<AMessage> &meta, const uint32_t flags); + virtual sp<NuCachedSource2> createCachedSource( + const sp<DataSource> &source, + const char *cacheConfig = NULL, + bool disconnectAtHighwatermark = false); + virtual MediaHTTP* createMediaHTTP( + const sp<IMediaHTTPConnection> &conn); + + virtual AudioSource* createAudioSource( + audio_source_t inputSource, + const String16 &opPackageName, + uint32_t sampleRate, + uint32_t channels, + uint32_t outSampleRate = 0); + + virtual CameraSource *CreateCameraSourceFromCamera( + const sp<ICamera> &camera, + const sp<ICameraRecordingProxy> &proxy, + int32_t cameraId, + const String16& clientName, + uid_t clientUid, + Size videoSize, + int32_t frameRate, + const sp<IGraphicBufferProducer>& surface, + bool storeMetaDataInVideoBuffers = true); + + virtual CameraSourceTimeLapse *CreateCameraSourceTimeLapseFromCamera( + const sp<ICamera> &camera, + const sp<ICameraRecordingProxy> &proxy, + int32_t cameraId, + const String16& clientName, + uid_t clientUid, + Size videoSize, + int32_t videoFrameRate, + const sp<IGraphicBufferProducer>& surface, + int64_t timeBetweenFrameCaptureUs, + bool storeMetaDataInVideoBuffers = true); + // ----- NO TRESSPASSING BEYOND THIS LINE ------ + DECLARE_LOADABLE_SINGLETON(AVFactory); +}; + +/* + * Common delegate to the classes in libstagefright + */ +struct AVUtils { + + virtual status_t convertMetaDataToMessage( + const sp<MetaData> &meta, sp<AMessage> *format); + virtual DataSource::SnifferFunc getExtendedSniffer(); + virtual status_t mapMimeToAudioFormat( audio_format_t& format, const char* mime); + virtual status_t sendMetaDataToHal(const sp<MetaData>& meta, AudioParameter *param); + + virtual sp<MediaCodec> createCustomComponentByName(const sp<ALooper> &looper, + const char* mime, bool encoder, const sp<AMessage> &format); + virtual bool isEnhancedExtension(const char *extension); + + virtual bool is24bitPCMOffloadEnabled(); + virtual bool is16bitPCMOffloadEnabled(); + virtual int getAudioSampleBits(const sp<MetaData> &); + virtual int getAudioSampleBits(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> &); + + virtual bool canOffloadAPE(const sp<MetaData> &meta); + + virtual int32_t getAudioMaxInputBufferSize(audio_format_t audioFormat, + const sp<AMessage> &); + + virtual bool mapAACProfileToAudioFormat(const sp<MetaData> &, + audio_format_t &, + uint64_t /*eAacProfile*/); + + virtual bool mapAACProfileToAudioFormat(const sp<AMessage> &, + audio_format_t &, + uint64_t /*eAacProfile*/); + + virtual void extractCustomCameraKeys( + const CameraParameters& /*params*/, sp<MetaData> &/*meta*/) {} + virtual void printFileName(int /*fd*/) {} + virtual void addDecodingTimesFromBatch(MediaBuffer * /*buf*/, + List<int64_t> &/*decodeTimeQueue*/) {} + + virtual bool useQCHWEncoder(const sp<AMessage> &, AString &) { return false; } + + virtual bool canDeferRelease(const sp<MetaData> &/*meta*/) { return false; } + virtual void setDeferRelease(sp<MetaData> &/*meta*/) {} + + struct HEVCMuxer { + + virtual bool reassembleHEVCCSD(const AString &mime, sp<ABuffer> csd0, sp<MetaData> &meta); + + virtual void writeHEVCFtypBox(MPEG4Writer *writer); + + virtual status_t makeHEVCCodecSpecificData(const uint8_t *data, + size_t size, void** codecSpecificData, + size_t *codecSpecificDataSize); + + virtual const char *getFourCCForMime(const char *mime); + + virtual void writeHvccBox(MPEG4Writer *writer, + void* codecSpecificData, size_t codecSpecificDataSize, + bool useNalLengthFour); + + virtual bool isVideoHEVC(const char* mime); + + virtual void getHEVCCodecSpecificDataFromInputFormatIfPossible( + sp<MetaData> meta, void **codecSpecificData, + size_t *codecSpecificDataSize, bool *gotAllCodecSpecificData); + + protected: + HEVCMuxer() {}; + virtual ~HEVCMuxer() {}; + friend struct AVUtils; + }; + + virtual inline HEVCMuxer& HEVCMuxerUtils() { + return mHEVCMuxer; + } + + virtual bool isAudioMuxFormatSupported(const char *mime); + virtual void cacheCaptureBuffers(sp<ICamera> camera, video_encoder encoder); + virtual const char *getCustomCodecsLocation(); + + virtual void setIntraPeriod( + int nPFrames, int nBFrames, const sp<IOMX> OMXhandle, + IOMX::node_id nodeID); + +private: + HEVCMuxer mHEVCMuxer; + // ----- NO TRESSPASSING BEYOND THIS LINE ------ + DECLARE_LOADABLE_SINGLETON(AVUtils); +}; + +} + +#endif // _AV_EXTENSIONS__H_ diff --git a/media/libavextensions/stagefright/AVFactory.cpp b/media/libavextensions/stagefright/AVFactory.cpp new file mode 100644 index 0000000..f6d5f53 --- /dev/null +++ b/media/libavextensions/stagefright/AVFactory.cpp @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2013 - 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define LOG_TAG "AVFactory" +#include <utils/Log.h> + +#include <media/stagefright/foundation/ADebug.h> +#include <media/stagefright/foundation/AMessage.h> +#include <media/stagefright/foundation/ABuffer.h> +#include <media/stagefright/MediaDefs.h> +#include <media/stagefright/MediaCodecList.h> +#include <media/stagefright/MetaData.h> +#include <media/stagefright/ACodec.h> +#include <media/stagefright/DataSource.h> +#include <media/stagefright/MediaDefs.h> +#include <media/stagefright/MediaExtractor.h> +#include <media/stagefright/MediaHTTP.h> +#include <media/stagefright/AudioSource.h> +#include <media/stagefright/CameraSource.h> +#include <media/stagefright/CameraSourceTimeLapse.h> +#include <camera/CameraParameters.h> + +#include "common/ExtensionsLoader.hpp" +#include "stagefright/AVExtensions.h" +#include "include/NuCachedSource2.h" + +namespace android { + +sp<ACodec> AVFactory::createACodec() { + return new ACodec; +} + +MediaExtractor* AVFactory::createExtendedExtractor( + const sp<DataSource> &, const char *, const sp<AMessage> &, + const uint32_t) { + return NULL; +} + +sp<MediaExtractor> AVFactory::updateExtractor( + sp<MediaExtractor> ext, const sp<DataSource> &, + const char *, const sp<AMessage> &, const uint32_t) { + return ext; +} + +sp<NuCachedSource2> AVFactory::createCachedSource( + const sp<DataSource> &source, + const char *cacheConfig, + bool disconnectAtHighwatermark) { + return NuCachedSource2::Create(source, cacheConfig, disconnectAtHighwatermark); +} + +MediaHTTP* AVFactory::createMediaHTTP( + const sp<IMediaHTTPConnection> &conn) { + return new MediaHTTP(conn); +} + +AudioSource* AVFactory::createAudioSource( + audio_source_t inputSource, + const String16 &opPackageName, + uint32_t sampleRate, + uint32_t channels, + uint32_t outSampleRate) { + return new AudioSource(inputSource, opPackageName, sampleRate, + channels, outSampleRate); +} + +CameraSource* AVFactory::CreateCameraSourceFromCamera( + const sp<ICamera> &camera, + const sp<ICameraRecordingProxy> &proxy, + int32_t cameraId, + const String16& clientName, + uid_t clientUid, + Size videoSize, + int32_t frameRate, + const sp<IGraphicBufferProducer>& surface, + bool storeMetaDataInVideoBuffers) { + return CameraSource::CreateFromCamera(camera, proxy, cameraId, + clientName, clientUid, videoSize, frameRate, surface, + storeMetaDataInVideoBuffers); +} + +CameraSourceTimeLapse* AVFactory::CreateCameraSourceTimeLapseFromCamera( + const sp<ICamera> &camera, + const sp<ICameraRecordingProxy> &proxy, + int32_t cameraId, + const String16& clientName, + uid_t clientUid, + Size videoSize, + int32_t videoFrameRate, + const sp<IGraphicBufferProducer>& surface, + int64_t timeBetweenFrameCaptureUs, + bool storeMetaDataInVideoBuffers) { + return CameraSourceTimeLapse::CreateFromCamera(camera, proxy, cameraId, + clientName, clientUid, videoSize, videoFrameRate, surface, + timeBetweenFrameCaptureUs, storeMetaDataInVideoBuffers); +} +// ----- NO TRESSPASSING BEYOND THIS LINE ------ +AVFactory::AVFactory() { +} + +AVFactory::~AVFactory() { +} + +//static +AVFactory *AVFactory::sInst = + ExtensionsLoader<AVFactory>::createInstance("createExtendedFactory"); + +} //namespace android + diff --git a/media/libavextensions/stagefright/AVUtils.cpp b/media/libavextensions/stagefright/AVUtils.cpp new file mode 100644 index 0000000..50c0f89 --- /dev/null +++ b/media/libavextensions/stagefright/AVUtils.cpp @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2013 - 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define LOG_TAG "AVUtils" +#include <utils/Log.h> + +#include <media/stagefright/foundation/ADebug.h> +#include <media/stagefright/foundation/AMessage.h> +#include <media/stagefright/foundation/ABuffer.h> +#include <media/stagefright/MediaDefs.h> +#include <media/stagefright/MediaCodecList.h> +#include <media/stagefright/MetaData.h> +#include <media/stagefright/ACodec.h> +#include <media/stagefright/MediaCodec.h> + +#include "common/ExtensionsLoader.hpp" +#include "stagefright/AVExtensions.h" + +namespace android { + +status_t AVUtils::convertMetaDataToMessage( + const sp<MetaData> &, sp<AMessage> *) { + return OK; +} + +status_t AVUtils::mapMimeToAudioFormat( + audio_format_t&, const char* ) { + return OK; +} + +status_t AVUtils::sendMetaDataToHal( + const sp<MetaData>&, AudioParameter *){ + return OK; +} + +bool AVUtils::is24bitPCMOffloadEnabled() {return false;} +bool AVUtils::is16bitPCMOffloadEnabled() {return false;} + +int AVUtils::getAudioSampleBits(const sp<MetaData> &) { + return 16; +} + +int AVUtils::getAudioSampleBits(const sp<AMessage> &format) { + int32_t bits = 16; + format->findInt32("bit-width", &bits); + return bits; +} + +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> *) { + return false; +} + +DataSource::SnifferFunc AVUtils::getExtendedSniffer() { + return dumbSniffer; +} + +sp<MediaCodec> AVUtils::createCustomComponentByName( + const sp<ALooper> &, const char* , bool, const sp<AMessage> &) { + return NULL; +} + +bool AVUtils::canOffloadAPE(const sp<MetaData> &) { + return true; +} + +int32_t AVUtils::getAudioMaxInputBufferSize(audio_format_t, const sp<AMessage> &) { + return 0; +} + +bool AVUtils::mapAACProfileToAudioFormat(const sp<MetaData> &, audio_format_t &, + uint64_t /*eAacProfile*/) { + return false ; +} + +bool AVUtils::mapAACProfileToAudioFormat(const sp<AMessage> &, audio_format_t &, + uint64_t /*eAacProfile*/) { + return false ; +} + +bool AVUtils::isEnhancedExtension(const char *) { + return false; +} + +bool AVUtils::HEVCMuxer::reassembleHEVCCSD(const AString &/*mime*/, sp<ABuffer> /*csd0*/, sp<MetaData> &/*meta*/) { + return false; +} + +void AVUtils::HEVCMuxer::writeHEVCFtypBox(MPEG4Writer * /*writer*/) { + return; +} + +status_t AVUtils::HEVCMuxer::makeHEVCCodecSpecificData(const uint8_t * /*data*/, + size_t /*size*/, void ** /*codecSpecificData*/, + size_t * /*codecSpecificDataSize*/) { + return UNKNOWN_ERROR; +} + +const char *AVUtils::HEVCMuxer::getFourCCForMime(const char * /*mime*/) { + return NULL; +} + +void AVUtils::HEVCMuxer::writeHvccBox(MPEG4Writer * /*writer*/, + void * /*codecSpecificData*/, size_t /*codecSpecificDataSize*/, + bool /*useNalLengthFour*/) { + return; +} + +bool AVUtils::HEVCMuxer::isVideoHEVC(const char * /*mime*/) { + return false; +} + +void AVUtils::HEVCMuxer::getHEVCCodecSpecificDataFromInputFormatIfPossible( + sp<MetaData> /*meta*/, void ** /*codecSpecificData*/, + size_t * /*codecSpecificDataSize*/, bool * /*gotAllCodecSpecificData*/) { + return; +} + +bool AVUtils::isAudioMuxFormatSupported(const char *) { + return true; +} + +void AVUtils::cacheCaptureBuffers(sp<ICamera>, video_encoder) { + return; +} + +const char *AVUtils::getCustomCodecsLocation() { + return "/etc/media_codecs.xml"; +} + +void AVUtils::setIntraPeriod( + int, int, const sp<IOMX>, + IOMX::node_id) { + return; +} + +// ----- NO TRESSPASSING BEYOND THIS LINE ------ +AVUtils::AVUtils() {} + +AVUtils::~AVUtils() {} + +//static +AVUtils *AVUtils::sInst = + ExtensionsLoader<AVUtils>::createInstance("createExtendedUtils"); + +} //namespace android + diff --git a/media/libavextensions/stagefright/ExtendedMediaDefs.cpp b/media/libavextensions/stagefright/ExtendedMediaDefs.cpp new file mode 100644 index 0000000..cf2683c --- /dev/null +++ b/media/libavextensions/stagefright/ExtendedMediaDefs.cpp @@ -0,0 +1,68 @@ +/*Copyright (c) 2012 - 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include <stagefright/ExtendedMediaDefs.h> + +namespace android { + +const char *MEDIA_MIMETYPE_AUDIO_EVRC = "audio/evrc"; +const char *MEDIA_MIMETYPE_VIDEO_WMV = "video/x-ms-wmv"; +const char *MEDIA_MIMETYPE_VIDEO_WMV_VC1 = "video/wvc1"; +const char *MEDIA_MIMETYPE_AUDIO_WMA = "audio/x-ms-wma"; +const char *MEDIA_MIMETYPE_AUDIO_WMA_PRO = "audio/x-ms-wma-pro"; +const char *MEDIA_MIMETYPE_AUDIO_WMA_LOSSLESS = "audio/x-ms-wma-lossless"; +const char *MEDIA_MIMETYPE_CONTAINER_ASF = "video/x-ms-asf"; +const char *MEDIA_MIMETYPE_VIDEO_DIVX = "video/divx"; +const char *MEDIA_MIMETYPE_CONTAINER_AAC = "audio/aac"; +const char *MEDIA_MIMETYPE_CONTAINER_QCP = "audio/vnd.qcelp"; +const char *MEDIA_MIMETYPE_VIDEO_DIVX311 = "video/divx311"; +const char *MEDIA_MIMETYPE_VIDEO_DIVX4 = "video/divx4"; +const char *MEDIA_MIMETYPE_CONTAINER_MPEG2 = "video/mp2"; +const char *MEDIA_MIMETYPE_CONTAINER_3G2 = "video/3g2"; +const char *MEDIA_MIMETYPE_AUDIO_DTS = "audio/dts"; +const char *MEDIA_MIMETYPE_AUDIO_DTS_LBR = "audio/dts-lbr"; +const char *MEDIA_MIMETYPE_AUDIO_AMR_WB_PLUS = "audio/amr-wb-plus"; +const char *MEDIA_MIMETYPE_AUDIO_AIFF = "audio/x-aiff"; +const char *MEDIA_MIMETYPE_AUDIO_ALAC = "audio/alac"; +const char *MEDIA_MIMETYPE_AUDIO_APE = "audio/x-ape"; +const char *MEDIA_MIMETYPE_CONTAINER_QCAMR_NB = "audio/qc-amr"; +const char *MEDIA_MIMETYPE_CONTAINER_QCAMR_WB = "audio/qc-amr-wb"; +const char *MEDIA_MIMETYPE_CONTAINER_QCMPEG = "audio/qc-mpeg"; +const char *MEDIA_MIMETYPE_CONTAINER_QCWAV = "audio/qc-wav"; +const char *MEDIA_MIMETYPE_CONTAINER_QCMPEG2TS = "video/qc-mp2ts"; +const char *MEDIA_MIMETYPE_CONTAINER_QCMPEG2PS = "video/qc-mp2ps"; +const char *MEDIA_MIMETYPE_CONTAINER_QCMPEG4 = "video/qc-mp4"; +const char *MEDIA_MIMETYPE_CONTAINER_QCMATROSKA = "video/qc-matroska"; +const char *MEDIA_MIMETYPE_CONTAINER_QCOGG = "video/qc-ogg"; +const char *MEDIA_MIMETYPE_CONTAINER_QCFLV = "video/qc-flv"; +const char *MEDIA_MIMETYPE_VIDEO_VPX = "video/x-vnd.on2.vp8"; //backward compatibility +const char *MEDIA_MIMETYPE_CONTAINER_QTIFLAC = "audio/qti-flac"; +const char *MEDIA_MIMETYPE_VIDEO_MPEG4_DP = "video/mp4v-esdp"; + +} // namespace android |