compo_ov.c

来自「COMPO source code for reference」· C语言 代码 · 共 1,281 行 · 第 1/3 页

C
1,281
字号
            Overlay_p->WriteParams.Behind   = (STCOMPO_OverlayHandle_t)&(Device_p->BackgroundOverlay);            /* Update Background overlay */            Device_p->BackgroundOverlay.WriteParams.Infront   = (STCOMPO_OverlayHandle_t)Overlay_p;        }        break;    case STCOMPO_OVERLAY_ORDER_SEND_TO_FRONT:        if (OverlayInfront_p)        {            stcompo_Overlay_t *Front_p;            /* Find the Front of the list */            Front_p = OverlayInfront_p;            while (Front_p->WriteParams.Infront)            {                Front_p = (stcompo_Overlay_t *)Front_p->WriteParams.Infront;            }            /* Remove ourselves from the list : Update Overlay Behind (There is at least the BackgroundOverlay behind) */            OverlayBehind_p->WriteParams.Infront = (STCOMPO_OverlayHandle_t)OverlayInfront_p;            OverlayInfront_p->WriteParams.Behind = (STCOMPO_OverlayHandle_t)OverlayBehind_p;            /* Add ourselves to the front of the list */            Overlay_p->WriteParams.Infront  = (STCOMPO_OverlayHandle_t)NULL;            Overlay_p->WriteParams.Behind   = (STCOMPO_OverlayHandle_t)Front_p;            Front_p->WriteParams.Infront    = (STCOMPO_OverlayHandle_t)Overlay_p;            Device_p->WriteParams.Front_p   = Overlay_p;        }        break;		case STCOMPO_OVERLAY_ORDER_INFRONT:		if ( (ReferenceOverlay_p) && (OverlayBehind_p != ReferenceOverlay_p) )        {			/* Remove ourselves from the list : Update Overlay Behind (There is at least the BackgroundOverlay behind) */            OverlayBehind_p->WriteParams.Infront = (STCOMPO_OverlayHandle_t)OverlayInfront_p;            if (OverlayInfront_p)            {                OverlayInfront_p->WriteParams.Behind = (STCOMPO_OverlayHandle_t)OverlayBehind_p;            }            else            {                Device_p->WriteParams.Front_p = OverlayBehind_p;            }						            /* Add ourselves to the front of the reference ovoerlay */            Overlay_p->WriteParams.Behind   = (STCOMPO_OverlayHandle_t)ReferenceOverlay_p;            ReferenceOverlay_p->WriteParams.Infront    = (STCOMPO_OverlayHandle_t)Overlay_p;			/* Update Front overlay */			            if (ReferenceOverlayInfront_p)            {               /* ReferenceOverlayInfront can be the Overlay !!! dont update in this case */				if (ReferenceOverlayInfront_p != Overlay_p)				{					Overlay_p->WriteParams.Infront  = (STCOMPO_OverlayHandle_t)ReferenceOverlayInfront_p;					ReferenceOverlayInfront_p->WriteParams.Behind = (STCOMPO_OverlayHandle_t)Overlay_p;								}            }            else            {				/* Put Overlay at the front and update the device front */                Overlay_p->WriteParams.Infront  = (STCOMPO_OverlayHandle_t)NULL;								Device_p->WriteParams.Front_p   = Overlay_p;            }   			        }		break;    case STCOMPO_OVERLAY_ORDER_BEHIND:		if ( (ReferenceOverlay_p) && (OverlayBehind_p != &(Device_p->BackgroundOverlay)) &&		     (OverlayInfront_p != ReferenceOverlay_p) )		{            /* Remove ourselves from the list */            OverlayBehind_p->WriteParams.Infront = (STCOMPO_OverlayHandle_t)OverlayInfront_p;            if (OverlayInfront_p)            {                OverlayInfront_p->WriteParams.Behind = (STCOMPO_OverlayHandle_t)OverlayBehind_p;            }            else            {                Device_p->WriteParams.Front_p = OverlayBehind_p;            }			            /* Add ourselves behind the reference overlay */            Overlay_p->WriteParams.Behind   = (STCOMPO_OverlayHandle_t)ReferenceOverlayBehind_p;			            ReferenceOverlay_p->WriteParams.Behind      = (STCOMPO_OverlayHandle_t)Overlay_p;            Overlay_p->WriteParams.Infront  			= (STCOMPO_OverlayHandle_t)ReferenceOverlay_p;			if (ReferenceOverlayBehind_p != &(Device_p->BackgroundOverlay))			{				ReferenceOverlayBehind_p->WriteParams.Infront = (STCOMPO_OverlayHandle_t)Overlay_p;			}			else			{	            /* Update Background overlay */	            Device_p->BackgroundOverlay.WriteParams.Infront   = (STCOMPO_OverlayHandle_t)Overlay_p;			}					}        break;	    }    /* Update device */    Device_p->UpdateComposition = TRUE;    /* Data structure Protection */#ifdef ST_OS21    semaphore_signal (Device_p->AccessControlSemaphore_p);#endif#ifdef ST_OS20    semaphore_signal (&Device_p->AccessControlSemaphore);#endif    return ST_NO_ERROR;}/*******************************************************************************Name        : STCOMPO_EnableOverlayFlickerFilterDescription : This function enables the flicker filter for this surfaceParameters  :Assumptions :Limitations :Returns     :*******************************************************************************/ST_ErrorCode_t STCOMPO_EnableOverlayFlickerFilter(STCOMPO_OverlayHandle_t Overlay){    stcompo_Overlay_t* Overlay_p = (stcompo_Overlay_t*)Overlay;    stcompo_Device_t*  Device_p  = (stcompo_Device_t*)Overlay_p->CompoHandle;#ifdef COMPO_ENABLE_SETTINGS_TRACE    COMPO_TRACE("\r\nStt:Setting:StOF:%d",time_now());#endif    /* Data structure Protection */#ifdef ST_OS21    semaphore_wait (Device_p->AccessControlSemaphore_p);#endif#ifdef ST_OS20    semaphore_wait (&Device_p->AccessControlSemaphore);#endif    Overlay_p->WriteParams.Flags |= STCOMPO_OVERLAY_MODE_FLICKER_FILTER;    /* Set Hal Overlay flags */    HALCOMPO_SetOverlayFlags(Overlay_p->HalOverlay, Overlay_p->WriteParams.Flags);    /* Update device */    if ((Overlay_p->WriteParams.Flags & STCOMPO_OVERLAY_MODE_DISABLE) == 0)    {        Device_p->UpdateComposition = TRUE;    }    /* Data structure Protection */#ifdef ST_OS21    semaphore_signal (Device_p->AccessControlSemaphore_p);#endif#ifdef ST_OS20    semaphore_signal (&Device_p->AccessControlSemaphore);#endif    return ST_NO_ERROR;}/*******************************************************************************Name        : STCOMPO_DisableOverlayFlickerFilterDescription : This function disables the filcker filter for this surfaceParameters  :Assumptions :Limitations :Returns     :*******************************************************************************/ST_ErrorCode_t STCOMPO_DisableOverlayFlickerFilter(STCOMPO_OverlayHandle_t Overlay){    stcompo_Overlay_t* Overlay_p = (stcompo_Overlay_t*)Overlay;    stcompo_Device_t*  Device_p  = (stcompo_Device_t*)Overlay_p->CompoHandle;#ifdef COMPO_ENABLE_SETTINGS_TRACE    COMPO_TRACE("\r\nStt:Setting:DsOF:%d",time_now());#endif    /* Data structure Protection */#ifdef ST_OS21    semaphore_wait (Device_p->AccessControlSemaphore_p);#endif#ifdef ST_OS20    semaphore_wait (&Device_p->AccessControlSemaphore);#endif    Overlay_p->WriteParams.Flags &= ~(U32)STCOMPO_OVERLAY_MODE_FLICKER_FILTER;    /* Set Hal Overlay flags */    HALCOMPO_SetOverlayFlags(Overlay_p->HalOverlay, Overlay_p->WriteParams.Flags);    /* Update device */    if ((Overlay_p->WriteParams.Flags & STCOMPO_OVERLAY_MODE_DISABLE) == 0)    {        Device_p->UpdateComposition = TRUE;    }    /* Data structure Protection */#ifdef ST_OS21    semaphore_signal (Device_p->AccessControlSemaphore_p);#endif#ifdef ST_OS20    semaphore_signal (&Device_p->AccessControlSemaphore);#endif    return ST_NO_ERROR;}/*******************************************************************************Name        : STCOMPO_SetOverlayCompositionRecurrenceDescription :Parameters  :Assumptions :Limitations :Returns     :*******************************************************************************/ST_ErrorCode_t STCOMPO_SetOverlayCompositionRecurrence(STCOMPO_OverlayHandle_t   Overlay,                                                       STCOMPO_CompositionRecurrence_t CompositionRecurrence){    stcompo_Overlay_t* Overlay_p = (stcompo_Overlay_t*)Overlay;    stcompo_Device_t*  Device_p  = (stcompo_Device_t*)Overlay_p->CompoHandle;#ifdef COMPO_ENABLE_SETTINGS_TRACE    COMPO_TRACE("\r\nStt:Setting:StOCM:%d",time_now());#endif    /* Data structure Protection */#ifdef ST_OS21    semaphore_wait (Device_p->AccessControlSemaphore_p);#endif#ifdef ST_OS20    semaphore_wait (&Device_p->AccessControlSemaphore);#endif    /* Set composition recurrence mode */    HALCOMPO_SetOverlayCompositionRecurrence(Overlay_p->HalOverlay, CompositionRecurrence);    /* Update device */    if ((Overlay_p->WriteParams.Flags & STCOMPO_OVERLAY_MODE_DISABLE) == 0)    {        Device_p->UpdateComposition = TRUE;    }    /* Data structure Protection */#ifdef ST_OS21    semaphore_signal (Device_p->AccessControlSemaphore_p);#endif#ifdef ST_OS20    semaphore_signal (&Device_p->AccessControlSemaphore);#endif    return ST_NO_ERROR;}/*******************************************************************************Name        : STCOMPO_PerformOverlayCompositionDescription :Parameters  :Assumptions :Limitations :Returns     :*******************************************************************************/ST_ErrorCode_t STCOMPO_PerformOverlayComposition(STCOMPO_OverlayHandle_t   Overlay){    stcompo_Overlay_t* Overlay_p = (stcompo_Overlay_t*)Overlay;    stcompo_Device_t*  Device_p  = (stcompo_Device_t*)Overlay_p->CompoHandle;#ifdef COMPO_ENABLE_SETTINGS_TRACE    COMPO_TRACE("\r\nStt:Setting:PVpC:%d",time_now());#endif    /* Data structure Protection */#ifdef ST_OS21    semaphore_wait (Device_p->AccessControlSemaphore_p);#endif#ifdef ST_OS20    semaphore_wait (&Device_p->AccessControlSemaphore);#endif    /* Set composition recurrence action */    HALCOMPO_PerformOverlayComposition(Overlay_p->HalOverlay);    /* Data structure Protection */#ifdef ST_OS21    semaphore_signal (Device_p->AccessControlSemaphore_p);#endif#ifdef ST_OS20    semaphore_signal (&Device_p->AccessControlSemaphore);#endif    return ST_NO_ERROR;}/*******************************************************************************Name        : STCOMPO_SetOverlayFlickerFilterModeDescription :Parameters  :Assumptions :Limitations :Returns     :*******************************************************************************/ST_ErrorCode_t STCOMPO_SetOverlayFlickerFilterMode(STCOMPO_OverlayHandle_t     Overlay,                                                   STCOMPO_FlickerFilterMode_t FlickerFilterMode){    stcompo_Overlay_t* Overlay_p = (stcompo_Overlay_t*)Overlay;    stcompo_Device_t*  Device_p  = (stcompo_Device_t*)Overlay_p->CompoHandle;#ifdef COMPO_ENABLE_SETTINGS_TRACE    COMPO_TRACE("\r\nStt:Setting:StOFFM:%d",time_now());#endif    /* Data structure Protection */#ifdef ST_OS21    semaphore_wait (Device_p->AccessControlSemaphore_p);#endif#ifdef ST_OS20    semaphore_wait (&Device_p->AccessControlSemaphore);#endif    /* Set composition recurrence mode */    HALCOMPO_SetOverlayFlickerFilterMode(Overlay_p->HalOverlay, FlickerFilterMode);    /* Update device */    if ((Overlay_p->WriteParams.Flags & STCOMPO_OVERLAY_MODE_DISABLE) == 0)    {        Device_p->UpdateComposition = TRUE;    }    /* Data structure Protection */#ifdef ST_OS21    semaphore_signal (Device_p->AccessControlSemaphore_p);#endif#ifdef ST_OS20    semaphore_signal (&Device_p->AccessControlSemaphore);#endif    return ST_NO_ERROR;}/*******************************************************************************Name        : STCOMPO_InformPictureToBeDecodedDescription : Set info from video about next picture type to be decodedParameters  :Assumptions :Limitations :Returns     :*******************************************************************************/ST_ErrorCode_t STCOMPO_InformPictureToBeDecoded(STCOMPO_OverlayHandle_t Overlay, STGXOBJ_PictureInfos_t* PictureInfos_p){    stcompo_Overlay_t* Overlay_p = (stcompo_Overlay_t*)Overlay;    stcompo_Device_t*  Device_p  = (stcompo_Device_t*)Overlay_p->CompoHandle;    /* Data structure Protection */#ifdef ST_OS21    semaphore_wait (Device_p->AccessControlSemaphore_p);#endif#ifdef ST_OS20    semaphore_wait (&Device_p->AccessControlSemaphore);#endif     Device_p->NextPictureToBeDecodedType = PictureInfos_p->VideoParams.MPEGFrame;     if (Device_p->NextPictureToBeDecodedType != STGXOBJ_MPEG_FRAME_B)     {        HALCOMPO_InformPictureToBeDecoded(Overlay_p->HalOverlay);     }    /* Data structure Protection */#ifdef ST_OS21    semaphore_signal (Device_p->AccessControlSemaphore_p);#endif#ifdef ST_OS20    semaphore_signal (&Device_p->AccessControlSemaphore);#endif    return ST_NO_ERROR;}/*******************************************************************************Name        : STCOMPO_CommitOverlayParamsDescription :  Video params are commited. Nodes gen anticipation can be startedParameters  :Assumptions :Limitations :Returns     :*******************************************************************************/ST_ErrorCode_t STCOMPO_CommitOverlayParams(STCOMPO_OverlayHandle_t Overlay){    stcompo_Overlay_t* Overlay_p = (stcompo_Overlay_t*)Overlay;    stcompo_Device_t*  Device_p  = (stcompo_Device_t*)Overlay_p->CompoHandle;    /* Data structure Protection */#ifdef ST_OS21    semaphore_wait (Device_p->AccessControlSemaphore_p);#endif#ifdef ST_OS20    semaphore_wait (&Device_p->AccessControlSemaphore);#endif     /* Video params are commited. Nodes gen anticipation can be started */     Device_p->StartAnticipation   = TRUE;    /* Data structure Protection */#ifdef ST_OS21    semaphore_signal (Device_p->AccessControlSemaphore_p);#endif#ifdef ST_OS20    semaphore_signal (&Device_p->AccessControlSemaphore);#endif    return ST_NO_ERROR;}/* End of Compo_ov.c */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?