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