OpenMAX Bellagio 0.9.3
|
#include <string.h>
#include "omx_reference_resource_manager.h"
#include "base/omx_base_component.h"
#include "queue.h"
Go to the source code of this file.
Functions | |
OMX_ERRORTYPE | RM_Init () |
OMX_ERRORTYPE | RM_RegisterComponent (char *name, int max_components) |
OMX_ERRORTYPE | RM_Deinit () |
OMX_ERRORTYPE | addElemToList (ComponentListType **list, OMX_COMPONENTTYPE *openmaxStandComp, int index, OMX_BOOL bIsWaiting) |
OMX_ERRORTYPE | removeElemFromList (ComponentListType **list, OMX_COMPONENTTYPE *openmaxStandComp) |
int | numElemInList (ComponentListType *list) |
OMX_ERRORTYPE | clearList (ComponentListType **list) |
void | RM_printList (ComponentListType *list, int viewFlag) |
int | searchLowerPriority (ComponentListType *list, int current_priority, ComponentListType **oldest_component_preemptable) |
OMX_ERRORTYPE | preemptComponent (OMX_COMPONENTTYPE *openmaxStandComp) |
OMX_ERRORTYPE | RM_getResource (OMX_COMPONENTTYPE *openmaxStandComp) |
OMX_ERRORTYPE | RM_releaseResource (OMX_COMPONENTTYPE *openmaxStandComp) |
OMX_ERRORTYPE | RM_waitForResource (OMX_COMPONENTTYPE *openmaxStandComp) |
OMX_ERRORTYPE | RM_removeFromWaitForResource (OMX_COMPONENTTYPE *openmaxStandComp) |
OMX_ERRORTYPE addElemToList | ( | ComponentListType ** | list, |
OMX_COMPONENTTYPE * | openmaxStandComp, | ||
int | index, | ||
OMX_BOOL | bIsWaiting ) |
This function adds a new element to a given list. If it does not yet exists, this function also allocates the list.
Definition at line 109 of file omx_reference_resource_manager.c.
References DEB_LEV_ERR, DEB_LEV_FUNCTION_NAME, DEBUG, globalComponentList, globalWaitingComponentList, ComponentListType::next, ComponentListType::nGroupPriority, omx_base_component_PrivateType::nGroupPriority, OMX_ErrorInsufficientResources, OMX_ErrorNone, ComponentListType::openmaxStandComp, OMX_COMPONENTTYPE::pComponentPrivate, and ComponentListType::timestamp.
Referenced by RM_getResource(), and RM_waitForResource().
OMX_ERRORTYPE clearList | ( | ComponentListType ** | list | ) |
This function deallocate any remaining element in a list and dispose it
Definition at line 223 of file omx_reference_resource_manager.c.
References DEB_LEV_FUNCTION_NAME, DEBUG, ComponentListType::next, and OMX_ErrorNone.
Referenced by RM_Deinit().
int numElemInList | ( | ComponentListType * | list | ) |
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
Definition at line 202 of file omx_reference_resource_manager.c.
References DEB_LEV_FUNCTION_NAME, DEB_LEV_SIMPLE_SEQ, DEBUG, and ComponentListType::next.
Referenced by RM_getResource(), and RM_releaseResource().
OMX_ERRORTYPE preemptComponent | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
This function tries to preempt the given component, that has been detected as the candidate by the default policy defined in the OpenMAX spec.
Definition at line 312 of file omx_reference_resource_manager.c.
References omx_base_component_PrivateType::callbackData, omx_base_component_PrivateType::callbacks, DEB_LEV_ERR, DEB_LEV_FUNCTION_NAME, DEBUG, err, OMX_CALLBACKTYPE::EventHandler, OMX_CommandStateSet, OMX_ErrorNone, OMX_ErrorResourcesLost, OMX_ErrorUndefined, OMX_EventError, OMX_SendCommand, OMX_StateExecuting, OMX_StateIdle, OMX_StateLoaded, OMX_StatePause, OMX_COMPONENTTYPE::pComponentPrivate, and omx_base_component_PrivateType::state.
Referenced by RM_getResource().
OMX_ERRORTYPE removeElemFromList | ( | ComponentListType ** | list, |
OMX_COMPONENTTYPE * | openmaxStandComp ) |
This function removes the given element from the list, if present. If the list is empty, this function cleans up everything.
Definition at line 157 of file omx_reference_resource_manager.c.
References DEB_LEV_ERR, DEB_LEV_FUNCTION_NAME, DEBUG, ComponentListType::next, OMX_ErrorComponentNotFound, OMX_ErrorNone, OMX_ErrorUndefined, OMX_FALSE, OMX_TRUE, and ComponentListType::openmaxStandComp.
Referenced by RM_getResource(), RM_releaseResource(), and RM_removeFromWaitForResource().
OMX_ERRORTYPE RM_Deinit | ( | ) |
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.
Definition at line 93 of file omx_reference_resource_manager.c.
References clearList(), DEB_LEV_FUNCTION_NAME, DEBUG, globalComponentList, globalWaitingComponentList, and OMX_ErrorNone.
Referenced by BOSA_ST_DeInitComponentLoader(), and BOSA_STE_DeInitComponentLoader().
OMX_ERRORTYPE RM_getResource | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
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
Definition at line 344 of file omx_reference_resource_manager.c.
References addElemToList(), DEB_LEV_ERR, DEB_LEV_FUNCTION_NAME, DEB_LEV_SIMPLE_SEQ, DEBUG, err, globalComponentList, listOfcomponentRegistered, omx_base_component_PrivateType::name, omx_base_component_PrivateType::nGroupPriority, numElemInList(), OMX_ErrorInsufficientResources, OMX_ErrorNone, OMX_FALSE, ComponentListType::openmaxStandComp, OMX_COMPONENTTYPE::pComponentPrivate, preemptComponent(), removeElemFromList(), and searchLowerPriority().
Referenced by omx_base_component_DoStateSet().
OMX_ERRORTYPE RM_Init | ( | ) |
This function initializes the Resource manager. In the current implementation it does not perform any operation
Definition at line 42 of file omx_reference_resource_manager.c.
References DEB_LEV_FUNCTION_NAME, DEBUG, globalComponentList, globalIndex, globalWaitingComponentList, listOfcomponentRegistered, MAX_COMPONENTS_TYPES_HANDLED, and OMX_ErrorNone.
Referenced by BOSA_ST_InitComponentLoader(), and BOSA_STE_InitComponentLoader().
void RM_printList | ( | ComponentListType * | list, |
int | viewFlag ) |
This debug function is capable of printing the full list actually stored
Definition at line 246 of file omx_reference_resource_manager.c.
References omx_base_component_PrivateType::name, ComponentListType::next, ComponentListType::openmaxStandComp, OMX_COMPONENTTYPE::pComponentPrivate, RM_SHOW_ADDRESS, and RM_SHOW_NAME.
OMX_ERRORTYPE RM_RegisterComponent | ( | char * | name, |
int | max_components ) |
This function is called during initialization by any component interested in be handled by the internal resource manager
Definition at line 62 of file omx_reference_resource_manager.c.
References DEB_LEV_FUNCTION_NAME, DEBUG, globalIndex, listOfcomponentRegistered, OMX_ErrorInsufficientResources, OMX_ErrorNone, and OMX_MAX_STRINGNAME_SIZE.
Referenced by omx_audio_mixer_component_Constructor(), omx_clocksrc_component_Constructor(), omx_video_scheduler_component_Constructor(), and omx_volume_component_Constructor().
OMX_ERRORTYPE RM_releaseResource | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
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
Definition at line 399 of file omx_reference_resource_manager.c.
References DEB_LEV_ERR, DEB_LEV_FUNCTION_NAME, DEBUG, err, globalComponentList, globalWaitingComponentList, listOfcomponentRegistered, omx_base_component_PrivateType::name, numElemInList(), OMX_CommandStateSet, OMX_ErrorNone, OMX_ErrorUndefined, OMX_SendCommand, OMX_StateIdle, OMX_COMPONENTTYPE::pComponentPrivate, and removeElemFromList().
Referenced by omx_base_component_DoStateSet().
OMX_ERRORTYPE RM_removeFromWaitForResource | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
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
Definition at line 485 of file omx_reference_resource_manager.c.
References DEB_LEV_ERR, DEB_LEV_FUNCTION_NAME, DEBUG, globalComponentList, listOfcomponentRegistered, omx_base_component_PrivateType::name, OMX_ErrorNone, OMX_COMPONENTTYPE::pComponentPrivate, and removeElemFromList().
Referenced by omx_base_component_DoStateSet().
OMX_ERRORTYPE RM_waitForResource | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
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.
Definition at line 451 of file omx_reference_resource_manager.c.
References addElemToList(), DEB_LEV_ERR, DEB_LEV_FUNCTION_NAME, DEBUG, globalWaitingComponentList, listOfcomponentRegistered, omx_base_component_PrivateType::name, OMX_ErrorNone, OMX_TRUE, and OMX_COMPONENTTYPE::pComponentPrivate.
Referenced by omx_base_component_DoStateSet().
int searchLowerPriority | ( | ComponentListType * | list, |
int | current_priority, | ||
ComponentListType ** | oldest_component_preemptable ) |
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.
Definition at line 277 of file omx_reference_resource_manager.c.
References DEB_LEV_ERR, DEB_LEV_FUNCTION_NAME, DEBUG, ComponentListType::next, ComponentListType::nGroupPriority, OMX_ErrorUndefined, and ComponentListType::timestamp.
Referenced by RM_getResource().