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::AudioSourceDescriptor"
18//#define LOG_NDEBUG 0
19
20#include <utils/Log.h>
21#include <utils/String8.h>
22#include <media/AudioPolicyHelper.h>
23#include <HwModule.h>
24#include <AudioGain.h>
25#include <AudioSourceDescriptor.h>
26#include <DeviceDescriptor.h>
27#include <IOProfile.h>
28#include <AudioOutputDescriptor.h>
29
30namespace android {
31
32status_t AudioSourceDescriptor::dump(int fd)
33{
34    const size_t SIZE = 256;
35    char buffer[SIZE];
36    String8 result;
37
38    snprintf(buffer, SIZE, "mStream: %d\n", audio_attributes_to_stream_type(&mAttributes));
39    result.append(buffer);
40    snprintf(buffer, SIZE, "mDevice:\n");
41    result.append(buffer);
42    write(fd, result.string(), result.size());
43    mDevice->dump(fd, 2 , 0);
44    return NO_ERROR;
45}
46
47
48status_t AudioSourceCollection::dump(int fd) const
49{
50    const size_t SIZE = 256;
51    char buffer[SIZE];
52
53    snprintf(buffer, SIZE, "\nAudio sources dump:\n");
54    write(fd, buffer, strlen(buffer));
55    for (size_t i = 0; i < size(); i++) {
56        snprintf(buffer, SIZE, "- Source %d dump:\n", keyAt(i));
57        write(fd, buffer, strlen(buffer));
58        valueAt(i)->dump(fd);
59    }
60
61    return NO_ERROR;
62}
63
64}; //namespace android
65