Home | History | Annotate | Download | only in qomx_core
      1 /*Copyright (c) 2012, 2016, The Linux Foundation. All rights reserved.
      2 
      3 Redistribution and use in source and binary forms, with or without
      4 modification, are permitted provided that the following conditions are
      5 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
      9       copyright notice, this list of conditions and the following
     10       disclaimer in the documentation and/or other materials provided
     11       with the distribution.
     12     * Neither the name of The Linux Foundation nor the names of its
     13       contributors may be used to endorse or promote products derived
     14       from this software without specific prior written permission.
     15 
     16 THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
     17 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
     19 ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
     20 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
     23 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     24 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
     25 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
     26 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
     27 
     28 #ifndef QOMX_CORE_H
     29 #define QOMX_CORE_H
     30 
     31 // To remove (after PanoNative is updated)
     32 #include <string.h>
     33 
     34 // System dependencies
     35 #include <pthread.h>
     36 
     37 // OpenMAX dependencies
     38 #include "OMX_Component.h"
     39 
     40 #define TRUE 1
     41 #define FALSE 0
     42 #define OMX_COMP_MAX_INSTANCES 3
     43 #define OMX_CORE_MAX_ROLES 1
     44 #define OMX_COMP_MAX_NUM 5
     45 #define OMX_SPEC_VERSION 0x00000101
     46 
     47 typedef void *(*get_instance_t)(void);
     48 typedef void *(*create_comp_func_t)(OMX_PTR aobj);
     49 
     50 /** comp_info_t: Structure containing the mapping
     51 *    between the library name and the corresponding .so name
     52 *    @comp_name: name of the component
     53      @lib_name: Name of the .so library
     54 **/
     55 typedef struct comp_info_t {
     56   char *comp_name;
     57   char *lib_name;
     58 } comp_info_t;
     59 
     60 /** omx_core_component_t: OMX Component structure
     61 *    @handle: array of number of instances of the component
     62 *    @roles: array of roles played by the component
     63 *    @comp_info: Component information such as libname,
     64 *              component name
     65 *    @open: Is the component active
     66 *    @lib_handle: Library handle after dlopen
     67 *    @obj_ptr: Function ptr to get the instance of the component
     68 *    @comp_func_ptr: Function ptr to map the functions in the
     69 *     OMX handle to its respective function implementation in
     70 *     the component
     71 **/
     72 typedef struct _omx_core_component_t {
     73   OMX_HANDLETYPE *handle[OMX_COMP_MAX_INSTANCES];  //Instance handle
     74   char *roles[OMX_CORE_MAX_ROLES];  //Roles played by the component
     75   char *name;  //Component Name
     76   uint8_t open;  //Is component active
     77   void *lib_handle;
     78   get_instance_t get_instance;
     79   create_comp_func_t create_comp_func;
     80   char *comp_name;
     81   char *lib_name;
     82 } omx_core_component_t;
     83 
     84 /** omx_core_t: Global structure that contains all the active
     85 *   components
     86 *    @component: array of active components
     87 *    @is_initialized: Flag to check if the OMX core has been
     88 *    initialized
     89 *    @core_lock: Lock to syncronize the omx core operations
     90 **/
     91 typedef struct _omx_core_t {
     92   omx_core_component_t component[OMX_COMP_MAX_NUM];  //Array of pointers to components
     93   int comp_cnt;
     94   pthread_mutex_t core_lock;
     95 } omx_core_t;
     96 
     97 #endif
     98