Home | History | Annotate | Download | only in inc
      1 /*--------------------------------------------------------------------------
      2 Copyright (c) 2010, 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 #ifndef __OMX_VDEC_H__
     29 #define __OMX_VDEC_H__
     30 /*============================================================================
     31                             O p e n M A X   Component
     32                                 Video Decoder
     33 
     34 *//** @file comx_vdec.h
     35   This module contains the class definition for openMAX decoder component.
     36 
     37 *//*========================================================================*/
     38 
     39 //////////////////////////////////////////////////////////////////////////////
     40 //                             Include Files
     41 //////////////////////////////////////////////////////////////////////////////
     42 
     43 #include<stdlib.h>
     44 
     45 #include <stdio.h>
     46 
     47 #ifdef _ANDROID_
     48 #include <binder/MemoryHeapBase.h>
     49 extern "C"{
     50 #include<utils/Log.h>
     51 }
     52 //#define LOG_TAG "OMX-VDEC-720P"
     53 #ifdef ENABLE_DEBUG_LOW
     54 #define DEBUG_PRINT_LOW ALOGE
     55 #else
     56 #define DEBUG_PRINT_LOW
     57 #endif
     58 #ifdef ENABLE_DEBUG_HIGH
     59 #define DEBUG_PRINT_HIGH ALOGE
     60 #else
     61 #define DEBUG_PRINT_HIGH
     62 #endif
     63 #ifdef ENABLE_DEBUG_ERROR
     64 #define DEBUG_PRINT_ERROR ALOGE
     65 #else
     66 #define DEBUG_PRINT_ERROR
     67 #endif
     68 #endif // _ANDROID_
     69 
     70 #include <pthread.h>
     71 #ifndef PC_DEBUG
     72 #include <semaphore.h>
     73 #endif
     74 #include "OMX_Core.h"
     75 #include "OMX_QCOMExtns.h"
     76 //#include "vdec.h"
     77 #include "qc_omx_component.h"
     78 //#include "Map.h"
     79 //#include "OmxUtils.h"
     80 #include <linux/msm_vidc_dec.h>
     81 #include "frameparser.h"
     82 #include <linux/android_pmem.h>
     83 
     84 extern "C" {
     85   OMX_API void * get_omx_component_factory_fn(void);
     86 }
     87 
     88 
     89 #ifdef _ANDROID_
     90     using namespace android;
     91     // local pmem heap object
     92     class VideoHeap : public MemoryHeapBase
     93     {
     94     public:
     95         VideoHeap(int fd, size_t size, void* base);
     96         virtual ~VideoHeap() {}
     97     };
     98 #endif // _ANDROID_
     99 //////////////////////////////////////////////////////////////////////////////
    100 //                       Module specific globals
    101 //////////////////////////////////////////////////////////////////////////////
    102 #define OMX_SPEC_VERSION  0x00000101
    103 
    104 
    105 //////////////////////////////////////////////////////////////////////////////
    106 //               Macros
    107 //////////////////////////////////////////////////////////////////////////////
    108 #define PrintFrameHdr(bufHdr) DEBUG_PRINT("bufHdr %x buf %x size %d TS %d\n",\
    109                        (unsigned) bufHdr,\
    110                        (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->pBuffer,\
    111                        (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nFilledLen,\
    112                        (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nTimeStamp)
    113 
    114 // BitMask Management logic
    115 #define BITS_PER_BYTE        32
    116 #define BITMASK_SIZE(mIndex) (((mIndex) + BITS_PER_BYTE - 1)/BITS_PER_BYTE)
    117 #define BITMASK_OFFSET(mIndex) ((mIndex)/BITS_PER_BYTE)
    118 #define BITMASK_FLAG(mIndex) (1 << ((mIndex) % BITS_PER_BYTE))
    119 #define BITMASK_CLEAR(mArray,mIndex) (mArray)[BITMASK_OFFSET(mIndex)] \
    120         &=  ~(BITMASK_FLAG(mIndex))
    121 #define BITMASK_SET(mArray,mIndex)  (mArray)[BITMASK_OFFSET(mIndex)] \
    122         |=  BITMASK_FLAG(mIndex)
    123 #define BITMASK_PRESENT(mArray,mIndex) ((mArray)[BITMASK_OFFSET(mIndex)] \
    124         & BITMASK_FLAG(mIndex))
    125 #define BITMASK_ABSENT(mArray,mIndex) (((mArray)[BITMASK_OFFSET(mIndex)] \
    126         & BITMASK_FLAG(mIndex)) == 0x0)
    127 #define BITMASK_PRESENT(mArray,mIndex) ((mArray)[BITMASK_OFFSET(mIndex)] \
    128         & BITMASK_FLAG(mIndex))
    129 #define BITMASK_ABSENT(mArray,mIndex) (((mArray)[BITMASK_OFFSET(mIndex)] \
    130         & BITMASK_FLAG(mIndex)) == 0x0)
    131 
    132 #define OMX_VIDEO_DEC_NUM_INPUT_BUFFERS   2
    133 #define OMX_VIDEO_DEC_NUM_OUTPUT_BUFFERS  2
    134 
    135 #ifdef FEATURE_QTV_WVGA_ENABLE
    136 #define OMX_VIDEO_DEC_INPUT_BUFFER_SIZE   (256*1024)
    137 #else
    138 #define OMX_VIDEO_DEC_INPUT_BUFFER_SIZE   (128*1024)
    139 #endif
    140 
    141 #define OMX_CORE_CONTROL_CMDQ_SIZE   100
    142 #define OMX_CORE_QCIF_HEIGHT         144
    143 #define OMX_CORE_QCIF_WIDTH          176
    144 #define OMX_CORE_VGA_HEIGHT          480
    145 #define OMX_CORE_VGA_WIDTH           640
    146 #define OMX_CORE_WVGA_HEIGHT         480
    147 #define OMX_CORE_WVGA_WIDTH          800
    148 
    149 
    150 struct video_driver_context
    151 {
    152     int video_driver_fd;
    153     enum vdec_codec decoder_format;
    154     enum vdec_output_fromat output_format;
    155     struct vdec_picsize video_resoultion;
    156     struct vdec_allocatorproperty input_buffer;
    157     struct vdec_allocatorproperty output_buffer;
    158     struct vdec_bufferpayload *ptr_inputbuffer;
    159     struct vdec_bufferpayload *ptr_outputbuffer;
    160     struct vdec_output_frameinfo *ptr_respbuffer;
    161     char kind[128];
    162 };
    163 
    164 class OmxUtils;
    165 
    166 // OMX video decoder class
    167 class omx_vdec: public qc_omx_component
    168 {
    169 
    170 public:
    171     omx_vdec();  // constructor
    172     virtual ~omx_vdec();  // destructor
    173 
    174     static int async_message_process (void *context, void* message);
    175     static void process_event_cb(void *ctxt,unsigned char id);
    176 
    177     OMX_ERRORTYPE allocate_buffer(
    178                                    OMX_HANDLETYPE hComp,
    179                                    OMX_BUFFERHEADERTYPE **bufferHdr,
    180                                    OMX_U32 port,
    181                                    OMX_PTR appData,
    182                                    OMX_U32 bytes
    183                                   );
    184 
    185 
    186     OMX_ERRORTYPE component_deinit(OMX_HANDLETYPE hComp);
    187 
    188     OMX_ERRORTYPE component_init(OMX_STRING role);
    189 
    190     OMX_ERRORTYPE component_role_enum(
    191                                        OMX_HANDLETYPE hComp,
    192                                        OMX_U8 *role,
    193                                        OMX_U32 index
    194                                       );
    195 
    196     OMX_ERRORTYPE component_tunnel_request(
    197                                             OMX_HANDLETYPE hComp,
    198                                             OMX_U32 port,
    199                                             OMX_HANDLETYPE  peerComponent,
    200                                             OMX_U32 peerPort,
    201                                             OMX_TUNNELSETUPTYPE *tunnelSetup
    202                                            );
    203 
    204     OMX_ERRORTYPE empty_this_buffer(
    205                                      OMX_HANDLETYPE hComp,
    206                                      OMX_BUFFERHEADERTYPE *buffer
    207                                     );
    208 
    209 
    210 
    211     OMX_ERRORTYPE fill_this_buffer(
    212                                     OMX_HANDLETYPE hComp,
    213                                     OMX_BUFFERHEADERTYPE *buffer
    214                                    );
    215 
    216 
    217     OMX_ERRORTYPE free_buffer(
    218                               OMX_HANDLETYPE hComp,
    219                               OMX_U32 port,
    220                               OMX_BUFFERHEADERTYPE *buffer
    221                               );
    222 
    223     OMX_ERRORTYPE get_component_version(
    224                                         OMX_HANDLETYPE hComp,
    225                                         OMX_STRING componentName,
    226                                         OMX_VERSIONTYPE *componentVersion,
    227                                         OMX_VERSIONTYPE *specVersion,
    228                                         OMX_UUIDTYPE *componentUUID
    229                                         );
    230 
    231     OMX_ERRORTYPE get_config(
    232                               OMX_HANDLETYPE hComp,
    233                               OMX_INDEXTYPE configIndex,
    234                               OMX_PTR configData
    235                              );
    236 
    237     OMX_ERRORTYPE get_extension_index(
    238                                       OMX_HANDLETYPE hComp,
    239                                       OMX_STRING paramName,
    240                                       OMX_INDEXTYPE *indexType
    241                                       );
    242 
    243     OMX_ERRORTYPE get_parameter(OMX_HANDLETYPE hComp,
    244                                 OMX_INDEXTYPE  paramIndex,
    245                                 OMX_PTR        paramData);
    246 
    247     OMX_ERRORTYPE get_state(OMX_HANDLETYPE hComp,
    248                             OMX_STATETYPE *state);
    249 
    250 
    251 
    252     OMX_ERRORTYPE send_command(OMX_HANDLETYPE  hComp,
    253                                OMX_COMMANDTYPE cmd,
    254                                OMX_U32         param1,
    255                                OMX_PTR         cmdData);
    256 
    257 
    258     OMX_ERRORTYPE set_callbacks(OMX_HANDLETYPE   hComp,
    259                                 OMX_CALLBACKTYPE *callbacks,
    260                                 OMX_PTR          appData);
    261 
    262     OMX_ERRORTYPE set_config(OMX_HANDLETYPE hComp,
    263                              OMX_INDEXTYPE  configIndex,
    264                              OMX_PTR        configData);
    265 
    266     OMX_ERRORTYPE set_parameter(OMX_HANDLETYPE hComp,
    267                                 OMX_INDEXTYPE  paramIndex,
    268                                 OMX_PTR        paramData);
    269 
    270     OMX_ERRORTYPE use_buffer(OMX_HANDLETYPE      hComp,
    271                              OMX_BUFFERHEADERTYPE **bufferHdr,
    272                              OMX_U32              port,
    273                              OMX_PTR              appData,
    274                              OMX_U32              bytes,
    275                              OMX_U8               *buffer);
    276 
    277 
    278     OMX_ERRORTYPE use_EGL_image(OMX_HANDLETYPE     hComp,
    279                                 OMX_BUFFERHEADERTYPE **bufferHdr,
    280                                 OMX_U32              port,
    281                                 OMX_PTR              appData,
    282                                 void *               eglImage);
    283 
    284 
    285 
    286     struct video_driver_context driver_context;
    287     int  m_pipe_in;
    288     int  m_pipe_out;
    289     pthread_t msg_thread_id;
    290     pthread_t async_thread_id;
    291 
    292 private:
    293     // Bit Positions
    294     enum flags_bit_positions
    295     {
    296         // Defer transition to IDLE
    297         OMX_COMPONENT_IDLE_PENDING            =0x1,
    298         // Defer transition to LOADING
    299         OMX_COMPONENT_LOADING_PENDING         =0x2,
    300         // First  Buffer Pending
    301         OMX_COMPONENT_FIRST_BUFFER_PENDING    =0x3,
    302         // Second Buffer Pending
    303         OMX_COMPONENT_SECOND_BUFFER_PENDING   =0x4,
    304         // Defer transition to Enable
    305         OMX_COMPONENT_INPUT_ENABLE_PENDING    =0x5,
    306         // Defer transition to Enable
    307         OMX_COMPONENT_OUTPUT_ENABLE_PENDING   =0x6,
    308         // Defer transition to Disable
    309         OMX_COMPONENT_INPUT_DISABLE_PENDING   =0x7,
    310         // Defer transition to Disable
    311         OMX_COMPONENT_OUTPUT_DISABLE_PENDING  =0x8,
    312         //defer flush notification
    313         OMX_COMPONENT_OUTPUT_FLUSH_PENDING    =0x9,
    314         OMX_COMPONENT_INPUT_FLUSH_PENDING    =0xA,
    315         OMX_COMPONENT_PAUSE_PENDING          =0xB,
    316         OMX_COMPONENT_EXECUTE_PENDING        =0xC
    317 
    318     };
    319 
    320     // Deferred callback identifiers
    321     enum
    322     {
    323         //Event Callbacks from the vdec component thread context
    324         OMX_COMPONENT_GENERATE_EVENT       = 0x1,
    325         //Buffer Done callbacks from the vdec component thread context
    326         OMX_COMPONENT_GENERATE_BUFFER_DONE = 0x2,
    327         //Frame Done callbacks from the vdec component thread context
    328         OMX_COMPONENT_GENERATE_FRAME_DONE  = 0x3,
    329         //Buffer Done callbacks from the vdec component thread context
    330         OMX_COMPONENT_GENERATE_FTB         = 0x4,
    331         //Frame Done callbacks from the vdec component thread context
    332         OMX_COMPONENT_GENERATE_ETB         = 0x5,
    333         //Command
    334         OMX_COMPONENT_GENERATE_COMMAND     = 0x6,
    335         //Push-Pending Buffers
    336         OMX_COMPONENT_PUSH_PENDING_BUFS    = 0x7,
    337         // Empty Buffer Done callbacks
    338         OMX_COMPONENT_GENERATE_EBD         = 0x8,
    339         //Flush Event Callbacks from the vdec component thread context
    340         OMX_COMPONENT_GENERATE_EVENT_FLUSH       = 0x9,
    341         OMX_COMPONENT_GENERATE_EVENT_INPUT_FLUSH = 0x0A,
    342         OMX_COMPONENT_GENERATE_EVENT_OUTPUT_FLUSH = 0x0B,
    343         OMX_COMPONENT_GENERATE_FBD = 0xc,
    344         OMX_COMPONENT_GENERATE_START_DONE = 0xD,
    345         OMX_COMPONENT_GENERATE_PAUSE_DONE = 0xE,
    346         OMX_COMPONENT_GENERATE_RESUME_DONE = 0xF,
    347         OMX_COMPONENT_GENERATE_STOP_DONE = 0x10,
    348         OMX_COMPONENT_GENERATE_HARDWARE_ERROR = 0x11,
    349         OMX_COMPONENT_GENERATE_ETB_ARBITRARY = 0x12
    350     };
    351 
    352     enum port_indexes
    353     {
    354         OMX_CORE_INPUT_PORT_INDEX        =0,
    355         OMX_CORE_OUTPUT_PORT_INDEX       =1
    356     };
    357 
    358     enum vc1_profile_type
    359     {
    360         VC1_SP_MP_RCV = 1,
    361         VC1_AP = 2
    362     };
    363 
    364     struct omx_event
    365     {
    366         unsigned param1;
    367         unsigned param2;
    368         unsigned id;
    369     };
    370 
    371     struct omx_cmd_queue
    372     {
    373         omx_event m_q[OMX_CORE_CONTROL_CMDQ_SIZE];
    374         unsigned m_read;
    375         unsigned m_write;
    376         unsigned m_size;
    377 
    378         omx_cmd_queue();
    379         ~omx_cmd_queue();
    380         bool insert_entry(unsigned p1, unsigned p2, unsigned id);
    381         bool pop_entry(unsigned *p1,unsigned *p2, unsigned *id);
    382         // get msgtype of the first ele from the queue
    383         unsigned get_q_msg_type();
    384 
    385     };
    386 
    387     OMX_ERRORTYPE omx_vdec_check_port_settings(bool *port_setting_changed);
    388     OMX_ERRORTYPE omx_vdec_validate_port_param(int height, int width);
    389 
    390 
    391     bool allocate_done(void);
    392     bool allocate_input_done(void);
    393     bool allocate_output_done(void);
    394 
    395     OMX_ERRORTYPE free_input_buffer(OMX_BUFFERHEADERTYPE *bufferHdr);
    396     OMX_ERRORTYPE free_output_buffer(OMX_BUFFERHEADERTYPE *bufferHdr);
    397 
    398     OMX_ERRORTYPE allocate_input_heap_buffer(OMX_HANDLETYPE       hComp,
    399                                              OMX_BUFFERHEADERTYPE **bufferHdr,
    400                                              OMX_U32              port,
    401                                              OMX_PTR              appData,
    402                                              OMX_U32              bytes);
    403 
    404 
    405     OMX_ERRORTYPE allocate_input_buffer(OMX_HANDLETYPE       hComp,
    406                                         OMX_BUFFERHEADERTYPE **bufferHdr,
    407                                         OMX_U32              port,
    408                                         OMX_PTR              appData,
    409                                         OMX_U32              bytes);
    410 
    411     OMX_ERRORTYPE allocate_output_buffer(OMX_HANDLETYPE       hComp,
    412                                          OMX_BUFFERHEADERTYPE **bufferHdr,
    413                                          OMX_U32 port,OMX_PTR appData,
    414                                          OMX_U32              bytes);
    415 
    416     OMX_ERRORTYPE use_input_buffer(OMX_HANDLETYPE hComp,
    417                                    OMX_BUFFERHEADERTYPE  **bufferHdr,
    418                                    OMX_U32               port,
    419                                    OMX_PTR               appData,
    420                                    OMX_U32               bytes,
    421                                    OMX_U8                *buffer);
    422 
    423     OMX_ERRORTYPE use_output_buffer(OMX_HANDLETYPE hComp,
    424                                    OMX_BUFFERHEADERTYPE   **bufferHdr,
    425                                    OMX_U32                port,
    426                                    OMX_PTR                appData,
    427                                    OMX_U32                bytes,
    428                                    OMX_U8                 *buffer);
    429 
    430     bool execute_omx_flush(OMX_U32);
    431     bool execute_output_flush(OMX_U32);
    432     bool execute_input_flush(OMX_U32);
    433     bool register_output_buffers();
    434     OMX_ERRORTYPE empty_buffer_done(OMX_HANDLETYPE hComp,
    435                                     OMX_BUFFERHEADERTYPE * buffer);
    436 
    437     OMX_ERRORTYPE fill_buffer_done(OMX_HANDLETYPE hComp,
    438                                     OMX_BUFFERHEADERTYPE * buffer);
    439     OMX_ERRORTYPE empty_this_buffer_proxy(OMX_HANDLETYPE       hComp,
    440                                         OMX_BUFFERHEADERTYPE *buffer);
    441 
    442     OMX_ERRORTYPE empty_this_buffer_proxy_arbitrary(OMX_HANDLETYPE hComp,
    443                                                    OMX_BUFFERHEADERTYPE *buffer
    444                                                    );
    445 
    446     OMX_ERRORTYPE push_input_buffer (OMX_HANDLETYPE hComp);
    447     OMX_ERRORTYPE push_input_sc_codec (OMX_HANDLETYPE hComp);
    448     OMX_ERRORTYPE push_input_h264 (OMX_HANDLETYPE hComp);
    449     OMX_ERRORTYPE push_input_vc1 (OMX_HANDLETYPE hComp);
    450 
    451     OMX_ERRORTYPE fill_this_buffer_proxy(OMX_HANDLETYPE       hComp,
    452                                        OMX_BUFFERHEADERTYPE *buffer);
    453     bool release_done();
    454 
    455     bool release_output_done();
    456     bool release_input_done();
    457 
    458     bool align_pmem_buffers(int pmem_fd, OMX_U32 buffer_size,
    459                             OMX_U32 alignment);
    460 
    461     OMX_ERRORTYPE send_command_proxy(OMX_HANDLETYPE  hComp,
    462                                      OMX_COMMANDTYPE cmd,
    463                                      OMX_U32         param1,
    464                                      OMX_PTR         cmdData);
    465     bool post_event( unsigned int p1,
    466                      unsigned int p2,
    467                      unsigned int id
    468                     );
    469     inline int clip2(int x)
    470     {
    471         x = x -1;
    472         x = x | x >> 1;
    473         x = x | x >> 2;
    474         x = x | x >> 4;
    475         x = x | x >> 16;
    476         x = x + 1;
    477         return x;
    478     }
    479 
    480     inline void omx_report_error ()
    481     {
    482         DEBUG_PRINT_ERROR("\nERROR: Sending OMX_EventError to Client");
    483         if (m_cb.EventHandler && !m_error_propogated)
    484         {
    485             m_error_propogated = true;
    486             m_cb.EventHandler(&m_cmp,m_app_data,
    487                   OMX_EventError,OMX_ErrorHardware,0,NULL);
    488         }
    489     }
    490 
    491 
    492     //*************************************************************
    493     //*******************MEMBER VARIABLES *************************
    494     //*************************************************************
    495     pthread_mutex_t       m_lock;
    496     //sem to handle the minimum procesing of commands
    497     sem_t                 m_cmd_lock;
    498     bool              m_error_propogated;
    499     // compression format
    500     OMX_VIDEO_CODINGTYPE eCompressionFormat;
    501     // OMX State
    502     OMX_STATETYPE m_state;
    503     // Application data
    504     OMX_PTR m_app_data;
    505     // Application callbacks
    506     OMX_CALLBACKTYPE m_cb;
    507     OMX_COLOR_FORMATTYPE  m_color_format;
    508     OMX_PRIORITYMGMTTYPE m_priority_mgm ;
    509     OMX_PARAM_BUFFERSUPPLIERTYPE m_buffer_supplier;
    510     // fill this buffer queue
    511     omx_cmd_queue         m_ftb_q;
    512     // Command Q for rest of the events
    513     omx_cmd_queue         m_cmd_q;
    514     omx_cmd_queue         m_etb_q;
    515     // Input memory pointer
    516     OMX_BUFFERHEADERTYPE  *m_inp_mem_ptr;
    517     // Output memory pointer
    518     OMX_BUFFERHEADERTYPE  *m_out_mem_ptr;
    519 
    520     bool input_flush_progress;
    521     bool output_flush_progress;
    522     bool input_use_buffer;
    523     bool output_use_buffer;
    524     int pending_input_buffers;
    525     int pending_output_buffers;
    526     int m_ineos_reached;
    527     int m_outeos_pending;
    528     int m_outeos_reached;
    529     // bitmask array size for output side
    530     unsigned int m_out_bm_count;
    531     // Number of Output Buffers
    532     unsigned int m_out_buf_count;
    533     unsigned int m_out_buf_count_min;
    534     unsigned int m_out_buf_size;
    535     // Number of Input Buffers
    536     unsigned int m_inp_buf_count;
    537     unsigned int m_inp_buf_count_min;
    538     // Size of Input Buffers
    539     unsigned int m_inp_buf_size;
    540     // bitmask array size for input side
    541     unsigned int m_inp_bm_count;
    542     //Input port Populated
    543     OMX_BOOL m_inp_bPopulated;
    544     //Output port Populated
    545     OMX_BOOL m_out_bPopulated;
    546     //Height
    547     unsigned int m_height;
    548     // Width
    549     unsigned int m_width;
    550     unsigned int stride;
    551     unsigned int scan_lines;
    552     // Storage of HxW during dynamic port reconfig
    553     unsigned int m_port_height;
    554     unsigned int m_port_width;
    555 
    556     unsigned int m_crop_x;
    557     unsigned int m_crop_y;
    558     unsigned int m_crop_dx;
    559     unsigned int m_crop_dy;
    560     // encapsulate the waiting states.
    561     unsigned int m_flags;
    562 
    563 #ifdef _ANDROID_
    564     // Heap pointer to frame buffers
    565     sp<MemoryHeapBase>    m_heap_ptr;
    566 #endif //_ANDROID_
    567     // store I/P PORT state
    568     OMX_BOOL m_inp_bEnabled;
    569     // store O/P PORT state
    570     OMX_BOOL m_out_bEnabled;
    571     // to know whether Event Port Settings change has been triggered or not.
    572     bool m_event_port_settings_sent;
    573     OMX_U8                m_cRole[OMX_MAX_STRINGNAME_SIZE];
    574     // Platform specific details
    575     OMX_QCOM_PLATFORM_PRIVATE_LIST      *m_platform_list;
    576     OMX_QCOM_PLATFORM_PRIVATE_ENTRY     *m_platform_entry;
    577     OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *m_pmem_info;
    578     // SPS+PPS sent as part of set_config
    579     OMX_VENDOR_EXTRADATATYPE            m_vendor_config;
    580 
    581     /*Variables for arbitrary Byte parsing support*/
    582     frame_parse m_frame_parser;
    583     omx_cmd_queue m_input_pending_q;
    584     omx_cmd_queue m_input_free_q;
    585     bool arbitrary_bytes;
    586     OMX_BUFFERHEADERTYPE  h264_scratch;
    587     OMX_BUFFERHEADERTYPE  *psource_frame;
    588     OMX_BUFFERHEADERTYPE  *pdest_frame;
    589     OMX_BUFFERHEADERTYPE  *m_inp_heap_ptr;
    590     OMX_BUFFERHEADERTYPE  **m_phdr_pmem_ptr;
    591     unsigned int m_heap_inp_bm_count;
    592     codec_type codec_type_parse;
    593     bool first_frame_meta;
    594     unsigned frame_count;
    595     unsigned nal_count;
    596     unsigned nal_length;
    597     bool look_ahead_nal;
    598     int first_frame;
    599     unsigned char *first_buffer;
    600     int first_frame_size;
    601     unsigned int mp4h263_flags;
    602     unsigned int mp4h263_timestamp;
    603     bool set_seq_header_done;
    604     bool gate_output_buffers;
    605     bool gate_input_buffers;
    606     bool sent_first_frame;
    607     unsigned int m_out_buf_count_recon;
    608     unsigned int m_out_buf_count_min_recon;
    609     unsigned int m_out_buf_size_recon;
    610     unsigned char m_hwdevice_name[80];
    611     FILE *m_device_file_ptr;
    612     enum vc1_profile_type m_vc1_profile;
    613 };
    614 
    615 #endif // __OMX_VDEC_H__
    616