1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libcubeb/src/android/audiotrack_definitions.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,81 @@ 1.4 +/* 1.5 + * Copyright (C) 2008 The Android Open Source Project 1.6 + * 1.7 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.8 + * you may not use this file except in compliance with the License. 1.9 + * You may obtain a copy of the License at 1.10 + * 1.11 + * http://www.apache.org/licenses/LICENSE-2.0 1.12 + * 1.13 + * Unless required by applicable law or agreed to in writing, software 1.14 + * distributed under the License is distributed on an "AS IS" BASIS, 1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.16 + * See the License for the specific language governing permissions and 1.17 + * limitations under the License. 1.18 + */ 1.19 + 1.20 +#include <cubeb/cubeb-stdint.h> 1.21 + 1.22 +/* 1.23 + * The following definitions are copied from the android sources. Only the 1.24 + * relevant enum member and values needed are copied. 1.25 + */ 1.26 + 1.27 +/* 1.28 + * From https://android.googlesource.com/platform/frameworks/base/+/android-2.2.3_r2.1/include/utils/Errors.h 1.29 + */ 1.30 +typedef int32_t status_t; 1.31 + 1.32 +/* 1.33 + * From https://android.googlesource.com/platform/frameworks/base/+/android-2.2.3_r2.1/include/media/AudioTrack.h 1.34 + */ 1.35 +struct Buffer { 1.36 + uint32_t flags; 1.37 + int channelCount; 1.38 + int format; 1.39 + size_t frameCount; 1.40 + size_t size; 1.41 + union { 1.42 + void* raw; 1.43 + short* i16; 1.44 + int8_t* i8; 1.45 + }; 1.46 +}; 1.47 + 1.48 +enum event_type { 1.49 + EVENT_MORE_DATA = 0, 1.50 + EVENT_UNDERRUN = 1, 1.51 + EVENT_LOOP_END = 2, 1.52 + EVENT_MARKER = 3, 1.53 + EVENT_NEW_POS = 4, 1.54 + EVENT_BUFFER_END = 5 1.55 +}; 1.56 + 1.57 +/** 1.58 + * From https://android.googlesource.com/platform/frameworks/base/+/android-2.2.3_r2.1/include/media/AudioSystem.h 1.59 + * and 1.60 + * https://android.googlesource.com/platform/system/core/+/android-4.2.2_r1/include/system/audio.h 1.61 + */ 1.62 + 1.63 +#define AUDIO_STREAM_TYPE_MUSIC 3 1.64 + 1.65 +enum { 1.66 + AUDIO_CHANNEL_OUT_FRONT_LEFT_ICS = 0x1, 1.67 + AUDIO_CHANNEL_OUT_FRONT_RIGHT_ICS = 0x2, 1.68 + AUDIO_CHANNEL_OUT_MONO_ICS = AUDIO_CHANNEL_OUT_FRONT_LEFT_ICS, 1.69 + AUDIO_CHANNEL_OUT_STEREO_ICS = (AUDIO_CHANNEL_OUT_FRONT_LEFT_ICS | AUDIO_CHANNEL_OUT_FRONT_RIGHT_ICS) 1.70 +} AudioTrack_ChannelMapping_ICS; 1.71 + 1.72 +enum { 1.73 + AUDIO_CHANNEL_OUT_FRONT_LEFT_Legacy = 0x4, 1.74 + AUDIO_CHANNEL_OUT_FRONT_RIGHT_Legacy = 0x8, 1.75 + AUDIO_CHANNEL_OUT_MONO_Legacy = AUDIO_CHANNEL_OUT_FRONT_LEFT_Legacy, 1.76 + AUDIO_CHANNEL_OUT_STEREO_Legacy = (AUDIO_CHANNEL_OUT_FRONT_LEFT_Legacy | AUDIO_CHANNEL_OUT_FRONT_RIGHT_Legacy) 1.77 +} AudioTrack_ChannelMapping_Legacy; 1.78 + 1.79 +typedef enum { 1.80 + AUDIO_FORMAT_PCM = 0x00000000, 1.81 + AUDIO_FORMAT_PCM_SUB_16_BIT = 0x1, 1.82 + AUDIO_FORMAT_PCM_16_BIT = (AUDIO_FORMAT_PCM | AUDIO_FORMAT_PCM_SUB_16_BIT), 1.83 +} AudioTrack_SampleType; 1.84 +