1.frameworks/av/media目录下面的修改
From edd6f1374c1f15783d9920ebda22ea915e503775 Mon Sep 17 00:00:00 2001
From: GW00219471 <zhumingxing@noboauto.com>
Date: Wed, 17 Jan 2024 15:16:10 +0800
Subject: [PATCH] =?UTF-8?q?[V35CUX-4542]:=E7=A7=BB=E6=A4=8Dcux=20=E8=A7=A3?=
=?UTF-8?q?=E7=A0=81=E4=BB=A3=E7=A0=81=E5=88=B0=E4=B8=BB=E7=BA=BF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
[MODULE]:Media
[REASON]:CR
[SOLUTION]:移植
[IMPACT]:NA
[TEST RECOMMENDATIONS]:NA
Change-Id: I3077c4abbde3eb0caf483aeba8543ef6dcb7bedb
---
media/codec2/components/mp3/C2SoftMp3Dec.cpp | 2 +-
media/codec2/core/include/C2Config.h | 8 +
media/codec2/sfplugin/CCodecConfig.cpp | 5 +
media/codec2/sfplugin/Codec2InfoBuilder.cpp | 8 +
media/libdatasource/FileSource.cpp | 16 ++
.../include/datasource/FileSource.h | 7 +
media/libstagefright/Android.bp | 6 +-
media/libstagefright/FFMPEGUtil.cpp | 147 ++++++++++++++++++
media/libstagefright/MediaCodec.cpp | 4 +-
media/libstagefright/MediaCodecList.cpp | 2 +-
.../MediaCodecListOverrides.cpp | 2 +-
media/libstagefright/MediaCodecListWriter.cpp | 2 +-
media/libstagefright/MediaExtractor.cpp | 2 +-
.../libstagefright/MediaExtractorFactory.cpp | 2 +-
media/libstagefright/Utils.cpp | 21 +++
media/libstagefright/foundation/MediaDefs.cpp | 18 +++
.../foundation/MetaDataBase.cpp | 2 +-
.../media/stagefright/foundation/MediaDefs.h | 21 +++
.../include/media/stagefright/FFMPEGUtil.h | 23 +++
.../include/media/stagefright/MetaDataBase.h | 36 +++++
.../manifest_media_c2_software.xml | 1 +
21 files changed, 326 insertions(+), 9 deletions(-)
create mode 100755 media/libstagefright/FFMPEGUtil.cpp
create mode 100755 media/libstagefright/include/media/stagefright/FFMPEGUtil.h
diff --git a/media/codec2/components/mp3/C2SoftMp3Dec.cpp b/media/codec2/components/mp3/C2SoftMp3Dec.cpp
index 3984f62278..28d0dbbfc9 100644
--- a/media/codec2/components/mp3/C2SoftMp3Dec.cpp
+++ b/media/codec2/components/mp3/C2SoftMp3Dec.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
#define LOG_TAG "C2SoftMp3Dec"
#include <log/log.h>
diff --git a/media/codec2/core/include/C2Config.h b/media/codec2/core/include/C2Config.h
index 29bccd5dc5..c1ca622cc1 100644
--- a/media/codec2/core/include/C2Config.h
+++ b/media/codec2/core/include/C2Config.h
@@ -249,6 +249,9 @@ enum C2ParamIndexKind : C2Param::type_index_t {
// low latency mode
kParamIndexLowLatencyMode, // bool
+
+ // FFMPEG
+ kParamIndexRawCodecData,
};
}
@@ -2182,6 +2185,11 @@ inline C2TimestampGapAdjustmentStruct::C2TimestampGapAdjustmentStruct()
typedef C2PortParam<C2Tuning, C2TimestampGapAdjustmentStruct> C2PortTimestampGapTuning;
constexpr char C2_PARAMKEY_INPUT_SURFACE_TIMESTAMP_ADJUSTMENT[] = "input-surface.timestamp-adjustment";
+// FFMPEG
+
+typedef C2StreamParam<C2Info, C2BlobValue, kParamIndexRawCodecData> C2StreamRawCodecDataInfo;
+constexpr char C2_PARAMKEY_RAW_CODEC_DATA[] = "coded.raw-codec-data";
+
/// @}
#endif // C2CONFIG_H_
diff --git a/media/codec2/sfplugin/CCodecConfig.cpp b/media/codec2/sfplugin/CCodecConfig.cpp
index 96f86e8d59..23548ba353 100644
--- a/media/codec2/sfplugin/CCodecConfig.cpp
+++ b/media/codec2/sfplugin/CCodecConfig.cpp
@@ -917,6 +917,11 @@ void CCodecConfig::initializeStandardParams() {
KEY_AUDIO_SESSION_ID // we use "audio-hw-sync"
KEY_OUTPUT_REORDER_DEPTH
*/
+
+ // FFMPEG
+
+ add(ConfigMapper("raw-codec-data", C2_PARAMKEY_RAW_CODEC_DATA, "value")
+ .limitTo(D::DECODER & D::CODED));
}
status_t CCodecConfig::initialize(
diff --git a/media/codec2/sfplugin/Codec2InfoBuilder.cpp b/media/codec2/sfplugin/Codec2InfoBuilder.cpp
index b11224907e..721f76f02d 100644
--- a/media/codec2/sfplugin/Codec2InfoBuilder.cpp
+++ b/media/codec2/sfplugin/Codec2InfoBuilder.cpp
@@ -326,6 +326,11 @@ status_t Codec2InfoBuilder::buildMediaCodecList(MediaCodecListWriter* writer) {
{ "media_codecs.xml", "media_codecs_performance.xml" },
{ "/apex/com.android.media.swcodec/etc" });
+ // Add ffmpeg codecs
+ parser.parseXmlFilesInSearchDirs(
+ { "media_codecs_ffmpeg_c2.xml" },
+ { "/system_ext/etc/" });
+
// TODO: remove these c2-specific files once product moved to default file names
parser.parseXmlFilesInSearchDirs(
{ "media_codecs_c2.xml", "media_codecs_performance_c2.xml" });
@@ -360,6 +365,9 @@ status_t Codec2InfoBuilder::buildMediaCodecList(MediaCodecListWriter* writer) {
nameAndAliases.insert(nameAndAliases.begin(), trait.name);
for (const std::string &nameOrAlias : nameAndAliases) {
bool isAlias = trait.name != nameOrAlias;
+ ALOGV("To create interface for %s'%s'",
+ isAlias ? "alias " : "",
+ nameOrAlias.c_str());
std::shared_ptr<Codec2Client::Interface> intf =
Codec2Client::CreateInterfaceByName(nameOrAlias.c_str());
if (!intf) {
diff --git a/media/libdatasource/FileSource.cpp b/media/libdatasource/FileSource.cpp
index 3d34d0ca33..1f1cffdc7f 100644
--- a/media/libdatasource/FileSource.cpp
+++ b/media/libdatasource/FileSource.cpp
@@ -31,6 +31,7 @@ namespace android {
FileSource::FileSource(const char *filename)
: mFd(-1),
+ mUri(filename),
mOffset(0),
mLength(-1),
mName("<null>") {
@@ -87,6 +88,7 @@ FileSource::FileSource(int fd, int64_t offset, int64_t length)
(long long) mOffset,
(long long) mLength);
+ fetchUriFromFd(fd);
}
FileSource::~FileSource() {
@@ -96,6 +98,20 @@ FileSource::~FileSource() {
}
}
+void FileSource::fetchUriFromFd(int fd) {
+ ssize_t len = 0;
+ char path[PATH_MAX] = {0};
+ char link[PATH_MAX] = {0};
+
+ mUri.clear();
+
+ snprintf(path, PATH_MAX, "/proc/%d/fd/%d", getpid(), fd);
+ if ((len = readlink(path, link, sizeof(link)-1)) != -1) {
+ link[len] = '\0';
+ mUri.setTo(link);
+ }
+}
+
status_t FileSource::initCheck() const {
return mFd >= 0 ? OK : NO_INIT;
}
diff --git a/media/libdatasource/include/datasource/FileSource.h b/media/libdatasource/include/datasource/FileSource.h
index dee0c335ea..5033b7d2e4 100644
--- a/media/libdatasource/include/datasource/FileSource.h
+++ b/media/libdatasource/include/datasource/FileSource.h
@@ -46,11 +46,16 @@ public:
return mName;
}
+ virtual String8 getUri() {
+ return mUri;
+ }
+
protected:
virtual ~FileSource();
virtual ssize_t readAt_l(off64_t offset, void *data, size_t size);
int mFd;
+ String8 mUri;
int64_t mOffset;
int64_t mLength;
Mutex mLock;
@@ -60,6 +65,8 @@ private:
FileSource(const FileSource &);
FileSource &operator=(const FileSource &);
+
+ void fetchUriFromFd(int fd);
};
} // namespace android
diff --git a/media/libstagefright/Android.bp b/media/libstagefright/Android.bp
index 2b62b8979d..0d8552ba7e 100644
--- a/media/libstagefright/Android.bp
+++ b/media/libstagefright/Android.bp
@@ -118,6 +118,7 @@ cc_library_static {
srcs: [
"Utils.cpp",
+ "FFMPEGUtil.cpp",
"MediaSource.cpp",
"HevcUtils.cpp",
],
@@ -155,7 +156,9 @@ cc_library_static {
cc_library_shared {
name: "libstagefright_framecapture_utils",
- defaults: [
+
+
+defaults: [
"skia_renderengine_deps",
],
srcs: [
@@ -218,6 +221,7 @@ cc_library {
"CameraSource.cpp",
"CameraSourceTimeLapse.cpp",
"DataConverter.cpp",
+ "FFMPEGUtil.cpp",
"FrameDecoder.cpp",
"HevcUtils.cpp",
"InterfaceUtils.cpp",
diff --git a/media/libstagefright/FFMPEGUtil.cpp b/media/libstagefright/FFMPEGUtil.cpp
new file mode 100755
index 0000000000..b44d9054d6
--- /dev/null
+++ b/media/libstagefright/FFMPEGUtil.cpp
@@ -0,0 +1,147 @@
+#define LOG_NDEBUG 0
+#define LOG_TAG "FFMPEGUtil"
+#include <utils/Log.h>
+
+#include <media/stagefright/foundation/ADebug.h>
+#include <media/stagefright/foundation/ABuffer.h>
+#include <media/stagefright/MediaDefs.h>
+#include <media/stagefright/FFMPEGUtil.h>
+
+namespace android {
+
+enum MetaKeyType{
+ INT32, INT64, STRING, DATA, CSD
+};
+
+struct MetaKeyEntry{
+ int MetaKey;
+ const char* MsgKey;
+ MetaKeyType KeyType;
+};
+
+static const MetaKeyEntry MetaKeyTable[] {
+ {kKeyAACAOT , "aac-profile" , INT32},
+ {kKeyArbitraryMode , "use-arbitrary-mode" , INT32},
+ {kKeyBitsPerRawSample , "bits-per-raw-sample" , INT32},
+ {kKeyBitRate , "bitrate" , INT32},
+ {kKeyBlockAlign , "block-align" , INT32},
+ {kKeyChannelCount , "channel-count" , INT32},
+ {kKeyCodecId , "codec-id" , INT32},
+ {kKeyCodedSampleBits , "coded-sample-bits" , INT32},
+ {kKeyFileFormat , "file-format" , INT32},
+ {kKeyRawCodecData , "raw-codec-data" , DATA},
+ {kKeyRawCodecSpecificData , "raw-codec-specific-data", CSD},
+ {kKeyPcmEncoding , "pcm-encoding" , INT32},
+ {kKeySampleFormat , "sample-format" , INT32},
+ {kKeySampleRate , "sample-rate" , INT32},
+ {kKeyWMAVersion , "wma-version" , INT32}, // int32_t
+ {kKeyWMVVersion , "wmv-version" , INT32},
+ {kKeyThumbnailTime , "thumbnail-time" , INT64},
+};
+
+const char* FFMPEGUtil::getMsgKey(int key) {
+ static const size_t numMetaKeys =
+ sizeof(MetaKeyTable) / sizeof(MetaKeyTable[0]);
+ size_t i;
+ for (i = 0; i < numMetaKeys; ++i) {
+ if (key == MetaKeyTable[i].MetaKey) {
+ return MetaKeyTable[i].MsgKey;
+ }
+ }
+ return "unknown";
+}
+
+void FFMPEGUtil::convertMetaDataToMessageFF(
+ const MetaDataBase *meta, sp<AMessage> *format) {
+ const char * str_val;
+ int32_t int32_val;
+ int64_t int64_val;
+ uint32_t data_type;
+ const void * data;
+ size_t size;
+ static const size_t numMetaKeys =
+ sizeof(MetaKeyTable) / sizeof(MetaKeyTable[0]);
+ size_t i;
+ for (i = 0; i < numMetaKeys; ++i) {
+ if (MetaKeyTable[i].KeyType == INT32 &&
+ meta->findInt32(MetaKeyTable[i].MetaKey, &int32_val)) {
+ ALOGV("found metakey %s of type int32", MetaKeyTable[i].MsgKey);
+ format->get()->setInt32(MetaKeyTable[i].MsgKey, int32_val);
+ } else if (MetaKeyTable[i].KeyType == INT64 &&
+ meta->findInt64(MetaKeyTable[i].MetaKey, &int64_val)) {
+ ALOGV("found metakey %s of type int64", MetaKeyTable[i].MsgKey);
+ format->get()->setInt64(MetaKeyTable[i].MsgKey, int64_val);
+ } else if (MetaKeyTable[i].KeyType == STRING &&
+ meta->findCString(MetaKeyTable[i].MetaKey, &str_val)) {
+ ALOGV("found metakey %s of type string", MetaKeyTable[i].MsgKey);
+ format->get()->setString(MetaKeyTable[i].MsgKey, str_val);
+ } else if ( (MetaKeyTable[i].KeyType == DATA ||
+ MetaKeyTable[i].KeyType == CSD) &&
+ meta->findData(MetaKeyTable[i].MetaKey, &data_type, &data, &size)) {
+ ALOGV("found metakey %s of type data", MetaKeyTable[i].MsgKey);
+ if (MetaKeyTable[i].KeyType == CSD) {
+ const char *mime;
+ CHECK(meta->findCString(kKeyMIMEType, &mime));
+ if (strcasecmp(mime, MEDIA_MIMETYPE_VIDEO_AVC)) {
+ sp<ABuffer> buffer = new ABuffer(size);
+ memcpy(buffer->data(), data, size);
+ buffer->meta()->setInt32("csd", true);
+ buffer->meta()->setInt64("timeUs", 0);
+ format->get()->setBuffer("csd-0", buffer);
+ } else {
+ const uint8_t *ptr = (const uint8_t *)data;
+ CHECK(size >= 8);
+ int seqLength = 0, picLength = 0;
+ for (size_t i = 4; i < (size - 4); i++)
+ {
+ if ((*(ptr + i) == 0) && (*(ptr + i + 1) == 0) &&
+ (*(ptr + i + 2) == 0) && (*(ptr + i + 3) == 1))
+ seqLength = i;
+ }
+ sp<ABuffer> buffer = new ABuffer(seqLength);
+ memcpy(buffer->data(), data, seqLength);
+ buffer->meta()->setInt32("csd", true);
+ buffer->meta()->setInt64("timeUs", 0);
+ format->get()->setBuffer("csd-0", buffer);
+ picLength=size-seqLength;
+ sp<ABuffer> buffer1 = new ABuffer(picLength);
+ memcpy(buffer1->data(), (const uint8_t *)data + seqLength, picLength);
+ buffer1->meta()->setInt32("csd", true);
+ buffer1->meta()->setInt64("timeUs", 0);
+ format->get()->setBuffer("csd-1", buffer1);
+ }
+ } else {
+ sp<ABuffer> buffer = new ABuffer(size);
+ memcpy(buffer->data(), data, size);
+ format->get()->setBuffer(MetaKeyTable[i].MsgKey, buffer);
+ }
+ }
+ }
+}
+
+void FFMPEGUtil::convertMessageToMetaDataFF(
+ const sp<AMessage> &msg, sp<MetaData> &meta) {
+ AString str_val;
+ int32_t int32_val;
+ int64_t int64_val;
+ static const size_t numMetaKeys =
+ sizeof(MetaKeyTable) / sizeof(MetaKeyTable[0]);
+ size_t i;
+ for (i = 0; i < numMetaKeys; ++i) {
+ if (MetaKeyTable[i].KeyType == INT32 &&
+ msg->findInt32(MetaKeyTable[i].MsgKey, &int32_val)) {
+ ALOGV("found metakey %s of type int32", MetaKeyTable[i].MsgKey);
+ meta->setInt32(MetaKeyTable[i].MetaKey, int32_val);
+ } else if (MetaKeyTable[i].KeyType == INT64 &&
+ msg->findInt64(MetaKeyTable[i].MsgKey, &int64_val)) {
+ ALOGV("found metakey %s of type int64", MetaKeyTable[i].MsgKey);
+ meta->setInt64(MetaKeyTable[i].MetaKey, int64_val);
+ } else if (MetaKeyTable[i].KeyType == STRING &&
+ msg->findString(MetaKeyTable[i].MsgKey, &str_val)) {
+ ALOGV("found metakey %s of type string", MetaKeyTable[i].MsgKey);
+ meta->setCString(MetaKeyTable[i].MetaKey, str_val.c_str());
+ }
+ }
+}
+
+}
\ No newline at end of file
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index d1cbff1582..ecd3be6dae 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
#include "hidl/HidlSupport.h"
#define LOG_TAG "MediaCodec"
#include <utils/Log.h>
@@ -590,6 +590,7 @@ sp<MediaCodec> MediaCodec::CreateByType(
uid_t uid) {
Vector<AString> matchingCodecs;
+ ALOGI("CreateByType component '%s' start.", mime.c_str());
MediaCodecList::findMatchingCodecs(
mime.c_str(),
encoder,
@@ -607,6 +608,7 @@ sp<MediaCodec> MediaCodec::CreateByType(
*err = ret;
}
if (ret == OK) {
+ ALOGI("Allocating component '%s' success.", componentName.c_str());
return codec;
}
ALOGD("Allocating component '%s' failed (%d), try next one.",
diff --git a/media/libstagefright/MediaCodecList.cpp b/media/libstagefright/MediaCodecList.cpp
index 2b8324b53a..db90e25647 100644
--- a/media/libstagefright/MediaCodecList.cpp
+++ b/media/libstagefright/MediaCodecList.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
#define LOG_TAG "MediaCodecList"
#include <utils/Log.h>
diff --git a/media/libstagefright/MediaCodecListOverrides.cpp b/media/libstagefright/MediaCodecListOverrides.cpp
index 4a167d15ce..92a706ccc3 100644
--- a/media/libstagefright/MediaCodecListOverrides.cpp
+++ b/media/libstagefright/MediaCodecListOverrides.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
#define LOG_TAG "MediaCodecListOverrides"
#include <utils/Log.h>
diff --git a/media/libstagefright/MediaCodecListWriter.cpp b/media/libstagefright/MediaCodecListWriter.cpp
index c4fb19946d..8026b5da3d 100644
--- a/media/libstagefright/MediaCodecListWriter.cpp
+++ b/media/libstagefright/MediaCodecListWriter.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
#define LOG_TAG "MediaCodecListWriter"
#include <utils/Log.h>
diff --git a/media/libstagefright/MediaExtractor.cpp b/media/libstagefright/MediaExtractor.cpp
index 4ed3382135..11b44c9447 100644
--- a/media/libstagefright/MediaExtractor.cpp
+++ b/media/libstagefright/MediaExtractor.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
#define LOG_TAG "MediaExtractor"
#include <utils/Log.h>
#include <pwd.h>
diff --git a/media/libstagefright/MediaExtractorFactory.cpp b/media/libstagefright/MediaExtractorFactory.cpp
index c6e753d63d..a1b3fe9d24 100644
--- a/media/libstagefright/MediaExtractorFactory.cpp
+++ b/media/libstagefright/MediaExtractorFactory.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
#define LOG_TAG "MediaExtractorFactory"
#include <utils/Log.h>
diff --git a/media/libstagefright/Utils.cpp b/media/libstagefright/Utils.cpp
index ccd01dd20b..580ffb8f97 100644
--- a/media/libstagefright/Utils.cpp
+++ b/media/libstagefright/Utils.cpp
@@ -51,6 +51,7 @@
#include <stagefright/AVExtensions.h>
#endif
+#include <media/stagefright/FFMPEGUtil.h>
namespace android {
static status_t copyNALUToABuffer(sp<ABuffer> *buffer, const uint8_t *ptr, size_t length) {
@@ -720,6 +721,8 @@ static std::vector<std::pair<const char *, uint32_t>> stringMappings {
{ "manufacturer", kKeyManufacturer },
{ "title", kKeyTitle },
{ "year", kKeyYear },
+ // FFMEG
+ { "file-format", kKeyFileFormat },
}
};
@@ -757,6 +760,19 @@ static std::vector<std::pair<const char *, uint32_t>> int32Mappings {
{ "thumbnail-height", kKeyThumbnailHeight },
{ "track-id", kKeyTrackID },
{ "valid-samples", kKeyValidSamples },
+ // FFMPEG
+ { "bits-per-raw-sample", kKeyBitsPerRawSample },
+ { "block-align", kKeyBlockAlign },
+ { "codec-id", kKeyCodecId },
+ { "coded-sample-bits", kKeyCodedSampleBits },
+ { "min-block-size", 'mibs' },
+ { "max-block-size", 'mabs' },
+ { "min-frame-size", 'mifs' },
+ { "max-frame-size", 'mafs' },
+ { "sample-format", kKeySampleFormat },
+ { "sample-rate", kKeySampleRate },
+ { "wma-version", kKeyWMAVersion },
+ { "wmv-version", kKeyWMVVersion },
}
};
@@ -773,6 +789,9 @@ static std::vector<std::pair<const char *, uint32_t>> bufferMappings {
{ "sei", kKeySEI },
{ "text-format-data", kKeyTextFormatData },
{ "thumbnail-csd-hevc", kKeyThumbnailHVCC },
+ // FFMPEG
+ { "raw-codec-data", kKeyRawCodecData },
+ { "raw-codec-specific-data", kKeyRawCodecSpecificData },
}
};
@@ -1482,6 +1501,7 @@ AVUtils::get()->convertMetaDataToMessage(meta, &msg);
parseDolbyVisionProfileLevelFromDvcc(ptr, size, msg);
}
+ FFMPEGUtil::convertMetaDataToMessageFF(meta, &msg);
*format = msg;
return OK;
@@ -2014,6 +2034,7 @@ status_t convertMessageToMetaData(const sp<AMessage> &msg, sp<MetaData> &meta) {
#ifndef __NO_AVEXTENSIONS__
AVUtils::get()->convertMessageToMetaData(msg, meta);
#endif
+ FFMPEGUtil::convertMessageToMetaDataFF(msg, meta);
#if 0
ALOGI("converted %s to:", msg->debugString(0).c_str());
diff --git a/media/libstagefright/foundation/MediaDefs.cpp b/media/libstagefright/foundation/MediaDefs.cpp
index 7c422707a4..59a45fe8c7 100644
--- a/media/libstagefright/foundation/MediaDefs.cpp
+++ b/media/libstagefright/foundation/MediaDefs.cpp
@@ -80,6 +80,24 @@ const char *MEDIA_MIMETYPE_TEXT_CEA_608 = "text/cea-608";
const char *MEDIA_MIMETYPE_TEXT_CEA_708 = "text/cea-708";
const char *MEDIA_MIMETYPE_DATA_TIMED_ID3 = "application/x-id3v4";
+const char *MEDIA_MIMETYPE_VIDEO_VC1 = "video/vc1";
+#ifndef __ANDROID_VNDK_EXT__
+const char *MEDIA_MIMETYPE_VIDEO_WMV = "video/x-ms-wmv";
+#endif
+const char *MEDIA_MIMETYPE_VIDEO_FFMPEG = "video/ffmpeg";
+
+#ifndef __ANDROID_VNDK_EXT__
+const char *MEDIA_MIMETYPE_AUDIO_APE = "audio/x-ape";
+#endif
+const char *MEDIA_MIMETYPE_AUDIO_PCM = "audio/x-pcm";
+const char *MEDIA_MIMETYPE_AUDIO_FFMPEG = "audio/ffmpeg";
+
+const char *MEDIA_MIMETYPE_CONTAINER_APE = "audio/x-ape";
+const char *MEDIA_MIMETYPE_CONTAINER_WMA = "audio/x-ms-wma";
+const char *MEDIA_MIMETYPE_CONTAINER_WMV = "video/x-ms-wmv";
+const char *MEDIA_MIMETYPE_CONTAINER_VC1 = "video/vc1";
+const char *MEDIA_MIMETYPE_CONTAINER_FFMPEG = "video/ffmpeg";
+
#ifdef __ANDROID_VNDK_EXT__
const char *MEDIA_MIMETYPE_AUDIO_EVRC = "audio/evrc";
const char *MEDIA_MIMETYPE_VIDEO_WMV = "video/x-ms-wmv";
diff --git a/media/libstagefright/foundation/MetaDataBase.cpp b/media/libstagefright/foundation/MetaDataBase.cpp
index 4b439c60fc..617d3a7828 100644
--- a/media/libstagefright/foundation/MetaDataBase.cpp
+++ b/media/libstagefright/foundation/MetaDataBase.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//#define LOG_NDEBUG 0
+#define LOG_NDEBUG 0
#define LOG_TAG "MetaDataBase"
#include <inttypes.h>
#include <utils/KeyedVector.h>
diff --git a/media/libstagefright/foundation/include/media/stagefright/foundation/MediaDefs.h b/media/libstagefright/foundation/include/media/stagefright/foundation/MediaDefs.h
index 56187c0851..39aa3cb8bd 100644
--- a/media/libstagefright/foundation/include/media/stagefright/foundation/MediaDefs.h
+++ b/media/libstagefright/foundation/include/media/stagefright/foundation/MediaDefs.h
@@ -38,7 +38,13 @@ extern const char *MEDIA_MIMETYPE_VIDEO_DIVX;
extern const char *MEDIA_MIMETYPE_VIDEO_DIVX3;
extern const char *MEDIA_MIMETYPE_VIDEO_XVID;
extern const char *MEDIA_MIMETYPE_VIDEO_MJPEG;
+#ifndef __ANDROID_VNDK_EXT__
+extern const char *MEDIA_MIMETYPE_VIDEO_WMV;
+#endif
+#ifndef __ANDROID_VNDK_EXT__
+extern const char *MEDIA_MIMETYPE_AUDIO_APE;
+#endif
extern const char *MEDIA_MIMETYPE_AUDIO_AMR_NB;
extern const char *MEDIA_MIMETYPE_AUDIO_AMR_WB;
extern const char *MEDIA_MIMETYPE_AUDIO_MPEG; // layer III
@@ -82,6 +88,21 @@ extern const char *MEDIA_MIMETYPE_TEXT_CEA_608;
extern const char *MEDIA_MIMETYPE_TEXT_CEA_708;
extern const char *MEDIA_MIMETYPE_DATA_TIMED_ID3;
+extern const char *MEDIA_MIMETYPE_VIDEO_VC1;
+extern const char *MEDIA_MIMETYPE_VIDEO_WMV;
+extern const char *MEDIA_MIMETYPE_VIDEO_FFMPEG;
+
+extern const char *MEDIA_MIMETYPE_AUDIO_APE;
+extern const char *MEDIA_MIMETYPE_AUDIO_PCM;
+extern const char *MEDIA_MIMETYPE_AUDIO_FFMPEG;
+
+extern const char *MEDIA_MIMETYPE_CONTAINER_APE;
+extern const char *MEDIA_MIMETYPE_CONTAINER_ASF;
+extern const char *MEDIA_MIMETYPE_CONTAINER_WMA;
+extern const char *MEDIA_MIMETYPE_CONTAINER_WMV;
+extern const char *MEDIA_MIMETYPE_CONTAINER_VC1;
+extern const char *MEDIA_MIMETYPE_CONTAINER_FFMPEG;
+
// These are values exported to JAVA API that need to be in sync with
// frameworks/base/media/java/android/media/AudioFormat.java. Unfortunately,
// they are not defined in frameworks/av, so defining them here.
diff --git a/media/libstagefright/include/media/stagefright/FFMPEGUtil.h b/media/libstagefright/include/media/stagefright/FFMPEGUtil.h
new file mode 100755
index 0000000000..6f1637841e
--- /dev/null
+++ b/media/libstagefright/include/media/stagefright/FFMPEGUtil.h
@@ -0,0 +1,23 @@
+#ifndef FFMPEG_UTIL_H
+#define FFMPEG_UTIL_H
+
+#include <media/stagefright/foundation/AMessage.h>
+#include <media/stagefright/MetaData.h>
+
+namespace android {
+
+struct FFMPEGUtil {
+
+ static void convertMessageToMetaDataFF(
+ const sp<AMessage> &msg, sp<MetaData> &meta);
+
+ static void convertMetaDataToMessageFF(
+ const MetaDataBase *meta, sp<AMessage> *format);
+
+ static const char* getMsgKey(int key);
+
+};
+
+}
+
+#endif
\ No newline at end of file
diff --git a/media/libstagefright/include/media/stagefright/MetaDataBase.h b/media/libstagefright/include/media/stagefright/MetaDataBase.h
index 735a836cb8..8556bbdb5b 100644
--- a/media/libstagefright/include/media/stagefright/MetaDataBase.h
+++ b/media/libstagefright/include/media/stagefright/MetaDataBase.h
@@ -55,6 +55,11 @@ enum {
kKeyMaxBitRate = 'mxBr', // int32_t (bps)
kKeyBitsPerSample = 'bits', // int32_t (bits per sample)
kKeyStreamHeader = 'stHd', // raw data
+ kKeyCodecId = 'cdid', // int32_t
+ kKeyCodedSampleBits = 'cosb', // int32_t
+ kKeySampleFormat = 'sfmt', // int32_t
+ kKeyBitsPerRawSample = 'sbit', // int32_t
+ kKeyFileFormat = 'ffmt', // cstring
kKeyESDS = 'esds', // raw data
kKeyAACProfile = 'aacp', // int32_t
kKeyAVCC = 'avcc', // raw data
@@ -135,6 +140,23 @@ enum {
kKeyIsUnreadable = 'unre', // bool (int32_t)
+ // FFMPEG
+ kKeyRawCodecData = 'rcdt',
+ kKeyRawCodecSpecificData = 'rcsd', // raw data - added to support mmParser
+ kKeyWMAEncodeOpt = 'eopt', // int32_t
+ kKeyWMABlockAlign = 'blka', // int32_t
+ kKeyWMAVersion = 'wmav', // int32_t
+ kKeyWMAAdvEncOpt1 = 'ade1', // int16_t
+ kKeyWMAAdvEncOpt2 = 'ade2', // int32_t
+ kKeyWMAFormatTag = 'fmtt', // int64_t
+ kKeyWMABitspersample = 'bsps', // int64_t
+ kKeyWMAVirPktSize = 'vpks', // int64_t
+ kKeyWMVProfile = 'wmvp', // int32_t
+
+ kKeyWMVVersion = 'wmvv', // int32_t
+ kKeyRVVersion = '#rvv', // int32_t
+ kKeyBlockAlign = 'ablk', // int32_t , should be different from kKeyWMABlockAlign
+
// An indication that a video buffer has been rendered.
kKeyRendered = 'rend', // bool (int32_t)
@@ -240,6 +262,8 @@ enum {
kKeyHapticChannelCount = 'hapC',
+ kKeyArbitraryMode = 'ArbM',
+
/* MediaRecorder.h, error notifications can represent track ids with 4 bits only.
* | track id | reserved | error or info type |
* 31 28 16 0
@@ -259,6 +283,18 @@ enum {
kTypeD263 = 'd263',
};
+enum {
+ kTypeWMA,
+ kTypeWMAPro,
+ kTypeWMALossLess,
+};
+
+enum {
+ kTypeWMVVer_7, // WMV1
+ kTypeWMVVer_8, // WMV2
+ kTypeWMVVer_9, // WMV3
+};
+
enum {
kCryptoModeUnencrypted = 0,
kCryptoModeAesCtr = 1,
diff --git a/media/mediaserver/manifest_media_c2_software.xml b/media/mediaserver/manifest_media_c2_software.xml
index f23ed446aa..2b0cf32f47 100644
--- a/media/mediaserver/manifest_media_c2_software.xml
+++ b/media/mediaserver/manifest_media_c2_software.xml
@@ -6,6 +6,7 @@
<interface>
<name>IComponentStore</name>
<instance>software</instance>
+ <instance>ffmpeg</instance>
</interface>
</hal>
</manifest>
--
2.17.1
-
/android/device/gwm/vcommon下面的修改
From d24f2f4c0a41cf678557a5393d2cbe85272d8e9f Mon Sep 17 00:00:00 2001
From: GW00219471 zhumingxing@noboauto.com
Date: Wed, 17 Jan 2024 16:09:21 +0800
Subject: [PATCH] =?UTF-8?q?[V35CUX-4542]:=E7=A7=BB=E6=A4=8Dcux=20=E8=A7=A3?=
=?UTF-8?q?=E7=A0=81=E4=BB=A3=E7=A0=81=E5=88=B0=E4=B8=BB=E7=BA=BF2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bitChange-Id: I3895d9af3ab0cdbe07323fdcccdca0cca3e43c60
vcommon/common_install_packages.mk | 13 +++++++++++++
1 file changed, 13 insertions(+)diff --git a/vcommon/common_install_packages.mk b/vcommon/common_install_packages.mk
index d841a3c..87a988f 100755
--- a/vcommon/common_install_packages.mk
+++ b/vcommon/common_install_packages.mk
@@ -120,6 +120,19 @@ PRODUCT_PACKAGES +=
libpcm_player_engine
libpcm_player \+# NBCodecs
+PRODUCT_PACKAGES += \-
libavcodec \
-
libavfilter \
-
libavformat \
-
libavutil \
-
libswscale \
-
libswresample \
-
libffmpeg_utils \
-
libffmpeg_extractor \
-
android.hardware.media.c2@1.1-ffmpeg-service
#Pss
PRODUCT_PACKAGES +=
nb_native_pssclient \2.17.1
From 128b685b69d17b0c3041c196bc8540663b697a0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=98=8E=E6=98=9F=20zhumingxing?=
zhumingxing@noboauto.com
Date: Wed, 24 Jan 2024 15:38:46 +0800
Subject: [PATCH] =?UTF-8?q?[V35CUX-4542]:=E7=A7=BB=E6=A4=8Dcux=20=E8=A7=A3?=
=?UTF-8?q?=E7=A0=81=E4=BB=A3=E7=A0=81=E5=88=B0=E4=B8=BB=E7=BA=BF2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bitChange-Id: I53d12df2e8687c090b2318bac0a0855aa2aadd60
vcommon/common_install_packages.mk | 6 ++++++
1 file changed, 6 insertions(+)diff --git a/vcommon/common_install_packages.mk b/vcommon/common_install_packages.mk
index 87a988f..1540d17 100755
--- a/vcommon/common_install_packages.mk
+++ b/vcommon/common_install_packages.mk
@@ -132,6 +132,12 @@ PRODUCT_PACKAGES +=
libffmpeg_utils
libffmpeg_extractor
android.hardware.media.c2@1.1-ffmpeg-service
+
+PRODUCT_PACKAGES += \-
libcodec2_soft_common \
-
libcodec2_hidl@1.0 \
-
libcodec2_hidl@1.1
#Pss
PRODUCT_PACKAGES += \2.17.1
-
-
/android/device/gwm/vcommon/sepolicy/nobo/common/file_contexts修改
From bc2c79064e95c37a180a009e5aa89285564c3d54 Mon Sep 17 00:00:00 2001
From: GW00219471 zhumingxing@noboauto.com
Date: Wed, 17 Jan 2024 16:14:34 +0800
Subject: [PATCH] =?UTF-8?q?[V35CUX-4542]:=E7=A7=BB=E6=A4=8Dcux=20=E8=A7=A3?=
=?UTF-8?q?=E7=A0=81=E4=BB=A3=E7=A0=81=E5=88=B0=E4=B8=BB=E7=BA=BF3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bitChange-Id: I4a8ffc6d7e9fd67ccd881ef8feef2e45c8382c81
nobo/common/file_contexts | 2 ++
1 file changed, 2 insertions(+)diff --git a/nobo/common/file_contexts b/nobo/common/file_contexts
index 6b95908..560c258 100755
--- a/nobo/common/file_contexts
+++ b/nobo/common/file_contexts
@@ -203,3 +203,5 @@/sys/devices(/platform)?/soc/[a-z0-9]+.ssusb/mode u:object_r:sysfs_usb_mode:s0
+/(system_ext|system/system_ext)/bin/hw/android.hardware.media.c2@1.1-ffmpeg-service u:object_r:mediaswcodec_exec:s0
+2.17.1
4、 /android/prebuilts/abi-dumps/vndk/30修改内容
Android 11 使用HAL层的ffmpeg库(2)-CSDN博客
5、/android/device/gwm/vcommon/android_ivi_auto_commit.toml
From 5d71e3a927a462f6f75c8defa38ea20fa8f06fcd Mon Sep 17 00:00:00 2001
From: GW00219471 <zhumingxing@noboauto.com>
Date: Fri, 19 Jan 2024 13:27:56 +0800
Subject: [PATCH] =?UTF-8?q?[V35CUX-4542]:=E7=A7=BB=E6=A4=8Dcux=20=E8=A7=A3?=
=?UTF-8?q?=E7=A0=81=E4=BB=A3=E7=A0=81=E5=88=B0=E4=B8=BB=E7=BA=BF5=20=20au?=
=?UTF-8?q?to=20commit?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
[MODULE]:Media
[REASON]:CR
[SOLUTION]:移植
[IMPACT]:NA
[TEST RECOMMENDATIONS]:NA
Change-Id: Ieb1b5f3ba0ab6f810923839fc9b30faa31fe05a5
---
vcommon/android_ivi_auto_commit.toml | 82 ++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)
diff --git a/vcommon/android_ivi_auto_commit.toml b/vcommon/android_ivi_auto_commit.toml
index 9d1ecee..5b37867 100755
--- a/vcommon/android_ivi_auto_commit.toml
+++ b/vcommon/android_ivi_auto_commit.toml
@@ -541,3 +541,85 @@ binary_repo_url = "ssh://10.255.33.240:29418/android/platform/vendor/nobo/prebui
module = "GwmDisplayManager"
src="../../../out/target/product/${TARGET_PRODUCT}/system/priv-app/GwmDisplayManager/GwmDisplayManager.apk"
dest="target/product/xxx/system/priv-app/GwmDisplayManager/GwmDisplayManager.apk"
+
+# NoBoMediaCodec
+[[repositorys.copy_infos]]
+ module = "libffmpeg_utils"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib64/libffmpeg_utils.so"
+ dest="target/product/xxx/system/system_ext/lib64/libffmpeg_utils.so"
+[[repositorys.copy_infos]]
+ module = "libffmpeg_utils"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib32/libffmpeg_utils.so"
+ dest="target/product/xxx/system/system_ext/lib/libffmpeg_utils.so"
+[[repositorys.copy_infos]]
+ module = "android.hardware.media.c2@1.1-ffmpeg-service"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/bin/hw/android.hardware.media.c2@1.1-ffmpeg-service"
+ dest="target/product/xxx/system/system_ext/bin/hw/android.hardware.media.c2@1.1-ffmpeg-service"
+[[repositorys.copy_infos]]
+ module = "android.hardware.media.c2@1.1-ffmpeg-service.rc"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/etc/init/android.hardware.media.c2@1.1-ffmpeg-service.rc"
+ dest="target/product/xxx/system/system_ext/etc/init/android.hardware.media.c2@1.1-ffmpeg-service.rc"
+[[repositorys.copy_infos]]
+ module = "media_codecs_ffmpeg_c2.xml"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/etc/media_codecs_ffmpeg_c2.xml"
+ dest="target/product/xxx/system/system_ext/etc/media_codecs_ffmpeg_c2.xml"
+[[repositorys.copy_infos]]
+ module = "android.hardware.media.c2@1.1-ffmpeg.policy"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/etc/seccomp_policy/android.hardware.media.c2@1.1-ffmpeg.policy"
+ dest="target/product/xxx/system/system_ext/etc/seccomp_policy/android.hardware.media.c2@1.1-ffmpeg.policy"
+[[repositorys.copy_infos]]
+ module = "libffmpeg_extractor"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib64/extractors/libffmpeg_extractor.so"
+ dest="target/product/xxx/system/system_ext/lib64/extractors/libffmpeg_extractor.so"
+[[repositorys.copy_infos]]
+ module = "libffmpeg_extractor"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib/extractors/libffmpeg_extractor.so"
+ dest="target/product/xxx/system/system_ext/lib/extractors/libffmpeg_extractor.so"
+[[repositorys.copy_infos]]
+ module = "libavcodec"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib/libavcodec.so"
+ dest="target/product/xxx/system/system_ext/lib/libavcodec.so"
+[[repositorys.copy_infos]]
+ module = "libavcodec"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib64/libavcodec.so"
+ dest="target/product/xxx/system/system_ext/lib64/libavcodec.so"
+[[repositorys.copy_infos]]
+ module = "libavfilter"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib/libavfilter.so"
+ dest="target/product/xxx/system/system_ext/lib/libavfilter.so"
+[[repositorys.copy_infos]]
+ module = "libavfilter"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib64/libavfilter.so"
+ dest="target/product/xxx/system/system_ext/lib64/libavfilter.so"
+[[repositorys.copy_infos]]
+ module = "libavformat"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib/libavformat.so"
+ dest="target/product/xxx/system/system_ext/lib/libavformat.so"
+[[repositorys.copy_infos]]
+ module = "libavformat"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib64/libavformat.so"
+ dest="target/product/xxx/system/system_ext/lib64/libavformat.so"
+[[repositorys.copy_infos]]
+ module = "libavutil"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib64/libavutil.so"
+ dest="target/product/xxx/system/system_ext/lib64/libavutil.so"
+[[repositorys.copy_infos]]
+ module = "libavutil"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib/libavutil.so"
+ dest="target/product/xxx/system/system_ext/lib/libavutil.so"
+[[repositorys.copy_infos]]
+ module = "libswscale"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib/libswscale.so"
+ dest="target/product/xxx/system/system_ext/lib/libswscale.so"
+[[repositorys.copy_infos]]
+ module = "libswscale"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib64/libswscale.so"
+ dest="target/product/xxx/system/system_ext/lib64/libswscale.so"
+[[repositorys.copy_infos]]
+ module = "libswresample"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib64/libswresample.so"
+ dest="target/product/xxx/system/system_ext/lib64/libswresample.so"
+[[repositorys.copy_infos]]
+ module = "libswresample"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib/libswresample.so"
+ dest="target/product/xxx/system/system_ext/lib/libswresample.so"
--
2.17.1
From 8c5f28d036c4233da66366592ef4d77a45a4cdfc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=98=8E=E6=98=9F=20zhumingxing?=
<zhumingxing@noboauto.com>
Date: Tue, 23 Jan 2024 09:56:04 +0800
Subject: [PATCH] =?UTF-8?q?[V35CUX-4542]:=E7=A7=BB=E6=A4=8Dcux=20=E8=A7=A3?=
=?UTF-8?q?=E7=A0=81=E4=BB=A3=E7=A0=81=E5=88=B0=E4=B8=BB=E7=BA=BF5=20=20au?=
=?UTF-8?q?to=20commit?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
[MODULE]:Media
[REASON]:CR
[SOLUTION]:移植 修改路径配置错误问题
[IMPACT]:NA
[TEST RECOMMENDATIONS]:NA
Change-Id: I8015c0497a91849cd1b6b1909a05562103b10e8b
---
vcommon/android_ivi_auto_commit.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vcommon/android_ivi_auto_commit.toml b/vcommon/android_ivi_auto_commit.toml
index 5b37867..5293d92 100755
--- a/vcommon/android_ivi_auto_commit.toml
+++ b/vcommon/android_ivi_auto_commit.toml
@@ -549,7 +549,7 @@ binary_repo_url = "ssh://10.255.33.240:29418/android/platform/vendor/nobo/prebui
dest="target/product/xxx/system/system_ext/lib64/libffmpeg_utils.so"
[[repositorys.copy_infos]]
module = "libffmpeg_utils"
- src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib32/libffmpeg_utils.so"
+ src="../../../out/target/product/${TARGET_PRODUCT}/system/system_ext/lib/libffmpeg_utils.so"
dest="target/product/xxx/system/system_ext/lib/libffmpeg_utils.so"
[[repositorys.copy_infos]]
module = "android.hardware.media.c2@1.1-ffmpeg-service"
--
2.17.1