00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #define OMX_INIT_COMMON(a) \
00028 (a).nSize = sizeof(a); \
00029 (a).nVersion.s.nVersionMajor = 1; \
00030 (a).nVersion.s.nVersionMinor = 1; \
00031 (a).nVersion.s.nRevision = 1; \
00032 (a).nVersion.s.nStep = 0
00033
00034 #define OMX_INIT_STRUCTURE(a) \
00035 memset(&(a), 0, sizeof(a)); \
00036 OMX_INIT_COMMON(a)
00037
00038 #define OMX_ComponentRoleEnum(hComponent, cRole, nIndex) \
00039 ((OMX_COMPONENTTYPE*)hComponent)->ComponentRoleEnum ? \
00040 ((OMX_COMPONENTTYPE*)hComponent)->ComponentRoleEnum( \
00041 hComponent, cRole, nIndex ) : OMX_ErrorNotImplemented
00042
00043 #define CHECK_ERROR(a, ...) \
00044 if(a != OMX_ErrorNone) {msg_Dbg( p_dec, __VA_ARGS__ ); goto error;}
00045
00046
00047
00048
00049 #define OMX_FIFO_PEEK(p_fifo, p_buffer) \
00050 p_buffer = (p_fifo)->p_first;
00051
00052 #define OMX_FIFO_GET(p_fifo, p_buffer) \
00053 do { vlc_mutex_lock( &(p_fifo)->lock ); \
00054 while( !(p_fifo)->p_first ) \
00055 vlc_cond_wait( &(p_fifo)->wait, &(p_fifo)->lock ); \
00056 p_buffer = (p_fifo)->p_first; \
00057 OMX_BUFFERHEADERTYPE **pp_next = (OMX_BUFFERHEADERTYPE **) \
00058 ((void **)p_buffer + (p_fifo)->offset); \
00059 (p_fifo)->p_first = *pp_next; *pp_next = 0; \
00060 if( !(p_fifo)->p_first ) (p_fifo)->pp_last = &(p_fifo)->p_first; \
00061 vlc_mutex_unlock( &(p_fifo)->lock ); } while(0)
00062
00063 #define OMX_FIFO_PUT(p_fifo, p_buffer) \
00064 do { vlc_mutex_lock (&(p_fifo)->lock); \
00065 OMX_BUFFERHEADERTYPE **pp_next = (OMX_BUFFERHEADERTYPE **) \
00066 ((void **)p_buffer + (p_fifo)->offset); \
00067 *(p_fifo)->pp_last = p_buffer; \
00068 (p_fifo)->pp_last = pp_next; *pp_next = 0; \
00069 vlc_cond_signal( &(p_fifo)->wait ); \
00070 vlc_mutex_unlock( &(p_fifo)->lock ); } while(0)
00071
00072
00073
00074
00075 typedef union {
00076 OMX_PARAM_U32TYPE common;
00077 OMX_AUDIO_PARAM_PCMMODETYPE pcm;
00078 OMX_AUDIO_PARAM_MP3TYPE mp3;
00079 OMX_AUDIO_PARAM_AACPROFILETYPE aac;
00080 OMX_AUDIO_PARAM_VORBISTYPE vorbis;
00081 OMX_AUDIO_PARAM_WMATYPE wma;
00082 OMX_AUDIO_PARAM_RATYPE ra;
00083 OMX_AUDIO_PARAM_ADPCMTYPE adpcm;
00084 OMX_AUDIO_PARAM_G723TYPE g723;
00085 OMX_AUDIO_PARAM_G726TYPE g726;
00086 OMX_AUDIO_PARAM_G729TYPE g729;
00087 OMX_AUDIO_PARAM_AMRTYPE amr;
00088
00089 OMX_VIDEO_PARAM_H263TYPE h263;
00090 OMX_VIDEO_PARAM_MPEG2TYPE mpeg2;
00091 OMX_VIDEO_PARAM_MPEG4TYPE mpeg4;
00092 OMX_VIDEO_PARAM_WMVTYPE wmv;
00093 OMX_VIDEO_PARAM_RVTYPE rv;
00094 OMX_VIDEO_PARAM_AVCTYPE avc;
00095
00096 } OmxFormatParam;
00097
00098
00099
00100
00101 typedef struct OmxEvent
00102 {
00103 OMX_EVENTTYPE event;
00104 OMX_U32 data_1;
00105 OMX_U32 data_2;
00106 OMX_PTR event_data;
00107
00108 struct OmxEvent *next;
00109 } OmxEvent;
00110
00111 OMX_ERRORTYPE PostOmxEvent(decoder_t *p_dec, OMX_EVENTTYPE event,
00112 OMX_U32 data_1, OMX_U32 data_2, OMX_PTR event_data);
00113 OMX_ERRORTYPE WaitForOmxEvent(decoder_t *p_dec, OMX_EVENTTYPE *event,
00114 OMX_U32 *data_1, OMX_U32 *data_2, OMX_PTR *event_data);
00115 OMX_ERRORTYPE WaitForSpecificOmxEvent(decoder_t *p_dec,
00116 OMX_EVENTTYPE specific_event, OMX_U32 *data_1, OMX_U32 *data_2,
00117 OMX_PTR *event_data);
00118
00119
00120
00121
00122 void CopyOmxPicture( decoder_t *, picture_t *, OMX_BUFFERHEADERTYPE * );
00123 void CopyVlcPicture( decoder_t *, OMX_BUFFERHEADERTYPE *, picture_t * );
00124
00125
00126
00127
00128 const char *StateToString(OMX_STATETYPE state);
00129 const char *CommandToString(OMX_COMMANDTYPE command);
00130 const char *EventToString(OMX_EVENTTYPE event);
00131 const char *ErrorToString(OMX_ERRORTYPE error);
00132
00133 void PrintOmx(decoder_t *p_dec, OMX_HANDLETYPE omx_handle, OMX_U32 i_port);
00134
00135
00136
00137
00138 int GetOmxVideoFormat( vlc_fourcc_t i_fourcc,
00139 OMX_VIDEO_CODINGTYPE *pi_omx_codec,
00140 const char **ppsz_name );
00141 int GetVlcVideoFormat( OMX_VIDEO_CODINGTYPE i_omx_codec,
00142 vlc_fourcc_t *pi_fourcc, const char **ppsz_name );
00143 int GetOmxAudioFormat( vlc_fourcc_t i_fourcc,
00144 OMX_AUDIO_CODINGTYPE *pi_omx_codec,
00145 const char **ppsz_name );
00146 int GetVlcAudioFormat( OMX_AUDIO_CODINGTYPE i_omx_codec,
00147 vlc_fourcc_t *pi_fourcc, const char **ppsz_name );
00148 const char *GetOmxRole( vlc_fourcc_t i_fourcc, int i_cat, bool b_enc );
00149 int GetOmxChromaFormat( vlc_fourcc_t i_fourcc,
00150 OMX_COLOR_FORMATTYPE *pi_omx_codec,
00151 const char **ppsz_name );
00152 int GetVlcChromaFormat( OMX_COLOR_FORMATTYPE i_omx_codec,
00153 vlc_fourcc_t *pi_fourcc, const char **ppsz_name );
00154 int GetVlcChromaSizes( vlc_fourcc_t i_fourcc,
00155 unsigned int width, unsigned int height,
00156 unsigned int *size, unsigned int *pitch,
00157 unsigned int *chroma_pitch_div );
00158
00159
00160
00161
00162 OMX_ERRORTYPE SetAudioParameters(OMX_HANDLETYPE handle,
00163 OmxFormatParam *param, OMX_U32 i_port, OMX_AUDIO_CODINGTYPE encoding,
00164 uint8_t i_channels, unsigned int i_samplerate, unsigned int i_bitrate,
00165 unsigned int i_bps, unsigned int i_blocksize);
00166 OMX_ERRORTYPE GetAudioParameters(OMX_HANDLETYPE handle,
00167 OmxFormatParam *param, OMX_U32 i_port, OMX_AUDIO_CODINGTYPE encoding,
00168 uint8_t *pi_channels, unsigned int *pi_samplerate,
00169 unsigned int *pi_bitrate, unsigned int *pi_bps, unsigned int *pi_blocksize);