Home | History | Annotate | Download | only in inc
      1 /*--------------------------------------------------------------------------
      2 Copyright (c) 2009, The Linux Foundation. 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 The Linux Foundation 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                             O p e n M A X   w r a p p e r s
     30                 O p e n  M A X   C o m p o n e n t  I n t e r f a c e
     31 
     32 *//** @file qc_omx_component.h
     33   This module contains the abstract interface for the OpenMAX components.
     34 
     35 *//*========================================================================*/
     36 
     37 #ifndef QC_OMX_COMPONENT_H
     38 #define QC_OMX_COMPONENT_H
     39 //////////////////////////////////////////////////////////////////////////////
     40 //                             Include Files
     41 //////////////////////////////////////////////////////////////////////////////
     42 #include "OMX_Core.h"
     43 #include "OMX_Component.h"
     44 
     45 class qc_omx_component
     46 {
     47 
     48 public:
     49   /* single member to hold the vtable */
     50   OMX_COMPONENTTYPE m_cmp;
     51 
     52 public:
     53 
     54   // this is critical, otherwise, sub class destructor will not be called
     55   virtual ~qc_omx_component(){}
     56 
     57   // Initialize the component after creation
     58   virtual OMX_ERRORTYPE component_init(OMX_IN OMX_STRING componentName)=0;
     59 
     60   /*******************************************************************/
     61   /*           Standard OpenMAX Methods                              */
     62   /*******************************************************************/
     63 
     64   // Query the component for its information
     65   virtual
     66   OMX_ERRORTYPE  get_component_version(OMX_HANDLETYPE       cmp_handle,
     67                                        OMX_STRING             cmp_name,
     68                                        OMX_VERSIONTYPE*    cmp_version,
     69                                        OMX_VERSIONTYPE*   spec_version,
     70                                        OMX_UUIDTYPE*          cmp_UUID)=0;
     71 
     72   // Invoke a command on the component
     73   virtual
     74   OMX_ERRORTYPE  send_command(OMX_HANDLETYPE cmp_handle,
     75                               OMX_COMMANDTYPE       cmd,
     76                               OMX_U32            param1,
     77                               OMX_PTR          cmd_data)=0;
     78 
     79   // Get a Parameter setting from the component
     80   virtual
     81   OMX_ERRORTYPE  get_parameter(OMX_HANDLETYPE     cmp_handle,
     82                                OMX_INDEXTYPE     param_index,
     83                                OMX_PTR            param_data)=0;
     84 
     85   // Send a parameter structure to the component
     86   virtual
     87   OMX_ERRORTYPE  set_parameter(OMX_HANDLETYPE     cmp_handle,
     88                                OMX_INDEXTYPE     param_index,
     89                                OMX_PTR            param_data)=0;
     90 
     91   // Get a configuration structure from the component
     92   virtual
     93   OMX_ERRORTYPE  get_config(OMX_HANDLETYPE      cmp_handle,
     94                             OMX_INDEXTYPE     config_index,
     95                             OMX_PTR            config_data)=0;
     96 
     97   // Set a component configuration value
     98   virtual
     99   OMX_ERRORTYPE  set_config(OMX_HANDLETYPE      cmp_handle,
    100                             OMX_INDEXTYPE     config_index,
    101                             OMX_PTR            config_data)=0;
    102 
    103   // Translate the vendor specific extension string to
    104   // standardized index type
    105   virtual
    106   OMX_ERRORTYPE  get_extension_index(OMX_HANDLETYPE  cmp_handle,
    107                                      OMX_STRING       paramName,
    108                                      OMX_INDEXTYPE*   indexType)=0;
    109 
    110   // Get Current state information
    111   virtual
    112   OMX_ERRORTYPE  get_state(OMX_HANDLETYPE  cmp_handle,
    113                            OMX_STATETYPE*       state)=0;
    114 
    115   // Component Tunnel Request
    116   virtual
    117   OMX_ERRORTYPE  component_tunnel_request(OMX_HANDLETYPE           cmp_handle,
    118                                           OMX_U32                        port,
    119                                           OMX_HANDLETYPE       peer_component,
    120                                           OMX_U32                   peer_port,
    121                                           OMX_TUNNELSETUPTYPE*   tunnel_setup)=0;
    122 
    123   // Use a buffer already allocated by the IL client
    124   // or a buffer already supplied by a tunneled component
    125   virtual
    126   OMX_ERRORTYPE  use_buffer(OMX_HANDLETYPE                cmp_handle,
    127                             OMX_BUFFERHEADERTYPE**        buffer_hdr,
    128                             OMX_U32                             port,
    129                             OMX_PTR                         app_data,
    130                             OMX_U32                            bytes,
    131                             OMX_U8*                           buffer)=0;
    132 
    133 
    134   // Request that the component allocate new buffer and associated header
    135   virtual
    136   OMX_ERRORTYPE  allocate_buffer(OMX_HANDLETYPE                cmp_handle,
    137                                  OMX_BUFFERHEADERTYPE**        buffer_hdr,
    138                                  OMX_U32                             port,
    139                                  OMX_PTR                         app_data,
    140                                  OMX_U32                            bytes)=0;
    141 
    142   // Release the buffer and associated header from the component
    143   virtual
    144   OMX_ERRORTYPE  free_buffer(OMX_HANDLETYPE         cmp_handle,
    145                              OMX_U32                      port,
    146                              OMX_BUFFERHEADERTYPE*      buffer)=0;
    147 
    148   // Send a filled buffer to an input port of a component
    149   virtual
    150   OMX_ERRORTYPE  empty_this_buffer(OMX_HANDLETYPE         cmp_handle,
    151                                    OMX_BUFFERHEADERTYPE*      buffer)=0;
    152 
    153   // Send an empty buffer to an output port of a component
    154   virtual
    155   OMX_ERRORTYPE  fill_this_buffer(OMX_HANDLETYPE         cmp_handle,
    156                                   OMX_BUFFERHEADERTYPE*      buffer)=0;
    157 
    158   // Set callbacks
    159   virtual
    160   OMX_ERRORTYPE  set_callbacks( OMX_HANDLETYPE        cmp_handle,
    161                                 OMX_CALLBACKTYPE*      callbacks,
    162                                 OMX_PTR                 app_data)=0;
    163 
    164   // Component De-Initialize
    165   virtual
    166   OMX_ERRORTYPE  component_deinit( OMX_HANDLETYPE cmp_handle)=0;
    167 
    168   // Use the Image already allocated via EGL
    169   virtual
    170   OMX_ERRORTYPE  use_EGL_image(OMX_HANDLETYPE                cmp_handle,
    171                                OMX_BUFFERHEADERTYPE**        buffer_hdr,
    172                                OMX_U32                             port,
    173                                OMX_PTR                         app_data,
    174                                void*                          egl_image)=0;
    175 
    176   // Component Role enum
    177   virtual
    178   OMX_ERRORTYPE  component_role_enum( OMX_HANDLETYPE cmp_handle,
    179                                       OMX_U8*              role,
    180                                       OMX_U32             index)=0;
    181 
    182 };
    183 #endif /* QC_OMX_COMPONENT_H */
    184