summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2014-08-15 14:48:45 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-15 08:11:59 +0000
commit74868d6d167ff231e9d2c65cb90eb249bc99c0ea (patch)
tree6cbac6a1e339272e6cf7ed4ef1b5d0d4a293addf /media
parentc2319720436f525315ec13fdce8b929d5dec8e84 (diff)
parent732c6d955524ead6c31e6e1bafbd41ea4cee525d (diff)
downloadframeworks_av-74868d6d167ff231e9d2c65cb90eb249bc99c0ea.zip
frameworks_av-74868d6d167ff231e9d2c65cb90eb249bc99c0ea.tar.gz
frameworks_av-74868d6d167ff231e9d2c65cb90eb249bc99c0ea.tar.bz2
Merge "stagefright/media: add support for codec features with text value" into lmp-dev
Diffstat (limited to 'media')
-rw-r--r--media/libmedia/MediaCodecInfo.cpp6
-rw-r--r--media/libstagefright/MediaCodecList.cpp15
2 files changed, 20 insertions, 1 deletions
diff --git a/media/libmedia/MediaCodecInfo.cpp b/media/libmedia/MediaCodecInfo.cpp
index 446c582..7b4c4e2 100644
--- a/media/libmedia/MediaCodecInfo.cpp
+++ b/media/libmedia/MediaCodecInfo.cpp
@@ -257,4 +257,10 @@ void MediaCodecInfo::addFeature(const AString &key, int32_t value) {
mCurrentCaps->mDetails->setInt32(tag.c_str(), value);
}
+void MediaCodecInfo::addFeature(const AString &key, const char *value) {
+ AString tag = "feature-";
+ tag.append(key);
+ mCurrentCaps->mDetails->setString(tag.c_str(), value);
+}
+
} // namespace android
diff --git a/media/libstagefright/MediaCodecList.cpp b/media/libstagefright/MediaCodecList.cpp
index 2f2a0b3..5b8be46 100644
--- a/media/libstagefright/MediaCodecList.cpp
+++ b/media/libstagefright/MediaCodecList.cpp
@@ -783,6 +783,7 @@ status_t MediaCodecList::addFeature(const char **attrs) {
const char *name = NULL;
int32_t optional = -1;
int32_t required = -1;
+ const char *value = NULL;
while (attrs[i] != NULL) {
if (attrs[i + 1] == NULL) {
@@ -801,6 +802,9 @@ status_t MediaCodecList::addFeature(const char **attrs) {
required = value;
}
++i;
+ } else if (!strcmp(attrs[i], "value")) {
+ value = attrs[i + 1];
+ ++i;
} else {
return -EINVAL;
}
@@ -816,7 +820,16 @@ status_t MediaCodecList::addFeature(const char **attrs) {
return -EINVAL;
}
- mCurrentInfo->addFeature(name, (required == 1) || (optional == 0));
+ if ((optional != -1 || required != -1) && (value != NULL)) {
+ ALOGE("feature '%s' has both a value and optional/required attribute", name);
+ return -EINVAL;
+ }
+
+ if (value != NULL) {
+ mCurrentInfo->addFeature(name, value);
+ } else {
+ mCurrentInfo->addFeature(name, (required == 1) || (optional == 0));
+ }
return OK;
}