Index: Makefile
===================================================================
--- Makefile (nonexistent)
+++ Makefile (revision 5)
@@ -0,0 +1,56 @@
+
+COMPONENT_TARGETS = $(HARDWARE_NOARCH)
+
+
+include ../../../../../build-system/constants.mk
+
+
+url = $(DOWNLOAD_SERVER)/sources/packages/m/OpenMAX/libomxil-bellagio
+
+versions = 0.9.3
+pkgname = libomxil-bellagio
+suffix = tar.gz
+
+tarballs = $(addsuffix .$(suffix), $(addprefix $(pkgname)-, $(versions)))
+sha1s = $(addsuffix .sha1sum, $(tarballs))
+
+patches = $(CURDIR)/patches/libomxil-bellagio-0.9.3.patch
+
+.NOTPARALLEL: $(patches)
+
+
+BUILD_TARGETS = $(tarballs) $(sha1s) $(patches)
+
+
+include ../../../../../build-system/core.mk
+
+
+.PHONY: download_clean
+
+
+$(tarballs):
+ @echo -e "\n======= Downloading source tarballs =======" ; \
+ for tarball in $(tarballs) ; do \
+ echo "$(url)/$$tarball" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & \
+ done ; wait
+
+$(sha1s): $(tarballs)
+ @for sha in $@ ; do \
+ echo -e "\n======= Downloading '$$sha' signature =======\n" ; \
+ echo "$(url)/$$sha" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & wait %1 ; \
+ touch $$sha ; \
+ echo -e "\n======= Check the '$$sha' sha1sum =======\n" ; \
+ sha1sum --check $$sha ; ret="$$?" ; \
+ if [ "$$ret" == "1" ]; then \
+ echo -e "\n======= ERROR: Bad '$$sha' sha1sum =======\n" ; \
+ exit 1 ; \
+ fi ; \
+ done
+
+$(patches): $(sha1s)
+ @echo -e "\n======= Create Patches =======\n" ; \
+ ( cd create-0.9.3-patch ; ./create.patch.sh ) ; \
+ echo -e "\n"
+
+download_clean:
+ @rm -f $(tarballs) $(sha1s) $(patches)
Index: create-0.9.3-patch/create.patch.sh
===================================================================
--- create-0.9.3-patch/create.patch.sh (nonexistent)
+++ create-0.9.3-patch/create.patch.sh (revision 5)
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+VERSION=0.9.3
+
+tar --files-from=file.list -xzvf ../libomxil-bellagio-$VERSION.tar.gz
+mv libomxil-bellagio-$VERSION libomxil-bellagio-$VERSION-orig
+
+cp -rf ./libomxil-bellagio-$VERSION-new ./libomxil-bellagio-$VERSION
+
+diff --unified -Nr libomxil-bellagio-$VERSION-orig libomxil-bellagio-$VERSION > libomxil-bellagio-$VERSION.patch
+
+mv libomxil-bellagio-$VERSION.patch ../patches
+
+rm -rf ./libomxil-bellagio-$VERSION
+rm -rf ./libomxil-bellagio-$VERSION-orig
Property changes on: create-0.9.3-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: create-0.9.3-patch/file.list
===================================================================
--- create-0.9.3-patch/file.list (nonexistent)
+++ create-0.9.3-patch/file.list (revision 5)
@@ -0,0 +1,8 @@
+libomxil-bellagio-0.9.3/Makefile.am
+libomxil-bellagio-0.9.3/configure.ac
+libomxil-bellagio-0.9.3/include/OMX_Types.h
+libomxil-bellagio-0.9.3/src/Makefile.am
+libomxil-bellagio-0.9.3/src/base/omx_base_component.c
+libomxil-bellagio-0.9.3/src/dynamic_loader/Makefile.am
+libomxil-bellagio-0.9.3/src/omx_reference_resource_manager.c
+libomxil-bellagio-0.9.3/src/omxregister.c
Index: create-0.9.3-patch/libomxil-bellagio-0.9.3-new/Makefile.am
===================================================================
--- create-0.9.3-patch/libomxil-bellagio-0.9.3-new/Makefile.am (nonexistent)
+++ create-0.9.3-patch/libomxil-bellagio-0.9.3-new/Makefile.am (revision 5)
@@ -0,0 +1,15 @@
+SUBDIRS = src include test m4 doc
+
+ACLOCAL_AMFLAGS = -I m4
+
+EXTRA_DIST = libomxil-bellagio.spec
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libomxil-bellagio.pc
+
+doc_DATA = README \
+ ChangeLog \
+ TODO
+
+uninstall-local:
+ rm -rf $(plugindir)
Index: create-0.9.3-patch/libomxil-bellagio-0.9.3-new/configure.ac
===================================================================
--- create-0.9.3-patch/libomxil-bellagio-0.9.3-new/configure.ac (nonexistent)
+++ create-0.9.3-patch/libomxil-bellagio-0.9.3-new/configure.ac (revision 5)
@@ -0,0 +1,251 @@
+AC_INIT([OpenMAX Bellagio], [0.9.3], [giulio.urlini@st.com], [libomxil-bellagio])
+AM_INIT_AUTOMAKE()
+
+# Prerequisite autoconf version
+AC_PREREQ([2.59])
+
+AC_CONFIG_HEADERS([config.h])
+CFLAGS="${CFLAGS} -Wall"
+
+################################################################################
+# Set the shared versioning info, according to section 6.3 of the libtool info #
+# pages. CURRENT:REVISION:AGE must be updated immediately before each release: #
+# #
+# * If the library source code has changed at all since the last #
+# update, then increment REVISION (`C:R:A' becomes `C:r+1:A'). #
+# #
+# * If any interfaces have been added, removed, or changed since the #
+# last update, increment CURRENT, and set REVISION to 0. #
+# #
+# * If any interfaces have been added since the last public release, #
+# then increment AGE. #
+# #
+# * If any interfaces have been removed since the last public release, #
+# then set AGE to 0. #
+# #
+################################################################################
+SHARED_VERSION_INFO="0:0:0"
+AC_SUBST(SHARED_VERSION_INFO)
+
+# Check if the OMX_Core.h file is present
+AC_CONFIG_SRCDIR([include/OMX_Core.h])
+
+# Set to 'm4' the directory where the extra autoconf macros are stored
+AC_CONFIG_MACRO_DIR([m4])
+
+AC_CONFIG_FILES([
+ Makefile
+ libomxil-bellagio.pc
+ libomxil-bellagio.spec
+ doc/Doxyfile
+ doc/footer_SF.html
+ doc/omxregister-bellagio.1
+ doc/Makefile
+ include/Makefile
+ src/Makefile
+ src/base/Makefile
+ src/core_extensions/Makefile
+ src/components/Makefile
+ src/components/audio_effects/Makefile
+ src/components/clocksrc/Makefile
+ src/components/videoscheduler/Makefile
+ src/dynamic_loader/Makefile
+ m4/Makefile
+ test/Makefile
+ test/components/Makefile
+ test/components/common/Makefile
+ test/components/audio_effects/Makefile
+ test/components/resource_manager/Makefile
+])
+################################################################################
+# Define the extra arguments the user can pass to the configure script #
+################################################################################
+
+# Check whether volume/mixer components has been requested
+AC_ARG_ENABLE(
+ [audioeffects],
+ [AC_HELP_STRING(
+ [--disable-audioeffects],
+ [whether to disable the audio effects components compilation])],
+ [with_audioeffects=$enableval],
+ [with_audioeffects=yes])
+
+#Check whether clock component has been requested
+AC_ARG_ENABLE(
+ [clocksrc],
+ [AC_HELP_STRING(
+ [--disable-clocksrc],
+ [whether to disable the clocksrc compilation])],
+ [with_clocksrc=$enableval],
+ [with_clocksrc=yes]) dnl default
+
+#Check whether xvideosink component has been requested
+AC_ARG_ENABLE(
+ [videoscheduler],
+ [AC_HELP_STRING(
+ [--disable-videoscheduler],
+ [whether to disable the video scheduler component])],
+ [with_videoscheduler=$enableval],
+ [with_videoscheduler=yes])
+
+#Check whether to disable all components
+AC_ARG_ENABLE(
+ [components],
+ [AC_HELP_STRING(
+ [--disable-components],
+ [whether to disable all the components])],
+ [with_components=$enableval],
+ [with_components=yes])
+
+#Check whether to create documentation
+AC_ARG_ENABLE(
+ [doc],
+ [AC_HELP_STRING(
+ [--disable-doc],
+ [whether to enable documentation generation])],
+ [with_doc=$enableval],
+ [with_doc=yes])
+
+AC_ARG_ENABLE(
+ [debug],
+ [AC_HELP_STRING(
+ [--enable-debug],
+ [whether to enable an x debug level])],
+ [with_debug_level=$enableval],
+ [with_debug_level=no])
+
+AC_ARG_ENABLE(
+ [android],
+ [AC_HELP_STRING(
+ [--enable-android],
+ [whether to enable android compilation])],
+ [with_android=$enableval],
+ [with_android=no])
+
+################################################################################
+# Check for programs #
+################################################################################
+
+# Check for a working C compiler
+AC_PROG_CXX
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+
+# Check for libtool
+AM_PROG_LIBTOOL
+
+# Check for doxygen
+AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
+AM_CONDITIONAL(HAVE_DOXYGEN,($HAVE_DOXYGEN) && (test x$with_doc = xyes))
+if (test $HAVE_DOXYGEN = "false"); then
+ AC_MSG_WARN([*** doxygen not found, docs will not be built])
+fi
+
+################################################################################
+# Check for libraries #
+################################################################################
+
+AC_CHECK_LIB([pthread], [pthread_create])
+
+# Check for libdl
+AC_SEARCH_LIBS([dlopen], [dl], [], [AC_MSG_ERROR([libdl is required])])
+
+if test "x$with_components" = "xno"; then
+ with_audioeffects=no
+ with_clocksrc=no
+ with_videoscheduler=no
+fi
+
+# Define components default ldflags (man ld)
+PLUGIN_LDFLAGS="-module -avoid-version -no-undefined -as-needed"
+AC_SUBST(PLUGIN_LDFLAGS)
+
+AX_SET_PLUGINDIR
+
+CFG_DEBUG_LEVEL=0
+# Define debug messages level
+if test "x$with_debug_level" = "xno"; then
+ CFG_DEBUG_LEVEL=0
+fi
+if test "x$with_debug_level" = "xyes"; then
+ CFG_DEBUG_LEVEL=255
+fi
+if test "x$with_debug_level" = "x1"; then
+ CFG_DEBUG_LEVEL=2
+fi
+if test "x$with_debug_level" = "x2"; then
+ CFG_DEBUG_LEVEL=4
+fi
+if test "x$with_debug_level" = "x3"; then
+ CFG_DEBUG_LEVEL=8
+fi
+if test "x$with_debug_level" = "x4"; then
+ CFG_DEBUG_LEVEL=16
+fi
+if test "x$with_debug_level" = "x5"; then
+ CFG_DEBUG_LEVEL=32
+fi
+if test "x$with_debug_level" = "x6"; then
+ CFG_DEBUG_LEVEL=255
+fi
+
+AC_SUBST(CFG_DEBUG_LEVEL)
+CFLAGS="${CFLAGS} -DCONFIG_DEBUG_LEVEL=$CFG_DEBUG_LEVEL"
+
+if test "x$with_android" = "xyes"; then
+ CFLAGS="${CFLAGS} -DANDROID_COMPILATION"
+fi
+################################################################################
+# Check for header files #
+################################################################################
+
+AC_CHECK_HEADERS([fcntl.h malloc.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/socket.h sys/time.h unistd.h])
+
+################################################################################
+# Check for pkg-config modules #
+################################################################################
+
+################################################################################
+# Check for types #
+################################################################################
+
+AC_TYPE_SIZE_T
+
+################################################################################
+# Check for structures #
+################################################################################
+
+# unused
+
+################################################################################
+# Check for compiler characteristics #
+################################################################################
+
+# unused
+
+################################################################################
+# Check for library functions #
+################################################################################
+
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+AC_CHECK_FUNCS([gethostbyname gettimeofday memset mkdir socket strdup strerror strndup strrchr])
+
+################################################################################
+# Check for system services #
+################################################################################
+
+# unused
+
+################################################################################
+# Conditionals and file output #
+################################################################################
+AM_CONDITIONAL([WITH_AUDIOEFFECTS], [test x$with_audioeffects = xyes])
+AM_CONDITIONAL([WITH_CLOCKSRC], [test x$with_clocksrc = xyes])
+AM_CONDITIONAL([WITH_VIDEOSCHEDULER],[test x$with_videoscheduler = xyes])
+
+AC_OUTPUT
Index: create-0.9.3-patch/libomxil-bellagio-0.9.3-new/include/OMX_Types.h
===================================================================
--- create-0.9.3-patch/libomxil-bellagio-0.9.3-new/include/OMX_Types.h (nonexistent)
+++ create-0.9.3-patch/libomxil-bellagio-0.9.3-new/include/OMX_Types.h (revision 5)
@@ -0,0 +1,359 @@
+/*
+ * Copyright (c) 2008 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+/** OMX_Types.h - OpenMax IL version 1.1.2
+ * The OMX_Types header file contains the primitive type definitions used by
+ * the core, the application and the component. This file may need to be
+ * modified to be used on systems that do not have "char" set to 8 bits,
+ * "short" set to 16 bits and "long" set to 32 bits.
+ */
+
+#ifndef OMX_Types_h
+#define OMX_Types_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** The OMX_API and OMX_APIENTRY are platform specific definitions used
+ * to declare OMX function prototypes. They are modified to meet the
+ * requirements for a particular platform */
+#ifdef __SYMBIAN32__
+# ifdef __OMX_EXPORTS
+# define OMX_API __declspec(dllexport)
+# else
+# ifdef _WIN32
+# define OMX_API __declspec(dllexport)
+# else
+# define OMX_API __declspec(dllimport)
+# endif
+# endif
+#else
+# ifdef _WIN32
+# ifdef __OMX_EXPORTS
+# define OMX_API __declspec(dllexport)
+# else
+# define OMX_API __declspec(dllimport)
+# endif
+# else
+# ifdef __OMX_EXPORTS
+# define OMX_API
+# else
+# define OMX_API extern
+# endif
+# endif
+#endif
+
+#ifndef OMX_APIENTRY
+#define OMX_APIENTRY
+#endif
+
+/** OMX_IN is used to identify inputs to an OMX function. This designation
+ will also be used in the case of a pointer that points to a parameter
+ that is used as an output. */
+#ifndef OMX_IN
+#define OMX_IN
+#endif
+
+/** OMX_OUT is used to identify outputs from an OMX function. This
+ designation will also be used in the case of a pointer that points
+ to a parameter that is used as an input. */
+#ifndef OMX_OUT
+#define OMX_OUT
+#endif
+
+
+/** OMX_INOUT is used to identify parameters that may be either inputs or
+ outputs from an OMX function at the same time. This designation will
+ also be used in the case of a pointer that points to a parameter that
+ is used both as an input and an output. */
+#ifndef OMX_INOUT
+#define OMX_INOUT
+#endif
+
+/** OMX_ALL is used to as a wildcard to select all entities of the same type
+ * when specifying the index, or referring to a object by an index. (i.e.
+ * use OMX_ALL to indicate all N channels). When used as a port index
+ * for a config or parameter this OMX_ALL denotes that the config or
+ * parameter applies to the entire component not just one port. */
+#define OMX_ALL 0xFFFFFFFF
+
+/** In the following we define groups that help building doxygen documentation */
+
+/** @defgroup core OpenMAX IL core
+ * Functions and structure related to the OMX IL core
+ */
+
+ /** @defgroup comp OpenMAX IL component
+ * Functions and structure related to the OMX IL component
+ */
+
+/** @defgroup rpm Resource and Policy Management
+ * Structures for resource and policy management of components
+ */
+
+/** @defgroup buf Buffer Management
+ * Buffer handling functions and structures
+ */
+
+/** @defgroup tun Tunneling
+ * @ingroup core comp
+ * Structures and functions to manage tunnels among component ports
+ */
+
+/** @defgroup cp Content Pipes
+ * @ingroup core
+ */
+
+ /** @defgroup metadata Metadata handling
+ *
+ */
+
+/** OMX_U8 is an 8 bit unsigned quantity that is byte aligned */
+typedef unsigned char OMX_U8;
+
+/** OMX_S8 is an 8 bit signed quantity that is byte aligned */
+typedef signed char OMX_S8;
+
+/** OMX_U16 is a 16 bit unsigned quantity that is 16 bit word aligned */
+typedef unsigned short OMX_U16;
+
+/** OMX_S16 is a 16 bit signed quantity that is 16 bit word aligned */
+typedef signed short OMX_S16;
+
+/** OMX_U32 is a 32 bit unsigned quantity that is 32 bit word aligned */
+typedef unsigned long OMX_U32;
+
+/** OMX_S32 is a 32 bit signed quantity that is 32 bit word aligned */
+typedef signed long OMX_S32;
+
+
+/* Users with compilers that cannot accept the "long long" designation should
+ define the OMX_SKIP64BIT macro. It should be noted that this may cause
+ some components to fail to compile if the component was written to require
+ 64 bit integral types. However, these components would NOT compile anyway
+ since the compiler does not support the way the component was written.
+*/
+#ifndef OMX_SKIP64BIT
+#ifdef __SYMBIAN32__
+/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
+typedef unsigned long long OMX_U64;
+
+/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
+typedef signed long long OMX_S64;
+
+#elif defined(WIN32)
+
+/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
+typedef unsigned __int64 OMX_U64;
+
+/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
+typedef signed __int64 OMX_S64;
+
+#else /* WIN32 */
+
+/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
+typedef unsigned long long OMX_U64;
+
+/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
+typedef signed long long OMX_S64;
+
+#endif /* WIN32 */
+#endif
+
+
+/** The OMX_BOOL type is intended to be used to represent a true or a false
+ value when passing parameters to and from the OMX core and components. The
+ OMX_BOOL is a 32 bit quantity and is aligned on a 32 bit word boundary.
+ */
+typedef enum OMX_BOOL {
+ OMX_FALSE = 0,
+ OMX_TRUE = !OMX_FALSE,
+ OMX_BOOL_MAX = 0x7FFFFFFF
+} OMX_BOOL;
+
+/** The OMX_PTR type is intended to be used to pass pointers between the OMX
+ applications and the OMX Core and components. This is a 32 bit pointer and
+ is aligned on a 32 bit boundary.
+ */
+typedef void* OMX_PTR;
+
+/** The OMX_STRING type is intended to be used to pass "C" type strings between
+ the application and the core and component. The OMX_STRING type is a 32
+ bit pointer to a zero terminated string. The pointer is word aligned and
+ the string is byte aligned.
+ */
+typedef char* OMX_STRING;
+
+/** The OMX_BYTE type is intended to be used to pass arrays of bytes such as
+ buffers between the application and the component and core. The OMX_BYTE
+ type is a 32 bit pointer to a zero terminated string. The pointer is word
+ aligned and the string is byte aligned.
+ */
+typedef unsigned char* OMX_BYTE;
+
+/** OMX_UUIDTYPE is a very long unique identifier to uniquely identify
+ at runtime. This identifier should be generated by a component in a way
+ that guarantees that every instance of the identifier running on the system
+ is unique. */
+typedef unsigned char OMX_UUIDTYPE[128];
+
+/** The OMX_DIRTYPE enumeration is used to indicate if a port is an input or
+ an output port. This enumeration is common across all component types.
+ */
+typedef enum OMX_DIRTYPE
+{
+ OMX_DirInput, /**< Port is an input port */
+ OMX_DirOutput, /**< Port is an output port */
+ OMX_DirMax = 0x7FFFFFFF
+} OMX_DIRTYPE;
+
+/** The OMX_ENDIANTYPE enumeration is used to indicate the bit ordering
+ for numerical data (i.e. big endian, or little endian).
+ */
+typedef enum OMX_ENDIANTYPE
+{
+ OMX_EndianBig, /**< big endian */
+ OMX_EndianLittle, /**< little endian */
+ OMX_EndianMax = 0x7FFFFFFF
+} OMX_ENDIANTYPE;
+
+
+/** The OMX_NUMERICALDATATYPE enumeration is used to indicate if data
+ is signed or unsigned
+ */
+typedef enum OMX_NUMERICALDATATYPE
+{
+ OMX_NumericalDataSigned, /**< signed data */
+ OMX_NumericalDataUnsigned, /**< unsigned data */
+ OMX_NumercialDataMax = 0x7FFFFFFF
+} OMX_NUMERICALDATATYPE;
+
+
+/** Unsigned bounded value type */
+typedef struct OMX_BU32 {
+ OMX_U32 nValue; /**< actual value */
+ OMX_U32 nMin; /**< minimum for value (i.e. nValue >= nMin) */
+ OMX_U32 nMax; /**< maximum for value (i.e. nValue <= nMax) */
+} OMX_BU32;
+
+
+/** Signed bounded value type */
+typedef struct OMX_BS32 {
+ OMX_S32 nValue; /**< actual value */
+ OMX_S32 nMin; /**< minimum for value (i.e. nValue >= nMin) */
+ OMX_S32 nMax; /**< maximum for value (i.e. nValue <= nMax) */
+} OMX_BS32;
+
+
+/** Structure representing some time or duration in microseconds. This structure
+ * must be interpreted as a signed 64 bit value. The quantity is signed to accommodate
+ * negative deltas and preroll scenarios. The quantity is represented in microseconds
+ * to accomodate high resolution timestamps (e.g. DVD presentation timestamps based
+ * on a 90kHz clock) and to allow more accurate and synchronized delivery (e.g.
+ * individual audio samples delivered at 192 kHz). The quantity is 64 bit to
+ * accommodate a large dynamic range (signed 32 bit values would allow only for plus
+ * or minus 35 minutes).
+ *
+ * Implementations with limited precision may convert the signed 64 bit value to
+ * a signed 32 bit value internally but risk loss of precision.
+ */
+#ifndef OMX_SKIP64BIT
+typedef OMX_S64 OMX_TICKS;
+#else
+typedef struct OMX_TICKS
+{
+ OMX_U32 nLowPart; /** low bits of the signed 64 bit tick value */
+ OMX_U32 nHighPart; /** high bits of the signed 64 bit tick value */
+} OMX_TICKS;
+#endif
+#define OMX_TICKS_PER_SECOND 1000000
+
+/** Define the public interface for the OMX Handle. The core will not use
+ this value internally, but the application should only use this value.
+ */
+typedef void* OMX_HANDLETYPE;
+
+typedef struct OMX_MARKTYPE
+{
+ OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will
+ generate a mark event upon
+ processing the mark. */
+ OMX_PTR pMarkData; /**< Application specific data associated with
+ the mark sent on a mark event to disambiguate
+ this mark from others. */
+} OMX_MARKTYPE;
+
+
+/** OMX_NATIVE_DEVICETYPE is used to map a OMX video port to the
+ * platform & operating specific object used to reference the display
+ * or can be used by a audio port for native audio rendering */
+typedef void* OMX_NATIVE_DEVICETYPE;
+
+/** OMX_NATIVE_WINDOWTYPE is used to map a OMX video port to the
+ * platform & operating specific object used to reference the window */
+typedef void* OMX_NATIVE_WINDOWTYPE;
+
+
+/** Define the OMX IL version that corresponds to this set of header files.
+ * We also define a combined version that can be used to write or compare
+ * values of the 32bit nVersion field, assuming a little endian architecture */
+#define OMX_VERSION_MAJOR 1
+#define OMX_VERSION_MINOR 1
+#define OMX_VERSION_REVISION 2
+#define OMX_VERSION_STEP 0
+
+#define OMX_VERSION ((OMX_VERSION_STEP<<24) | (OMX_VERSION_REVISION<<16) | (OMX_VERSION_MINOR<<8) | OMX_VERSION_MAJOR)
+
+
+/** The OMX_VERSIONTYPE union is used to specify the version for
+ a structure or component. For a component, the version is entirely
+ specified by the component vendor. Components doing the same function
+ from different vendors may or may not have the same version. For
+ structures, the version shall be set by the entity that allocates the
+ structure. For structures specified in the OMX 1.1 specification, the
+ value of the version shall be set to 1.1.0.0 in all cases. Access to the
+ OMX_VERSIONTYPE can be by a single 32 bit access (e.g. by nVersion) or
+ by accessing one of the structure elements to, for example, check only
+ the Major revision.
+ */
+typedef union OMX_VERSIONTYPE
+{
+ struct
+ {
+ OMX_U8 nVersionMajor; /**< Major version accessor element */
+ OMX_U8 nVersionMinor; /**< Minor version accessor element */
+ OMX_U8 nRevision; /**< Revision version accessor element */
+ OMX_U8 nStep; /**< Step version accessor element */
+ } s;
+ OMX_U32 nVersion; /**< 32 bit value to make accessing the
+ version easily done in a single word
+ size copy/compare operation */
+} OMX_VERSIONTYPE;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+/* File EOF */
Index: create-0.9.3-patch/libomxil-bellagio-0.9.3-new/include
===================================================================
--- create-0.9.3-patch/libomxil-bellagio-0.9.3-new/include (nonexistent)
+++ create-0.9.3-patch/libomxil-bellagio-0.9.3-new/include (revision 5)
Property changes on: create-0.9.3-patch/libomxil-bellagio-0.9.3-new/include
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/Makefile.am
===================================================================
--- create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/Makefile.am (nonexistent)
+++ create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/Makefile.am (revision 5)
@@ -0,0 +1,59 @@
+# Build order is important
+# First base, then core, finally components
+
+SUBDIRS = base core_extensions . components dynamic_loader
+
+bin_PROGRAMS = omxregister-bellagio
+omxregister_bellagio_SOURCES = omxregister.c common.c common.h
+omxregister_bellagio_CFLAGS = -DOMXILCOMPONENTSPATH=\"$(plugindir)/\" \
+ -I$(top_srcdir)/include
+omxregister_bellagio_LDFLAGS = -lomxil-bellagio -L$(builddir)
+omxregister_bellagio_DEPENDENCIES = libomxil-bellagio.la
+
+lib_LTLIBRARIES = libomxil-bellagio.la
+libomxil_bellagio_la_SOURCES = component_loader.h \
+ st_static_component_loader.c st_static_component_loader.h \
+ omxcore.c omxcore.h \
+ omx_create_loaders_linux.c omx_create_loaders.h \
+ omx_comp_debug_levels.h \
+ extension_struct.h \
+ tsemaphore.c tsemaphore.h \
+ queue.c queue.h \
+ utils.c utils.h \
+ common.c common.h \
+ content_pipe_inet.c content_pipe_inet.h \
+ content_pipe_file.c content_pipe_file.h \
+ omx_reference_resource_manager.c \
+ omx_reference_resource_manager.h
+
+libomxil_bellagio_la_CFLAGS = -I$(top_srcdir)/include -I$(srcdir)/base -I$(srcdir)/core_extensions \
+ -DINSTALL_PATH_STR=\"$(plugindir)\" -DOMX_LOADERS_DIRNAME=\"$(libdir)/omxloaders\/\"
+libomxil_bellagio_la_LIBADD = base/libomxbase.la core_extensions/libomxcoreext.la -lpthread
+libomxil_bellagio_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
+
+include_extradir = $(includedir)/bellagio
+
+include_extra_HEADERS = $(srcdir)/omxcore.h \
+ $(srcdir)/queue.h \
+ $(srcdir)/utils.h \
+ $(srcdir)/component_loader.h \
+ $(srcdir)/st_static_component_loader.h \
+ $(srcdir)/tsemaphore.h \
+ $(srcdir)/omx_comp_debug_levels.h \
+ $(srcdir)/common.h \
+ $(srcdir)/omx_reference_resource_manager.h \
+ $(srcdir)/base/omx_base_component.h \
+ $(srcdir)/base/omx_base_port.h \
+ $(srcdir)/base/omx_base_audio_port.h \
+ $(srcdir)/base/omx_base_video_port.h \
+ $(srcdir)/base/omx_base_filter.h \
+ $(srcdir)/base/omx_base_sink.h \
+ $(srcdir)/base/omx_base_source.h \
+ $(srcdir)/base/omx_classmagic.h \
+ $(srcdir)/base/omx_base_clock_port.h \
+ $(srcdir)/base/omx_base_image_port.h \
+ $(srcdir)/extension_struct.h \
+ $(srcdir)/base/OMXComponentRMExt.h \
+ $(srcdir)/core_extensions/OMXCoreRMExt.h \
+ $(top_srcdir)/test/components/common/user_debug_levels.h
+
Index: create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/base/omx_base_component.c
===================================================================
--- create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/base/omx_base_component.c (nonexistent)
+++ create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/base/omx_base_component.c (revision 5)
@@ -0,0 +1,1983 @@
+/**
+ src/base/omx_base_component.c
+
+ OpenMAX base_component component. This component does not perform any multimedia
+ processing. It is used as a base_component for new components development.
+
+ Copyright (C) 2007-2009 STMicroelectronics
+ Copyright (C) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+
+ This library is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 2.1 of the License, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA
+
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <OMX_Core.h>
+#include <OMX_Component.h>
+
+#include "omx_base_component.h"
+#include <omx_reference_resource_manager.h>
+
+#include "tsemaphore.h"
+#include "queue.h"
+
+/**
+ * This function releases all the resources allocated by the base constructor if something fails.
+ * It checks if any item has been already allocated/configured
+ */
+void base_constructor_remove_garbage_collected(omx_base_component_PrivateType* omx_base_component_Private) {
+ if (omx_base_component_Private->flush_condition) {
+ tsem_deinit(omx_base_component_Private->flush_condition);
+ free(omx_base_component_Private->flush_condition);
+ }
+ if (omx_base_component_Private->flush_all_condition) {
+ tsem_deinit(omx_base_component_Private->flush_all_condition);
+ free(omx_base_component_Private->flush_all_condition);
+ }
+ if (omx_base_component_Private->bellagioThreads) {
+ free(omx_base_component_Private->bellagioThreads);
+ }
+ if (omx_base_component_Private->name) {
+ free(omx_base_component_Private->name);
+ }
+ if (omx_base_component_Private->bStateSem) {
+ tsem_deinit(omx_base_component_Private->bStateSem);
+ free(omx_base_component_Private->bStateSem);
+ }
+ if (omx_base_component_Private->bMgmtSem) {
+ tsem_deinit(omx_base_component_Private->bMgmtSem);
+ free(omx_base_component_Private->bMgmtSem);
+ }
+ if (omx_base_component_Private->messageSem) {
+ tsem_deinit(omx_base_component_Private->messageSem);
+ free(omx_base_component_Private->messageSem);
+ }
+ if (omx_base_component_Private->messageQueue) {
+ queue_deinit(omx_base_component_Private->messageQueue);
+ free(omx_base_component_Private->messageQueue);
+ }
+ if (omx_base_component_Private) {
+ free(omx_base_component_Private);
+ }
+}
+/**
+ * @brief The base constructor for the OpenMAX ST components
+ *
+ * This function is executed by the ST static component loader.
+ * It takes care of constructing the instance of the component.
+ * For the base_component component, the following is done:
+ *
+ * 1) Fills the basic OpenMAX structure. The fields can be overwritten
+ * by derived components.
+ * 2) Allocates (if needed) the omx_base_component_PrivateType private structure
+ *
+ * @param openmaxStandComp the ST component to be initialized
+ * @param cComponentName the OpenMAX string that describes the component
+ *
+ * @return OMX_ErrorInsufficientResources if a memory allocation fails
+ */
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName) {
+ omx_base_component_PrivateType* omx_base_component_Private;
+ OMX_U32 i;
+ int err;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, openmaxStandComp);
+
+ if (openmaxStandComp->pComponentPrivate) {
+ omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
+ } else {
+ omx_base_component_Private = calloc(1,sizeof(omx_base_component_PrivateType));
+ if (!omx_base_component_Private) {
+ return OMX_ErrorInsufficientResources;
+ }
+ }
+
+ if(!omx_base_component_Private->messageQueue) {
+ omx_base_component_Private->messageQueue = calloc(1,sizeof(queue_t));
+ if (!omx_base_component_Private->messageQueue) {
+ base_constructor_remove_garbage_collected(omx_base_component_Private);
+ return OMX_ErrorInsufficientResources;
+ }
+ err = queue_init(omx_base_component_Private->messageQueue);
+ if (err != 0) {
+ base_constructor_remove_garbage_collected(omx_base_component_Private);
+ return OMX_ErrorInsufficientResources;
+ }
+ }
+
+ if(!omx_base_component_Private->messageSem) {
+ omx_base_component_Private->messageSem = calloc(1,sizeof(tsem_t));
+ if (!omx_base_component_Private->messageSem) {
+ base_constructor_remove_garbage_collected(omx_base_component_Private);
+ return OMX_ErrorInsufficientResources;
+ }
+ err = tsem_init(omx_base_component_Private->messageSem, 0);
+ if (err != 0) {
+ base_constructor_remove_garbage_collected(omx_base_component_Private);
+ return OMX_ErrorInsufficientResources;
+ }
+ }
+ if(!omx_base_component_Private->bMgmtSem) {
+ omx_base_component_Private->bMgmtSem = calloc(1,sizeof(tsem_t));
+ if (!omx_base_component_Private->bMgmtSem) {
+ base_constructor_remove_garbage_collected(omx_base_component_Private);
+ return OMX_ErrorInsufficientResources;
+ }
+ err = tsem_init(omx_base_component_Private->bMgmtSem, 0);
+ if (err != 0) {
+ base_constructor_remove_garbage_collected(omx_base_component_Private);
+ return OMX_ErrorInsufficientResources;
+ }
+ }
+
+ if(!omx_base_component_Private->bStateSem) {
+ omx_base_component_Private->bStateSem = calloc(1,sizeof(tsem_t));
+ if (!omx_base_component_Private->bStateSem) {
+ base_constructor_remove_garbage_collected(omx_base_component_Private);
+ return OMX_ErrorInsufficientResources;
+ }
+ err = tsem_init(omx_base_component_Private->bStateSem, 0);
+ if (err != 0) {
+ base_constructor_remove_garbage_collected(omx_base_component_Private);
+ return OMX_ErrorInsufficientResources;
+ }
+ }
+
+ openmaxStandComp->nSize = sizeof(OMX_COMPONENTTYPE);
+ openmaxStandComp->pApplicationPrivate = NULL;
+ openmaxStandComp->GetComponentVersion = omx_base_component_GetComponentVersion;
+ openmaxStandComp->SendCommand = omx_base_component_SendCommand;
+ openmaxStandComp->GetParameter = omx_base_component_GetParameter;
+ openmaxStandComp->SetParameter = omx_base_component_SetParameter;
+ openmaxStandComp->GetConfig = omx_base_component_GetConfig;
+ openmaxStandComp->SetConfig = omx_base_component_SetConfig;
+ openmaxStandComp->GetExtensionIndex = omx_base_component_GetExtensionIndex;
+ openmaxStandComp->GetState = omx_base_component_GetState;
+ openmaxStandComp->SetCallbacks = omx_base_component_SetCallbacks;
+ openmaxStandComp->ComponentDeInit = omx_base_component_ComponentDeInit;
+ openmaxStandComp->ComponentRoleEnum = omx_base_component_ComponentRoleEnum;
+ openmaxStandComp->ComponentTunnelRequest =omx_base_component_ComponentTunnelRequest;
+
+ /*Will make Specific port Allocate buffer call*/
+ openmaxStandComp->AllocateBuffer = omx_base_component_AllocateBuffer;
+ openmaxStandComp->UseBuffer = omx_base_component_UseBuffer;
+ openmaxStandComp->UseEGLImage = omx_base_component_UseEGLImage;
+ openmaxStandComp->FreeBuffer = omx_base_component_FreeBuffer;
+ openmaxStandComp->EmptyThisBuffer = omx_base_component_EmptyThisBuffer;
+ openmaxStandComp->FillThisBuffer = omx_base_component_FillThisBuffer;
+
+ openmaxStandComp->nVersion.s.nVersionMajor = SPECVERSIONMAJOR;
+ openmaxStandComp->nVersion.s.nVersionMinor = SPECVERSIONMINOR;
+ openmaxStandComp->nVersion.s.nRevision = SPECREVISION;
+ openmaxStandComp->nVersion.s.nStep = SPECSTEP;
+
+ omx_base_component_Private->name = calloc(1,OMX_MAX_STRINGNAME_SIZE);
+ if (!omx_base_component_Private->name) {
+ base_constructor_remove_garbage_collected(omx_base_component_Private);
+ return OMX_ErrorInsufficientResources;
+ }
+ strcpy(omx_base_component_Private->name,cComponentName);
+ omx_base_component_Private->state = OMX_StateLoaded;
+ omx_base_component_Private->transientState = OMX_TransStateMax;
+ omx_base_component_Private->callbacks = NULL;
+ omx_base_component_Private->callbackData = NULL;
+ omx_base_component_Private->nGroupPriority = 100;
+ omx_base_component_Private->nGroupID = 0;
+ omx_base_component_Private->pMark.hMarkTargetComponent = NULL;
+ omx_base_component_Private->pMark.pMarkData = NULL;
+ omx_base_component_Private->openmaxStandComp = openmaxStandComp;
+ omx_base_component_Private->DoStateSet = &omx_base_component_DoStateSet;
+ omx_base_component_Private->messageHandler = omx_base_component_MessageHandler;
+ omx_base_component_Private->destructor = omx_base_component_Destructor;
+ omx_base_component_Private->getQualityLevel = omx_base_getQualityLevel;
+ omx_base_component_Private->setQualityLevel = omx_base_setQualityLevel;
+ omx_base_component_Private->currentQualityLevel = 0;
+ omx_base_component_Private->nqualitylevels = 0;
+ omx_base_component_Private->bufferMgmtThreadID = -1;
+ omx_base_component_Private->bellagioThreads = calloc(1, sizeof(OMX_PARAM_BELLAGIOTHREADS_ID));
+ if (omx_base_component_Private->bellagioThreads == NULL) {
+ base_constructor_remove_garbage_collected(omx_base_component_Private);
+ return OMX_ErrorInsufficientResources;
+ }
+ omx_base_component_Private->bellagioThreads->nThreadBufferMngtID = 0;
+ omx_base_component_Private->bellagioThreads->nThreadMessageID = 0;
+ omx_base_component_Private->bIsEOSReached = OMX_FALSE;
+
+ pthread_mutex_init(&omx_base_component_Private->flush_mutex, NULL);
+
+ if(!omx_base_component_Private->flush_all_condition) {
+ omx_base_component_Private->flush_all_condition = calloc(1,sizeof(tsem_t));
+ if(!omx_base_component_Private->flush_all_condition) {
+ base_constructor_remove_garbage_collected(omx_base_component_Private);
+ return OMX_ErrorInsufficientResources;
+ }
+ err = tsem_init(omx_base_component_Private->flush_all_condition, 0);
+ if (err != 0) {
+ base_constructor_remove_garbage_collected(omx_base_component_Private);
+ return OMX_ErrorInsufficientResources;
+ }
+ }
+
+ if(!omx_base_component_Private->flush_condition) {
+ omx_base_component_Private->flush_condition = calloc(1,sizeof(tsem_t));
+ if(!omx_base_component_Private->flush_condition) {
+ base_constructor_remove_garbage_collected(omx_base_component_Private);
+ return OMX_ErrorInsufficientResources;
+ }
+ err = tsem_init(omx_base_component_Private->flush_condition, 0);
+ if (err != 0) {
+ base_constructor_remove_garbage_collected(omx_base_component_Private);
+ return OMX_ErrorInsufficientResources;
+ }
+ }
+
+ for(i=0;i<NUM_DOMAINS;i++) {
+ memset(&omx_base_component_Private->sPortTypesParam[i], 0, sizeof(OMX_PORT_PARAM_TYPE));
+ setHeader(&omx_base_component_Private->sPortTypesParam[i], sizeof(OMX_PORT_PARAM_TYPE));
+ }
+
+ err = pthread_create(&omx_base_component_Private->messageHandlerThread, NULL, compMessageHandlerFunction, openmaxStandComp);
+ if (err) {
+ base_constructor_remove_garbage_collected(omx_base_component_Private);
+ return OMX_ErrorInsufficientResources;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME,"Out of %s for component %p\n", __func__, openmaxStandComp);
+ return OMX_ErrorNone;
+}
+
+/** @brief The base destructor for ST OpenMAX components
+ *
+ * This function is called by the standard function ComponentDeInit()
+ * that is called by the IL core during the execution of the FreeHandle()
+ *
+ * @param openmaxStandComp the ST OpenMAX component to be disposed
+ */
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_Destructor(OMX_COMPONENTTYPE *openmaxStandComp) {
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
+ int err;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, openmaxStandComp);
+ omx_base_component_Private->state = OMX_StateInvalid;
+ omx_base_component_Private->callbacks=NULL;
+
+ /*Send Dummy signal to Component Message handler to exit*/
+ tsem_up(omx_base_component_Private->messageSem);
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s before pthread_detach\n", __func__);
+ err = pthread_detach(omx_base_component_Private->messageHandlerThread);
+ if(err!=0) {
+ DEBUG(DEB_LEV_FUNCTION_NAME,"In %s pthread_detach returned err=%d\n", __func__, err);
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s after pthread_detach\n", __func__);
+ /*Deinitialize and free message queue*/
+ if(omx_base_component_Private->messageQueue) {
+ queue_deinit(omx_base_component_Private->messageQueue);
+ free(omx_base_component_Private->messageQueue);
+ omx_base_component_Private->messageQueue=NULL;
+ }
+
+
+ /*Deinitialize and free buffer management semaphore*/
+ if(omx_base_component_Private->bMgmtSem){
+ tsem_deinit(omx_base_component_Private->bMgmtSem);
+ free(omx_base_component_Private->bMgmtSem);
+ omx_base_component_Private->bMgmtSem=NULL;
+ }
+
+ /*Deinitialize and free message semaphore*/
+ if(omx_base_component_Private->messageSem) {
+ tsem_deinit(omx_base_component_Private->messageSem);
+ free(omx_base_component_Private->messageSem);
+ omx_base_component_Private->messageSem=NULL;
+ }
+
+ if(omx_base_component_Private->bStateSem){
+ tsem_deinit(omx_base_component_Private->bStateSem);
+ free(omx_base_component_Private->bStateSem);
+ omx_base_component_Private->bStateSem=NULL;
+ }
+
+ if(omx_base_component_Private->name){
+ free(omx_base_component_Private->name);
+ omx_base_component_Private->name=NULL;
+ }
+
+ pthread_mutex_destroy(&omx_base_component_Private->flush_mutex);
+
+ if(omx_base_component_Private->flush_all_condition){
+ tsem_deinit(omx_base_component_Private->flush_all_condition);
+ free(omx_base_component_Private->flush_all_condition);
+ omx_base_component_Private->flush_all_condition=NULL;
+ }
+
+ if(omx_base_component_Private->flush_condition){
+ tsem_deinit(omx_base_component_Private->flush_condition);
+ free(omx_base_component_Private->flush_condition);
+ omx_base_component_Private->flush_condition=NULL;
+ }
+
+ DEBUG(DEB_LEV_FUNCTION_NAME,"Out of %s for component %p\n", __func__, openmaxStandComp);
+ return OMX_ErrorNone;
+}
+
+/** @brief This standard functionality is called when the component is
+ * destroyed in the FreeHandle standard call.
+ *
+ * In this way the implementation of the FreeHandle is standard,
+ * and it does not need a support by a specific component loader.
+ * The implementation of the ComponentDeInit contains the
+ * implementation specific part of the destroying phase.
+ */
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_ComponentDeInit(
+ OMX_HANDLETYPE hComponent) {
+ OMX_COMPONENTTYPE *openmaxStandComp = (OMX_COMPONENTTYPE *)hComponent;
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
+ DEBUG(DEB_LEV_FUNCTION_NAME,"In %s for component %p\n", __func__, openmaxStandComp);
+
+ omx_base_component_Private->destructor(openmaxStandComp);
+
+ free(openmaxStandComp->pComponentPrivate);
+ openmaxStandComp->pComponentPrivate=NULL;
+ DEBUG(DEB_LEV_FUNCTION_NAME,"Out of %s for component %p\n", __func__, openmaxStandComp);
+ return OMX_ErrorNone;
+}
+
+/** Changes the state of a component taking proper actions depending on
+ * the transition requested. This base function cover only the state
+ * changes that do not involve any port
+ *
+ * @param openmaxStandComp the OpenMAX component which state is to be changed
+ * @param destinationState the requested target state
+ *
+ * @return OMX_ErrorNotImplemented if the state change is not handled in this base class, but needs
+ * a specific handling
+ */
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_DoStateSet(OMX_COMPONENTTYPE *openmaxStandComp, OMX_U32 destinationState) {
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
+ omx_base_PortType *pPort;
+ OMX_U32 i,j,k;
+ OMX_ERRORTYPE err=OMX_ErrorNone;
+ OMX_BOOL bExit = OMX_FALSE;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, openmaxStandComp);
+ DEBUG(DEB_LEV_PARAMS, "Changing state from %i to %i\n", omx_base_component_Private->state, (int)destinationState);
+
+ if (omx_base_component_Private->state == OMX_StateLoaded && destinationState == OMX_StateIdle) {
+ err = RM_getResource(openmaxStandComp);
+ if (err != OMX_ErrorNone) {
+ return OMX_ErrorInsufficientResources;
+ }
+ }
+ if (omx_base_component_Private->state == OMX_StateIdle && destinationState == OMX_StateLoaded) {
+ RM_releaseResource(openmaxStandComp);
+ }
+
+ if(destinationState == OMX_StateLoaded){
+ switch(omx_base_component_Private->state){
+ case OMX_StateInvalid:
+ err = OMX_ErrorInvalidState;
+ break;
+ case OMX_StateWaitForResources:
+ /* return back from wait for resources */
+ RM_removeFromWaitForResource(openmaxStandComp);
+ omx_base_component_Private->state = OMX_StateLoaded;
+ break;
+ case OMX_StateLoaded:
+ err = OMX_ErrorSameState;
+ break;
+ case OMX_StateIdle:
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+
+ pPort = omx_base_component_Private->ports[i];
+ if (PORT_IS_TUNNELED(pPort) && PORT_IS_BUFFER_SUPPLIER(pPort)) {
+ while(pPort->pBufferQueue->nelem > 0) {
+ DEBUG(DEB_LEV_PARAMS, "In %s Buffer %d remained in the port %d queue of comp%s\n",
+ __func__,(int)pPort->pBufferQueue->nelem,(int)i,omx_base_component_Private->name);
+ dequeue(pPort->pBufferQueue);
+ }
+ /* Freeing here the buffers allocated for the tunneling:*/
+ err = pPort->Port_FreeTunnelBuffer(pPort,i);
+ if(err!=OMX_ErrorNone) {
+ DEBUG(DEB_LEV_ERR, "In %s Freeing Tunnel Buffer Error=%x\n",__func__,err);
+ return err;
+ }
+ } else {
+ DEBUG(DEB_LEV_FULL_SEQ, "In %s nPortIndex=%d pAllocSem Semval=%x\n", __func__,(int)i,(int)pPort->pAllocSem->semval);
+
+ /*If ports are enabled then wait till all buffers are freed*/
+ if(PORT_IS_ENABLED(pPort)) {
+ tsem_down(pPort->pAllocSem);
+ }
+ }
+ pPort->sPortParam.bPopulated = OMX_FALSE;
+
+ if(pPort->pInternalBufferStorage != NULL) {
+ free(pPort->pInternalBufferStorage);
+ pPort->pInternalBufferStorage=NULL;
+ }
+
+ if(pPort->bBufferStateAllocated != NULL) {
+ free(pPort->bBufferStateAllocated);
+ pPort->bBufferStateAllocated=NULL;
+ }
+ }
+ }
+ omx_base_component_Private->state = OMX_StateLoaded;
+
+ if(omx_base_component_Private->bufferMgmtThreadID == 0 ){
+ /*Signal Buffer Management thread to exit*/
+ tsem_up(omx_base_component_Private->bMgmtSem);
+ pthread_join(omx_base_component_Private->bufferMgmtThread, NULL);
+ omx_base_component_Private->bufferMgmtThreadID = -1;
+ if(err != 0) {
+ DEBUG(DEB_LEV_ERR,"In %s pthread_join returned err=%d\n",__func__,err);
+ }
+ }
+
+ break;
+ default:
+ DEBUG(DEB_LEV_ERR, "In %s: state transition not allowed\n", __func__);
+ err = OMX_ErrorIncorrectStateTransition;
+ break;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p with err %i\n", __func__, openmaxStandComp, err);
+ return err;
+ }
+
+ if(destinationState == OMX_StateWaitForResources){
+ switch(omx_base_component_Private->state){
+ case OMX_StateInvalid:
+ err = OMX_ErrorInvalidState;
+ break;
+ case OMX_StateLoaded:
+ omx_base_component_Private->state = OMX_StateWaitForResources;
+ err = RM_waitForResource(openmaxStandComp);
+ break;
+ case OMX_StateWaitForResources:
+ err = OMX_ErrorSameState;
+ break;
+ default:
+ DEBUG(DEB_LEV_ERR, "In %s: state transition not allowed\n", __func__);
+ err = OMX_ErrorIncorrectStateTransition;
+ break;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p with err %i\n", __func__, openmaxStandComp, err);
+ return err;
+ }
+
+ if(destinationState == OMX_StateIdle){
+ switch(omx_base_component_Private->state){
+ case OMX_StateInvalid:
+ err = OMX_ErrorInvalidState;
+ break;
+ case OMX_StateWaitForResources:
+ omx_base_component_Private->state = OMX_StateIdle;
+ break;
+ case OMX_StateLoaded:
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+ pPort = omx_base_component_Private->ports[i];
+ if (PORT_IS_TUNNELED(pPort) && PORT_IS_BUFFER_SUPPLIER(pPort)) {
+ if(PORT_IS_ENABLED(pPort)) {
+ /** Allocate here the buffers needed for the tunneling */
+ err= pPort->Port_AllocateTunnelBuffer(pPort, i);
+ if(err!=OMX_ErrorNone) {
+ DEBUG(DEB_LEV_ERR, "In %s Allocating Tunnel Buffer Error=%x\n",__func__,err);
+ return err;
+ }
+ }
+ } else {
+ if(PORT_IS_ENABLED(pPort)) {
+ DEBUG(DEB_LEV_FULL_SEQ, "In %s: wait for buffers. port enabled %i, port populated %i\n",
+ __func__, pPort->sPortParam.bEnabled,pPort->sPortParam.bPopulated);
+ if (pPort->sPortParam.nBufferCountActual > 0) {
+ tsem_down(pPort->pAllocSem);
+ pthread_mutex_lock(&pPort->exitMutex);
+ if (pPort->bIsDestroying) {
+ bExit = OMX_TRUE;
+ pthread_mutex_unlock(&pPort->exitMutex);
+ continue;
+ }
+ pthread_mutex_unlock(&pPort->exitMutex);
+ }
+ pPort->sPortParam.bPopulated = OMX_TRUE;
+ }
+ else {
+ DEBUG(DEB_LEV_SIMPLE_SEQ, "In %s: Port %i Disabled So no wait\n",__func__,(int)i);
+ }
+ }
+ DEBUG(DEB_LEV_SIMPLE_SEQ, "Tunnel status : port %d flags 0x%x\n",(int)i, (int)pPort->nTunnelFlags);
+ }
+ }
+ if (bExit) {
+ break;
+ }
+ omx_base_component_Private->state = OMX_StateIdle;
+ /** starting buffer management thread */
+ omx_base_component_Private->bufferMgmtThreadID = pthread_create(&omx_base_component_Private->bufferMgmtThread,
+ NULL,
+ omx_base_component_Private->BufferMgmtFunction,
+ openmaxStandComp);
+ if(omx_base_component_Private->bufferMgmtThreadID < 0){
+ DEBUG(DEB_LEV_ERR, "Starting buffer management thread failed\n");
+ return OMX_ErrorUndefined;
+ }
+ break;
+ case OMX_StateIdle:
+ err = OMX_ErrorSameState;
+ break;
+ case OMX_StateExecuting:
+ /*Flush Ports*/
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+ DEBUG(DEB_LEV_FULL_SEQ, "Flushing Port %i\n",(int)i);
+ pPort = omx_base_component_Private->ports[i];
+ if(PORT_IS_ENABLED(pPort)) {
+ pPort->FlushProcessingBuffers(pPort);
+ }
+ }
+ }
+ omx_base_component_Private->state = OMX_StateIdle;
+ break;
+ case OMX_StatePause:
+ /*Flush Ports*/
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+ DEBUG(DEB_LEV_FULL_SEQ, "Flushing Port %i\n",(int)i);
+ pPort = omx_base_component_Private->ports[i];
+ if(PORT_IS_ENABLED(pPort)) {
+ pPort->FlushProcessingBuffers(pPort);
+ }
+ }
+ }
+ omx_base_component_Private->state = OMX_StateIdle;
+ /*Signal buffer management thread if waiting at paused state*/
+ tsem_signal(omx_base_component_Private->bStateSem);
+ break;
+ default:
+ DEBUG(DEB_LEV_ERR, "In %s: state transition not allowed\n", __func__);
+ err = OMX_ErrorIncorrectStateTransition;
+ break;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p with err %i\n", __func__, openmaxStandComp, err);
+ return err;
+ }
+
+ if(destinationState == OMX_StatePause) {
+ switch(omx_base_component_Private->state) {
+ case OMX_StateInvalid:
+ err = OMX_ErrorInvalidState;
+ break;
+ case OMX_StatePause:
+ err = OMX_ErrorSameState;
+ break;
+ case OMX_StateIdle:
+ omx_base_component_Private->bIsEOSReached = OMX_FALSE;
+ case OMX_StateExecuting:
+ omx_base_component_Private->state = OMX_StatePause;
+ break;
+ default:
+ DEBUG(DEB_LEV_ERR, "In %s: state transition not allowed\n", __func__);
+ err = OMX_ErrorIncorrectStateTransition;
+ break;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p with err %i\n", __func__, openmaxStandComp, err);
+ return err;
+ }
+
+ if(destinationState == OMX_StateExecuting) {
+ switch(omx_base_component_Private->state) {
+ case OMX_StateInvalid:
+ err = OMX_ErrorInvalidState;
+ break;
+ case OMX_StateIdle:
+ omx_base_component_Private->state = OMX_StateExecuting;
+ omx_base_component_Private->bIsEOSReached = OMX_FALSE;
+ /*Send Tunneled Buffer to the Neighbouring Components*/
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+ pPort = omx_base_component_Private->ports[i];
+ if (PORT_IS_TUNNELED(pPort) && PORT_IS_BUFFER_SUPPLIER(pPort) && PORT_IS_ENABLED(pPort)) {
+ for(k=0;k<pPort->nNumTunnelBuffer;k++) {
+ tsem_up(pPort->pBufferSem);
+ /*signal buffer management thread availability of buffers*/
+ tsem_up(omx_base_component_Private->bMgmtSem);
+ }
+ }
+ }
+ }
+ omx_base_component_Private->transientState = OMX_TransStateMax;
+ err = OMX_ErrorNone;
+ break;
+ case OMX_StatePause:
+ omx_base_component_Private->state=OMX_StateExecuting;
+
+ /* Tunneled Supplier Ports were enabled in paused state. So signal buffer managment thread*/
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+
+ pPort=omx_base_component_Private->ports[i];
+ DEBUG(DEB_LEV_PARAMS, "In %s: state transition Paused 2 Executing, nelem=%d,semval=%d,Buf Count Actual=%d\n", __func__,
+ pPort->pBufferQueue->nelem,pPort->pBufferSem->semval,(int)pPort->sPortParam.nBufferCountActual);
+
+ if (PORT_IS_TUNNELED_N_BUFFER_SUPPLIER(pPort) &&
+ (pPort->pBufferQueue->nelem == (pPort->pBufferSem->semval + pPort->sPortParam.nBufferCountActual))) {
+ for(k=0; k < pPort->sPortParam.nBufferCountActual;k++) {
+ tsem_up(pPort->pBufferSem);
+ tsem_up(omx_base_component_Private->bMgmtSem);
+ }
+ }
+ }
+ }
+ /*Signal buffer management thread if waiting at paused state*/
+ tsem_signal(omx_base_component_Private->bStateSem);
+ break;
+ case OMX_StateExecuting:
+ err = OMX_ErrorSameState;
+ break;
+ default:
+ DEBUG(DEB_LEV_ERR, "In %s: state transition not allowed\n", __func__);
+ err = OMX_ErrorIncorrectStateTransition;
+ break;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p with err %i\n", __func__, openmaxStandComp, err);
+ return err;
+ }
+
+ if(destinationState == OMX_StateInvalid) {
+ switch(omx_base_component_Private->state) {
+ case OMX_StateInvalid:
+ err = OMX_ErrorInvalidState;
+ break;
+ default:
+ omx_base_component_Private->state = OMX_StateInvalid;
+
+ if(omx_base_component_Private->bufferMgmtThreadID == 0 ){
+ tsem_signal(omx_base_component_Private->bStateSem);
+ /*Signal Buffer Management Thread to Exit*/
+ tsem_up(omx_base_component_Private->bMgmtSem);
+ pthread_join(omx_base_component_Private->bufferMgmtThread, NULL);
+ omx_base_component_Private->bufferMgmtThreadID = -1;
+ if(err!=0) {
+ DEBUG(DEB_LEV_FUNCTION_NAME,"In %s pthread_join returned err=%d\n",__func__,err);
+ }
+ }
+ err = OMX_ErrorInvalidState;
+ break;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p with err %i\n", __func__, openmaxStandComp, err);
+ return err;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, openmaxStandComp);
+ return OMX_ErrorNone;
+}
+
+/** @brief Checks the header of a structure for consistency
+ * with size and spec version
+ *
+ * @param header Pointer to the structure to be checked
+ * @param size Size of the structure. it is in general obtained
+ * with a sizeof call applied to the structure
+ *
+ * @return OMX error code. If the header has failed the check,
+ * OMX_ErrorVersionMismatch is returned.
+ * If the header fails the size check OMX_ErrorBadParameter is returned
+ */
+OSCL_EXPORT_REF OMX_ERRORTYPE checkHeader(OMX_PTR header, OMX_U32 size) {
+ OMX_VERSIONTYPE* ver;
+ if (header == NULL) {
+ DEBUG(DEB_LEV_ERR, "In %s the header is null\n",__func__);
+ return OMX_ErrorBadParameter;
+ }
+ ver = (OMX_VERSIONTYPE*)((char*)header + sizeof(OMX_U32));
+ if(*((OMX_U32*)header) != size) {
+ DEBUG(DEB_LEV_ERR, "In %s the header has a wrong size %i should be %i\n",__func__,(int)*((OMX_U32*)header),(int)size);
+ return OMX_ErrorBadParameter;
+ }
+ if(ver->s.nVersionMajor != SPECVERSIONMAJOR ||
+ ver->s.nVersionMinor != SPECVERSIONMINOR) {
+ DEBUG(DEB_LEV_ERR, "The version does not match\n");
+ return OMX_ErrorVersionMismatch;
+ }
+ return OMX_ErrorNone;
+}
+
+/** @brief Simply fills the first two fields in any OMX structure
+ * with the size and the version
+ *
+ * @param header pointer to the structure to be filled
+ * @param size size of the structure. It can be obtained with
+ * a call to sizeof of the structure type
+ */
+void setHeader(OMX_PTR header, OMX_U32 size) {
+ OMX_VERSIONTYPE* ver = (OMX_VERSIONTYPE*)((char*)header + sizeof(OMX_U32));
+ *((OMX_U32*)header) = size;
+
+ ver->s.nVersionMajor = SPECVERSIONMAJOR;
+ ver->s.nVersionMinor = SPECVERSIONMINOR;
+ ver->s.nRevision = SPECREVISION;
+ ver->s.nStep = SPECSTEP;
+}
+
+/**
+ * This function verify Component State and Structure header
+ */
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_ParameterSanityCheck(OMX_HANDLETYPE hComponent,
+ OMX_U32 nPortIndex,
+ OMX_PTR pStructure,
+ size_t size) {
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)(((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate);
+ omx_base_PortType *pPort;
+ int nNumPorts;
+ OMX_ERRORTYPE err;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
+ nNumPorts = omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts;
+
+ if (nPortIndex >= nNumPorts) {
+ DEBUG(DEB_LEV_ERR, "Bad Port index %i when the component has %i ports\n", (int)nPortIndex, (int)nNumPorts);
+ return OMX_ErrorBadPortIndex;
+ }
+
+ pPort = omx_base_component_Private->ports[nPortIndex];
+
+ if (omx_base_component_Private->state != OMX_StateLoaded && omx_base_component_Private->state != OMX_StateWaitForResources) {
+ if(PORT_IS_ENABLED(pPort) && !pPort->bIsTransientToEnabled) {
+ DEBUG(DEB_LEV_ERR, "In %s Incorrect State=%x lineno=%d\n",__func__,omx_base_component_Private->state,__LINE__);
+ return OMX_ErrorIncorrectStateOperation;
+ }
+ }
+
+ err = checkHeader(pStructure, size);
+ if (err != OMX_ErrorNone) {
+ DEBUG(DEB_LEV_ERR, "In %s failing the checkHeader with err %i\n", __func__, (int)err);
+ return err;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
+ return OMX_ErrorNone;
+}
+
+/** @brief Standard OpenMAX function
+ *
+ * it returns the version of the component. See OMX_Core.h
+ */
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_GetComponentVersion(OMX_HANDLETYPE hComponent,
+ OMX_STRING pComponentName,
+ OMX_VERSIONTYPE* pComponentVersion,
+ OMX_VERSIONTYPE* pSpecVersion,
+ OMX_UUIDTYPE* pComponentUUID) {
+
+ OMX_COMPONENTTYPE* omx_component = (OMX_COMPONENTTYPE*)hComponent;
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)omx_component->pComponentPrivate;
+
+ OMX_U32 uuid[3];
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
+ /* Fill component name */
+ strcpy(pComponentName, omx_base_component_Private->name);
+
+ /* Fill component version */
+ pComponentVersion->s.nVersionMajor = SPECVERSIONMAJOR;
+ pComponentVersion->s.nVersionMinor = SPECVERSIONMINOR;
+ pComponentVersion->s.nRevision = SPECREVISION;
+ pComponentVersion->s.nStep = SPECSTEP;
+
+ /* Fill spec version (copy from component field) */
+ memcpy(pSpecVersion, &omx_component->nVersion, sizeof(OMX_VERSIONTYPE));
+
+ /* Fill UUID with handle address, PID and UID.
+ * This should guarantee uiniqness */
+ uuid[0] = (OMX_U32)omx_component;
+ uuid[1] = getpid();
+ uuid[2] = getuid();
+ memcpy(*pComponentUUID, uuid, 3*sizeof(uuid));
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
+ return OMX_ErrorNone;
+}
+
+/** @brief Enumerates all the roles of the component.
+ *
+ * This function is intended to be used only by a core. The ST static core
+ * in any case does not use this function, because it can not be used before the
+ * creation of the component, but uses a static list.
+ * It is implemented only for API completion,and it will be not overriden
+ * by a derived component
+ */
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_ComponentRoleEnum(
+ OMX_HANDLETYPE hComponent,
+ OMX_U8 *cRole,
+ OMX_U32 nIndex) {
+ strcat((char*)cRole, "\0");
+ return OMX_ErrorNoMore;
+}
+
+/** @brief standard OpenMAX function
+ *
+ * it sets the callback functions given by the IL client.
+ * See OMX_Component.h
+ */
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_SetCallbacks(
+ OMX_HANDLETYPE hComponent,
+ OMX_CALLBACKTYPE* pCallbacks,
+ OMX_PTR pAppData) {
+
+ OMX_COMPONENTTYPE *omxcomponent = (OMX_COMPONENTTYPE*)hComponent;
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)omxcomponent->pComponentPrivate;
+ omx_base_PortType *pPort;
+ OMX_U32 i,j;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
+ omx_base_component_Private->callbacks = pCallbacks;
+ omx_base_component_Private->callbackData = pAppData;
+
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+ pPort = omx_base_component_Private->ports[i];
+ if (pPort->sPortParam.eDir == OMX_DirInput) {
+ pPort->BufferProcessedCallback = omx_base_component_Private->callbacks->EmptyBufferDone;
+ } else {
+ pPort->BufferProcessedCallback = omx_base_component_Private->callbacks->FillBufferDone;
+ }
+ }
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
+ return OMX_ErrorNone;
+}
+
+/** @brief Part of the standard OpenMAX function
+ *
+ * This function return the parameters not related to any port.
+ * These parameters are handled in the derived components
+ * See OMX_Core.h for standard reference
+ *
+ * @return OMX_ErrorUnsupportedIndex if the index is not supported or not handled here
+ */
+OSCL_EXPORT_REF OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_GetParameter(
+ OMX_HANDLETYPE hComponent,
+ OMX_INDEXTYPE nParamIndex,
+ OMX_PTR ComponentParameterStructure) {
+
+ OMX_COMPONENTTYPE *omxcomponent = (OMX_COMPONENTTYPE*)hComponent;
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)omxcomponent->pComponentPrivate;
+ OMX_PRIORITYMGMTTYPE* pPrioMgmt;
+ OMX_PARAM_PORTDEFINITIONTYPE *pPortDef;
+ OMX_PARAM_BUFFERSUPPLIERTYPE *pBufferSupplier;
+ omx_base_PortType *pPort;
+ OMX_PORT_PARAM_TYPE* pPortDomains;
+ OMX_ERRORTYPE err = OMX_ErrorNone;
+ OMX_VENDOR_PROP_TUNNELSETUPTYPE *pPropTunnelSetup;
+ OMX_PARAM_BELLAGIOTHREADS_ID *threadID;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
+ DEBUG(DEB_LEV_PARAMS, "Getting parameter %i\n", nParamIndex);
+ if (ComponentParameterStructure == NULL) {
+ return OMX_ErrorBadParameter;
+ }
+ switch(nParamIndex) {
+ case OMX_IndexParamAudioInit:
+ case OMX_IndexParamVideoInit:
+ case OMX_IndexParamImageInit:
+ case OMX_IndexParamOtherInit:
+ pPortDomains = (OMX_PORT_PARAM_TYPE*)ComponentParameterStructure;
+ if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PORT_PARAM_TYPE))) != OMX_ErrorNone) {
+ break;
+ }
+ pPortDomains->nPorts = 0;
+ pPortDomains->nStartPortNumber = 0;
+ break;
+ case OMX_IndexParamPortDefinition:
+ pPortDef = (OMX_PARAM_PORTDEFINITIONTYPE*) ComponentParameterStructure;
+ if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PARAM_PORTDEFINITIONTYPE))) != OMX_ErrorNone) {
+ break;
+ }
+ if (pPortDef->nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
+ return OMX_ErrorBadPortIndex;
+ }
+
+ memcpy(pPortDef, &omx_base_component_Private->ports[pPortDef->nPortIndex]->sPortParam, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+ break;
+ case OMX_IndexParamPriorityMgmt:
+ pPrioMgmt = (OMX_PRIORITYMGMTTYPE*)ComponentParameterStructure;
+ if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PRIORITYMGMTTYPE))) != OMX_ErrorNone) {
+ break;
+ }
+ pPrioMgmt->nGroupPriority = omx_base_component_Private->nGroupPriority;
+ pPrioMgmt->nGroupID = omx_base_component_Private->nGroupID;
+ break;
+ case OMX_IndexParamCompBufferSupplier:
+ pBufferSupplier = (OMX_PARAM_BUFFERSUPPLIERTYPE*)ComponentParameterStructure;
+ if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PARAM_BUFFERSUPPLIERTYPE))) != OMX_ErrorNone) {
+ break;
+ }
+ if (pBufferSupplier->nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
+ return OMX_ErrorBadPortIndex;
+ }
+
+ pPort = omx_base_component_Private->ports[pBufferSupplier->nPortIndex];
+
+ if (pPort->sPortParam.eDir == OMX_DirInput) {
+ if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
+ pBufferSupplier->eBufferSupplier = OMX_BufferSupplyInput;
+ } else if (PORT_IS_TUNNELED(pPort)) {
+ pBufferSupplier->eBufferSupplier = OMX_BufferSupplyOutput;
+ } else {
+ pBufferSupplier->eBufferSupplier = OMX_BufferSupplyUnspecified;
+ }
+ } else {
+ if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
+ pBufferSupplier->eBufferSupplier = OMX_BufferSupplyOutput;
+ } else if (PORT_IS_TUNNELED(pPort)) {
+ pBufferSupplier->eBufferSupplier = OMX_BufferSupplyInput;
+ } else {
+ pBufferSupplier->eBufferSupplier = OMX_BufferSupplyUnspecified;
+ }
+ }
+ break;
+ default:
+ /* additional switch statement for extended OMX_INDEXTYPE */
+ switch((OMX_INDEXVENDORTYPE) nParamIndex) {
+ case OMX_IndexParameterThreadsID:
+ if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PARAM_BELLAGIOTHREADS_ID))) != OMX_ErrorNone) {
+ break;
+ }
+ threadID = (OMX_PARAM_BELLAGIOTHREADS_ID *)ComponentParameterStructure;
+ threadID->nThreadBufferMngtID = omx_base_component_Private->bellagioThreads->nThreadBufferMngtID;
+ threadID->nThreadMessageID = omx_base_component_Private->bellagioThreads->nThreadMessageID;
+ break;
+ case OMX_IndexVendorCompPropTunnelFlags:
+ pPropTunnelSetup = (OMX_VENDOR_PROP_TUNNELSETUPTYPE*)ComponentParameterStructure;
+
+ if (pPropTunnelSetup->nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
+
+ DEBUG(DEB_LEV_ERR,"In %s OMX_IndexVendorCompPropTunnelFlags nPortIndex=%d Line=%d \n",
+ __func__,(int)pPropTunnelSetup->nPortIndex,__LINE__);
+
+ return OMX_ErrorBadPortIndex;
+ }
+
+ pPort = omx_base_component_Private->ports[pPropTunnelSetup->nPortIndex];
+
+ pPropTunnelSetup->nTunnelSetup.nTunnelFlags = pPort->nTunnelFlags;
+ pPropTunnelSetup->nTunnelSetup.eSupplier = pPort->eBufferSupplier;
+ break;
+ default:
+ err = OMX_ErrorUnsupportedIndex;
+ break;
+ }
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
+ return err;
+}
+
+/** @brief Part of the standard OpenMAX function
+ *
+ * This function sets the parameters not related to any port.
+ * These parameters are handled in the derived components
+ * See OMX_Core.h for standard reference
+ *
+ * @return OMX_ErrorUnsupportedIndex if the index is not supported or not handled here
+ */
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_SetParameter(
+ OMX_HANDLETYPE hComponent,
+ OMX_INDEXTYPE nParamIndex,
+ OMX_PTR ComponentParameterStructure) {
+
+ OMX_PRIORITYMGMTTYPE* pPrioMgmt;
+ OMX_PARAM_PORTDEFINITIONTYPE *pPortDef;
+ OMX_ERRORTYPE err = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *omxcomponent = (OMX_COMPONENTTYPE*)hComponent;
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)omxcomponent->pComponentPrivate;
+ OMX_PARAM_BUFFERSUPPLIERTYPE *pBufferSupplier;
+ omx_base_PortType *pPort;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
+ DEBUG(DEB_LEV_PARAMS, "Setting parameter %x\n", nParamIndex);
+ if (ComponentParameterStructure == NULL) {
+ DEBUG(DEB_LEV_ERR, "In %s parameter provided is null! err = %x\n", __func__, err);
+ return OMX_ErrorBadParameter;
+ }
+
+ switch(nParamIndex) {
+ case OMX_IndexParamAudioInit:
+ case OMX_IndexParamVideoInit:
+ case OMX_IndexParamImageInit:
+ case OMX_IndexParamOtherInit:
+ /* pPortParam = (OMX_PORT_PARAM_TYPE* ) ComponentParameterStructure;*/
+ if (omx_base_component_Private->state != OMX_StateLoaded &&
+ omx_base_component_Private->state != OMX_StateWaitForResources) {
+ return OMX_ErrorIncorrectStateOperation;
+ }
+ if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PORT_PARAM_TYPE))) != OMX_ErrorNone) {
+ break;
+ }
+ err = OMX_ErrorUndefined;
+ break;
+ case OMX_IndexParamPortDefinition:
+ pPortDef = (OMX_PARAM_PORTDEFINITIONTYPE*) ComponentParameterStructure;
+ err = omx_base_component_ParameterSanityCheck(hComponent, pPortDef->nPortIndex, pPortDef, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+ if(err!=OMX_ErrorNone) {
+ DEBUG(DEB_LEV_ERR, "In %s Parameter Check Error=%x\n",__func__,err);
+ break;
+ }
+ {
+ OMX_PARAM_PORTDEFINITIONTYPE *pPortParam;
+ OMX_U32 j,old_nBufferCountActual=0;
+ pPortParam = &omx_base_component_Private->ports[pPortDef->nPortIndex]->sPortParam;
+ if(pPortDef->nBufferCountActual < pPortParam->nBufferCountMin) {
+ DEBUG(DEB_LEV_ERR, "In %s nBufferCountActual of param (%i) is < of nBufferCountMin of port(%i)\n",__func__, (int)pPortDef->nBufferCountActual, (int)pPortParam->nBufferCountMin);
+ err = OMX_ErrorBadParameter;
+ break;
+ }
+ old_nBufferCountActual = pPortParam->nBufferCountActual;
+ pPortParam->nBufferCountActual = pPortDef->nBufferCountActual;
+
+ switch(pPortDef->eDomain) {
+ case OMX_PortDomainAudio:
+ memcpy(&pPortParam->format.audio, &pPortDef->format.audio, sizeof(OMX_AUDIO_PORTDEFINITIONTYPE));
+ break;
+ case OMX_PortDomainVideo:
+ pPortParam->format.video.pNativeRender = pPortDef->format.video.pNativeRender;
+ pPortParam->format.video.nFrameWidth = pPortDef->format.video.nFrameWidth;
+ pPortParam->format.video.nFrameHeight = pPortDef->format.video.nFrameHeight;
+ pPortParam->format.video.nStride = pPortDef->format.video.nStride;
+ pPortParam->format.video.xFramerate = pPortDef->format.video.xFramerate;
+ pPortParam->format.video.bFlagErrorConcealment = pPortDef->format.video.bFlagErrorConcealment;
+ pPortParam->format.video.eCompressionFormat = pPortDef->format.video.eCompressionFormat;
+ pPortParam->format.video.eColorFormat = pPortDef->format.video.eColorFormat;
+ pPortParam->format.video.pNativeWindow = pPortDef->format.video.pNativeWindow;
+ break;
+ case OMX_PortDomainImage:
+ pPortParam->format.image.nFrameWidth = pPortDef->format.image.nFrameWidth;
+ pPortParam->format.image.nFrameHeight = pPortDef->format.image.nFrameHeight;
+ pPortParam->format.image.nStride = pPortDef->format.image.nStride;
+ pPortParam->format.image.bFlagErrorConcealment = pPortDef->format.image.bFlagErrorConcealment;
+ pPortParam->format.image.eCompressionFormat = pPortDef->format.image.eCompressionFormat;
+ pPortParam->format.image.eColorFormat = pPortDef->format.image.eColorFormat;
+ pPortParam->format.image.pNativeWindow = pPortDef->format.image.pNativeWindow;
+ break;
+ case OMX_PortDomainOther:
+ memcpy(&pPortParam->format.other, &pPortDef->format.other, sizeof(OMX_OTHER_PORTDEFINITIONTYPE));
+ break;
+ default:
+ DEBUG(DEB_LEV_ERR, "In %s wrong port domain. Out of OpenMAX scope\n",__func__);
+ err = OMX_ErrorBadParameter;
+ break;
+ }
+
+ /*If component state Idle/Pause/Executing and re-alloc the following private variables */
+ if ((omx_base_component_Private->state == OMX_StateIdle ||
+ omx_base_component_Private->state == OMX_StatePause ||
+ omx_base_component_Private->state == OMX_StateExecuting) &&
+ (pPortParam->nBufferCountActual > old_nBufferCountActual)) {
+// todo check if here it is not better != instead of >
+ pPort = omx_base_component_Private->ports[pPortDef->nPortIndex];
+ if(pPort->pInternalBufferStorage) {
+ pPort->pInternalBufferStorage = realloc(pPort->pInternalBufferStorage,pPort->sPortParam.nBufferCountActual*sizeof(OMX_BUFFERHEADERTYPE *));
+ }
+
+ if(pPort->bBufferStateAllocated) {
+ pPort->bBufferStateAllocated = realloc(pPort->bBufferStateAllocated,pPort->sPortParam.nBufferCountActual*sizeof(BUFFER_STATUS_FLAG));
+ for(j=0; j < pPort->sPortParam.nBufferCountActual; j++) {
+ pPort->bBufferStateAllocated[j] = BUFFER_FREE;
+ }
+ }
+ }
+ }
+ break;
+ case OMX_IndexParamPriorityMgmt:
+ if (omx_base_component_Private->state != OMX_StateLoaded &&
+ omx_base_component_Private->state != OMX_StateWaitForResources) {
+ return OMX_ErrorIncorrectStateOperation;
+ }
+ pPrioMgmt = (OMX_PRIORITYMGMTTYPE*)ComponentParameterStructure;
+ if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PRIORITYMGMTTYPE))) != OMX_ErrorNone) {
+ break;
+ }
+ omx_base_component_Private->nGroupPriority = pPrioMgmt->nGroupPriority;
+ omx_base_component_Private->nGroupID = pPrioMgmt->nGroupID;
+ break;
+ case OMX_IndexParamCompBufferSupplier:
+ pBufferSupplier = (OMX_PARAM_BUFFERSUPPLIERTYPE*)ComponentParameterStructure;
+
+ DEBUG(DEB_LEV_PARAMS, "In %s Buf Sup Port index=%d\n", __func__,(int)pBufferSupplier->nPortIndex);
+
+ if(pBufferSupplier == NULL) {
+ DEBUG(DEB_LEV_ERR, "In %s pBufferSupplier is null!\n",__func__);
+ return OMX_ErrorBadParameter;
+ }
+ if(pBufferSupplier->nPortIndex > (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
+ return OMX_ErrorBadPortIndex;
+ }
+ err = omx_base_component_ParameterSanityCheck(hComponent, pBufferSupplier->nPortIndex, pBufferSupplier, sizeof(OMX_PARAM_BUFFERSUPPLIERTYPE));
+ if(err==OMX_ErrorIncorrectStateOperation) {
+ if (PORT_IS_ENABLED(omx_base_component_Private->ports[pBufferSupplier->nPortIndex])) {
+ DEBUG(DEB_LEV_ERR, "In %s Incorrect State=%x\n",__func__,omx_base_component_Private->state);
+ return OMX_ErrorIncorrectStateOperation;
+ }
+ } else if (err != OMX_ErrorNone) {
+ break;
+ }
+
+ if (pBufferSupplier->eBufferSupplier == OMX_BufferSupplyUnspecified) {
+ DEBUG(DEB_LEV_PARAMS, "In %s: port is already buffer supplier unspecified\n", __func__);
+ return OMX_ErrorNone;
+ }
+ if ((PORT_IS_TUNNELED(omx_base_component_Private->ports[pBufferSupplier->nPortIndex])) == 0) {
+ return OMX_ErrorNone;
+ }
+
+ pPort = omx_base_component_Private->ports[pBufferSupplier->nPortIndex];
+
+ if ((pBufferSupplier->eBufferSupplier == OMX_BufferSupplyInput) &&
+ (pPort->sPortParam.eDir == OMX_DirInput)) {
+ /** These two cases regard the first stage of client override */
+ if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
+ err = OMX_ErrorNone;
+ }
+ pPort->nTunnelFlags |= TUNNEL_IS_SUPPLIER;
+ pBufferSupplier->nPortIndex = pPort->nTunneledPort;
+ err = OMX_SetParameter(pPort->hTunneledComponent, OMX_IndexParamCompBufferSupplier, pBufferSupplier);
+ } else if ((pBufferSupplier->eBufferSupplier == OMX_BufferSupplyOutput) &&
+ (pPort->sPortParam.eDir == OMX_DirInput)) {
+ if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
+ pPort->nTunnelFlags &= ~TUNNEL_IS_SUPPLIER;
+ pBufferSupplier->nPortIndex = pPort->nTunneledPort;
+ err = OMX_SetParameter(pPort->hTunneledComponent, OMX_IndexParamCompBufferSupplier, pBufferSupplier);
+ }
+ err = OMX_ErrorNone;
+ } else if ((pBufferSupplier->eBufferSupplier == OMX_BufferSupplyOutput) &&
+ (pPort->sPortParam.eDir == OMX_DirOutput)) {
+ /** these two cases regard the second stage of client override */
+ if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
+ err = OMX_ErrorNone;
+ }
+ pPort->nTunnelFlags |= TUNNEL_IS_SUPPLIER;
+ } else {
+ if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
+ pPort->nTunnelFlags &= ~TUNNEL_IS_SUPPLIER;
+ err = OMX_ErrorNone;
+ }
+ err = OMX_ErrorNone;
+ }
+ DEBUG(DEB_LEV_PARAMS, "In %s port %d Tunnel flag=%x \n", __func__,(int)pBufferSupplier->nPortIndex, (int)pPort->nTunnelFlags);
+ break;
+ default:
+ err = OMX_ErrorUnsupportedIndex;
+ break;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
+ return err;
+}
+
+/** @brief base GetConfig function
+ *
+ * This base function is not implemented. If a derived component
+ * needs to support any config, it must implement a derived
+ * version of this function and assign it to the correct pointer
+ * in the private component descriptor
+ */
+OSCL_EXPORT_REF OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_GetConfig(
+ OMX_HANDLETYPE hComponent,
+ OMX_INDEXTYPE nIndex,
+ OMX_PTR pComponentConfigStructure) {
+ return OMX_ErrorNone;
+}
+
+/** @brief base SetConfig function
+ *
+ * This base function is not implemented. If a derived component
+ * needs to support any config, it must implement a derived
+ * version of this function and assign it to the correct pointer
+ * in the private component descriptor
+ */
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_SetConfig(
+ OMX_HANDLETYPE hComponent,
+ OMX_INDEXTYPE nIndex,
+ OMX_PTR pComponentConfigStructure) {
+ return OMX_ErrorNone;
+}
+
+/** @brief base function not implemented
+ *
+ * This function can be eventually implemented by a
+ * derived component if needed
+ */
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_GetExtensionIndex(
+ OMX_HANDLETYPE hComponent,
+ OMX_STRING cParameterName,
+ OMX_INDEXTYPE* pIndexType) {
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
+ if(strcmp(cParameterName,"OMX.st.index.param.BellagioThreadsID") == 0) {
+ *pIndexType = OMX_IndexParameterThreadsID;
+ } else {
+ return OMX_ErrorBadParameter;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
+ return OMX_ErrorNone;
+}
+
+/** @return the state of the component
+ *
+ * This function does not need any override by derived components
+ */
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_GetState(
+ OMX_HANDLETYPE hComponent,
+ OMX_STATETYPE* pState) {
+ OMX_COMPONENTTYPE *omxcomponent = (OMX_COMPONENTTYPE*)hComponent;
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)omxcomponent->pComponentPrivate;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
+ *pState = omx_base_component_Private->state;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
+ return OMX_ErrorNone;
+}
+
+/** @brief standard SendCommand function
+ *
+ * In general this function does not need a overwrite, but
+ * a special derived component could do it.
+ */
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_SendCommand(
+ OMX_HANDLETYPE hComponent,
+ OMX_COMMANDTYPE Cmd,
+ OMX_U32 nParam,
+ OMX_PTR pCmdData) {
+ OMX_COMPONENTTYPE* omxComponent = (OMX_COMPONENTTYPE*)hComponent;
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)omxComponent->pComponentPrivate;
+ internalRequestMessageType *message;
+ queue_t* messageQueue;
+ tsem_t* messageSem;
+ OMX_U32 i,j,k;
+ omx_base_PortType *pPort;
+ OMX_ERRORTYPE err = OMX_ErrorNone;
+ int errQue;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
+
+ messageQueue = omx_base_component_Private->messageQueue;
+ messageSem = omx_base_component_Private->messageSem;
+
+ if (omx_base_component_Private->state == OMX_StateInvalid) {
+ return OMX_ErrorInvalidState;
+ }
+
+ message = calloc(1,sizeof(internalRequestMessageType));
+ message->messageParam = nParam;
+ message->pCmdData=pCmdData;
+ /** Fill in the message */
+ switch (Cmd) {
+ case OMX_CommandStateSet:
+ message->messageType = OMX_CommandStateSet;
+ if ((nParam == OMX_StateIdle) && (omx_base_component_Private->state == OMX_StateLoaded)) {
+ /*Allocate Internal Buffer Storage and Buffer Allocation State flags*/
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+
+ pPort = omx_base_component_Private->ports[i];
+
+ if(pPort->pInternalBufferStorage == NULL) {
+ pPort->pInternalBufferStorage = calloc(pPort->sPortParam.nBufferCountActual,sizeof(OMX_BUFFERHEADERTYPE *));
+ }
+
+ if(pPort->bBufferStateAllocated == NULL) {
+ pPort->bBufferStateAllocated = calloc(pPort->sPortParam.nBufferCountActual,sizeof(BUFFER_STATUS_FLAG));
+ }
+
+ for(k=0; k < pPort->sPortParam.nBufferCountActual; k++) {
+ pPort->bBufferStateAllocated[k] = BUFFER_FREE;
+ }
+ }
+ }
+
+ omx_base_component_Private->transientState = OMX_TransStateLoadedToIdle;
+ } else if ((nParam == OMX_StateLoaded) && (omx_base_component_Private->state == OMX_StateIdle)) {
+ omx_base_component_Private->transientState = OMX_TransStateIdleToLoaded;
+ } else if ((nParam == OMX_StateIdle) && (omx_base_component_Private->state == OMX_StateExecuting)) {
+ omx_base_component_Private->transientState = OMX_TransStateExecutingToIdle;
+ } else if ((nParam == OMX_StateIdle) && (omx_base_component_Private->state == OMX_StatePause)) {
+ omx_base_component_Private->transientState = OMX_TransStatePauseToIdle;
+ }
+ break;
+ case OMX_CommandFlush:
+ if (nParam >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts) && nParam != OMX_ALL) {
+ return OMX_ErrorBadPortIndex;
+ }
+ message->messageType = OMX_CommandFlush;
+ break;
+ case OMX_CommandPortDisable:
+ if (nParam >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts) && nParam != OMX_ALL) {
+ return OMX_ErrorBadPortIndex;
+ }
+ message->messageType = OMX_CommandPortDisable;
+ if(message->messageParam == OMX_ALL) {
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+ omx_base_component_Private->ports[i]->bIsTransientToDisabled = OMX_TRUE;
+ }
+ }
+ } else {
+ omx_base_component_Private->ports[message->messageParam]->bIsTransientToDisabled = OMX_TRUE;
+ }
+ break;
+ case OMX_CommandPortEnable:
+ if (nParam >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts) && nParam != OMX_ALL) {
+ return OMX_ErrorBadPortIndex;
+ }
+ message->messageType = OMX_CommandPortEnable;
+ if(message->messageParam == OMX_ALL) {
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+ omx_base_component_Private->ports[i]->bIsTransientToEnabled = OMX_TRUE;
+ }
+ }
+ } else {
+ omx_base_component_Private->ports[message->messageParam]->bIsTransientToEnabled = OMX_TRUE;
+ }
+ break;
+ case OMX_CommandMarkBuffer:
+ if (nParam >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts) && nParam != OMX_ALL) {
+ return OMX_ErrorBadPortIndex;
+ }
+ message->messageType = OMX_CommandMarkBuffer;
+ break;
+ default:
+ err = OMX_ErrorUnsupportedIndex;
+ break;
+ }
+
+ if (err == OMX_ErrorNone) {
+ errQue = queue(messageQueue, message);
+ if (errQue) {
+ /* /TODO the queue is full. This can be handled in a fine way with
+ * some retrials, or other checking. For the moment this is a critical error
+ * and simply causes the failure of this call
+ */
+ return OMX_ErrorInsufficientResources;
+ }
+ tsem_up(messageSem);
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
+ return err;
+}
+
+/** @brief Component's message handler thread function
+ *
+ * Handles all messages coming from components and
+ * processes them by dispatching them back to the
+ * triggering component.
+ */
+void* compMessageHandlerFunction(void* param) {
+ OMX_COMPONENTTYPE *openmaxStandComp = (OMX_COMPONENTTYPE *)param;
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
+ internalRequestMessageType *message;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, openmaxStandComp);
+ omx_base_component_Private->bellagioThreads->nThreadMessageID = (long int)syscall(__NR_gettid);
+ DEBUG(DEB_LEV_SIMPLE_SEQ, "In %s the thread ID is %i\n", __func__, (int)omx_base_component_Private->bellagioThreads->nThreadMessageID);
+
+ while(1){
+ /* Wait for an incoming message */
+ if (omx_base_component_Private == NULL) {
+ break;
+ }
+ tsem_down(omx_base_component_Private->messageSem);
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s new message\n", __func__);
+ /*Destructor has been called. So exit from the loop*/
+ if(omx_base_component_Private->state == OMX_StateInvalid) {
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s Destructor has been called. So exit from the loop\n", __func__);
+ break;
+ }
+ /* Dequeue it */
+ message = dequeue(omx_base_component_Private->messageQueue);
+ if(message == NULL){
+ DEBUG(DEB_LEV_ERR, "In %s: ouch!! had null message!\n", __func__);
+ break;
+ }
+ /* Process it by calling component's message handler method */
+ omx_base_component_Private->messageHandler(openmaxStandComp, message);
+ /* Message ownership has been transferred to us
+ * so we gonna free it when finished.
+ */
+ free(message);
+ message = NULL;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, openmaxStandComp);
+ return NULL;
+}
+
+/** This is called by the component message entry point.
+ * In this base version this function is named compMessageHandlerFunction
+ *
+ * A request is made by the component when some asynchronous services are needed:
+ * 1) A SendCommand() is to be processed
+ * 2) An error needs to be notified
+ * 3) ...
+ *
+ * @param openmaxStandComp the component itself
+ * @param message the message that has been passed to core
+ */
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_MessageHandler(OMX_COMPONENTTYPE *openmaxStandComp,internalRequestMessageType* message) {
+ omx_base_component_PrivateType* omx_base_component_Private=openmaxStandComp->pComponentPrivate;
+ OMX_U32 i,j,k;
+ OMX_ERRORTYPE err = OMX_ErrorNone;
+ omx_base_PortType* pPort;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p with message %i\n", __func__, openmaxStandComp, message->messageType);
+
+ /* Dealing with a SendCommand call.
+ * -messageType contains the command to execute
+ * -messageParam contains the parameter of the command
+ * (destination state in case of a state change command).
+ */
+ switch(message->messageType){
+ case OMX_CommandStateSet: {
+ /* Do the actual state change */
+ err = (*(omx_base_component_Private->DoStateSet))(openmaxStandComp, message->messageParam);
+ if (err != OMX_ErrorNone) {
+ (*(omx_base_component_Private->callbacks->EventHandler))
+ (openmaxStandComp,
+ omx_base_component_Private->callbackData,
+ OMX_EventError, /* The command was completed */
+ err, /* The commands was a OMX_CommandStateSet */
+ 0, /* The state has been changed in message->messageParam */
+ NULL);
+ } else {
+ /* And run the callback */
+ if (omx_base_component_Private->callbacks) {
+ DEBUG(DEB_LEV_SIMPLE_SEQ, "running callback in %s\n", __func__);
+ (*(omx_base_component_Private->callbacks->EventHandler))
+ (openmaxStandComp,
+ omx_base_component_Private->callbackData,
+ OMX_EventCmdComplete, /* The command was completed */
+ OMX_CommandStateSet, /* The commands was a OMX_CommandStateSet */
+ message->messageParam, /* The state has been changed in message->messageParam */
+ NULL);
+ }
+ }
+ }
+ break;
+ case OMX_CommandFlush: {
+ /*Flush port/s*/
+ if(message->messageParam == OMX_ALL) {
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+ omx_base_component_Private->ports[i]->bIsPortFlushed = OMX_TRUE;
+ }
+ }
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+ pPort=omx_base_component_Private->ports[i];
+ err = pPort->FlushProcessingBuffers(pPort);
+ }
+ }
+ }
+ else {
+ pPort=omx_base_component_Private->ports[message->messageParam];
+ err = pPort->FlushProcessingBuffers(pPort);
+ }
+ if (err != OMX_ErrorNone) {
+ (*(omx_base_component_Private->callbacks->EventHandler))
+ (openmaxStandComp,
+ omx_base_component_Private->callbackData,
+ OMX_EventError, /* The command was completed */
+ err, /* The commands was a OMX_CommandStateSet */
+ 0, /* The state has been changed in message->messageParam */
+ NULL);
+ } else {
+ if(message->messageParam == OMX_ALL){ /*Flush all port*/
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+ (*(omx_base_component_Private->callbacks->EventHandler))
+ (openmaxStandComp,
+ omx_base_component_Private->callbackData,
+ OMX_EventCmdComplete, /* The command was completed */
+ OMX_CommandFlush, /* The commands was a OMX_CommandStateSet */
+ i, /* The state has been changed in message->messageParam */
+ NULL);
+
+ pPort=omx_base_component_Private->ports[i];
+ /* Signal the buffer Semaphore and the buffer managment semaphore, to restart the exchange of buffers after flush */
+ if (PORT_IS_TUNNELED(pPort) && PORT_IS_BUFFER_SUPPLIER(pPort)) {
+ for(k=0;k<pPort->nNumTunnelBuffer;k++) {
+ tsem_up(pPort->pBufferSem);
+ /*signal buffer management thread availability of buffers*/
+ tsem_up(omx_base_component_Private->bMgmtSem);
+ }
+ }
+ }
+ }
+ } else {/*Flush input/output port*/
+ (*(omx_base_component_Private->callbacks->EventHandler))
+ (openmaxStandComp,
+ omx_base_component_Private->callbackData,
+ OMX_EventCmdComplete, /* The command was completed */
+ OMX_CommandFlush, /* The commands was a OMX_CommandStateSet */
+ message->messageParam, /* The state has been changed in message->messageParam */
+ NULL);
+ /* Signal the buffer Semaphore and the buffer managment semaphore, to restart the exchange of buffers after flush */
+ if (PORT_IS_TUNNELED(omx_base_component_Private->ports[message->messageParam])
+ && PORT_IS_BUFFER_SUPPLIER(omx_base_component_Private->ports[message->messageParam])) {
+ for(j=0;j<omx_base_component_Private->ports[message->messageParam]->nNumTunnelBuffer;j++) {
+ tsem_up(omx_base_component_Private->ports[message->messageParam]->pBufferSem);
+ /*signal buffer management thread availability of buffers*/
+ tsem_up(omx_base_component_Private->bMgmtSem);
+ }
+ }
+ }
+ }
+ }
+ break;
+ case OMX_CommandPortDisable: {
+ /*Flush port/s*/
+ if(message->messageParam == OMX_ALL) {
+ /*If Component is not in loaded state,then First Flush all buffers then disable the port*/
+ if(omx_base_component_Private->state!=OMX_StateLoaded) {
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+ pPort=omx_base_component_Private->ports[i];
+ err = pPort->FlushProcessingBuffers(pPort);
+ }
+ }
+ }
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+ pPort=omx_base_component_Private->ports[i];
+ err = pPort->Port_DisablePort(pPort);
+ }
+ }
+ }
+ else {
+ pPort=omx_base_component_Private->ports[message->messageParam];
+ if(omx_base_component_Private->state!=OMX_StateLoaded) {
+ err = pPort->FlushProcessingBuffers(pPort);
+ DEBUG(DEB_LEV_FULL_SEQ, "In %s: Port Flush completed for Comp %s\n",__func__,omx_base_component_Private->name);
+ }
+ err = pPort->Port_DisablePort(pPort);
+ }
+ /** This condition is added to pass the tests, it is not significant for the environment */
+ if (err != OMX_ErrorNone) {
+ (*(omx_base_component_Private->callbacks->EventHandler))
+ (openmaxStandComp,
+ omx_base_component_Private->callbackData,
+ OMX_EventError, /* The command was completed */
+ err, /* The commands was a OMX_CommandStateSet */
+ 0, /* The state has been changed in message->messageParam */
+ NULL);
+ } else {
+ if(message->messageParam == OMX_ALL){ /*Disable all ports*/
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+ (*(omx_base_component_Private->callbacks->EventHandler))
+ (openmaxStandComp,
+ omx_base_component_Private->callbackData,
+ OMX_EventCmdComplete, /* The command was completed */
+ OMX_CommandPortDisable, /* The commands was a OMX_CommandStateSet */
+ i, /* The state has been changed in message->messageParam */
+ NULL);
+ }
+ }
+ } else {
+ (*(omx_base_component_Private->callbacks->EventHandler))
+ (openmaxStandComp,
+ omx_base_component_Private->callbackData,
+ OMX_EventCmdComplete, /* The command was completed */
+ OMX_CommandPortDisable, /* The commands was a OMX_CommandStateSet */
+ message->messageParam, /* The state has been changed in message->messageParam */
+ NULL);
+ }
+ }
+ }
+ break;
+ case OMX_CommandPortEnable:{
+ /*Flush port/s*/
+ if(message->messageParam == OMX_ALL) {
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+ pPort=omx_base_component_Private->ports[i];
+ err = pPort->Port_EnablePort(pPort);
+ }
+ }
+ } else {
+ pPort=omx_base_component_Private->ports[message->messageParam];
+ err = pPort->Port_EnablePort(pPort);
+ }
+ if (err != OMX_ErrorNone) {
+ (*(omx_base_component_Private->callbacks->EventHandler))
+ (openmaxStandComp,
+ omx_base_component_Private->callbackData,
+ OMX_EventError, /* The command was completed */
+ err, /* The commands was a OMX_CommandStateSet */
+ 0, /* The state has been changed in message->messageParam */
+ NULL);
+ } else {
+ if(message->messageParam != OMX_ALL) {
+ (*(omx_base_component_Private->callbacks->EventHandler))
+ (openmaxStandComp,
+ omx_base_component_Private->callbackData,
+ OMX_EventCmdComplete, /* The command was completed */
+ OMX_CommandPortEnable, /* The commands was a OMX_CommandStateSet */
+ message->messageParam, /* The state has been changed in message->messageParam */
+ NULL);
+
+ if (omx_base_component_Private->state==OMX_StateExecuting) {
+ pPort=omx_base_component_Private->ports[message->messageParam];
+ if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
+ for(i=0; i < pPort->sPortParam.nBufferCountActual;i++) {
+ tsem_up(pPort->pBufferSem);
+ tsem_up(omx_base_component_Private->bMgmtSem);
+ }
+ }
+ }
+
+ } else {
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+ (*(omx_base_component_Private->callbacks->EventHandler))
+ (openmaxStandComp,
+ omx_base_component_Private->callbackData,
+ OMX_EventCmdComplete, /* The command was completed */
+ OMX_CommandPortEnable, /* The commands was a OMX_CommandStateSet */
+ i, /* The state has been changed in message->messageParam */
+ NULL);
+ }
+ }
+
+ if (omx_base_component_Private->state==OMX_StateExecuting) {
+ /* for all ports */
+ for(j = 0; j < NUM_DOMAINS; j++) {
+ for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
+ i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
+ omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
+ pPort=omx_base_component_Private->ports[i];
+ if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
+ for(k=0; k < pPort->sPortParam.nBufferCountActual;k++) {
+ tsem_up(pPort->pBufferSem);
+ tsem_up(omx_base_component_Private->bMgmtSem);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+ case OMX_CommandMarkBuffer: {
+ omx_base_component_Private->pMark.hMarkTargetComponent = ((OMX_MARKTYPE *)message->pCmdData)->hMarkTargetComponent;
+ omx_base_component_Private->pMark.pMarkData = ((OMX_MARKTYPE *)message->pCmdData)->pMarkData;
+ }
+ break;
+ default:
+ DEBUG(DEB_LEV_ERR, "In %s: Unrecognized command %i\n", __func__, message->messageType);
+ break;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, openmaxStandComp);
+ return OMX_ErrorNone;
+}
+
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_AllocateBuffer(
+ OMX_HANDLETYPE hComponent,
+ OMX_BUFFERHEADERTYPE** ppBuffer,
+ OMX_U32 nPortIndex,
+ OMX_PTR pAppPrivate,
+ OMX_U32 nSizeBytes) {
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
+ omx_base_PortType *pPort;
+ OMX_ERRORTYPE err;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
+
+ if (nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
+ DEBUG(DEB_LEV_ERR, "In %s: wrong port index\n", __func__);
+ return OMX_ErrorBadPortIndex;
+ }
+ pPort = omx_base_component_Private->ports[nPortIndex];
+ err = pPort->Port_AllocateBuffer(pPort, ppBuffer, nPortIndex, pAppPrivate, nSizeBytes);
+ if (err != OMX_ErrorNone) {
+ DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %i\n", __func__, hComponent, (int)err);
+ return err;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p buffer %p\n", __func__, hComponent, ppBuffer);
+ return OMX_ErrorNone;
+}
+
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_UseBuffer(
+ OMX_HANDLETYPE hComponent,
+ OMX_BUFFERHEADERTYPE** ppBufferHdr,
+ OMX_U32 nPortIndex,
+ OMX_PTR pAppPrivate,
+ OMX_U32 nSizeBytes,
+ OMX_U8* pBuffer) {
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
+ omx_base_PortType *pPort;
+ OMX_ERRORTYPE err;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
+ if (nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
+ DEBUG(DEB_LEV_ERR, "In %s: wrong port index\n", __func__);
+ return OMX_ErrorBadPortIndex;
+ }
+ pPort = omx_base_component_Private->ports[nPortIndex];
+ err = pPort->Port_UseBuffer(pPort, ppBufferHdr, nPortIndex, pAppPrivate, nSizeBytes, pBuffer);
+ if (err != OMX_ErrorNone) {
+ DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %i\n", __func__, hComponent, (int)err);
+ return err;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
+ return OMX_ErrorNone;
+}
+
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_UseEGLImage (
+ OMX_HANDLETYPE hComponent,
+ OMX_BUFFERHEADERTYPE** ppBufferHdr,
+ OMX_U32 nPortIndex,
+ OMX_PTR pAppPrivate,
+ void* eglImage) {
+ return OMX_ErrorNotImplemented;
+}
+
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_FreeBuffer(
+ OMX_HANDLETYPE hComponent,
+ OMX_U32 nPortIndex,
+ OMX_BUFFERHEADERTYPE* pBuffer) {
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
+ omx_base_PortType *pPort;
+ OMX_ERRORTYPE err;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
+ if (nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
+ DEBUG(DEB_LEV_ERR, "In %s: wrong port index\n", __func__);
+ return OMX_ErrorBadPortIndex;
+ }
+
+ pPort = omx_base_component_Private->ports[nPortIndex];
+ err = pPort->Port_FreeBuffer(pPort, nPortIndex, pBuffer);
+ if (err != OMX_ErrorNone) {
+ DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %i\n", __func__, hComponent, (int)err);
+ return err;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
+ return OMX_ErrorNone;
+}
+
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_EmptyThisBuffer(
+ OMX_HANDLETYPE hComponent,
+ OMX_BUFFERHEADERTYPE* pBuffer) {
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
+ omx_base_PortType *pPort;
+ OMX_ERRORTYPE err;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
+
+ if (pBuffer->nInputPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
+ DEBUG(DEB_LEV_ERR, "In %s: wrong port index\n", __func__);
+ return OMX_ErrorBadPortIndex;
+ }
+ pPort = omx_base_component_Private->ports[pBuffer->nInputPortIndex];
+ if (pPort->sPortParam.eDir != OMX_DirInput) {
+ DEBUG(DEB_LEV_ERR, "In %s: wrong port direction in Component %s\n", __func__,omx_base_component_Private->name);
+ return OMX_ErrorBadPortIndex;
+ }
+ err = pPort->Port_SendBufferFunction(pPort, pBuffer);
+ if (err != OMX_ErrorNone) {
+ DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %s\n", __func__, hComponent, errorName(err));
+ return err;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
+ return OMX_ErrorNone;
+}
+
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_FillThisBuffer(
+ OMX_HANDLETYPE hComponent,
+ OMX_BUFFERHEADERTYPE* pBuffer) {
+
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
+ omx_base_PortType *pPort;
+ OMX_ERRORTYPE err;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
+ if (pBuffer->nOutputPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
+ DEBUG(DEB_LEV_ERR, "In %s: wrong port index\n", __func__);
+ return OMX_ErrorBadPortIndex;
+ }
+ pPort = omx_base_component_Private->ports[pBuffer->nOutputPortIndex];
+ if (pPort->sPortParam.eDir != OMX_DirOutput) {
+ DEBUG(DEB_LEV_ERR, "In %s: wrong port(%d) direction(%x) pBuffer=%p in Component %s\n", __func__,
+ (int)pBuffer->nOutputPortIndex, (int)pPort->sPortParam.eDir, pBuffer, omx_base_component_Private->name);
+ return OMX_ErrorBadPortIndex;
+ }
+ err = pPort->Port_SendBufferFunction(pPort, pBuffer);
+ if (err != OMX_ErrorNone) {
+ DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %s\n", __func__, hComponent, errorName(err));
+ return err;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
+ return OMX_ErrorNone;
+}
+
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_component_ComponentTunnelRequest(
+ OMX_HANDLETYPE hComponent,
+ OMX_U32 nPort,
+ OMX_HANDLETYPE hTunneledComp,
+ OMX_U32 nTunneledPort,
+ OMX_TUNNELSETUPTYPE* pTunnelSetup) {
+
+ omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
+ omx_base_PortType *pPort;
+ OMX_ERRORTYPE err;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
+ if (nPort >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
+ omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
+ return OMX_ErrorBadPortIndex;
+ }
+
+ pPort = omx_base_component_Private->ports[nPort];
+ err = pPort->ComponentTunnelRequest(pPort, hTunneledComp, nTunneledPort, pTunnelSetup);
+ if (err != OMX_ErrorNone) {
+ DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %i\n", __func__, hComponent, (int)err);
+ return err;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
+ return OMX_ErrorNone;
+}
+
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_getQualityLevel(OMX_COMPONENTTYPE *openmaxStandComp, OMX_U32* pQualityLevel) {
+ omx_base_component_PrivateType* omx_base_component_Private = openmaxStandComp->pComponentPrivate;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s\n", __func__);
+ *pQualityLevel = omx_base_component_Private->currentQualityLevel;
+ return OMX_ErrorNone;
+}
+
+OSCL_EXPORT_REF OMX_ERRORTYPE omx_base_setQualityLevel(OMX_COMPONENTTYPE *openmaxStandComp, OMX_U32 nQualityLevel) {
+ omx_base_component_PrivateType* omx_base_component_Private = openmaxStandComp->pComponentPrivate;
+ /* this change is done regardless to the state. When the way to change effectively quality in a component is known
+ * change this function adding state checks
+ */
+ DEBUG(DEB_LEV_SIMPLE_SEQ, "In %s setting %i of %i\n", __func__, (int)nQualityLevel, (int)omx_base_component_Private->nqualitylevels);
+ if ((nQualityLevel > 0) && (nQualityLevel <= omx_base_component_Private->nqualitylevels)) {
+ omx_base_component_Private->currentQualityLevel = nQualityLevel;
+ return OMX_ErrorNone;
+ } else {
+ return OMX_ErrorBadParameter;
+ }
+}
+
+#ifdef __cplusplus
+}
+#endif
+
Index: create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/base
===================================================================
--- create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/base (nonexistent)
+++ create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/base (revision 5)
Property changes on: create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/base
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/dynamic_loader/Makefile.am
===================================================================
--- create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/dynamic_loader/Makefile.am (nonexistent)
+++ create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/dynamic_loader/Makefile.am (revision 5)
@@ -0,0 +1,11 @@
+omxdynamicloaderdir = $(libdir)/omxloaders
+
+omxdynamicloader_LTLIBRARIES = libomxdynamicloader.la
+libomxdynamicloader_la_SOURCES = ste_dynamic_component_loader.c ste_dynamic_component_loader.h
+
+#libomxdynamicloader_la_LDFLAGS = -L$(abs_top_builddir)/src/.libs -lomxil-bellagio
+libomxdynamicloader_la_LDFLAGS = $(top_builddir)/src/.libs/libomxil-bellagio.la
+libomxdynamicloader_la_CFLAGS = -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/src/base \
+ -DOMX_COMPONENT_PATH=\"$(plugindir)\/\"
Index: create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/dynamic_loader
===================================================================
--- create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/dynamic_loader (nonexistent)
+++ create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/dynamic_loader (revision 5)
Property changes on: create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/dynamic_loader
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/omx_reference_resource_manager.c
===================================================================
--- create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/omx_reference_resource_manager.c (nonexistent)
+++ create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/omx_reference_resource_manager.c (revision 5)
@@ -0,0 +1,504 @@
+/**
+ src/omx_reference_resource_manager.c
+
+ This simple resource manager emulates the behavior of a real RM.
+ It applies the rules defined in the OpenMAX spec. It can be replaced in
+ the future by a real system.
+
+ Copyright (C) 2007-2009 STMicroelectronics
+ Copyright (C) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+
+ This library is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 2.1 of the License, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA
+
+*/
+
+#include <string.h>
+#include "omx_reference_resource_manager.h"
+#include "base/omx_base_component.h"
+#include "queue.h"
+
+/**
+ * This is the static base pointer of the list
+ */
+static int globalTimestamp = 0;
+
+/**
+ * This function initializes the Resource manager. In the current implementation
+ * it does not perform any operation
+ */
+OMX_ERRORTYPE RM_Init() {
+ int i;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s\n", __func__);
+ globalIndex = 0;
+ listOfcomponentRegistered = calloc(1, sizeof(struct NameIndexType) * MAX_COMPONENTS_TYPES_HANDLED);
+ for (i = 0; i<MAX_COMPONENTS_TYPES_HANDLED; i++) {
+ listOfcomponentRegistered[i].index = -1;
+ listOfcomponentRegistered[i].component_name = NULL;
+ }
+ globalComponentList = malloc(sizeof(ComponentListType*) * MAX_COMPONENTS_TYPES_HANDLED);
+ globalWaitingComponentList = malloc(sizeof(ComponentListType*) * MAX_COMPONENTS_TYPES_HANDLED);
+ memset(globalComponentList, '\0', sizeof(ComponentListType*) * MAX_COMPONENTS_TYPES_HANDLED);
+ memset(globalWaitingComponentList, '\0', sizeof(ComponentListType*) * MAX_COMPONENTS_TYPES_HANDLED);
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s\n", __func__);
+ return OMX_ErrorNone;
+}
+
+/** This function is called during initialization by any component interested in be
+ * handled by the internal resource manager
+ */
+OMX_ERRORTYPE RM_RegisterComponent(char *name, int max_components) {
+ int i = 0;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s\n", __func__);
+ while (listOfcomponentRegistered[i].component_name != NULL) {
+ if (!strcmp(listOfcomponentRegistered[i].component_name, name)) {
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s component already registered\n", __func__);
+ return OMX_ErrorNone;
+ }
+ i++;
+ }
+ listOfcomponentRegistered[i].component_name = calloc(1, OMX_MAX_STRINGNAME_SIZE);
+ if (listOfcomponentRegistered[i].component_name == NULL) {
+ return OMX_ErrorInsufficientResources;
+ }
+ strcpy(listOfcomponentRegistered[i].component_name, name);
+ listOfcomponentRegistered[i].component_name[strlen(name)] = '\0';
+ listOfcomponentRegistered[i].index = globalIndex;
+ listOfcomponentRegistered[i].max_components = max_components;
+ globalIndex++;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s\n", __func__);
+ return OMX_ErrorNone;
+}
+
+/**
+ * This function de-initializes the resource manager.
+ * In the current implementation its responsibility is to clean up any queue
+ * that can be left pending at the end of usage. With a correct use of the
+ * resource manager it won't happen, but it is safer to clean up everything
+ * this these lists are global and alive for all the life of IL client,
+ * beyond the usual OMX_Init - Deinit scope.
+ */
+OMX_ERRORTYPE RM_Deinit() {
+ int i = 0;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s\n", __func__);
+ while(globalComponentList[i] != NULL) {
+ clearList(&globalComponentList[i]);
+ clearList(&globalWaitingComponentList[i]);
+ i++;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s\n", __func__);
+ return OMX_ErrorNone;
+}
+
+/**
+ * This function adds a new element to a given list.
+ * If it does not yet exists, this function also allocates the list.
+ */
+OMX_ERRORTYPE addElemToList(ComponentListType **list, OMX_COMPONENTTYPE *openmaxStandComp, int index, OMX_BOOL bIsWaiting) {
+ ComponentListType *componentTemp;
+ ComponentListType *componentNext;
+ omx_base_component_PrivateType* omx_base_component_Private;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s is waiting %i\n", __func__, bIsWaiting);
+ omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
+ if (!*list) {
+ *list = malloc(sizeof(ComponentListType));
+ if (!bIsWaiting) {
+ globalComponentList[index] = *list;
+ } else {
+ globalWaitingComponentList[index] = *list;
+ }
+ if (!*list) {
+ DEBUG(DEB_LEV_ERR, "In %s OMX_ErrorInsufficientResources\n", __func__);
+ return OMX_ErrorInsufficientResources;
+ }
+ (*list)->openmaxStandComp = openmaxStandComp;
+ (*list)->timestamp = globalTimestamp;
+ globalTimestamp++;
+ (*list)->nGroupPriority = omx_base_component_Private->nGroupPriority;
+ (*list)->next = NULL;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s\n", __func__);
+ return OMX_ErrorNone;
+ }
+ componentTemp = *list;
+ while(componentTemp->next) {
+ componentTemp = componentTemp->next;
+ }
+ componentNext = malloc(sizeof(ComponentListType));
+ if (!componentNext) {
+ DEBUG(DEB_LEV_ERR, "In %s OMX_ErrorInsufficientResources\n", __func__);
+ return OMX_ErrorInsufficientResources;
+ }
+ componentTemp->next = componentNext;
+ componentNext->next = NULL;
+ componentNext->openmaxStandComp = openmaxStandComp;
+ componentNext->timestamp = globalTimestamp;
+ globalTimestamp++;
+ componentNext->nGroupPriority = omx_base_component_Private->nGroupPriority;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s\n", __func__);
+ return OMX_ErrorNone;
+}
+
+/**
+ * This function removes the given element from the list, if present.
+ * If the list is empty, this function cleans up everything.
+ */
+OMX_ERRORTYPE removeElemFromList(ComponentListType **list, OMX_COMPONENTTYPE *openmaxStandComp) {
+ ComponentListType *componentTemp;
+ ComponentListType *componentPrev;
+ OMX_BOOL bFound = OMX_FALSE;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s list %p\n", __func__, *list);
+ if (!*list) {
+ DEBUG(DEB_LEV_ERR, "In %s, the resource manager is not initialized\n", __func__);
+ return OMX_ErrorUndefined;
+ }
+ componentTemp = *list;
+ componentPrev = *list;
+ while(componentTemp) {
+ if (componentTemp->openmaxStandComp == openmaxStandComp) {
+ if (componentTemp == *list) {
+ *list = (*list)->next;
+ free(componentTemp);
+ } else {
+ componentPrev->next = componentTemp->next;
+ free(componentTemp);
+ }
+ bFound = OMX_TRUE;
+ break;
+ } else {
+ if (componentTemp != *list) {
+ componentPrev = componentPrev->next;
+ }
+ componentTemp = componentTemp->next;
+ }
+ }
+ if(!bFound) {
+ DEBUG(DEB_LEV_ERR, "In %s, the specified component does not exist\n", __func__);
+ return OMX_ErrorComponentNotFound;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s\n", __func__);
+ return OMX_ErrorNone;
+
+}
+
+
+/**
+ * This function returns the number of elements present in the
+ * list. If the list does not exists, this function returns 0 elements
+ * without further warnings
+ */
+int numElemInList(ComponentListType *list) {
+ ComponentListType *componentTemp;
+ int numElem = 0;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s\n", __func__);
+ if (!list) {
+ DEBUG(DEB_LEV_SIMPLE_SEQ, "In %s, no list no elements\n", __func__);
+ return 0;
+ }
+ componentTemp = list;
+ while(componentTemp) {
+ numElem++;
+ componentTemp = componentTemp->next;
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s\n", __func__);
+ return numElem;
+}
+
+/**
+ * This function deallocate any remaining element in a list
+ * and dispose it
+ */
+OMX_ERRORTYPE clearList(ComponentListType **list) {
+ ComponentListType *componentTemp;
+ ComponentListType *componentPrev;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s\n", __func__);
+ if (!*list) {
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, no list no elements\n", __func__);
+ return OMX_ErrorNone;
+ }
+ componentTemp = *list;
+ while(componentTemp) {
+ componentPrev = componentTemp;
+ componentTemp = componentTemp->next;
+ free(componentPrev);
+ }
+ *list = NULL;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s\n", __func__);
+ return OMX_ErrorNone;
+}
+
+/**
+ * This debug function is capable of printing the full list
+ * actually stored
+ */
+void RM_printList(ComponentListType *list, int viewFlag) {
+ ComponentListType *componentTemp = list;
+ omx_base_component_PrivateType* omx_base_component_Private;
+ int index;
+
+ if (!list) {
+ printf("The list is empty\n");
+ return;
+ }
+ index = 0;
+ while (componentTemp) {
+ omx_base_component_Private = (omx_base_component_PrivateType*)componentTemp->openmaxStandComp->pComponentPrivate;
+ if ((viewFlag & RM_SHOW_NAME) == RM_SHOW_NAME) {
+ printf("Name %s ", omx_base_component_Private->name);
+ }
+ if ((viewFlag & RM_SHOW_ADDRESS) == RM_SHOW_ADDRESS) {
+ printf("Address %p ", componentTemp->openmaxStandComp);
+ }
+ printf("\n");
+ index++;
+ componentTemp = componentTemp->next;
+ }
+}
+
+/**
+ * This function returns the number of components that have a lower priority
+ * than the value specified, and the lowest among all possibles.
+ * If the number returned is 0, no component is preemptable. if it is 1 or more,
+ * the oldest_component_preemptable will contain the reference to the preemptable
+ * component with the oldest time stamp.
+ */
+int searchLowerPriority(ComponentListType *list, int current_priority, ComponentListType **oldest_component_preemptable) {
+ ComponentListType *componentTemp;
+ ComponentListType *componentCandidate;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s\n", __func__);
+ int nComp = 0;
+ if (!list) {
+ DEBUG(DEB_LEV_ERR, "In %s no list\n", __func__);
+ return OMX_ErrorUndefined;
+ }
+ componentTemp = list;
+ componentCandidate = NULL;
+ while (componentTemp) {
+ if (componentTemp->nGroupPriority > current_priority) {
+ nComp++;
+ }
+ if (nComp>0) {
+ if (componentCandidate) {
+ if (componentCandidate->timestamp > componentTemp->timestamp) {
+ componentCandidate = componentTemp;
+ }
+ } else {
+ componentCandidate = componentTemp;
+ }
+ }
+ componentTemp = componentTemp->next;
+ }
+ *oldest_component_preemptable = componentCandidate;
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s\n", __func__);
+ return nComp;
+}
+
+/**
+ * This function tries to preempt the given component, that has been detected as
+ * the candidate by the default policy defined in the OpenMAX spec.
+ */
+OMX_ERRORTYPE preemptComponent(OMX_COMPONENTTYPE *openmaxStandComp) {
+ OMX_ERRORTYPE err;
+ omx_base_component_PrivateType* omx_base_component_Private = openmaxStandComp->pComponentPrivate;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s\n", __func__);
+
+ if (omx_base_component_Private->state == OMX_StateIdle) {
+ (*(omx_base_component_Private->callbacks->EventHandler))
+ (openmaxStandComp, omx_base_component_Private->callbackData,
+ OMX_EventError, OMX_ErrorResourcesLost, 0, NULL);
+ err = OMX_SendCommand(openmaxStandComp, OMX_CommandStateSet, OMX_StateLoaded, NULL);
+ if (err != OMX_ErrorNone) {
+ DEBUG(DEB_LEV_ERR, "In %s, the state cannot be changed\n", __func__);
+ return OMX_ErrorUndefined;
+ }
+ } else if ((omx_base_component_Private->state == OMX_StateExecuting) || (omx_base_component_Private->state == OMX_StatePause)) {
+ // TODO fill also this section that cover the preemption of a running component
+ // send OMX_ErrorResourcesPreempted
+ // change state to Idle
+ // send OMX_ErrorResourcesLost
+ // change state to Loaded
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s\n", __func__);
+ return OMX_ErrorNone;
+}
+
+/**
+ * This function is executed by a component when it changes state from Loaded to Idle.
+ * If it return ErrorNone the resource is granted and it can transit to Idle.
+ * In case the resource is already busy, the resource manager preempt another component
+ * with a lower priority and a oldest time flag if it exists. Differently it returns OMX_ErrorInsufficientResources
+ */
+OMX_ERRORTYPE RM_getResource(OMX_COMPONENTTYPE *openmaxStandComp) {
+ ComponentListType *componentCandidate;
+ omx_base_component_PrivateType* omx_base_component_Private;
+ int candidates;
+ OMX_ERRORTYPE err;
+ int i = 0;
+ int indexComponent = -1;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s\n", __func__);
+ omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
+ while(listOfcomponentRegistered[i].component_name != NULL ) {
+ if (!strcmp(listOfcomponentRegistered[i].component_name, omx_base_component_Private->name)) {
+ // found component in the list of the resource manager
+ indexComponent = listOfcomponentRegistered[i].index;
+ break;
+ }
+ i++;
+ }
+ if (indexComponent <0) {
+ // No resource to be handled
+ DEBUG(DEB_LEV_ERR, "In %s No resource to be handled\n", __func__);
+ return OMX_ErrorNone;
+ }
+ if (numElemInList(globalComponentList[indexComponent]) >= listOfcomponentRegistered[i].max_components) {
+ candidates = searchLowerPriority(globalComponentList[indexComponent], omx_base_component_Private->nGroupPriority, &componentCandidate);
+ if (candidates) {
+ DEBUG(DEB_LEV_SIMPLE_SEQ, "In %s candidates %i winner %p\n", __func__, candidates, componentCandidate->openmaxStandComp);
+ err = preemptComponent(componentCandidate->openmaxStandComp);
+ if (err != OMX_ErrorNone) {
+ DEBUG(DEB_LEV_ERR, "In %s the component cannot be preempted\n", __func__);
+ return OMX_ErrorInsufficientResources;
+ } else {
+ err = removeElemFromList(&globalComponentList[indexComponent], componentCandidate->openmaxStandComp);
+ err = addElemToList(&globalComponentList[indexComponent], openmaxStandComp, indexComponent, OMX_FALSE);
+ if (err != OMX_ErrorNone) {
+ DEBUG(DEB_LEV_ERR, "In %s memory error\n", __func__);
+ return OMX_ErrorInsufficientResources;
+ }
+ }
+ } else {
+ DEBUG(DEB_LEV_SIMPLE_SEQ, "Out of %s with insufficient resources\n", __func__);
+ return OMX_ErrorInsufficientResources;
+ }
+
+ } else {
+ err = addElemToList(&globalComponentList[indexComponent], openmaxStandComp, indexComponent, OMX_FALSE);
+ }
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s\n", __func__);
+ return OMX_ErrorNone;
+}
+
+/**
+ * This function is called by a component when it transit from Idle to Loaded and can release
+ * its used resource handled by the resource manager
+ */
+OMX_ERRORTYPE RM_releaseResource(OMX_COMPONENTTYPE *openmaxStandComp){
+ omx_base_component_PrivateType* omx_base_component_Private;
+ OMX_COMPONENTTYPE *openmaxWaitingComp;
+ OMX_ERRORTYPE err;
+
+ int i = 0;
+ int indexComponent = -1;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s\n", __func__);
+ omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
+
+ while(listOfcomponentRegistered[i].component_name != NULL ) {
+ if (!strcmp(listOfcomponentRegistered[i].component_name, omx_base_component_Private->name)) {
+ // found component in the list of the resource manager
+ indexComponent = listOfcomponentRegistered[i].index;
+ break;
+ }
+ i++;
+ }
+ if (indexComponent <0) {
+ // No resource to be handled
+ DEBUG(DEB_LEV_ERR, "In %s No resource to be handled\n", __func__);
+ return OMX_ErrorNone;
+ }
+ if (!globalComponentList[indexComponent]) {
+ DEBUG(DEB_LEV_ERR, "In %s, the resource manager is not initialized\n", __func__);
+ return OMX_ErrorUndefined;
+ }
+ err = removeElemFromList(&globalComponentList[indexComponent], openmaxStandComp);
+ if (err != OMX_ErrorNone) {
+ DEBUG(DEB_LEV_ERR, "In %s, the resource cannot be released\n", __func__);
+ return OMX_ErrorUndefined;
+ }
+ if(numElemInList(globalWaitingComponentList[indexComponent])) {
+ openmaxWaitingComp = globalWaitingComponentList[indexComponent]->openmaxStandComp;
+ removeElemFromList(&globalWaitingComponentList[indexComponent], openmaxWaitingComp);
+ err = OMX_SendCommand(openmaxWaitingComp, OMX_CommandStateSet, OMX_StateIdle, NULL);
+ if (err != OMX_ErrorNone) {
+ DEBUG(DEB_LEV_ERR, "In %s, the state cannot be changed\n", __func__);
+ }
+ }
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s\n", __func__);
+ return OMX_ErrorNone;
+}
+
+/**
+ * This function adds the given component to the waiting queue for
+ * the given resource. When a resource becomes available through the
+ * RM_releaseResource function the first element in the queue is taken
+ * off the list and it receives the resource just released.
+ */
+OMX_ERRORTYPE RM_waitForResource(OMX_COMPONENTTYPE *openmaxStandComp) {
+ omx_base_component_PrivateType* omx_base_component_Private;
+
+ int i = 0;
+ int indexComponent = -1;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s\n", __func__);
+ omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
+
+ while(listOfcomponentRegistered[i].component_name != NULL ) {
+ if (!strcmp(listOfcomponentRegistered[i].component_name, omx_base_component_Private->name)) {
+ // found component in the list of the resource manager
+ indexComponent = listOfcomponentRegistered[i].index;
+ break;
+ }
+ i++;
+ }
+ if (indexComponent <0) {
+ // No resource to be handled
+ DEBUG(DEB_LEV_ERR, "In %s No resource to be handled\n", __func__);
+ return OMX_ErrorNone;
+ }
+
+ addElemToList(&globalWaitingComponentList[indexComponent], openmaxStandComp, listOfcomponentRegistered[i].index, OMX_TRUE);
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s\n", __func__);
+ return OMX_ErrorNone;
+}
+
+/**
+ * This function removes a component from the waiting queue
+ * if the IL client decides that the component should not wait any
+ * more for the resource
+ */
+OMX_ERRORTYPE RM_removeFromWaitForResource(OMX_COMPONENTTYPE *openmaxStandComp) {
+ omx_base_component_PrivateType* omx_base_component_Private;
+ int i = 0;
+
+ DEBUG(DEB_LEV_FUNCTION_NAME, "In %s\n", __func__);
+ omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
+
+ while(listOfcomponentRegistered[i].component_name != NULL ) {
+ if (!strcmp(listOfcomponentRegistered[i].component_name, omx_base_component_Private->name)) {
+ // found component in the list of the resource manager
+ removeElemFromList(&globalComponentList[i], openmaxStandComp);
+ DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s\n", __func__);
+ return OMX_ErrorNone;
+ }
+ i++;
+ }
+ // No resource to be handled
+ DEBUG(DEB_LEV_ERR, "In %s No resource to be handled\n", __func__);
+ return OMX_ErrorNone;
+}
Index: create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/omxregister.c
===================================================================
--- create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/omxregister.c (nonexistent)
+++ create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src/omxregister.c (revision 5)
@@ -0,0 +1,501 @@
+/**
+ src/omxregister.c
+
+ Register OpenMAX components. This application registers the installed OpenMAX
+ components and stores the list in the file:
+ $HOME/.omxregistry
+
+ It must be run before using components.
+ The components are searched in the default directory:
+ OMXILCOMPONENTSPATH
+ If the components are installed in a different location, specify:
+
+ omxregister-bellagio installation_path
+
+ If the installation path parameter is not set also the environment variable
+ BELLAGIO_SEARCH_PATH is checked.
+ If set it contains the locations of the components, separated by colons
+
+ Copyright (C) 2007-2010 STMicroelectronics
+ Copyright (C) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+
+ This library is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 2.1 of the License, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA
+
+*/
+
+#include <dlfcn.h>
+#include <dirent.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "st_static_component_loader.h"
+#include "common.h"
+
+#define DEFAULT_LINE_LENGHT 500
+/** String element to be put in the .omxregister file to indicate an
+ * OpenMAX component and its roles
+ */
+static const char arrow[] = " ==> ";
+
+int int2strlen(int value) {
+ int ret = 0;
+ if (value<0) return -1;
+ while(value>0) {
+ value = value/10;
+ ret++;
+ }
+ return ret;
+}
+/** This function shows all the components and related rules already registered
+ * and described in the omxregister file
+ */
+static int showComponentsList(FILE* omxregistryfp) {
+ char* buffer;
+ char* temp_buffer, *temp_rules;
+ char *comp_name, *temp_name, *comp_rules;
+ char* checkChar;
+ int data_read;
+ int allocation_length = DEFAULT_LINE_LENGHT;
+ long int start_pos, end_pos;
+ long int offset;
+ int i;
+
+ buffer = malloc(allocation_length+1);
+ comp_name = malloc(DEFAULT_LINE_LENGHT);
+ temp_name = malloc(DEFAULT_LINE_LENGHT);
+ comp_rules = malloc(DEFAULT_LINE_LENGHT);
+ checkChar = malloc(2);
+
+ printf("*********************************\n");
+ printf("* List of registered components *\n");
+ printf("*********************************\n");
+ while(1) {
+ //read line
+ start_pos = ftell(omxregistryfp);
+ do {
+ data_read = fread(checkChar, 1, 1, omxregistryfp);
+ } while ((*checkChar != '\n') && (data_read > 0));
+ if (feof(omxregistryfp)) {
+ break;
+ }
+ end_pos = ftell(omxregistryfp);
+ offset = (end_pos - start_pos);
+ fseek(omxregistryfp, start_pos, SEEK_SET);
+ data_read = fread(buffer, offset, 1, omxregistryfp);
+ buffer[offset] = '\0';
+ if (buffer[0] == '/') {
+ continue;
+ }
+ temp_buffer = buffer+5;
+ i = 0;
+ while ((temp_buffer[i] != '\0') && (temp_buffer[i] != ' ')) {
+ i++;
+ }
+ strncpy(comp_name, temp_buffer, i);
+ comp_name[i] = '\0';
+ temp_buffer += i;
+ if (*temp_buffer != '\0') {
+ temp_buffer += 5;
+ i = 0;
+ while ((temp_buffer[i] != '\n') && (temp_buffer[i] != ' ')) {
+ i++;
+ }
+ strncpy(comp_rules, temp_buffer, i);
+ comp_rules[i] = '\0';
+ } else {
+ comp_rules[0] = '\0';
+ }
+ printf("Component %s\n", comp_name);
+ if (comp_rules[0] != '\0') {
+ temp_rules = comp_rules;
+ printf(" supported formats:\n");
+ i = 0;
+ while (*(temp_rules+i) != '\0') {
+ i++;
+ if (*(temp_rules+i) == ':') {
+ strncpy(temp_name, temp_rules, i);
+ temp_name[i] = '\0';
+ temp_rules += i+1;
+ printf(" %s\n", temp_name);
+ i = 0;
+ }
+ }
+ }
+ printf("\n");
+ }
+
+ free(buffer);
+ free(comp_name);
+ free(temp_name);
+ free(comp_rules);
+ free(checkChar);
+
+ return 0;
+}
+/** @brief Creates a list of components on a registry file
+ *
+ * This function
+ * - reads for the given directory(ies) any library contained
+ * - check if the library belongs to OpenMAX ST static component loader
+ * (it must contain the function omx_component_library_Setup for the initialization)
+ * - write the openmax names and related libraries to the registry file
+ */
+static int buildComponentsList(FILE* omxregistryfp, char *componentspath, int verbose) {
+ DIR *dirp;
+ struct dirent *dp;
+ void *handle = NULL;
+ int i, num_of_comp, k, qi;
+ int num_of_libraries = 0;
+ unsigned int j;
+ char *buffer = NULL;
+ int (*fptr)(void *);
+ stLoaderComponentType **stComponents;
+ int ncomponents = 0, nroles=0;
+ int pathconsumed = 0;
+ int currentgiven;
+ int index;
+ char* currentpath = componentspath;
+ char* actual;
+ int err;
+ nameList *allNames = NULL;
+ nameList *currentName = NULL;
+ nameList *tempName = NULL;
+ char* qualityString = NULL;
+ int index_string;
+ /* the componentpath contains a single or multiple directories
+ * and is is colon separated like env variables in Linux
+ */
+
+ qualityString = malloc(4096);
+ buffer = malloc(8192);
+ while (!pathconsumed) {
+ index = 0;
+ currentgiven = 0;
+ while (!currentgiven) {
+ if (*(currentpath + index) == '\0') {
+ pathconsumed = 1;
+ }
+ if ((*(currentpath + index) == ':') || (*(currentpath + index) =='\0')) {
+ currentgiven = 1;
+ if (*(currentpath + index - 1) != '/') {
+ actual = malloc(index + 2);
+ *(actual + index) = '/';
+ *(actual+index + 1) = '\0';
+ } else {
+ actual = malloc(index + 1);
+ *(actual+index) = '\0';
+ }
+ strncpy(actual, currentpath, index);
+ currentpath = currentpath + index + 1;
+ }
+ index++;
+ }
+ /* Populate the registry file */
+ dirp = opendir(actual);
+ if (verbose) {
+ printf("\n Scanning directory %s\n", actual);
+ }
+ if(dirp == NULL){
+ free(actual);
+ DEBUG(DEB_LEV_SIMPLE_SEQ, "Cannot open directory %s\n", actual);
+ continue;
+ }
+ while((dp = readdir(dirp)) != NULL) {
+ int len = strlen(dp->d_name);
+
+ if(len >= 3){
+
+
+ if(strncmp(dp->d_name+len-3, ".so", 3) == 0){
+ char lib_absolute_path[strlen(actual) + len + 1];
+
+ strcpy(lib_absolute_path, actual);
+ strcat(lib_absolute_path, dp->d_name);
+
+ if((handle = dlopen(lib_absolute_path, RTLD_NOW)) == NULL) {
+ DEBUG(DEB_LEV_ERR, "could not load %s: %s\n", lib_absolute_path, dlerror());
+ } else {
+ if (verbose) {
+ printf("\n Scanning library %s\n", lib_absolute_path);
+ }
+ if ((fptr = dlsym(handle, "omx_component_library_Setup")) == NULL) {
+ DEBUG(DEB_LEV_SIMPLE_SEQ, "the library %s is not compatible with ST static component loader - %s\n", lib_absolute_path, dlerror());
+ continue;
+ }
+ num_of_libraries++;
+ num_of_comp = fptr(NULL);
+ stComponents = malloc(num_of_comp * sizeof(stLoaderComponentType*));
+ for (i = 0; i<num_of_comp; i++) {
+ stComponents[i] = calloc(1,sizeof(stLoaderComponentType));
+ stComponents[i]->nqualitylevels = 0;
+ stComponents[i]->multiResourceLevel = NULL;
+ }
+ fptr(stComponents);
+ err = fwrite(lib_absolute_path, 1, strlen(lib_absolute_path), omxregistryfp);
+ if (err != strlen(lib_absolute_path)) {
+ DEBUG(DEB_LEV_ERR, "Failed to write %zu bytes to fd %d\n", strlen(lib_absolute_path), fileno(omxregistryfp));
+ continue;
+ }
+ err = fwrite("\n", 1, strlen(buffer), omxregistryfp);
+ if (err != strlen(buffer)) {
+ DEBUG(DEB_LEV_ERR, "Failed to write %zu bytes to fd %d\n", strlen(buffer), fileno(omxregistryfp));
+ continue;
+ }
+
+
+ for (i = 0; i<num_of_comp; i++) {
+ tempName = allNames;
+ if (tempName != NULL) {
+ do {
+ if (!strcmp(tempName->name, stComponents[i]->name)) {
+ DEBUG(DEB_LEV_ERR, "Component %s already registered. Skip\n", stComponents[i]->name);
+ break;
+ }
+ tempName = tempName->next;
+ } while(tempName != NULL);
+ if (tempName != NULL) {
+ continue;
+ }
+ }
+ if (allNames == NULL) {
+ allNames = malloc(sizeof(nameList));
+ currentName = allNames;
+ } else {
+ currentName->next = malloc(sizeof(nameList));
+ currentName = currentName->next;
+ }
+ currentName->next = NULL;
+ currentName->name = malloc(strlen(stComponents[i]->name) + 1);
+ strcpy(currentName->name, stComponents[i]->name);
+ *(currentName->name + strlen(currentName->name)) = '\0';
+
+ DEBUG(DEB_LEV_PARAMS, "Found component %s version=%d.%d.%d.%d in shared object %s\n",
+ stComponents[i]->name,
+ stComponents[i]->componentVersion.s.nVersionMajor,
+ stComponents[i]->componentVersion.s.nVersionMinor,
+ stComponents[i]->componentVersion.s.nRevision,
+ stComponents[i]->componentVersion.s.nStep,
+ lib_absolute_path);
+ if (verbose) {
+ printf("Component %s registered with %i quality levels\n", stComponents[i]->name, (int)stComponents[i]->nqualitylevels);
+ }
+ if (stComponents[i]->nqualitylevels > 0) {
+ index_string = 0;
+ sprintf((qualityString + index_string), "%i ", (int)stComponents[i]->nqualitylevels);
+ index_string = index_string + int2strlen(stComponents[i]->nqualitylevels) + 1;
+ for (qi=0; qi<stComponents[i]->nqualitylevels; qi++) {
+ sprintf((qualityString + index_string), "%i,%i ",
+ stComponents[i]->multiResourceLevel[qi]->CPUResourceRequested,
+ stComponents[i]->multiResourceLevel[qi]->MemoryResourceRequested);
+ index_string = index_string + 2 +
+ int2strlen(stComponents[i]->multiResourceLevel[qi]->CPUResourceRequested) +
+ int2strlen(stComponents[i]->multiResourceLevel[qi]->MemoryResourceRequested);
+ }
+ index_string--;
+ *(qualityString + index_string) = '\0';
+ }
+ // insert first of all the name of the library
+ strcpy(buffer, arrow);
+ strcat(buffer, stComponents[i]->name);
+ if (stComponents[i]->name_specific_length>0) {
+ nroles += stComponents[i]->name_specific_length;
+ strcat(buffer, arrow);
+ for(j=0;j<stComponents[i]->name_specific_length;j++){
+ if (verbose) {
+ printf(" Specific role %s registered\n", stComponents[i]->name_specific[j]);
+ }
+ strcat(buffer, stComponents[i]->name_specific[j]);
+ strcat(buffer, ":");
+ }
+ }
+
+ if ((qualityString != NULL) && (qualityString[0] != '\0')) {
+ strcat(buffer, arrow);
+ strcat(buffer, qualityString);
+ }
+ qualityString[0] = '\0';
+ strcat(buffer, "\n");
+ err = fwrite(buffer, 1, strlen(buffer), omxregistryfp);
+ ncomponents++;
+ }
+ for (i = 0; i < num_of_comp; i++) {
+ free(stComponents[i]->name);
+ for (k=0; k<stComponents[i]->name_specific_length; k++) {
+ free(stComponents[i]->name_specific[k]);
+ free(stComponents[i]->role_specific[k]);
+ }
+ if (stComponents[i]->name_specific_length > 0) {
+ free(stComponents[i]->name_specific);
+ free(stComponents[i]->role_specific);
+ }
+ for (k=0; k<stComponents[i]->nqualitylevels; k++) {
+ free(stComponents[i]->multiResourceLevel[k]);
+ }
+ if (stComponents[i]->multiResourceLevel) {
+ free(stComponents[i]->multiResourceLevel);
+ }
+ free(stComponents[i]);
+ }
+ free(stComponents);
+ }
+ }
+ }
+ }
+ free(actual);
+ closedir(dirp);
+ }
+ if (verbose) {
+ printf("\n %i OpenMAX IL ST static components in %i libraries succesfully scanned\n", ncomponents, num_of_libraries);
+ } else {
+ DEBUG(DEB_LEV_SIMPLE_SEQ, "\n %i OpenMAX IL ST static components with %i roles in %i libraries succesfully scanned\n", ncomponents, nroles, num_of_libraries);
+ }
+ free(qualityString);
+ free(buffer);
+ return 0;
+}
+
+static void usage(const char *app) {
+ char *registry_filename;
+ registry_filename = componentsRegistryGetFilename();
+
+ printf(
+ "Usage: %s [-l] [-v] [-h] [componentspath[:other_components_path]]...\n"
+ "\n"
+ "Version 0.9.2\n"
+ "\n"
+ "This programs scans for a given list of directory searching for any OpenMAX\n"
+ "component compatible with the ST static component loader.\n"
+ "The registry is saved under %s. (can be changed via OMX_BELLAGIO_REGISTRY\n"
+ "environment variable)\n"
+ "\n"
+ "The following options are supported:\n"
+ "\n"
+ " -v display a verbose output, listing all the components registered\n"
+ " -l list only the components already registered. If -l is specified \n"
+ " all the other parameters are ignored and only the register file\n"
+ " is checked\n"
+ " -h display this message\n"
+ "\n"
+ " componentspath: a searching path for components can be specified.\n"
+ " If this parameter is omitted, the components are searched in the\n"
+ " locations specified by the environment variable BELLAGIO_SEARCH_PATH.If it \n"
+ " is not defined the components are searched in the default %s directory \n"
+ "\n",
+ app, registry_filename, OMXILCOMPONENTSPATH);
+
+ free(registry_filename);
+}
+
+/** @brief execution of registration function
+ *
+ * This register by default searches for OpenMAX libraries in OMXILCOMPONENTSPATH
+ * If specified it can search in a different directory
+ */
+int main(int argc, char *argv[]) {
+ int found;
+ int err, i;
+ int verbose=0;
+ FILE *omxregistryfp;
+ char *registry_filename;
+ char *dir,*dirp;
+ char *buffer;
+ int isListOnly = 0;
+
+ for(i = 1; i < argc; i++) {
+ if(*(argv[i]) != '-') {
+ continue;
+ }
+ if (*(argv[i]+1) == 'v') {
+ verbose = 1;
+ } else if (*(argv[i]+1) == 'l') {
+ isListOnly = 1;
+ } else {
+ usage(argv[0]);
+ exit(*(argv[i]+1) == 'h' ? 0 : -EINVAL);
+ }
+ }
+
+ registry_filename = componentsRegistryGetFilename();
+
+ /* make sure the registry directory exists */
+ dir = strdup(registry_filename);
+ if (dir == NULL) {
+ exit(EXIT_FAILURE);
+ }
+ dirp = strrchr(dir, '/');
+ if (dirp != NULL) {
+ *dirp = '\0';
+ if (makedir(dir)) {
+ DEBUG(DEB_LEV_ERR, "Cannot create OpenMAX registry directory %s\n", dir);
+ exit(EXIT_FAILURE);
+ }
+ }
+ free(dir);
+
+ if (isListOnly) {
+ omxregistryfp = fopen(registry_filename, "r");
+ } else {
+ omxregistryfp = fopen(registry_filename, "w");
+ }
+ if (omxregistryfp == NULL){
+ DEBUG(DEB_LEV_ERR, "Cannot open OpenMAX registry file %s\n", registry_filename);
+ exit(EXIT_FAILURE);
+ }
+
+ free(registry_filename);
+ if (isListOnly) {
+ err = showComponentsList(omxregistryfp);
+ if(err) {
+ DEBUG(DEB_LEV_ERR, "Error reading omxregister file\n");
+ }
+ exit(0);
+ }
+
+ for(i = 1, found = 0; i < argc; i++) {
+ if(*(argv[i]) == '-') {
+ continue;
+ }
+
+ found = 1;
+ err = buildComponentsList(omxregistryfp, argv[i], verbose);
+ if(err) {
+ DEBUG(DEB_LEV_ERR, "Error registering OpenMAX components with ST static component loader %s\n", strerror(err));
+ continue;
+ }
+ }
+
+ if (found == 0) {
+ buffer=getenv("BELLAGIO_SEARCH_PATH");
+ if (buffer!=NULL&&*buffer!='\0') {
+ err = buildComponentsList(omxregistryfp, buffer, verbose);
+ if(err) {
+ DEBUG(DEB_LEV_ERR, "Error registering OpenMAX components with ST static component loader %s\n", strerror(err));
+ }
+ } else {
+ err = buildComponentsList(omxregistryfp, OMXILCOMPONENTSPATH, verbose);
+ if(err) {
+ DEBUG(DEB_LEV_ERR, "Error registering OpenMAX components with ST static component loader %s\n", strerror(err));
+ }
+ }
+ }
+
+ fclose(omxregistryfp);
+
+ return 0;
+}
Index: create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src
===================================================================
--- create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src (nonexistent)
+++ create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src (revision 5)
Property changes on: create-0.9.3-patch/libomxil-bellagio-0.9.3-new/src
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: create-0.9.3-patch/libomxil-bellagio-0.9.3-new
===================================================================
--- create-0.9.3-patch/libomxil-bellagio-0.9.3-new (nonexistent)
+++ create-0.9.3-patch/libomxil-bellagio-0.9.3-new (revision 5)
Property changes on: create-0.9.3-patch/libomxil-bellagio-0.9.3-new
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: create-0.9.3-patch
===================================================================
--- create-0.9.3-patch (nonexistent)
+++ create-0.9.3-patch (revision 5)
Property changes on: create-0.9.3-patch
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: patches/README
===================================================================
--- patches/README (nonexistent)
+++ patches/README (revision 5)
@@ -0,0 +1,6 @@
+
+/* begin *
+
+ TODO: Leave some comment here.
+
+ * end */
Index: patches
===================================================================
--- patches (nonexistent)
+++ patches (revision 5)
Property changes on: patches
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~
Index: .
===================================================================
--- . (nonexistent)
+++ . (revision 5)
Property changes on: .
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,73 ##
+
+# install dir
+dist
+
+# Target build dirs
+.a1x-newlib
+.a2x-newlib
+.at91sam7s-newlib
+
+.build-machine
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.i586-glibc
+.i686-glibc
+.imx6-glibc
+.jz47xx-glibc
+.makefile
+.am335x-glibc
+.omap543x-glibc
+.p5600-glibc
+.power8-glibc
+.power8le-glibc
+.power9-glibc
+.power9le-glibc
+.m1000-glibc
+.riscv64-glibc
+.rk328x-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.dist
+.rootfs
+
+# src & hw requires
+.src_requires
+.src_requires_depend
+.requires
+.requires_depend
+
+# Tarballs
+*.gz
+*.bz2
+*.lz
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Descriptions
+*.dsc
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# backup copies
+*~