status_t initializeCapabilities(const CodecCapabilities &caps);
void addDetail(const AString &key, const AString &value);
void addFeature(const AString &key, int32_t value);
+ void addFeature(const AString &key, const char *value);
void removeMime(const char *mime);
void complete();
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
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) {
required = value;
}
++i;
+ } else if (!strcmp(attrs[i], "value")) {
+ value = attrs[i + 1];
+ ++i;
} else {
return -EINVAL;
}
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;
}