summaryrefslogtreecommitdiffstats
path: root/media/libavextensions
diff options
context:
space:
mode:
Diffstat (limited to 'media/libavextensions')
-rw-r--r--media/libavextensions/Android.mk6
-rw-r--r--media/libavextensions/mediaplayerservice/AVNuExtensions.h1
-rw-r--r--media/libavextensions/mediaplayerservice/AVNuUtils.cpp64
-rw-r--r--media/libavextensions/stagefright/AVFactory.cpp2
-rw-r--r--media/libavextensions/stagefright/AVUtils.cpp6
5 files changed, 62 insertions, 17 deletions
diff --git a/media/libavextensions/Android.mk b/media/libavextensions/Android.mk
index 0380135..3918857 100644
--- a/media/libavextensions/Android.mk
+++ b/media/libavextensions/Android.mk
@@ -12,7 +12,7 @@ LOCAL_C_INCLUDES:= \
$(TOP)/frameworks/native/include/media/hardware \
$(TOP)/frameworks/native/include/media/openmax \
$(TOP)/external/flac/include \
- $(TOP)/hardware/qcom/media/mm-core/inc \
+ $(TOP)/$(call project-path-for,qcom-media)/mm-core/inc \
$(TOP)/frameworks/av/media/libstagefright \
LOCAL_CFLAGS += -Wno-multichar -Werror
@@ -41,7 +41,7 @@ LOCAL_C_INCLUDES:= \
$(TOP)/frameworks/native/include/media/hardware \
$(TOP)/frameworks/native/include/media/openmax \
$(TOP)/external/flac/include \
- $(TOP)/hardware/qcom/media/mm-core/inc
+ $(TOP)/$(call project-path-for,qcom-media)/mm-core/inc
LOCAL_CFLAGS += -Wno-multichar -Werror
@@ -75,7 +75,7 @@ LOCAL_C_INCLUDES:= \
$(TOP)/frameworks/native/include/media/hardware \
$(TOP)/frameworks/native/include/media/openmax \
$(TOP)/external/flac/include \
- $(TOP)/hardware/qcom/media/mm-core/inc
+ $(TOP)/$(call project-path-for,qcom-media)/mm-core/inc
LOCAL_CFLAGS += -Wno-multichar -Werror
diff --git a/media/libavextensions/mediaplayerservice/AVNuExtensions.h b/media/libavextensions/mediaplayerservice/AVNuExtensions.h
index 1d45c00..d7e29d1 100644
--- a/media/libavextensions/mediaplayerservice/AVNuExtensions.h
+++ b/media/libavextensions/mediaplayerservice/AVNuExtensions.h
@@ -85,6 +85,7 @@ struct AVNuUtils {
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);
virtual bool dropCorruptFrame();
// ----- NO TRESSPASSING BEYOND THIS LINE ------
diff --git a/media/libavextensions/mediaplayerservice/AVNuUtils.cpp b/media/libavextensions/mediaplayerservice/AVNuUtils.cpp
index 95f6454..85f07db 100644
--- a/media/libavextensions/mediaplayerservice/AVNuUtils.cpp
+++ b/media/libavextensions/mediaplayerservice/AVNuUtils.cpp
@@ -33,6 +33,8 @@
#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>
@@ -52,12 +54,29 @@ bool AVNuUtils::pcmOffloadException(const sp<MetaData> &) {
return true;
}
-bool AVNuUtils::isRAWFormat(const sp<MetaData> &) {
- return false;
+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> &) {
- 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> &) {
@@ -69,20 +88,39 @@ int AVNuUtils::updateAudioBitWidth(audio_format_t /*audioFormat*/,
return 16;
}
-audio_format_t AVNuUtils::getKeyPCMFormat(const sp<MetaData> &) {
- return AUDIO_FORMAT_INVALID;
-}
+audio_format_t AVNuUtils::getKeyPCMFormat(const sp<MetaData> &meta) {
+ int32_t pcmFormat = 0;
+ if (meta->findInt32('pfmt', &pcmFormat))
+ return (audio_format_t)pcmFormat;
-void AVNuUtils::setKeyPCMFormat(const sp<MetaData> &, audio_format_t /*audioFormat*/) {
+ 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> &) {
+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> &, audio_format_t /*audioFormat*/) {
-
+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> &) {
@@ -104,6 +142,10 @@ void AVNuUtils::checkFormatChange(bool * /*formatChange*/,
const sp<ABuffer> & /*accessUnit*/) {
}
+void AVNuUtils::addFlagsInMeta(const sp<ABuffer> & /*buffer*/,
+ int32_t /*flags*/, bool /*isAudio*/) {
+}
+
uint32_t AVNuUtils::getFlags() {
return 0;
}
diff --git a/media/libavextensions/stagefright/AVFactory.cpp b/media/libavextensions/stagefright/AVFactory.cpp
index 2a3810d..f6d5f53 100644
--- a/media/libavextensions/stagefright/AVFactory.cpp
+++ b/media/libavextensions/stagefright/AVFactory.cpp
@@ -72,7 +72,7 @@ sp<NuCachedSource2> AVFactory::createCachedSource(
const sp<DataSource> &source,
const char *cacheConfig,
bool disconnectAtHighwatermark) {
- return new NuCachedSource2(source, cacheConfig, disconnectAtHighwatermark);
+ return NuCachedSource2::Create(source, cacheConfig, disconnectAtHighwatermark);
}
MediaHTTP* AVFactory::createMediaHTTP(
diff --git a/media/libavextensions/stagefright/AVUtils.cpp b/media/libavextensions/stagefright/AVUtils.cpp
index 324ff9b..50c0f89 100644
--- a/media/libavextensions/stagefright/AVUtils.cpp
+++ b/media/libavextensions/stagefright/AVUtils.cpp
@@ -66,8 +66,10 @@ int AVUtils::getAudioSampleBits(const sp<MetaData> &) {
return 16;
}
-int AVUtils::getAudioSampleBits(const sp<AMessage> &) {
- 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*/) {