data.h revision d158d31a6bbb06426b71c3d097b7768bc3fb79a3
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/* Our own merged version of SLDataSource and SLDataSink */ 18 19typedef union { 20 SLuint32 mLocatorType; 21 SLDataLocator_Address mAddress; 22 SLDataLocator_BufferQueue mBufferQueue; 23 SLDataLocator_IODevice mIODevice; 24 SLDataLocator_MIDIBufferQueue mMIDIBufferQueue; 25 SLDataLocator_OutputMix mOutputMix; 26 SLDataLocator_URI mURI; 27 XADataLocator_NativeDisplay mNativeDisplay; 28#ifdef ANDROID 29 SLDataLocator_AndroidFD mFD; 30 SLDataLocator_AndroidBufferQueue mABQ; 31#endif 32} DataLocator; 33 34typedef union { 35 SLuint32 mFormatType; 36 SLDataFormat_PCM mPCM; 37 SLDataFormat_MIME mMIME; 38 XADataFormat_RawImage mRawImage; 39} DataFormat; 40 41typedef struct { 42 union { 43 SLDataSource mSource; 44 SLDataSink mSink; 45 struct { 46 DataLocator *pLocator; 47 DataFormat *pFormat; 48 } mNeutral; 49 } u; 50 DataLocator mLocator; 51 DataFormat mFormat; 52} DataLocatorFormat; 53 54#define SL_DATALOCATOR_NULL 0 // application specified a NULL value for pLocator 55#define XA_DATALOCATOR_NULL SL_DATALOCATOR_NULL 56#define SL_DATAFORMAT_NULL 0 // application specified a NULL or undefined value for pFormat 57#define XA_DATAFORMAT_NULL SL_DATAFORMAT_NULL 58 59// bit masks used to configure the allowed data locators for a given data source or data sink 60#define DATALOCATOR_MASK_NONE 0L 61#define DATALOCATOR_MASK_NULL (1L << SL_DATALOCATOR_NULL) 62#define DATALOCATOR_MASK_URI (1L << SL_DATALOCATOR_URI) 63#define DATALOCATOR_MASK_ADDRESS (1L << SL_DATALOCATOR_ADDRESS) 64#define DATALOCATOR_MASK_IODEVICE (1L << SL_DATALOCATOR_IODEVICE) 65#define DATALOCATOR_MASK_OUTPUTMIX (1L << SL_DATALOCATOR_OUTPUTMIX) 66#define DATALOCATOR_MASK_NATIVEDISPLAY (1L << XA_DATALOCATOR_NATIVEDISPLAY) 67#define DATALOCATOR_MASK_BUFFERQUEUE (1L << SL_DATALOCATOR_BUFFERQUEUE) 68#define DATALOCATOR_MASK_MIDIBUFFERQUEUE (1L << SL_DATALOCATOR_MIDIBUFFERQUEUE) 69#define DATALOCATOR_MASK_ANDROIDFD \ 70 (0x100L << (SL_DATALOCATOR_ANDROIDFD - SL_DATALOCATOR_ANDROIDFD)) 71#define DATALOCATOR_MASK_ANDROIDSIMPLEBUFFERQUEUE \ 72 (0x100L << (SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE - SL_DATALOCATOR_ANDROIDFD)) 73#define DATALOCATOR_MASK_ANDROIDBUFFERQUEUE \ 74 (0x100L << (SL_DATALOCATOR_ANDROIDBUFFERQUEUE - SL_DATALOCATOR_ANDROIDFD)) 75#define DATALOCATOR_MASK_ALL 0x7FFL 76 77// bit masks used to configure the allowed data formats for a given data source or data sink 78#define DATAFORMAT_MASK_NONE 0L 79#define DATAFORMAT_MASK_NULL (1L << SL_DATAFORMAT_NULL) 80#define DATAFORMAT_MASK_MIME (1L << SL_DATAFORMAT_MIME) 81#define DATAFORMAT_MASK_PCM (1L << SL_DATAFORMAT_PCM) 82#define DATAFORMAT_MASK_RAWIMAGE (1L << XA_DATAFORMAT_RAWIMAGE) 83#define DATAFORMAT_MASK_ALL 0xFL 84 85extern SLresult checkDataSource(const char *name, const SLDataSource *pDataSrc, 86 DataLocatorFormat *myDataSourceLocator, SLuint32 allowedDataLocatorMask, 87 SLuint32 allowedDataFormatMask); 88extern SLresult checkDataSink(const char *name, const SLDataSink *pDataSink, 89 DataLocatorFormat *myDataSinkLocator, SLuint32 allowedDataLocatorMask, 90 SLuint32 allowedDataFormatMask); 91extern SLresult checkSourceFormatVsInterfacesCompatibility( 92 const DataLocatorFormat *pDataLocatorFormat, const ClassTable *clazz, 93 unsigned exposedMask); 94extern void freeDataLocatorFormat(DataLocatorFormat *dlf); 95 96 97/* For stream information storage */ 98typedef struct { 99 XAuint32 domain; 100 union { 101 XAMediaContainerInformation containerInfo; 102 XAVideoStreamInformation videoInfo; 103 XAAudioStreamInformation audioInfo; 104 XAImageStreamInformation imageInfo; 105 XATimedTextStreamInformation textInfo; 106 XAMIDIStreamInformation midiInfo; 107 }; 108} StreamInfo; 109