media/libcubeb/src/audiotrack_definitions.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /*
     2  * Copyright (C) 2008 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  */
    17 #include <cubeb/cubeb-stdint.h>
    19 /*
    20  * The following definitions are copied from the android sources. Only the
    21  * relevant enum member and values needed are copied.
    22  */
    24 /*
    25  * From https://android.googlesource.com/platform/frameworks/base/+/android-2.2.3_r2.1/include/utils/Errors.h
    26  */
    27 typedef int32_t status_t;
    29 /*
    30  * From https://android.googlesource.com/platform/frameworks/base/+/android-2.2.3_r2.1/include/media/AudioTrack.h
    31  */
    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;
    42   };
    43 };
    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
    52 };
    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
    58  */
    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;

mercurial