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 40f4ad6e5637b6deccdac4b60615383f290b3806cfFrançois Gaffiestatus_t AudioRouteVector::dump(int fd, int spaces) const 41cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie{ 42f4ad6e5637b6deccdac4b60615383f290b3806cfFrançois Gaffie if (isEmpty()) { 43f4ad6e5637b6deccdac4b60615383f290b3806cfFrançois Gaffie return NO_ERROR; 44f4ad6e5637b6deccdac4b60615383f290b3806cfFrançois Gaffie } 45cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie const size_t SIZE = 256; 46cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie char buffer[SIZE]; 47cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 48f4ad6e5637b6deccdac4b60615383f290b3806cfFrançois Gaffie snprintf(buffer, SIZE, "\n%*sAudio Routes (%zu):\n", spaces, "", size()); 49cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie write(fd, buffer, strlen(buffer)); 50cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie for (size_t i = 0; i < size(); i++) { 51f4ad6e5637b6deccdac4b60615383f290b3806cfFrançois Gaffie snprintf(buffer, SIZE, "%*s- Route %zu:\n", spaces, "", i + 1); 52cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie write(fd, buffer, strlen(buffer)); 53cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie itemAt(i)->dump(fd, 4); 54cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie } 55cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie return NO_ERROR; 56cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie} 57cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 58cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie}; // namespace android 59