Home | History | Annotate | Download | only in 2.0
      1 /*
      2  * Copyright (C) 2016 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 package android.hardware.audio@2.0;
     18 
     19 import android.hardware.audio.common@2.0;
     20 
     21 enum Result : int32_t {
     22     OK,
     23     NOT_INITIALIZED,
     24     INVALID_ARGUMENTS,
     25     INVALID_STATE,
     26     NOT_SUPPORTED
     27 };
     28 
     29 @export(name="audio_drain_type_t", value_prefix="AUDIO_DRAIN_")
     30 enum AudioDrain : int32_t {
     31     /** drain() returns when all data has been played. */
     32     ALL,
     33     /**
     34      * drain() returns a short time before all data from the current track has
     35      * been played to give time for gapless track switch.
     36      */
     37     EARLY_NOTIFY
     38 };
     39 
     40 /**
     41  * A substitute for POSIX timespec.
     42  */
     43 struct TimeSpec {
     44     uint64_t tvSec;   // seconds
     45     uint64_t tvNSec;  // nanoseconds
     46 };
     47 
     48 /**
     49  * IEEE 802 MAC address.
     50  */
     51 typedef uint8_t[6] MacAddress;
     52 
     53 struct ParameterValue {
     54     string key;
     55     string value;
     56 };
     57 
     58 /**
     59  * Specifies a device in case when several devices of the same type
     60  * can be connected (e.g. BT A2DP, USB).
     61  */
     62 struct DeviceAddress {
     63     AudioDevice device;  // discriminator
     64     union Address {
     65         MacAddress mac;     // used for BLUETOOTH_A2DP_*
     66         uint8_t[4] ipv4;    // used for IP
     67         struct Alsa {
     68             int32_t card;
     69             int32_t device;
     70         } alsa;             // used for USB_*
     71     } address;
     72     string busAddress;      // used for BUS
     73     string rSubmixAddress;  // used for REMOTE_SUBMIX
     74 };
     75 
     76 /**
     77  * Mmap buffer descriptor returned by IStream.createMmapBuffer().
     78  * Used by streams opened in mmap mode.
     79  */
     80 struct MmapBufferInfo {
     81     memory  sharedMemory;         // mmap memory buffer
     82     int32_t bufferSizeFrames;     // total buffer size in frames
     83     int32_t burstSizeFrames;      // transfer size granularity in frames
     84 };
     85 
     86 /**
     87  * Mmap buffer read/write position returned by IStream.getMmapPosition().
     88  * Used by streams opened in mmap mode.
     89  */
     90 struct MmapPosition {
     91     int64_t  timeNanoseconds; // time stamp in ns, CLOCK_MONOTONIC
     92     int32_t  positionFrames;  // increasing 32 bit frame count reset when IStream.stop() is called
     93 };
     94 
     95 /**
     96  * The message queue flags used to synchronize reads and writes from
     97  * message queues used by StreamIn and StreamOut.
     98  */
     99 enum MessageQueueFlagBits : uint32_t {
    100     NOT_EMPTY = 1 << 0,
    101     NOT_FULL = 1 << 1
    102 };
    103