• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
26 namespace android {
27 
findByTagName(const String8 & tagName) const28 sp<AudioPort> AudioPortVector::findByTagName(const String8 &tagName) const
29 {
30     for (const auto& port : *this) {
31         if (port->getTagName() == tagName) {
32             return port;
33         }
34     }
35     return nullptr;
36 }
37 
dump(String8 * dst,int spaces) const38 void AudioRouteVector::dump(String8 *dst, int spaces) const
39 {
40     if (isEmpty()) {
41         return;
42     }
43     dst->appendFormat("\n%*sAudio Routes (%zu):\n", spaces, "", size());
44     for (size_t i = 0; i < size(); i++) {
45         dst->appendFormat("%*s- Route %zu:\n", spaces, "", i + 1);
46         itemAt(i)->dump(dst, 4);
47     }
48 }
49 
50 } // namespace android
51