29 #define DEFAULT_WIDTH 352
30 #define DEFAULT_HEIGHT 288
31 #define CLOCKPORT_INDEX 2
34 #define DEFAULT_VIDEO_INPUT_BUF_SIZE DEFAULT_WIDTH*DEFAULT_HEIGHT*3/2
42 omx_video_scheduler_component_PrivateType* omx_video_scheduler_component_Private;
50 openmaxStandComp->
pComponentPrivate = calloc(1,
sizeof(omx_video_scheduler_component_PrivateType));
59 omx_video_scheduler_component_Private->ports = NULL;
66 omx_video_scheduler_component_Private->sPortTypesParam[
OMX_PortDomainVideo].nStartPortNumber = 0;
75 && !omx_video_scheduler_component_Private->ports) {
76 omx_video_scheduler_component_Private->ports = calloc((omx_video_scheduler_component_Private->sPortTypesParam[
OMX_PortDomainVideo].nPorts
79 if (!omx_video_scheduler_component_Private->ports) {
82 for (i=0; i < omx_video_scheduler_component_Private->sPortTypesParam[
OMX_PortDomainVideo].nPorts; i++) {
84 if (!omx_video_scheduler_component_Private->ports[i]) {
126 omx_video_scheduler_component_Private->currentQualityLevel = 1;
130 omx_video_scheduler_component_Private->multiResourceLevel[i]->CPUResourceRequested = videoSchedQualityLevels[i * 2];
131 omx_video_scheduler_component_Private->multiResourceLevel[i]->MemoryResourceRequested = videoSchedQualityLevels[i * 2 + 1];
140 omx_video_scheduler_component_PrivateType* omx_video_scheduler_component_Private = openmaxStandComp->
pComponentPrivate;
146 if (omx_video_scheduler_component_Private->ports) {
147 for(i=0; i < (omx_video_scheduler_component_Private->sPortTypesParam[
OMX_PortDomainVideo].nPorts +
148 omx_video_scheduler_component_Private->sPortTypesParam[
OMX_PortDomainOther].nPorts); i++) {
149 if(omx_video_scheduler_component_Private->ports[i])
150 omx_video_scheduler_component_Private->ports[i]->PortDestructor(omx_video_scheduler_component_Private->ports[i]);
152 free(omx_video_scheduler_component_Private->ports);
153 omx_video_scheduler_component_Private->ports=NULL;
185 DEBUG(
DEB_LEV_ERR,
"In %s: wrong port for this operation portIndex=%d port->portIndex=%d\n",
198 DEBUG(
DEB_LEV_ERR,
"In %s: we are not in executing/paused/idle state, but in %d\n", __func__, omx_base_component_Private->
state);
204 DEBUG(
DEB_LEV_ERR,
"In %s: Port %d is disabled comp = %s \n", __func__, (
int)portIndex,omx_base_component_Private->
name);
212 if(pBuffer!=NULL && pBuffer->
pBuffer!=NULL) {
227 DEBUG(
DEB_LEV_ERR,
"In %s: received wrong buffer header on input port\n", __func__);
273 omx_video_scheduler_component_PrivateType* omx_video_scheduler_component_Private,
309 omx_video_scheduler_component_Private->eState = pMediaTime->
eState;
310 omx_video_scheduler_component_Private->xScale = pMediaTime->
xScale;
336 omx_video_scheduler_component_Private->frameDropFlag =
OMX_TRUE;
337 omx_video_scheduler_component_Private->dropFrameCount = 0;
338 omx_video_scheduler_component_Private->xScale = pMediaTime->
xScale;
346 if(omx_video_scheduler_component_Private->frameDropFlag && omx_video_scheduler_component_Private->dropFrameCount<7) {
347 omx_video_scheduler_component_Private->dropFrameCount ++;
348 if(omx_video_scheduler_component_Private->dropFrameCount==7) {
358 omx_video_scheduler_component_Private->frameDropFlag =
OMX_FALSE;
359 omx_video_scheduler_component_Private->dropFrameCount = 0;
393 omx_video_scheduler_component_Private->frameDropFlag =
OMX_TRUE;
394 omx_video_scheduler_component_Private->dropFrameCount = 0;
395 omx_video_scheduler_component_Private->xScale = pMediaTime->
xScale;
419 omx_video_scheduler_component_PrivateType* omx_video_scheduler_component_Private;
426 omx_video_scheduler_component_Private = ( omx_video_scheduler_component_PrivateType*) omx_base_component_Private;
431 pthread_mutex_lock(&omx_base_component_Private->
flush_mutex);
444 pthread_mutex_unlock(&omx_base_component_Private->
flush_mutex);
497 pthread_mutex_lock(&omx_base_component_Private->
flush_mutex);
499 pthread_mutex_unlock(&omx_base_component_Private->
flush_mutex);
506 DEBUG(
DEB_LEV_PARAMS,
"In %s TFlag=%x Qelem=%d BSem=%d bMgmtsem=%d component=%s\n", __func__,
511 omx_base_component_Private->
name);
522 omx_video_scheduler_component_PrivateType* omx_video_scheduler_component_Private = openmaxStandComp->
pComponentPrivate;
548 OMX_PTR ComponentParameterStructure) {
559 omx_video_scheduler_component_PrivateType* omx_video_scheduler_component_Private = openmaxStandComp->
pComponentPrivate;
563 if (ComponentParameterStructure == NULL) {
568 switch(nParamIndex) {
578 if(portIndex > (omx_video_scheduler_component_Private->sPortTypesParam[
OMX_PortDomainVideo].nPorts +
652 DEBUG(
DEB_LEV_ERR,
"In %s Incorrect State=%x lineno=%d\n",__func__,omx_video_scheduler_component_Private->state,__LINE__);
674 OMX_PTR ComponentParameterStructure) {
680 omx_video_scheduler_component_PrivateType* omx_video_scheduler_component_Private = openmaxStandComp->
pComponentPrivate;
685 if (ComponentParameterStructure == NULL) {
690 switch(nParamIndex) {
@ OMX_ErrorUnsupportedSetting
@ OMX_ErrorInsufficientResources
@ OMX_ErrorIncorrectStateOperation
@ OMX_IndexConfigTimeCurrentVideoReference
@ OMX_IndexParamVideoInit
@ OMX_IndexConfigTimeClientStartTime
@ OMX_IndexParamStandardComponentRole
@ OMX_IndexParamPortDefinition
@ OMX_IndexParamOtherPortFormat
@ OMX_IndexParamOtherInit
@ OMX_IndexParamVideoPortFormat
@ OMX_IndexConfigTimeMediaTimeRequest
@ OMX_TIME_UpdateRequestFulfillment
@ OMX_TIME_UpdateScaleChanged
@ OMX_TIME_ClockStateRunning
#define OMX_BUFFERFLAG_EOS
#define OMX_BUFFERFLAG_STARTTIME
#define OMX_SetConfig( hComponent, nConfigIndex, pComponentConfigStructure)
@ OMX_StateWaitForResources
@ OMX_COLOR_Format24bitRGB888
OMX_ERRORTYPE base_clock_port_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, omx_base_PortType **openmaxStandPort, OMX_U32 nPortIndex, OMX_BOOL isInput)
the base constructor for the generic OpenMAX ST Clock port
OMX_ERRORTYPE omx_base_component_SetParameter(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure)
Part of the standard OpenMAX function.
OMX_ERRORTYPE omx_base_component_ParameterSanityCheck(OMX_HANDLETYPE hComponent, OMX_U32 nPortIndex, OMX_PTR pStructure, size_t size)
void setHeader(OMX_PTR header, OMX_U32 size)
Simply fills the first two fields in any OMX structure with the size and the version.
OMX_ERRORTYPE omx_base_component_GetParameter(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure)
Part of the standard OpenMAX function.
OMX_ERRORTYPE checkHeader(OMX_PTR header, OMX_U32 size)
Checks the header of a structure for consistency with size and spec version.
@ OMX_TransStateExecutingToIdle
OMX_ERRORTYPE omx_base_filter_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName)
The base filter contructor for the OpenMAX ST components.
OMX_ERRORTYPE omx_base_filter_Destructor(OMX_COMPONENTTYPE *openmaxStandComp)
the base filter destructor for ST OpenMAX components
#define OMX_BASE_FILTER_INPUTPORT_INDEX
#define OMX_BASE_FILTER_OUTPUTPORT_INDEX
#define PORT_IS_TUNNELED_N_BUFFER_SUPPLIER(pPort)
#define PORT_IS_BUFFER_SUPPLIER(pPort)
#define PORT_IS_TUNNELED(pPort)
#define PORT_IS_BEING_DISABLED(pPort)
#define PORT_IS_ENABLED(pPort)
#define PORT_IS_BEING_FLUSHED(pPort)
OMX_ERRORTYPE base_video_port_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, omx_base_PortType **openmaxStandPort, OMX_U32 nPortIndex, OMX_BOOL isInput)
The base contructor for the generic OpenMAX ST Video port.
#define DEB_LEV_FUNCTION_NAME
#define DEB_LEV_SIMPLE_SEQ
#define DEBUG(n, fmt, args...)
OMX_ERRORTYPE RM_RegisterComponent(char *name, int max_components)
void omx_video_scheduler_component_BufferMgmtCallback(OMX_COMPONENTTYPE *openmaxStandComp, OMX_BUFFERHEADERTYPE *pInputBuffer, OMX_BUFFERHEADERTYPE *pOutputBuffer)
OMX_BOOL omx_video_scheduler_component_ClockPortHandleFunction(omx_video_scheduler_component_PrivateType *omx_video_scheduler_component_Private, OMX_BUFFERHEADERTYPE *pInputBuffer)
OMX_ERRORTYPE omx_video_scheduler_component_Destructor(OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE omx_video_scheduler_component_GetParameter(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure)
OMX_ERRORTYPE omx_video_scheduler_component_port_SendBufferFunction(omx_base_PortType *openmaxStandPort, OMX_BUFFERHEADERTYPE *pBuffer)
the entry point for sending buffers to the video scheduler ports
OMX_ERRORTYPE omx_video_scheduler_component_port_FlushProcessingBuffers(omx_base_PortType *openmaxStandPort)
Releases buffers under processing. This function must be implemented in the derived classes,...
OMX_ERRORTYPE omx_video_scheduler_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName)
OMX_ERRORTYPE omx_video_scheduler_component_SetParameter(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure)
#define DEFAULT_VIDEO_INPUT_BUF_SIZE
#define MAX_VIDEOSCHED_COMPONENTS
#define VIDEOSCHED_QUALITY_LEVELS
#define VIDEO_SCHEDULER_COMP_NAME
#define VIDEO_SCHEDULER_COMP_ROLE
int queue(queue_t *queue, void *data)
void * dequeue(queue_t *queue)
OMX_ERRORTYPE(* SetParameter)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nIndex, OMX_IN OMX_PTR pComponentParameterStructure)
OMX_ERRORTYPE(* GetParameter)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nParamIndex, OMX_INOUT OMX_PTR pComponentParameterStructure)
OMX_PTR pComponentPrivate
OMX_OTHER_FORMATTYPE eFormat
OMX_OTHER_FORMATTYPE eFormat
union OMX_PARAM_PORTDEFINITIONTYPE::@0 format
OMX_PORTDOMAINTYPE eDomain
OMX_OTHER_PORTDEFINITIONTYPE other
OMX_U32 nBufferCountActual
OMX_VIDEO_PORTDEFINITIONTYPE video
OMX_TICKS nMediaTimestamp
OMX_TIME_CLOCKSTATE eState
OMX_TIME_UPDATETYPE eUpdateType
OMX_COLOR_FORMATTYPE eColorFormat
OMX_VIDEO_CODINGTYPE eCompressionFormat
OMX_BOOL bFlagErrorConcealment
OMX_COLOR_FORMATTYPE eColorFormat
OMX_PARAM_PORTDEFINITIONTYPE sPortParam
OMX_ERRORTYPE(* BufferProcessedCallback)(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE *pBuffer)
OMX_U32 nNumAssignedBuffers
OMX_HANDLETYPE hTunneledComponent
OMX_COMPONENTTYPE * standCompContainer
OMX_BUFFERHEADERTYPE ** pInternalBufferStorage
OMX_ERRORTYPE(* ReturnBufferFunction)(omx_base_PortType *openmaxStandPort, OMX_BUFFERHEADERTYPE *pBuffer)
OMX_OTHER_PARAM_PORTFORMATTYPE sOtherParam
OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE sMediaTimeRequest
OMX_PARAM_PORTDEFINITIONTYPE sPortParam
OMX_HANDLETYPE hTunneledComponent
tsem_t * flush_all_condition
pthread_mutex_t flush_mutex
OMX_TRANS_STATETYPE transientState
omx_base_PortType ** ports
OMX_PARAM_PORTDEFINITIONTYPE sPortParam
OMX_VIDEO_PARAM_PORTFORMATTYPE sVideoParam
OMX_ERRORTYPE(* FlushProcessingBuffers)(omx_base_PortType *openmaxStandPort)
void tsem_signal(tsem_t *tsem)
void tsem_up(tsem_t *tsem)
void tsem_down(tsem_t *tsem)
void tsem_reset(tsem_t *tsem)