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{ 302478d528186436f693b02c3534f04425086b638cMikhail Naganov for (const auto& port : *this) { 312478d528186436f693b02c3534f04425086b638cMikhail Naganov if (port->getTagName() == tagName) { 322478d528186436f693b02c3534f04425086b638cMikhail Naganov return port; 33cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie } 34cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie } 352478d528186436f693b02c3534f04425086b638cMikhail Naganov return nullptr; 36cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie} 37cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 38f4ad6e5637b6deccdac4b60615383f290b3806cfFrançois Gaffiestatus_t AudioRouteVector::dump(int fd, int spaces) const 39cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie{ 40f4ad6e5637b6deccdac4b60615383f290b3806cfFrançois Gaffie if (isEmpty()) { 41f4ad6e5637b6deccdac4b60615383f290b3806cfFrançois Gaffie return NO_ERROR; 42f4ad6e5637b6deccdac4b60615383f290b3806cfFrançois Gaffie } 43cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie const size_t SIZE = 256; 44cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie char buffer[SIZE]; 45cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 46f4ad6e5637b6deccdac4b60615383f290b3806cfFrançois Gaffie snprintf(buffer, SIZE, "\n%*sAudio Routes (%zu):\n", spaces, "", size()); 47cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie write(fd, buffer, strlen(buffer)); 48cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie for (size_t i = 0; i < size(); i++) { 49f4ad6e5637b6deccdac4b60615383f290b3806cfFrançois Gaffie snprintf(buffer, SIZE, "%*s- Route %zu:\n", spaces, "", i + 1); 50cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie write(fd, buffer, strlen(buffer)); 51cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie itemAt(i)->dump(fd, 4); 52cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie } 53cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie return NO_ERROR; 54cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie} 55cbb3044d6bfa9ab30c83b67874f40344e29805e1François Gaffie 561b2a794a27caab3a1320d22b872b04ef73e96555Mikhail Naganov} // namespace android 57