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