OpenMAXBellagio 0.9.3
OMX_ContentPipe.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008 The Khronos Group Inc. 
00003  * 
00004  * Permission is hereby granted, free of charge, to any person obtaining
00005  * a copy of this software and associated documentation files (the
00006  * "Software"), to deal in the Software without restriction, including
00007  * without limitation the rights to use, copy, modify, merge, publish,
00008  * distribute, sublicense, and/or sell copies of the Software, and to
00009  * permit persons to whom the Software is furnished to do so, subject
00010  * to the following conditions: 
00011  * The above copyright notice and this permission notice shall be included
00012  * in all copies or substantial portions of the Software. 
00013  * 
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00016  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00017  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00018  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00019  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00020  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
00021  *
00022  */
00023 
00030 #ifndef OMX_CONTENTPIPE_H
00031 #define OMX_CONTENTPIPE_H
00032 
00033 #ifndef KD_EACCES
00034 /* OpenKODE error codes. CPResult values may be zero (indicating success
00035    or one of the following values) */
00036 #define KD_EACCES (1)
00037 #define KD_EADDRINUSE (2)
00038 #define KD_EAGAIN (5)
00039 #define KD_EBADF (7)
00040 #define KD_EBUSY (8)
00041 #define KD_ECONNREFUSED (9)
00042 #define KD_ECONNRESET (10)
00043 #define KD_EDEADLK (11)
00044 #define KD_EDESTADDRREQ (12)
00045 #define KD_ERANGE (35)
00046 #define KD_EEXIST (13)
00047 #define KD_EFBIG (14)
00048 #define KD_EHOSTUNREACH (15)
00049 #define KD_EINVAL (17)
00050 #define KD_EIO (18)
00051 #define KD_EISCONN (20)
00052 #define KD_EISDIR (21)
00053 #define KD_EMFILE (22)
00054 #define KD_ENAMETOOLONG (23)
00055 #define KD_ENOENT (24)
00056 #define KD_ENOMEM (25)
00057 #define KD_ENOSPC (26)
00058 #define KD_ENOSYS (27)
00059 #define KD_ENOTCONN (28)
00060 #define KD_EPERM (33)
00061 #define KD_ETIMEDOUT (36)
00062 #define KD_EILSEQ (19)
00063 #endif
00064 
00066 typedef OMX_U32    CPresult;
00067 typedef char *     CPstring;  
00068 typedef void *     CPhandle;
00069 typedef OMX_U32    CPuint;
00070 typedef OMX_S32    CPint;  
00071 typedef char       CPbyte;  
00072 typedef OMX_BOOL   CPbool;
00073 
00077 typedef enum CP_ORIGINTYPE {
00078     CP_OriginBegin,      
00079     CP_OriginCur,      
00080     CP_OriginEnd,      
00081     CP_OriginKhronosExtensions = 0x6F000000, 
00082     CP_OriginVendorStartUnused = 0x7F000000, 
00083     CP_OriginMax = 0X7FFFFFFF
00084 } CP_ORIGINTYPE;
00085 
00089 typedef enum CP_ACCESSTYPE {
00090     CP_AccessRead,      
00091     CP_AccessWrite,  
00092     CP_AccessReadWrite ,  
00093     CP_AccessKhronosExtensions = 0x6F000000, 
00094     CP_AccessVendorStartUnused = 0x7F000000, 
00095     CP_AccessMax = 0X7FFFFFFF
00096 } CP_ACCESSTYPE;
00097 
00101 typedef enum CP_CHECKBYTESRESULTTYPE
00102 {
00103     CP_CheckBytesOk,                    
00105     CP_CheckBytesNotReady,              
00109     CP_CheckBytesInsufficientBytes  ,     
00112     CP_CheckBytesAtEndOfStream,         
00114     CP_CheckBytesOutOfBuffers,          
00115     CP_CheckBytesKhronosExtensions = 0x6F000000, 
00116     CP_CheckBytesVendorStartUnused = 0x7F000000, 
00117     CP_CheckBytesMax = 0X7FFFFFFF
00118 } CP_CHECKBYTESRESULTTYPE;
00119 
00123 typedef enum CP_EVENTTYPE{
00124     CP_BytesAvailable,              
00125     CP_Overflow,                   
00126     CP_PipeDisconnected  ,              
00127     CP_EventKhronosExtensions = 0x6F000000, 
00128     CP_EventVendorStartUnused = 0x7F000000, 
00129     CP_EventMax = 0X7FFFFFFF
00130 } CP_EVENTTYPE;
00131 
00135 typedef struct CP_PIPETYPE
00136 {
00138     CPresult (*Open)( CPhandle* hContent, CPstring szURI, CP_ACCESSTYPE eAccess );
00139 
00141     CPresult (*Close)( CPhandle hContent );
00142 
00144     CPresult (*Create)( CPhandle *hContent, CPstring szURI );
00145 
00147     CPresult (*CheckAvailableBytes)( CPhandle hContent, CPuint nBytesRequested, CP_CHECKBYTESRESULTTYPE *eResult );
00148 
00150     CPresult (*SetPosition)( CPhandle  hContent, CPint nOffset, CP_ORIGINTYPE eOrigin);
00151 
00153     CPresult (*GetPosition)( CPhandle hContent, CPuint *pPosition);
00154 
00157     CPresult (*Read)( CPhandle hContent, CPbyte *pData, CPuint nSize); 
00158 
00171     CPresult (*ReadBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint *nSize, CPbool bForbidCopy);
00172 
00174     CPresult (*ReleaseReadBuffer)(CPhandle hContent, CPbyte *pBuffer);
00175 
00178     CPresult (*Write)( CPhandle hContent, CPbyte *data, CPuint nSize); 
00179 
00183     CPresult (*GetWriteBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint nSize);
00184 
00187     CPresult (*WriteBuffer)( CPhandle hContent, CPbyte *pBuffer, CPuint nFilledSize);
00188 
00190     CPresult (*RegisterCallback)( CPhandle hContent, CPresult (*ClientCallback)(CP_EVENTTYPE eEvent, CPuint iParam));
00191 
00192 } CP_PIPETYPE;
00193 
00194 #endif
00195