AudioCollections.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::AudioCollections" 18cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie//#define LOG_NDEBUG 0 19cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 20cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie#include "AudioCollections.h" 21cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie#include "AudioPort.h" 22cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie#include "AudioRoute.h" 23cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie#include "HwModule.h" 24cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie#include "AudioGain.h" 25cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 26cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffienamespace android { 27cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 28cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffiesp<AudioPort> AudioPortVector::findByTagName(const String8 &tagName) const 29cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie{ 30cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie sp<AudioPort> port = 0; 31cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie for (size_t i = 0; i < size(); i++) { 32cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie if (itemAt(i)->getTagName() == tagName) { 33cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie port = itemAt(i); 34cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie break; 35cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie } 36cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie } 37cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie return port; 38cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie} 39cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 40cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffiestatus_t AudioRouteVector::dump(int fd) const 41cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie{ 42cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie const size_t SIZE = 256; 43cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie char buffer[SIZE]; 44cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 45cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie snprintf(buffer, SIZE, "\nAudio Route dump (%d):\n", size()); 46cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie write(fd, buffer, strlen(buffer)); 47cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie for (size_t i = 0; i < size(); i++) { 48cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie snprintf(buffer, SIZE, "- Route %zu:\n", i + 1); 49cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie write(fd, buffer, strlen(buffer)); 50cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie itemAt(i)->dump(fd, 4); 51cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie } 52cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie return NO_ERROR; 53cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie} 54cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 55cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie}; // namespace android 56