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::AudioRoute"
18//#define LOG_NDEBUG 0
19
20#include "AudioRoute.h"
21#include "HwModule.h"
22#include "AudioGain.h"
23
24namespace android
25{
26
27void AudioRoute::dump(int fd, int spaces) const
28{
29    const size_t SIZE = 256;
30    char buffer[SIZE];
31    String8 result;
32
33    snprintf(buffer, SIZE, "%*s- Type: %s\n", spaces, "", mType == AUDIO_ROUTE_MUX ? "Mux" : "Mix");
34    result.append(buffer);
35
36    snprintf(buffer, SIZE, "%*s- Sink: %s\n", spaces, "", mSink->getTagName().string());
37    result.append(buffer);
38
39    if (mSources.size() != 0) {
40        snprintf(buffer, SIZE, "%*s- Sources: \n", spaces, "");
41        result.append(buffer);
42        for (size_t i = 0; i < mSources.size(); i++) {
43            snprintf(buffer, SIZE, "%*s%s \n", spaces + 4, "", mSources[i]->getTagName().string());
44            result.append(buffer);
45        }
46    }
47    result.append("\n");
48
49    write(fd, result.string(), result.size());
50}
51
52}
53