Home | History | Annotate | Download | only in include
      1 /*
      2  * Copyright (C) 2015 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #pragma once
     18 
     19 #include "AudioPolicyConfig.h"
     20 #include "DeviceDescriptor.h"
     21 #include "HwModule.h"
     22 #include "audio_policy_conf.h"
     23 #include <system/audio.h>
     24 #include <utils/Log.h>
     25 #include <utils/Vector.h>
     26 #include <utils/SortedVector.h>
     27 #include <cutils/config_utils.h>
     28 #include <utils/RefBase.h>
     29 #include <system/audio_policy.h>
     30 
     31 namespace android {
     32 
     33 // ----------------------------------------------------------------------------
     34 // Definitions for audio_policy.conf file parsing
     35 // ----------------------------------------------------------------------------
     36 
     37 class ConfigParsingUtils
     38 {
     39 public:
     40     static status_t loadConfig(const char *path, AudioPolicyConfig &config);
     41 
     42 private:
     43     static void loadAudioPortGain(cnode *root, AudioPort &audioPort, int index);
     44     static void loadAudioPortGains(cnode *root, AudioPort &audioPort);
     45     static void loadDeviceDescriptorGains(cnode *root, sp<DeviceDescriptor> &deviceDesc);
     46     static status_t loadHwModuleDevice(cnode *root, DeviceVector &devices);
     47     static status_t loadHwModuleProfile(cnode *root, sp<HwModule> &module, audio_port_role_t role);
     48     static void loadDevicesFromTag(const char *tag, DeviceVector &devices,
     49                             const DeviceVector &declaredDevices);
     50     static void loadHwModules(cnode *root, HwModuleCollection &hwModules,
     51                               AudioPolicyConfig &config);
     52     static void loadGlobalConfig(cnode *root, AudioPolicyConfig &config,
     53                                  const sp<HwModule> &primaryModule);
     54     static void loadModuleGlobalConfig(cnode *root, const sp<HwModule> &module,
     55                                        AudioPolicyConfig &config);
     56     static status_t loadHwModule(cnode *root, sp<HwModule> &module, AudioPolicyConfig &config);
     57 };
     58 
     59 } // namespace android
     60