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