AudioRoute.cpp revision cbb3044d6bfa9ab30c83b67874f40344e29805e1
1cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie/* 2cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie * Copyright (C) 2015 The Android Open Source Project 3cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie * 4cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie * Licensed under the Apache License, Version 2.0 (the "License"); 5cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie * you may not use this file except in compliance with the License. 6cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie * You may obtain a copy of the License at 7cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie * 8cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie * http://www.apache.org/licenses/LICENSE-2.0 9cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie * 10cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie * Unless required by applicable law or agreed to in writing, software 11cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie * distributed under the License is distributed on an "AS IS" BASIS, 12cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie * See the License for the specific language governing permissions and 14cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie * limitations under the License. 15cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie */ 16cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 17cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie#define LOG_TAG "APM::AudioRoute" 18cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie//#define LOG_NDEBUG 0 19cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 20cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie#include "AudioRoute.h" 21cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie#include "HwModule.h" 22cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie#include "AudioGain.h" 23cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 24cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffienamespace android 25cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie{ 26cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 27cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffievoid AudioRoute::dump(int fd, int spaces) const 28cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie{ 29cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie const size_t SIZE = 256; 30cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie char buffer[SIZE]; 31cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie String8 result; 32cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 33cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie snprintf(buffer, SIZE, "%*s- Type: %s\n", spaces, "", mType == AUDIO_ROUTE_MUX ? "Mux" : "Mix"); 34cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie result.append(buffer); 35cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 36cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie snprintf(buffer, SIZE, "%*s- Sink: %s\n", spaces, "", mSink->getTagName().string()); 37cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie result.append(buffer); 38cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 39cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie if (mSources.size() != 0) { 40cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie snprintf(buffer, SIZE, "%*s- Sources: \n", spaces, ""); 41cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie result.append(buffer); 42cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie for (size_t i = 0; i < mSources.size(); i++) { 43cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie snprintf(buffer, SIZE, "%*s%s \n", spaces + 4, "", mSources[i]->getTagName().string()); 44cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie result.append(buffer); 45cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie } 46cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie } 47cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie result.append("\n"); 48cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 49cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie write(fd, result.string(), result.size()); 50cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie} 51cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 52cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie} 53