• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*--------------------------------------------------------------------------
2 Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
3 
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are met:
6     * Redistributions of source code must retain the above copyright
7       notice, this list of conditions and the following disclaimer.
8     * Redistributions in binary form must reproduce the above copyright
9       notice, this list of conditions and the following disclaimer in the
10       documentation and/or other materials provided with the distribution.
11     * Neither the name of Code Aurora nor
12       the names of its contributors may be used to endorse or promote
13       products derived from this software without specific prior written
14       permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 --------------------------------------------------------------------------*/
28 
29 #ifndef __OMX_VIDEO_BASE_H__
30 #define __OMX_VIDEO_BASE_H__
31 /*============================================================================
32                             O p e n M A X   Component
33                                 Video Encoder
34 
35 *//** @file comx_video_base.h
36   This module contains the class definition for openMAX decoder component.
37 
38 *//*========================================================================*/
39 
40 //////////////////////////////////////////////////////////////////////////////
41 //                             Include Files
42 //////////////////////////////////////////////////////////////////////////////
43 
44 #include<stdlib.h>
45 #include <stdio.h>
46 #include <sys/mman.h>
47 #ifdef _ANDROID_
48   #include <binder/MemoryHeapBase.h>
49 #ifdef _ANDROID_ICS_
50   #include "QComOMXMetadata.h"
51 #endif
52 #endif // _ANDROID_
53 #include <pthread.h>
54 #include <semaphore.h>
55 #include <linux/msm_vidc_enc.h>
56 #include "OMX_Core.h"
57 #include "OMX_QCOMExtns.h"
58 #include "qc_omx_component.h"
59 #include "omx_video_common.h"
60 #include "extra_data_handler.h"
61 #include <linux/videodev2.h>
62 #include <dlfcn.h>
63 #include "C2DColorConverter.h"
64 
65 #ifdef _ANDROID_
66 using namespace android;
67 // local pmem heap object
68 class VideoHeap : public MemoryHeapBase
69 {
70 public:
71   VideoHeap(int fd, size_t size, void* base);
~VideoHeap()72   virtual ~VideoHeap() {}
73 };
74 
75 #include <utils/Log.h>
76 #define LOG_TAG "OMX-VENC-720p"
77 #ifdef ENABLE_DEBUG_LOW
78 #define DEBUG_PRINT_LOW ALOGV
79 #else
80 #define DEBUG_PRINT_LOW
81 #endif
82 #ifdef ENABLE_DEBUG_HIGH
83 #define DEBUG_PRINT_HIGH  ALOGV
84 #else
85 #define DEBUG_PRINT_HIGH
86 #endif
87 #ifdef ENABLE_DEBUG_ERROR
88 #define DEBUG_PRINT_ERROR ALOGE
89 #else
90 #define DEBUG_PRINT_ERROR
91 #endif
92 
93 #else //_ANDROID_
94 #define DEBUG_PRINT_LOW
95 #define DEBUG_PRINT_HIGH
96 #define DEBUG_PRINT_ERROR
97 #endif // _ANDROID_
98 
99 #ifdef USE_ION
100     static const char* MEM_DEVICE = "/dev/ion";
101     #define MEM_HEAP_ID ION_CP_MM_HEAP_ID
102 #elif MAX_RES_720P
103 static const char* MEM_DEVICE = "/dev/pmem_adsp";
104 #elif MAX_RES_1080P_EBI
105 static const char* MEM_DEVICE  = "/dev/pmem_adsp";
106 #elif MAX_RES_1080P
107 static const char* MEM_DEVICE = "/dev/pmem_smipool";
108 #else
109 #error MEM_DEVICE cannot be determined.
110 #endif
111 
112 //////////////////////////////////////////////////////////////////////////////
113 //                       Module specific globals
114 //////////////////////////////////////////////////////////////////////////////
115 
116 #define OMX_SPEC_VERSION  0x00000101
117 
118 
119 //////////////////////////////////////////////////////////////////////////////
120 //               Macros
121 //////////////////////////////////////////////////////////////////////////////
122 #define PrintFrameHdr(bufHdr) DEBUG_PRINT("bufHdr %x buf %x size %d TS %d\n",\
123                        (unsigned) bufHdr,\
124                        (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->pBuffer,\
125                        (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nFilledLen,\
126                        (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nTimeStamp)
127 
128 // BitMask Management logic
129 #define BITS_PER_BYTE        32
130 #define BITMASK_SIZE(mIndex) (((mIndex) + BITS_PER_BYTE - 1)/BITS_PER_BYTE)
131 #define BITMASK_OFFSET(mIndex) ((mIndex)/BITS_PER_BYTE)
132 #define BITMASK_FLAG(mIndex) (1 << ((mIndex) % BITS_PER_BYTE))
133 #define BITMASK_CLEAR(mArray,mIndex) (mArray)[BITMASK_OFFSET(mIndex)] \
134         &=  ~(BITMASK_FLAG(mIndex))
135 #define BITMASK_SET(mArray,mIndex)  (mArray)[BITMASK_OFFSET(mIndex)] \
136         |=  BITMASK_FLAG(mIndex)
137 #define BITMASK_PRESENT(mArray,mIndex) ((mArray)[BITMASK_OFFSET(mIndex)] \
138         & BITMASK_FLAG(mIndex))
139 #define BITMASK_ABSENT(mArray,mIndex) (((mArray)[BITMASK_OFFSET(mIndex)] \
140         & BITMASK_FLAG(mIndex)) == 0x0)
141 #define BITMASK_PRESENT(mArray,mIndex) ((mArray)[BITMASK_OFFSET(mIndex)] \
142         & BITMASK_FLAG(mIndex))
143 #define BITMASK_ABSENT(mArray,mIndex) (((mArray)[BITMASK_OFFSET(mIndex)] \
144         & BITMASK_FLAG(mIndex)) == 0x0)
145 #ifdef _ANDROID_ICS_
146 #define MAX_NUM_INPUT_BUFFERS 32
147 #endif
148 void* message_thread(void *);
149 // OMX video class
150 class omx_video: public qc_omx_component
151 {
152 protected:
153 #ifdef _ANDROID_ICS_
154   bool meta_mode_enable;
155   bool c2d_opened;
156   encoder_media_buffer_type meta_buffers[MAX_NUM_INPUT_BUFFERS];
157   OMX_BUFFERHEADERTYPE *opaque_buffer_hdr[MAX_NUM_INPUT_BUFFERS];
158   bool mUseProxyColorFormat;
159   OMX_BUFFERHEADERTYPE  *psource_frame;
160   OMX_BUFFERHEADERTYPE  *pdest_frame;
161   bool secure_session;
162   int secure_color_format;
163   class omx_c2d_conv {
164   public:
165     omx_c2d_conv();
166     ~omx_c2d_conv();
167 	bool init();
168 	bool open(unsigned int height,unsigned int width,
169                 ColorConvertFormat src,
170                 ColorConvertFormat dest,
171                 unsigned int srcStride);
172 	bool convert(int src_fd, void *src_base, void *src_viraddr,
173 	             int dest_fd, void* dest_base, void *dest_viraddr);
174 	bool get_buffer_size(int port,unsigned int &buf_size);
175 	int get_src_format();
176 	void close();
177   private:
178      C2DColorConverterBase *c2dcc;
179     void *mLibHandle;
180 	ColorConvertFormat src_format;
181     createC2DColorConverter_t *mConvertOpen;
182     destroyC2DColorConverter_t *mConvertClose;
183   };
184   omx_c2d_conv c2d_conv;
185 #endif
186 public:
187   omx_video();  // constructor
188   virtual ~omx_video();  // destructor
189 
190   // virtual int async_message_process (void *context, void* message);
191   void process_event_cb(void *ctxt,unsigned char id);
192 
193   OMX_ERRORTYPE allocate_buffer(
194                                OMX_HANDLETYPE hComp,
195                                OMX_BUFFERHEADERTYPE **bufferHdr,
196                                OMX_U32 port,
197                                OMX_PTR appData,
198                                OMX_U32 bytes
199                                );
200 
201 
202   virtual OMX_ERRORTYPE component_deinit(OMX_HANDLETYPE hComp)= 0;
203 
204   virtual OMX_ERRORTYPE component_init(OMX_STRING role)= 0;
205 
206   virtual OMX_U32 dev_stop(void) = 0;
207   virtual OMX_U32 dev_pause(void) = 0;
208   virtual OMX_U32 dev_start(void) = 0;
209   virtual OMX_U32 dev_flush(unsigned) = 0;
210   virtual OMX_U32 dev_resume(void) = 0;
211   virtual OMX_U32 dev_start_done(void) = 0;
212   virtual OMX_U32 dev_stop_done(void) = 0;
213   virtual bool dev_use_buf(void *,unsigned,unsigned) = 0;
214   virtual bool dev_free_buf(void *,unsigned) = 0;
215   virtual bool dev_empty_buf(void *, void *,unsigned,unsigned) = 0;
216   virtual bool dev_fill_buf(void *buffer, void *,unsigned,unsigned) = 0;
217   virtual bool dev_get_buf_req(OMX_U32 *,OMX_U32 *,OMX_U32 *,OMX_U32) = 0;
218   virtual bool dev_get_seq_hdr(void *, unsigned, unsigned *) = 0;
219   virtual bool dev_loaded_start(void) = 0;
220   virtual bool dev_loaded_stop(void) = 0;
221   virtual bool dev_loaded_start_done(void) = 0;
222   virtual bool dev_loaded_stop_done(void) = 0;
223   virtual bool is_secure_session(void) = 0;
224 #ifdef _ANDROID_ICS_
225   void omx_release_meta_buffer(OMX_BUFFERHEADERTYPE *buffer);
226 #endif
227   OMX_ERRORTYPE component_role_enum(
228                                    OMX_HANDLETYPE hComp,
229                                    OMX_U8 *role,
230                                    OMX_U32 index
231                                    );
232 
233   OMX_ERRORTYPE component_tunnel_request(
234                                         OMX_HANDLETYPE hComp,
235                                         OMX_U32 port,
236                                         OMX_HANDLETYPE  peerComponent,
237                                         OMX_U32 peerPort,
238                                         OMX_TUNNELSETUPTYPE *tunnelSetup
239                                         );
240 
241   OMX_ERRORTYPE empty_this_buffer(
242                                  OMX_HANDLETYPE hComp,
243                                  OMX_BUFFERHEADERTYPE *buffer
244                                  );
245 
246 
247 
248   OMX_ERRORTYPE fill_this_buffer(
249                                 OMX_HANDLETYPE hComp,
250                                 OMX_BUFFERHEADERTYPE *buffer
251                                 );
252 
253 
254   OMX_ERRORTYPE free_buffer(
255                            OMX_HANDLETYPE hComp,
256                            OMX_U32 port,
257                            OMX_BUFFERHEADERTYPE *buffer
258                            );
259 
260   OMX_ERRORTYPE get_component_version(
261                                      OMX_HANDLETYPE hComp,
262                                      OMX_STRING componentName,
263                                      OMX_VERSIONTYPE *componentVersion,
264                                      OMX_VERSIONTYPE *specVersion,
265                                      OMX_UUIDTYPE *componentUUID
266                                      );
267 
268   OMX_ERRORTYPE get_config(
269                           OMX_HANDLETYPE hComp,
270                           OMX_INDEXTYPE configIndex,
271                           OMX_PTR configData
272                           );
273 
274   OMX_ERRORTYPE get_extension_index(
275                                    OMX_HANDLETYPE hComp,
276                                    OMX_STRING paramName,
277                                    OMX_INDEXTYPE *indexType
278                                    );
279 
280   OMX_ERRORTYPE get_parameter(OMX_HANDLETYPE hComp,
281                               OMX_INDEXTYPE  paramIndex,
282                               OMX_PTR        paramData);
283 
284   OMX_ERRORTYPE get_state(OMX_HANDLETYPE hComp,
285                           OMX_STATETYPE *state);
286 
287 
288 
289   OMX_ERRORTYPE send_command(OMX_HANDLETYPE  hComp,
290                              OMX_COMMANDTYPE cmd,
291                              OMX_U32         param1,
292                              OMX_PTR         cmdData);
293 
294 
295   OMX_ERRORTYPE set_callbacks(OMX_HANDLETYPE   hComp,
296                               OMX_CALLBACKTYPE *callbacks,
297                               OMX_PTR          appData);
298 
299   virtual OMX_ERRORTYPE set_config(OMX_HANDLETYPE hComp,
300                            OMX_INDEXTYPE  configIndex,
301                            OMX_PTR        configData) = 0;
302 
303   virtual OMX_ERRORTYPE set_parameter(OMX_HANDLETYPE hComp,
304                                       OMX_INDEXTYPE  paramIndex,
305                                       OMX_PTR        paramData) =0;
306 
307   OMX_ERRORTYPE use_buffer(OMX_HANDLETYPE      hComp,
308                            OMX_BUFFERHEADERTYPE **bufferHdr,
309                            OMX_U32              port,
310                            OMX_PTR              appData,
311                            OMX_U32              bytes,
312                            OMX_U8               *buffer);
313 
314 
315   OMX_ERRORTYPE use_EGL_image(OMX_HANDLETYPE     hComp,
316                               OMX_BUFFERHEADERTYPE **bufferHdr,
317                               OMX_U32              port,
318                               OMX_PTR              appData,
319                               void *               eglImage);
320 
321 
322 
323   int  m_pipe_in;
324   int  m_pipe_out;
325 
326   pthread_t msg_thread_id;
327   pthread_t async_thread_id;
328 
329   OMX_U8 m_nkind[128];
330 
331 
332   //int *input_pmem_fd;
333   //int *output_pmem_fd;
334   struct pmem *m_pInput_pmem;
335   struct pmem *m_pOutput_pmem;
336 #ifdef USE_ION
337   struct venc_ion *m_pInput_ion;
338   struct venc_ion *m_pOutput_ion;
339 #endif
340 
341 
342 
343 public:
344   // Bit Positions
345   enum flags_bit_positions
346   {
347     // Defer transition to IDLE
348     OMX_COMPONENT_IDLE_PENDING            =0x1,
349     // Defer transition to LOADING
350     OMX_COMPONENT_LOADING_PENDING         =0x2,
351     // First  Buffer Pending
352     OMX_COMPONENT_FIRST_BUFFER_PENDING    =0x3,
353     // Second Buffer Pending
354     OMX_COMPONENT_SECOND_BUFFER_PENDING   =0x4,
355     // Defer transition to Enable
356     OMX_COMPONENT_INPUT_ENABLE_PENDING    =0x5,
357     // Defer transition to Enable
358     OMX_COMPONENT_OUTPUT_ENABLE_PENDING   =0x6,
359     // Defer transition to Disable
360     OMX_COMPONENT_INPUT_DISABLE_PENDING   =0x7,
361     // Defer transition to Disable
362     OMX_COMPONENT_OUTPUT_DISABLE_PENDING  =0x8,
363     //defer flush notification
364     OMX_COMPONENT_OUTPUT_FLUSH_PENDING    =0x9,
365     OMX_COMPONENT_INPUT_FLUSH_PENDING    =0xA,
366     OMX_COMPONENT_PAUSE_PENDING          =0xB,
367     OMX_COMPONENT_EXECUTE_PENDING        =0xC,
368     OMX_COMPONENT_LOADED_START_PENDING = 0xD,
369     OMX_COMPONENT_LOADED_STOP_PENDING = 0xF,
370 
371   };
372 
373   // Deferred callback identifiers
374   enum
375   {
376     //Event Callbacks from the venc component thread context
377     OMX_COMPONENT_GENERATE_EVENT       = 0x1,
378     //Buffer Done callbacks from the venc component thread context
379     OMX_COMPONENT_GENERATE_BUFFER_DONE = 0x2,
380     //Frame Done callbacks from the venc component thread context
381     OMX_COMPONENT_GENERATE_FRAME_DONE  = 0x3,
382     //Buffer Done callbacks from the venc component thread context
383     OMX_COMPONENT_GENERATE_FTB         = 0x4,
384     //Frame Done callbacks from the venc component thread context
385     OMX_COMPONENT_GENERATE_ETB         = 0x5,
386     //Command
387     OMX_COMPONENT_GENERATE_COMMAND     = 0x6,
388     //Push-Pending Buffers
389     OMX_COMPONENT_PUSH_PENDING_BUFS    = 0x7,
390     // Empty Buffer Done callbacks
391     OMX_COMPONENT_GENERATE_EBD         = 0x8,
392     //Flush Event Callbacks from the venc component thread context
393     OMX_COMPONENT_GENERATE_EVENT_FLUSH       = 0x9,
394     OMX_COMPONENT_GENERATE_EVENT_INPUT_FLUSH = 0x0A,
395     OMX_COMPONENT_GENERATE_EVENT_OUTPUT_FLUSH = 0x0B,
396     OMX_COMPONENT_GENERATE_FBD = 0xc,
397     OMX_COMPONENT_GENERATE_START_DONE = 0xD,
398     OMX_COMPONENT_GENERATE_PAUSE_DONE = 0xE,
399     OMX_COMPONENT_GENERATE_RESUME_DONE = 0xF,
400     OMX_COMPONENT_GENERATE_STOP_DONE = 0x10,
401     OMX_COMPONENT_GENERATE_HARDWARE_ERROR = 0x11,
402     OMX_COMPONENT_GENERATE_ETB_OPQ = 0x12
403   };
404 
405   struct omx_event
406   {
407     unsigned param1;
408     unsigned param2;
409     unsigned id;
410   };
411 
412   struct omx_cmd_queue
413   {
414     omx_event m_q[OMX_CORE_CONTROL_CMDQ_SIZE];
415     unsigned m_read;
416     unsigned m_write;
417     unsigned m_size;
418 
419     omx_cmd_queue();
420     ~omx_cmd_queue();
421     bool insert_entry(unsigned p1, unsigned p2, unsigned id);
422     bool pop_entry(unsigned *p1,unsigned *p2, unsigned *id);
423     // get msgtype of the first ele from the queue
424     unsigned get_q_msg_type();
425 
426   };
427 
428   bool allocate_done(void);
429   bool allocate_input_done(void);
430   bool allocate_output_done(void);
431 
432   OMX_ERRORTYPE free_input_buffer(OMX_BUFFERHEADERTYPE *bufferHdr);
433   OMX_ERRORTYPE free_output_buffer(OMX_BUFFERHEADERTYPE *bufferHdr);
434 
435   OMX_ERRORTYPE allocate_input_buffer(OMX_HANDLETYPE       hComp,
436                                       OMX_BUFFERHEADERTYPE **bufferHdr,
437                                       OMX_U32              port,
438                                       OMX_PTR              appData,
439                                       OMX_U32              bytes);
440 #ifdef _ANDROID_ICS_
441   OMX_ERRORTYPE allocate_input_meta_buffer(OMX_HANDLETYPE       hComp,
442                                       OMX_BUFFERHEADERTYPE **bufferHdr,
443                                       OMX_PTR              appData,
444                                       OMX_U32              bytes);
445 #endif
446   OMX_ERRORTYPE allocate_output_buffer(OMX_HANDLETYPE       hComp,
447                                        OMX_BUFFERHEADERTYPE **bufferHdr,
448                                        OMX_U32 port,OMX_PTR appData,
449                                        OMX_U32              bytes);
450 
451   OMX_ERRORTYPE use_input_buffer(OMX_HANDLETYPE hComp,
452                                  OMX_BUFFERHEADERTYPE  **bufferHdr,
453                                  OMX_U32               port,
454                                  OMX_PTR               appData,
455                                  OMX_U32               bytes,
456                                  OMX_U8                *buffer);
457 
458   OMX_ERRORTYPE use_output_buffer(OMX_HANDLETYPE hComp,
459                                   OMX_BUFFERHEADERTYPE   **bufferHdr,
460                                   OMX_U32                port,
461                                   OMX_PTR                appData,
462                                   OMX_U32                bytes,
463                                   OMX_U8                 *buffer);
464 
465   bool execute_omx_flush(OMX_U32);
466   bool execute_output_flush(void);
467   bool execute_input_flush(void);
468   OMX_ERRORTYPE empty_buffer_done(OMX_HANDLETYPE hComp,
469                                   OMX_BUFFERHEADERTYPE * buffer);
470 
471   OMX_ERRORTYPE fill_buffer_done(OMX_HANDLETYPE hComp,
472                                  OMX_BUFFERHEADERTYPE * buffer);
473   OMX_ERRORTYPE empty_this_buffer_proxy(OMX_HANDLETYPE hComp,
474                                         OMX_BUFFERHEADERTYPE *buffer);
475   OMX_ERRORTYPE empty_this_buffer_opaque(OMX_HANDLETYPE hComp,
476                                   OMX_BUFFERHEADERTYPE *buffer);
477   OMX_ERRORTYPE push_input_buffer(OMX_HANDLETYPE hComp);
478   OMX_ERRORTYPE convert_queue_buffer(OMX_HANDLETYPE hComp,
479      struct pmem &Input_pmem_info,unsigned &index);
480   OMX_ERRORTYPE queue_meta_buffer(OMX_HANDLETYPE hComp,
481      struct pmem &Input_pmem_info);
482   OMX_ERRORTYPE fill_this_buffer_proxy(OMX_HANDLETYPE       hComp,
483                                        OMX_BUFFERHEADERTYPE *buffer);
484   bool release_done();
485 
486   bool release_output_done();
487   bool release_input_done();
488 
489   OMX_ERRORTYPE send_command_proxy(OMX_HANDLETYPE  hComp,
490                                    OMX_COMMANDTYPE cmd,
491                                    OMX_U32         param1,
492                                    OMX_PTR         cmdData);
493   bool post_event( unsigned int p1,
494                    unsigned int p2,
495                    unsigned int id
496                  );
497   OMX_ERRORTYPE get_supported_profile_level(OMX_VIDEO_PARAM_PROFILELEVELTYPE *profileLevelType);
omx_report_error()498   inline void omx_report_error ()
499   {
500     if(m_pCallbacks.EventHandler && !m_error_propogated)
501     {
502       m_error_propogated = true;
503       m_pCallbacks.EventHandler(&m_cmp,m_app_data,
504                                 OMX_EventError,OMX_ErrorHardware,0,NULL);
505     }
506   }
507 
508   void complete_pending_buffer_done_cbs();
509 
510   //*************************************************************
511   //*******************MEMBER VARIABLES *************************
512   //*************************************************************
513 
514   pthread_mutex_t       m_lock;
515   sem_t                 m_cmd_lock;
516   bool              m_error_propogated;
517 
518   //sem to handle the minimum procesing of commands
519 
520 
521   // compression format
522   //OMX_VIDEO_CODINGTYPE eCompressionFormat;
523   // OMX State
524   OMX_STATETYPE m_state;
525   // Application data
526   OMX_PTR m_app_data;
527   OMX_BOOL m_use_input_pmem;
528   OMX_BOOL m_use_output_pmem;
529   // Application callbacks
530   OMX_CALLBACKTYPE m_pCallbacks;
531   OMX_PORT_PARAM_TYPE m_sPortParam;
532   OMX_VIDEO_PARAM_PROFILELEVELTYPE m_sParamProfileLevel;
533   OMX_VIDEO_PARAM_PORTFORMATTYPE m_sInPortFormat;
534   OMX_VIDEO_PARAM_PORTFORMATTYPE m_sOutPortFormat;
535   OMX_PARAM_PORTDEFINITIONTYPE m_sInPortDef;
536   OMX_PARAM_PORTDEFINITIONTYPE m_sOutPortDef;
537   OMX_VIDEO_PARAM_MPEG4TYPE m_sParamMPEG4;
538   OMX_VIDEO_PARAM_H263TYPE m_sParamH263;
539   OMX_VIDEO_PARAM_AVCTYPE m_sParamAVC;
540   OMX_PORT_PARAM_TYPE m_sPortParam_img;
541   OMX_PORT_PARAM_TYPE m_sPortParam_audio;
542   OMX_VIDEO_CONFIG_BITRATETYPE m_sConfigBitrate;
543   OMX_CONFIG_FRAMERATETYPE m_sConfigFramerate;
544   OMX_VIDEO_PARAM_BITRATETYPE m_sParamBitrate;
545   OMX_PRIORITYMGMTTYPE m_sPriorityMgmt;
546   OMX_PARAM_BUFFERSUPPLIERTYPE m_sInBufSupplier;
547   OMX_PARAM_BUFFERSUPPLIERTYPE m_sOutBufSupplier;
548   OMX_CONFIG_ROTATIONTYPE m_sConfigFrameRotation;
549   OMX_CONFIG_INTRAREFRESHVOPTYPE m_sConfigIntraRefreshVOP;
550   OMX_VIDEO_PARAM_QUANTIZATIONTYPE m_sSessionQuantization;
551   OMX_VIDEO_PARAM_AVCSLICEFMO m_sAVCSliceFMO;
552   QOMX_VIDEO_INTRAPERIODTYPE m_sIntraperiod;
553   OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE m_sErrorCorrection;
554   OMX_VIDEO_PARAM_INTRAREFRESHTYPE m_sIntraRefresh;
555   OMX_U32 m_sExtraData;
556   OMX_U32 m_sDebugSliceinfo;
557   OMX_U32 m_input_msg_id;
558   // fill this buffer queue
559   omx_cmd_queue         m_ftb_q;
560   // Command Q for rest of the events
561   omx_cmd_queue         m_cmd_q;
562   omx_cmd_queue         m_etb_q;
563   omx_cmd_queue         m_opq_meta_q;
564   omx_cmd_queue         m_opq_pmem_q;
565   // Input memory pointer
566   OMX_BUFFERHEADERTYPE  *m_inp_mem_ptr;
567   OMX_BUFFERHEADERTYPE meta_buffer_hdr[MAX_NUM_INPUT_BUFFERS];
568   // Output memory pointer
569   OMX_BUFFERHEADERTYPE  *m_out_mem_ptr;
570 
571   bool input_flush_progress;
572   bool output_flush_progress;
573   bool input_use_buffer;
574   bool output_use_buffer;
575   int pending_input_buffers;
576   int pending_output_buffers;
577 
578   unsigned int m_out_bm_count;
579   unsigned int m_inp_bm_count;
580   unsigned int m_flags;
581   unsigned int m_etb_count;
582   unsigned int m_fbd_count;
583 #ifdef _ANDROID_
584   // Heap pointer to frame buffers
585   sp<MemoryHeapBase>    m_heap_ptr;
586 #endif //_ANDROID_
587   // to know whether Event Port Settings change has been triggered or not.
588   bool m_event_port_settings_sent;
589   OMX_U8                m_cRole[OMX_MAX_STRINGNAME_SIZE];
590   extra_data_handler extra_data_handle;
591 
592 private:
593 #ifdef USE_ION
594   int alloc_map_ion_memory(int size,struct ion_allocation_data *alloc_data,
595                                     struct ion_fd_data *fd_data,int flag);
596   void free_ion_memory(struct venc_ion *buf_ion_info);
597 #endif
598 };
599 
600 #endif // __OMX_VIDEO_BASE_H__
601