1f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent/*
256ec4ffcbae8aeac6c5245fc7b825d02e2e6cefdJean-Michel Trivi * Copyright (C) 2015 The Android Open Source Project
3f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent *
4f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent * Licensed under the Apache License, Version 2.0 (the "License");
5f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent * you may not use this file except in compliance with the License.
6f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent * You may obtain a copy of the License at
7f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent *
8f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent *      http://www.apache.org/licenses/LICENSE-2.0
9f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent *
10f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent * Unless required by applicable law or agreed to in writing, software
11f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent * distributed under the License is distributed on an "AS IS" BASIS,
12f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent * See the License for the specific language governing permissions and
14f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent * limitations under the License.
15f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent */
16f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent
17ad3183e2d4cecd02f6261270a7ea1c68be0efa0fFrançois Gaffie#pragma once
18ad3183e2d4cecd02f6261270a7ea1c68be0efa0fFrançois Gaffie
1998cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffie#include <system/audio.h>
2053615e29c99c5e9d2ca77aaefd7bf5c770513120François Gaffie#include <utils/Errors.h>
2198cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffie#include <utils/RefBase.h>
2298cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffie#include <utils/Errors.h>
2353615e29c99c5e9d2ca77aaefd7bf5c770513120François Gaffie#include <utils/KeyedVector.h>
2498cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffie
25f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurentnamespace android {
26f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent
2798cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffieclass AudioPatch : public RefBase
2898cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffie{
2998cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffiepublic:
3098cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffie    AudioPatch(const struct audio_patch *patch, uid_t uid);
3198cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffie
3298cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffie    status_t dump(int fd, int spaces, int index) const;
3398cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffie
3498cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffie    audio_patch_handle_t mHandle;
3598cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffie    struct audio_patch mPatch;
3698cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffie    uid_t mUid;
3798cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffie    audio_patch_handle_t mAfPatchHandle;
3898cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffie
3998cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffieprivate:
4098cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffie    static volatile int32_t mNextUniqueId;
4156ec4ffcbae8aeac6c5245fc7b825d02e2e6cefdJean-Michel Trivi};
42f269b8e0e9ab950fc6652b9594b7a3431c81630cEric Laurent
4353615e29c99c5e9d2ca77aaefd7bf5c770513120François Gaffieclass AudioPatchCollection : public DefaultKeyedVector<audio_patch_handle_t, sp<AudioPatch> >
4453615e29c99c5e9d2ca77aaefd7bf5c770513120François Gaffie{
4553615e29c99c5e9d2ca77aaefd7bf5c770513120François Gaffiepublic:
4653615e29c99c5e9d2ca77aaefd7bf5c770513120François Gaffie    status_t addAudioPatch(audio_patch_handle_t handle, const sp<AudioPatch>& patch);
4753615e29c99c5e9d2ca77aaefd7bf5c770513120François Gaffie
4853615e29c99c5e9d2ca77aaefd7bf5c770513120François Gaffie    status_t removeAudioPatch(audio_patch_handle_t handle);
4953615e29c99c5e9d2ca77aaefd7bf5c770513120François Gaffie
5053615e29c99c5e9d2ca77aaefd7bf5c770513120François Gaffie    status_t listAudioPatches(unsigned int *num_patches, struct audio_patch *patches) const;
5153615e29c99c5e9d2ca77aaefd7bf5c770513120François Gaffie
5253615e29c99c5e9d2ca77aaefd7bf5c770513120François Gaffie    status_t dump(int fd) const;
5353615e29c99c5e9d2ca77aaefd7bf5c770513120François Gaffie};
5453615e29c99c5e9d2ca77aaefd7bf5c770513120François Gaffie
5598cc191247388132b6fd8a4ecd07abd6e4c5a0edFrançois Gaffie}; // namespace android
56