summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MediaCodecList.cpp
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2014-08-14 19:54:08 -0700
committerLajos Molnar <lajos@google.com>2014-08-14 19:56:58 -0700
commit732c6d955524ead6c31e6e1bafbd41ea4cee525d (patch)
tree512bb207b9013da6f9c728f77a3070a7a5b99638 /media/libstagefright/MediaCodecList.cpp
parent261562316c1b652ea697c99c0f24a54112bd0385 (diff)
downloadframeworks_av-732c6d955524ead6c31e6e1bafbd41ea4cee525d.zip
frameworks_av-732c6d955524ead6c31e6e1bafbd41ea4cee525d.tar.gz
frameworks_av-732c6d955524ead6c31e6e1bafbd41ea4cee525d.tar.bz2
stagefright/media: add support for codec features with text value
Bug: 11990470 Change-Id: I7600d999c5f4b6821d825d25fa7e8a2bb5a80c46
Diffstat (limited to 'media/libstagefright/MediaCodecList.cpp')
-rw-r--r--media/libstagefright/MediaCodecList.cpp15
1 files changed, 14 insertions, 1 deletions
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;
}