android_defs.h revision b2aeb0f1009555181dabb944fe05901cb6e6f632
1/*
2 * Copyright (C) 2010 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
18/**
19 * Used to define the mapping from an OpenSL ES audio player to an Android
20 * media framework object
21 */
22enum AndroidObject_type {
23    INVALID_TYPE     =-1,
24    A_PLR_URIFD      = 0, // audio player, compressed data, URI or FD data source
25    A_PLR_PCM_BQ     = 1, // audio player, PCM, buffer queue data source
26    A_PLR_TS_ABQ     = 2, // audio player, transport stream, Android simple buffer queue data source
27    A_PLR_URIFD_ASQ  = 3, // audio player, URI or FD data source (as in android::MediaPlayer),
28                          //    decoded to a PCM Android simple buffer queue data sink
29    AV_PLR_TS_ABQ    = 4, // audio video player, transport stream, Android buffer queue data source
30    AV_PLR_URIFD     = 5, // audio video player, URI or FD data source (as in android::MediaPlayer)
31    A_RCR_MIC_ASQ    = 6, // audio recorder, device data source,
32                          //    streamed into a PCM Android simple buffer queue data sink
33    NUM_AUDIOPLAYER_MAP_TYPES
34};
35
36
37/**
38 * Used to define the states of the OpenSL ES / OpenMAX AL object initialization and preparation
39 * with regards to the Android-side of the data
40 */
41enum AndroidObject_state {
42    ANDROID_UNINITIALIZED = -1,
43    ANDROID_PREPARING,
44    ANDROID_READY,
45    NUM_ANDROID_STATES
46};
47
48
49#define ANDROID_DEFAULT_OUTPUT_STREAM_TYPE android::AudioSystem::MUSIC
50
51#define PLAYER_SUCCESS 1
52
53#define PLAYER_FD_FIND_FILE_SIZE ((int64_t)0xFFFFFFFFFFFFFFFFll)
54
55
56/*
57 * Structure to maintain the set of audio levels about a player
58 */
59typedef struct AndroidAudioLevels_struct {
60/** send level to aux effect, there's a single aux bus, so there's a single level */
61    SLmillibel mAuxSendLevel;
62    /**
63     * Amplification (can be attenuation) factor derived for the VolumeLevel
64     */
65    float mAmplFromVolLevel;
66    /**
67     * Left/right amplification (can be attenuations) factors derived for the StereoPosition
68     */
69    float mAmplFromStereoPos[STEREO_CHANNELS];
70    /**
71     * Attenuation factor derived from direct level
72     */
73    float mAmplFromDirectLevel;
74} AndroidAudioLevels;
75
76
77typedef void (*notif_client_t)(int event, const int data1, void* notifUser);
78
79
80/**
81 * events sent to mNotifyClient during prepare, prefetch, and playback
82 */
83#define PLAYEREVENT_PREPARED                "prep"
84#define PLAYEREVENT_PREFETCHSTATUSCHANGE    "prsc"
85#define PLAYEREVENT_PREFETCHFILLLEVELUPDATE "pflu"
86#define PLAYEREVENT_ENDOFSTREAM             "eos"
87#define PLAYEREVENT_NEW_AUDIOTRACK          "nwat"
88
89
90namespace android {
91
92enum {
93    kDataLocatorNone = 'none',
94    kDataLocatorUri  = 'uri',
95    kDataLocatorFd   = 'fd',
96    };
97
98struct FdInfo {
99    int fd;
100    int64_t offset;
101    int64_t length;
102};
103
104union DataLocator {
105    char* uri;
106    FdInfo fdi;
107};
108
109} // namespace android
110