Bug 698328 - Add a new cubeb backend based on AudioTrack.cpp. r=kinetik
[gecko.git] / media / libcubeb / src / audiotrack_definitions.h
blobda3032d4084cf14db29e7875acdeae9dfd0db3c3
1 /*
2 * Copyright (C) 2008 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include <cubeb/cubeb-stdint.h>
20 * The following definitions are copied from the android sources. Only the
21 * relevant enum member and values needed are copied.
25 * From https://android.googlesource.com/platform/frameworks/base/+/android-2.2.3_r2.1/include/utils/Errors.h
27 typedef int32_t status_t;
30 * From https://android.googlesource.com/platform/frameworks/base/+/android-2.2.3_r2.1/include/media/AudioTrack.h
32 struct Buffer {
33 uint32_t flags;
34 int channelCount;
35 int format;
36 size_t frameCount;
37 size_t size;
38 union {
39 void* raw;
40 short* i16;
41 int8_t* i8;
45 enum event_type {
46 EVENT_MORE_DATA = 0,
47 EVENT_UNDERRUN = 1,
48 EVENT_LOOP_END = 2,
49 EVENT_MARKER = 3,
50 EVENT_NEW_POS = 4,
51 EVENT_BUFFER_END = 5
54 /**
55 * From https://android.googlesource.com/platform/frameworks/base/+/android-2.2.3_r2.1/include/media/AudioSystem.h
56 * and
57 * https://android.googlesource.com/platform/system/core/+/android-4.2.2_r1/include/system/audio.h
60 #define AUDIO_STREAM_TYPE_MUSIC 3
62 enum {
63 AUDIO_CHANNEL_OUT_FRONT_LEFT_ICS = 0x1,
64 AUDIO_CHANNEL_OUT_FRONT_RIGHT_ICS = 0x2,
65 AUDIO_CHANNEL_OUT_MONO_ICS = AUDIO_CHANNEL_OUT_FRONT_LEFT_ICS,
66 AUDIO_CHANNEL_OUT_STEREO_ICS = (AUDIO_CHANNEL_OUT_FRONT_LEFT_ICS | AUDIO_CHANNEL_OUT_FRONT_RIGHT_ICS)
67 } AudioTrack_ChannelMapping_ICS;
69 enum {
70 AUDIO_CHANNEL_OUT_FRONT_LEFT_Froyo = 0x4,
71 AUDIO_CHANNEL_OUT_FRONT_RIGHT_Froyo = 0x8,
72 AUDIO_CHANNEL_OUT_MONO_Froyo = AUDIO_CHANNEL_OUT_FRONT_LEFT_Froyo,
73 AUDIO_CHANNEL_OUT_STEREO_Froyo = (AUDIO_CHANNEL_OUT_FRONT_LEFT_Froyo | AUDIO_CHANNEL_OUT_FRONT_RIGHT_Froyo)
74 } AudioTrack_ChannelMapping_Froyo;
76 typedef enum {
77 AUDIO_FORMAT_PCM = 0x00000000,
78 AUDIO_FORMAT_PCM_SUB_16_BIT = 0x1,
79 AUDIO_FORMAT_PCM_16_BIT = (AUDIO_FORMAT_PCM | AUDIO_FORMAT_PCM_SUB_16_BIT),
80 } AudioTrack_SampleType;