Better tuning hooks for mediaformatshaper
more appropriate "<Tuning .../>" in Codec XML to indicate parameters.
enhance per-mediatype default configurations.
Bug: 183211971
Test: logcat examination
Test: atest XMLParserTest
Change-Id: Ieb04ef7b0322fe8a9029b9023dabdd93959e17a2
diff --git a/media/libmediaformatshaper/FormatShaper.cpp b/media/libmediaformatshaper/FormatShaper.cpp
index a52edc2..42502e0 100644
--- a/media/libmediaformatshaper/FormatShaper.cpp
+++ b/media/libmediaformatshaper/FormatShaper.cpp
@@ -99,6 +99,23 @@
     return 0;
 }
 
+int setTuning(shaperHandle_t shaper, const char *tuning, const char *value) {
+    ALOGV("setTuning: tuning %s value %s", tuning, value);
+    CodecProperties *codec = (CodecProperties*) shaper;
+    if (codec == nullptr) {
+        return -1;
+    }
+    // must not yet be registered
+    if (codec->isRegistered()) {
+        return -1;
+    }
+
+    // save a map of all features
+    codec->setTuningValue(tuning, value);
+
+    return 0;
+}
+
 /*
  * The routines that manage finding, creating, and registering the shapers.
  */
@@ -176,6 +193,8 @@
     .shapeFormat = shapeFormat,
     .getMappings = getMappings,
     .getReverseMappings = getReverseMappings,
+
+    .setTuning = setTuning,
 };
 
 }  // namespace mediaformatshaper