av.c
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:20k
- #include <stdio.h>
- #include <string.h>
- #include "gendef.h"
- #include "dmx.h"
- #include "vid.h"
- #include "osp.h"
- #include "aud.h"
- #include "avslot.h"
- #include "errors.h"
- #include "evt.h"
- #include "av.h"
- #include "vtg.h"
- #include "denc.h"
- #include "timer.h"
- #include "stvid.h"
- #include "staudlt.h"
- #include "stpti_hal.h"
- #include "staud.h"
- #include "regevent.h"
- #include "vmix.h"
- #include "layer.h"
- #include "db.h"
- #define PLAYING 0
- #define STOPPED 1
- #define PAUSED 2
- static U16 attenuation_table[KB_AV_MAX_VOLUME] =
- {
- 63, 62, 60, 58,
- 54, 49, 44, 42,
- 38, 36, 30, 29,
- 27, 25, 23, 22,
- 20, 18, 17, 16,
- 15, 14, 13, 10,
- 8, 6, 5, 4,
- 3, 2, 1, 0
- };
- static UINT32 gnAvInitFlag = FALSE;
- static UINT32 gnAvVolume;
- static UINT32 gnAvMuteStatus;
- //added by whale 07/06/26 start
- static UINT32 gnAvMode;
- static UINT32 gnAvRatio;
- //added by whale 07/06/26 end
- static KB_DBTRACK gnAvChannel;
- static INT32 gnAvVideoEnabled;
- static INT32 gnAvVideoIframeEnabled;
- static UINT32 avTimer = KB_TIMER_INVALID_ID ;
- static void AVHandleTimer(void);
- static KB_AVPlayStartCallback s_ptCallback = NULL;
- static BOOL s_bPlaySuccess = TRUE;
- static KB_AVPID gtAvCurrentPid;
- static INT32 nSavedLeft;
- static INT32 nSavedTop;
- static INT32 nSavedRight;
- static INT32 nSavedBottom;
- static BOOL gFullFlag;
- extern BOOL SET_ENTRY_BROD_PutFullScreen_FLAGS;
- #define MP2A_SAMPLING_FREQUENCY 44100
- INT32 KB_AVInit(void)
- {
- ST_ErrorCode_t ST_ErrorCode = ST_NO_ERROR;
-
- if (gnAvInitFlag == FALSE)
- {
- ST_ErrorCode = AVSlotInit();
- if (ST_ErrorCode != ST_NO_ERROR)
- {
- Print("error init AVSlotInit n");
- return RETFIAL1;
- }
-
- ST_ErrorCode = VID_Setup();
- if (ST_ErrorCode != ST_NO_ERROR)
- {
- Print("error init VID_Setup n");
- return RETFIAL1;
- }
- ST_ErrorCode = AUD_Setup( SERVICE_MODE_DVB );
- if (ST_ErrorCode != ST_NO_ERROR)
- {
- Print("error init AUD_Setup n");
- return RETFIAL1;
- }
- STAUD_SetStereoOutput(AUD_Handle, STAUD_STEREO_DUAL_LEFT);
- RegisterEvents();
- gnAvVolume = 0;
- gnAvMuteStatus = FALSE;
- gnAvInitFlag = TRUE;
- gnAvChannel = LEFT_TRACK;
- gnAvVideoEnabled = FALSE;
- gnAvVideoIframeEnabled = FALSE;
-
- memset(>AvCurrentPid, 0, sizeof(KB_AVPID));
- if(avTimer == KB_TIMER_INVALID_ID )
- {
- avTimer = KB_TimerCreate(KB_TIMER_REPEAT , (KB_TIMER_FUNC_POINTER)AVHandleTimer,NULL);
- }
- }
- gFullFlag = TRUE;
- KB_AVGetWindow(&nSavedLeft, &nSavedTop, &nSavedRight, &nSavedBottom);
- return RETOK;
- }
- INT32 KB_AVPlay(UINT32 nVideoPid, UINT32 nAudioPid, UINT32 nPcrPid)
- {
- ST_ErrorCode_t ST_ErrorCode;
- STAUD_StartParams_t AUDStartParams;
- STVID_StartParams_t VIDStartParams;
- KB_AVStop();
- if (nAudioPid > 0 && nAudioPid < 8191)
- {
- StartAud((UINT16)nAudioPid);
- gtAvCurrentPid.nAudioPid = nAudioPid;
-
- AUDStartParams.StreamContent = STAUD_STREAM_CONTENT_MPEG2;
- AUDStartParams.SamplingFrequency = MP2A_SAMPLING_FREQUENCY;
- AUDStartParams.StreamType = STAUD_STREAM_TYPE_PES;
- AUDStartParams.StreamID = STAUD_IGNORE_ID;
- ST_ErrorCode = STAUD_Start(AUD_Handle, &AUDStartParams);
- STTBX_Print(("%s,%d,Ignore)=%sn",
- AUDStartParams.StreamContent == STAUD_STREAM_CONTENT_MPEG1 ? "MPEG1":"MPEG2",
- AUDStartParams.SamplingFrequency, KB_ErrorGetText(ST_ErrorCode) ));
- #ifdef DISABLE_AVSYNC_FOR_DVB
- ST_ErrorCode = STAUD_DisableSynchronisation(AUD_Handle);
- if ( ST_ErrorCode != ST_NO_ERROR )
- {
- STTBX_Print(("STAUD_DisableSyncronisation()=%sn", KB_ErrorGetText(ST_ErrorCode) ));
- }
- #else
- ST_ErrorCode = STAUD_EnableSynchronisation(AUD_Handle);
- if ( ST_ErrorCode != ST_NO_ERROR )
- {
- STTBX_Print(("STAUD_EnableSyncronisation()=%sn", KB_ErrorGetText(ST_ErrorCode) ));
- }
- #endif
- }
- if (nVideoPid > 0 && nVideoPid < 8191)
- {
- StartVid((UINT16)nVideoPid);
- gtAvCurrentPid.nVideoPid = nVideoPid;
-
- #if defined(STVID_ERROR_RECOVERY_MODE_NONE)
- {
- ST_ErrorCode = STVID_SetErrorRecoveryMode(VID_Handle, STVID_ERROR_RECOVERY_NONE);
- if ( ST_ErrorCode != ST_NO_ERROR )
- {
- STTBX_Print(("STVID_SetErrorRecoveryMode()Failed 0x%08x n", ST_ErrorCode ));
- }
- else
- {
- STTBX_Print(("STVID_SetErrorRecoveryMode()= STVID_ERROR_RECOVERY_NONE n" ));
- }
- }
- #endif /* end of STVID_ERROR_RECOVERY_MODE_NONE */
- VIDStartParams.RealTime = TRUE;
- VIDStartParams.UpdateDisplay = TRUE;
- VIDStartParams.StreamID = STVID_IGNORE_ID;
- VIDStartParams.DecodeOnce = FALSE;
- VIDStartParams.StreamType = STVID_STREAM_TYPE_PES;
- VIDStartParams.BrdCstProfile = STVID_BROADCAST_DVB;
- ST_ErrorCode = STVID_Start(VID_Handle, &VIDStartParams);
- STTBX_Print(("STVID_Start %sn", KB_ErrorGetText(ST_ErrorCode) ));
-
- #ifdef DISABLE_AVSYNC_FOR_DVB
- ST_ErrorCode = STVID_DisableSynchronisation(VID_Handle);
- if ( ST_ErrorCode != ST_NO_ERROR )
- {
- STTBX_Print(("STVID_DisableSyncronisation()=%sn", KB_ErrorGetText(ST_ErrorCode) ));
- }
- #else
- ST_ErrorCode = STVID_EnableSynchronisation(VID_Handle);
- if ( ST_ErrorCode != ST_NO_ERROR )
- {
- STTBX_Print(("STVID_EnableSyncronisation()=%sn", KB_ErrorGetText(ST_ErrorCode) ));
- }
- #endif /* end of DISABLE_AVSYNC_FOR_DVB */
- }
- if (nPcrPid > 0 && nPcrPid < 8192)
- {
- StartPCR((UINT16)nPcrPid);
- gtAvCurrentPid.nPcrPid = nPcrPid;
- }
- s_bPlaySuccess = TRUE;
- KB_TimerEnable(avTimer, 4000);
- return RETOK;
- }
- INT32 KB_AVStop(void)
- {
- STAUD_Fade_t Fade;
- ST_ErrorCode_t error;
- STVID_Stop_t StopMode = STVID_STOP_NOW;
- STVID_Freeze_t Freeze;
- if (gtAvCurrentPid.nAudioPid != 0)
- {
- StopAud();
- gtAvCurrentPid.nAudioPid = 0;
-
- Fade.FadeType = STAUD_FADE_SOFT_MUTE;
- error = STAUD_Stop(AUD_Handle, STAUD_STOP_NOW, &Fade);
- if ( error != ST_NO_ERROR )
- {
- STTBX_Print(("STAUD_Stop=%sn", KB_ErrorGetText(error)));
- }
- }
- if (gtAvCurrentPid.nVideoPid != 0)
- {
- StopVid();
- gtAvCurrentPid.nVideoPid = 0;
-
- if (gnAvVideoIframeEnabled == FALSE)
- {
- Freeze.Field = STVID_FREEZE_FIELD_TOP;
- Freeze.Mode = STVID_FREEZE_MODE_NO_FLICKER;
- DBGPrint("gnAvVideoIframeEnabled = %dn", (int)gnAvVideoIframeEnabled);
-
- STVID_DisableOutputWindow(VID_ViewPortHandle);
- gnAvVideoEnabled = FALSE;
-
- error = STVID_Stop(VID_Handle, StopMode, &Freeze);
- if ( error != ST_NO_ERROR )
- {
- STTBX_Print(("STVID_Stop=%sn", KB_ErrorGetText(error)));
- }
- }
- }
- if (gtAvCurrentPid.nPcrPid != 0)
- {
- StopPCR();
- gtAvCurrentPid.nPcrPid = 0;
- }
-
- KB_TimerDisable(avTimer);
-
- return RETOK;
- }
- INT32 AVStop_A(void)
- {
- STAUD_Fade_t Fade;
- ST_ErrorCode_t error;
- //STVID_Stop_t StopMode = STVID_STOP_NOW;
- //STVID_Freeze_t Freeze;
- if (gtAvCurrentPid.nAudioPid != 0)
- {
- gtAvCurrentPid.nAudioPid = 0;
-
- Fade.FadeType = STAUD_FADE_SOFT_MUTE;
- error = STAUD_Stop(AUD_Handle, STAUD_STOP_NOW, &Fade);
- }
- if (gtAvCurrentPid.nPcrPid != 0)
- {
- StopPCR();
- gtAvCurrentPid.nPcrPid = 0;
- }
-
- KB_TimerDisable(avTimer);
- return RETOK;
- }
- INT32 AVStop_V(void)
- {
- //STAUD_Fade_t Fade;
- ST_ErrorCode_t error;
- STVID_Stop_t StopMode = STVID_STOP_NOW;
- STVID_Freeze_t Freeze;
- if (gtAvCurrentPid.nVideoPid != 0)
- {
- StopVid();
- gtAvCurrentPid.nVideoPid = 0;
-
- if (gnAvVideoIframeEnabled == FALSE)
- {
- Freeze.Field = STVID_FREEZE_FIELD_TOP;
- Freeze.Mode = STVID_FREEZE_MODE_NO_FLICKER;
- STVID_DisableOutputWindow(VID_ViewPortHandle);
- gnAvVideoEnabled = FALSE;
-
- error = STVID_Stop(VID_Handle, StopMode, &Freeze);
- }
- }
- if (gtAvCurrentPid.nPcrPid != 0)
- {
- StopPCR();
- gtAvCurrentPid.nPcrPid = 0;
- }
-
- KB_TimerDisable(avTimer);
- return RETOK;
- }
- INT32 KB_AVPause(void)
- {
- STAUD_Fade_t Fade;
- STVID_Freeze_t Freeze;
- ST_ErrorCode_t ST_ErrorCode;
-
- Fade.FadeType = STAUD_FADE_SOFT_MUTE;
- ST_ErrorCode = STAUD_Pause(AUD_Handle, &Fade);
- if (ST_ErrorCode != ST_NO_ERROR)
- {
- STTBX_Print(("STAUD_Pause()=%sn", KB_ErrorGetText(ST_ErrorCode) ));
- }
- Freeze.Field = STVID_FREEZE_FIELD_TOP;
- Freeze.Mode = STVID_FREEZE_MODE_NO_FLICKER;
- ST_ErrorCode = STVID_Pause(VID_Handle, &Freeze);
- if (ST_ErrorCode != ST_NO_ERROR)
- {
- STTBX_Print(("STVID_Pause()=%sn", KB_ErrorGetText(ST_ErrorCode) ));
- }
-
- return RETOK;
- }
- INT32 KB_AVSetWindow(INT32 nLeft, INT32 nTop, INT32 nRight, INT32 nBottom)
- {
- ST_ErrorCode_t ErrCode = ST_NO_ERROR;
- STGXOBJ_Rectangle_t OutputRectangle;
- BOOL AutoMode;
- STVID_WindowParams_t WinParams;
- if (nLeft == 0 && nTop == 0 && nRight == 720 && nBottom == 576)
- gFullFlag = TRUE;
- else
- gFullFlag = FALSE;
-
- nSavedLeft = nLeft;
- nSavedTop = nTop;
- nSavedRight = nRight;
- nSavedBottom = nBottom;
- if (nLeft % 2 == 0)
- {
- OutputRectangle.PositionX = (S32)nLeft;
- }
- else
- {
- OutputRectangle.PositionX = (S32)nLeft + 1;
- }
- if (nTop % 2 == 0)
- {
- OutputRectangle.PositionY = (S32)nTop;
- }
- else
- {
- OutputRectangle.PositionY = (S32)nTop + 1;
- }
- OutputRectangle.Width = (U32)(nRight - nLeft);
- OutputRectangle.Height = (U32)(nBottom - nTop);
- if ( OutputRectangle.Width == 0 )
- OutputRectangle.Width = g_KB_VtgModeParams.ActiveAreaWidth;
- if ( OutputRectangle.Height == 0 )
- OutputRectangle.Height = g_KB_VtgModeParams.ActiveAreaHeight;
-
- STVID_GetOutputWindowMode(VID_ViewPortHandle, &AutoMode, &WinParams);
- STVID_SetOutputWindowMode(VID_ViewPortHandle, FALSE, &WinParams);
- ErrCode = STVID_SetIOWindows(VID_ViewPortHandle, 0, 0, 0, 0,
- OutputRectangle.PositionX,
- OutputRectangle.PositionY,
- OutputRectangle.Width,
- OutputRectangle.Height);
- if ( ErrCode != ST_NO_ERROR )
- {
- STTBX_Print(("STVID_SetIOWindows()=%sn", KB_ErrorGetText(ErrCode)));
- return RETFIAL1;
- }
- return RETOK;
- }
- INT32 KB_AVGetWindow(INT32 *pLeft, INT32 *pTop, INT32 *pRight, INT32 *pBottom)
- {
- ST_ErrorCode_t ErrCode;
- S32 InputWinPositionX;
- S32 InputWinPositionY;
- U32 InputWinWidth;
- U32 InputWinHeight;
- S32 OutputWinPositionX;
- S32 OutputWinPositionY;
- U32 OutputWinWidth;
- U32 OutputWinHeight;
- if( (pLeft == NULL) || (pTop == NULL)
- || (pRight == NULL) || (pBottom == NULL) ) return RETFAIL3;
-
- if (( ErrCode = STVID_GetIOWindows( VID_ViewPortHandle,
- &InputWinPositionX, &InputWinPositionY,
- &InputWinWidth, &InputWinHeight,
- &OutputWinPositionX, &OutputWinPositionY,
- &OutputWinWidth, &OutputWinHeight )) != ST_NO_ERROR)
- {
- STTBX_Print(("STVID_GetIOWindows()=%sn", KB_ErrorGetText(ErrCode)));
- return RETFIAL1;
- }
- *pLeft = (INT32)OutputWinPositionX;
- *pTop = (INT32)OutputWinPositionY;
- *pRight = (INT32)(OutputWinPositionX + (INT32)OutputWinWidth);
- *pBottom= (INT32)(OutputWinPositionY + (INT32)OutputWinHeight);
-
- return RETOK;
- }
- INT32 KB_AVChangeWindow(BOOL bFull)
- {
- if(bFull)
- KB_AVSetWindow(0,0,720,576);
- else
- KB_AVSetWindow(nSavedLeft,nSavedTop,nSavedRight,nSavedBottom);
- gFullFlag = bFull;
- return RETOK;
- }
- BOOL KB_AVGetWindowFlag(void)
- {
- return gFullFlag;
- }
- INT32 KB_AVSetMute(BOOL bisMute)
- {
- ST_ErrorCode_t ST_ErrorCode;
- gnAvMuteStatus = bisMute;
- if(bisMute)
- ST_ErrorCode = STAUD_Mute(AUD_Handle, TRUE, TRUE);
- else
- ST_ErrorCode = STAUD_Mute(AUD_Handle, FALSE, FALSE);
- if ( ST_ErrorCode != ST_NO_ERROR )
- {
- STTBX_Print(("STAUD_Mute(TRUE)=%sn", KB_ErrorGetText(ST_ErrorCode) ));
- }
-
- return RETOK;
- }
- INT32 KB_AVGetMuteFlag(void)
- {
- return gnAvMuteStatus;
- }
- INT32 KB_AVSetPrgTrack(KB_DBTRACK nTrack)
- {
- STAUD_Stereo_t nMode;
-
- if (nTrack > STEREO_TRACK)
- {
- return RETFAIL3;
- }
- else
- {
- if (gnAvChannel == nTrack)
- {
- return RETOK;
- }
-
- switch (nTrack)
- {
- case LEFT_TRACK:
- nMode = STAUD_STEREO_DUAL_LEFT;
- break;
-
- case RIGHT_TRACK:
- nMode = STAUD_STEREO_DUAL_RIGHT;
- break;
- case STEREO_TRACK:
- nMode = STAUD_STEREO_STEREO;
- break;
- default:
- nMode = STAUD_STEREO_DUAL_LEFT;
- break;
- }
-
- STAUD_SetStereoOutput(AUD_Handle, nMode);
- gnAvChannel = nTrack;
- return RETOK;
- }
- }
- KB_DBTRACK KB_AVGetTrack(void)
- {
- return gnAvChannel;
- }
- INT32 KB_AVSetVolume(INT32 nVolume)
- {
- STAUD_Attenuation_t Attenuation;
- U16 left_volume, right_volume;
-
- if (nVolume < 0 || nVolume > KB_AV_MAX_VOLUME - 1)
- {
- return RETFAIL3;
- }
- gnAvVolume = nVolume;
- memset(&Attenuation, 0, sizeof(STAUD_Attenuation_t));
-
- left_volume = right_volume = (U16)nVolume;
- Attenuation.Left = attenuation_table[left_volume];
- Attenuation.Right = attenuation_table[right_volume];
- STAUD_SetAttenuation(AUD_Handle, Attenuation);
-
- return RETOK;
- }
- INT32 KB_AVGetVolume(void)
- {
- return gnAvVolume;
- }
- void AVHandleNewVideoFrame(STEVT_CallReason_t Reason,
- STEVT_EventConstant_t Event,
- const void *EventData)
- {
- ST_ErrorCode_t ErrCode;
- STVID_PictureInfos_t PictureInfo;
- static U32 FrameRate = 25000;
- ErrCode = ST_NO_ERROR;
- if((Event == STVID_NEW_PICTURE_TO_BE_DISPLAYED_EVT) && gnAvVideoEnabled == FALSE)
- {
- PictureInfo = *((STVID_PictureInfos_t*) EventData);
- STTBX_Print(("FRAME_RATE = %dn", PictureInfo.VideoParams.FrameRate));
- if(FrameRate != PictureInfo.VideoParams.FrameRate)
- {
- STTBX_Print(("New FRAME_RATE detected = %dn", PictureInfo.VideoParams.FrameRate));
- FrameRate = PictureInfo.VideoParams.FrameRate;
- }
-
- STVID_EnableOutputWindow(VID_ViewPortHandle);
- gnAvVideoEnabled = TRUE;
- }
-
- return;
- }
- static void AVHandleTimer(void)
- {
- static U32 oldVideoCount = 0;
- static U32 oldAudioCount = 0;
-
- BOOL bVideo = TRUE;
- if(oldVideoCount == VideoEvent_STVID_NEW_PICTURE_TO_BE_DISPLAYED_EVT_Count)
- {
- bVideo = FALSE;
- }
- else
- {
- oldVideoCount = VideoEvent_STVID_NEW_PICTURE_TO_BE_DISPLAYED_EVT_Count;
- }
-
- if(oldAudioCount == AudioEvent_STAUD_NEW_FRAME_EVT_Count)
- {
- if(!bVideo)
- {
- s_bPlaySuccess = FALSE;
- if(s_ptCallback != NULL)
- {
- s_ptCallback(FALSE, 0, 0, 0);
- }
- }
- }
- else
- {
- oldAudioCount = AudioEvent_STAUD_NEW_FRAME_EVT_Count;
-
- if(!s_bPlaySuccess)
- {
- s_bPlaySuccess = TRUE;
- if(s_ptCallback != NULL)
- {
- s_ptCallback(TRUE, 0, 0, 0);
- }
- }
- }
- }
- BOOL KB_AVGetIFrameFlag(void)
- {
- return (BOOL)gnAvVideoIframeEnabled;
- }
- INT32 KB_AVPlayIFrame(UINT8 *pInData, INT32 nDataSize)
- {
- Switch2Iframe(pInData, (int)nDataSize);
- gnAvVideoIframeEnabled = TRUE;
- return RETOK;
- }
- INT32 KB_AVStopIFrame(void)
- {
- Switch2Live();
- gnAvVideoEnabled = FALSE;
- gnAvVideoIframeEnabled = FALSE;
- return RETOK;
- }
- KB_AVPlayStartCallback KB_AVHandlePlayState(KB_AVPlayStartCallback ptCallback)
- {
- KB_AVPlayStartCallback oldCallBack = s_ptCallback;
- s_ptCallback = ptCallback;
- return oldCallBack;
- }
- #if 0
- extern STVID_ViewPortHandle_t VID_ViewPortHandle_Multiple[VIDEO_USED]; /* j_vid.c */
- int KB_AVSetTVAspectRatioAndMatchMode(KB_AVAspectRatio nAspectRatio,
- STVID_DisplayAspectRatioConversion_t nMatchMode)
- {
- STVMIX_ScreenParams_t ScreenParams;
- STLAYER_LayerParams_t LayerParams;
- STVID_DisplayAspectRatioConversion_t STVID_darc = STVID_DISPLAY_AR_CONVERSION_IGNORE;
- STVID_WindowParams_t WindowParams;
- ST_ErrorCode_t ErrCode = ST_NO_ERROR;
- WindowParams.Size = STVID_WIN_SIZE_DONT_CARE;
- WindowParams.Align = STVID_WIN_ALIGN_VCENTRE_HCENTRE;
- ErrCode = STLAYER_GetLayerParams(g_KB_LayerHandle[LAYER_VIDEO], &LayerParams);
- ErrCode |= STVMIX_GetScreenParams(g_KB_VmixHandle, &ScreenParams);
- if (ErrCode == ST_NO_ERROR)
- {
- switch (nAspectRatio)
- {
- case KB_AV_ASPECT_RATIO_16TO9:
- LayerParams.AspectRatio = STGXOBJ_ASPECT_RATIO_16TO9;
- ScreenParams.AspectRatio = STGXOBJ_ASPECT_RATIO_16TO9;
- break;
- case KB_AV_ASPECT_RATIO_4TO3:
- LayerParams.AspectRatio = STGXOBJ_ASPECT_RATIO_4TO3;
- ScreenParams.AspectRatio = STGXOBJ_ASPECT_RATIO_4TO3;
- break;
- default:
- ErrCode = ST_ERROR_BAD_PARAMETER;
- break;
- }
- }
-
- if (ErrCode == ST_NO_ERROR)
- {
- ErrCode = STLAYER_SetLayerParams(g_KB_LayerHandle[LAYER_VIDEO], &LayerParams);
- }
-
- if (ErrCode == ST_NO_ERROR)
- {
- ErrCode = STVMIX_SetScreenParams(g_KB_VmixHandle, &ScreenParams);
- }
-
- if (ErrCode != ST_NO_ERROR)
- {
- return RETFIAL1;
- }
-
- STVID_darc = nMatchMode;
-
-
- ErrCode = STVID_SetDisplayAspectRatioConversion(VID_ViewPortHandle_Multiple[VIDEO_USED-1], STVID_darc);
- if (ErrCode != ST_NO_ERROR)
- {
- STTBX_Print(("[VID]: SetDisplayAspectRatioConversion()=%d err=0x%x n",
- KB_ErrorGetText(ErrCode), ErrCode));
- }
-
- STVID_SetOutputWindowMode(VID_ViewPortHandle_Multiple[VIDEO_USED-1], TRUE, &WindowParams );
-
- return RETOK;
- }
- #else
- int KB_AVSetAspectRatio(KB_AVAspectRatio nAspectRatio)
- {
- ST_ErrorCode_t ErrCode = ST_NO_ERROR;
- //STGXOBJ_AspectRatio_t *nRatio;
- if (gnAvRatio != nAspectRatio)
- {
- gnAvRatio = nAspectRatio;
- switch (nAspectRatio)
- {
- case KB_AV_ASPECT_RATIO_16TO9:
- ErrCode = KB_VmixSetAspectRatio(STGXOBJ_ASPECT_RATIO_16TO9);
- break;
- case KB_AV_ASPECT_RATIO_4TO3:
- ErrCode = KB_VmixSetAspectRatio(STGXOBJ_ASPECT_RATIO_4TO3);
- break;
- default:
- ErrCode = ST_ERROR_BAD_PARAMETER;
- break;
- }
- }
-
- if (ErrCode != ST_NO_ERROR)
- {
- Print("KB_AVSetAspectRatio=%sn", KB_ErrorGetText(ErrCode));
- return RETFIAL1;
- }
- KB_DBSaveVideoAspectRatio((UINT8)nAspectRatio);
- return RETOK;
- }
- #endif
- int KB_AVSetMode(KB_AVVideoDisplayMode nMode)
- {
- ST_ErrorCode_t ErrCode = ST_NO_ERROR;
- if (gnAvMode != nMode)
- {
- gnAvMode = nMode;
- switch(nMode)
- {
- case KB_AV_VIDEO_DISPLAY_PAL:
- ErrCode = KB_DENCSetMode( STDENC_MODE_PALBDGHI );
- ErrCode |= KB_VtgSetMode( STDENC_MODE_PALBDGHI );
- break;
- case KB_AV_VIDEO_DISPLAY_NTSC:
- ErrCode = KB_DENCSetMode( STDENC_MODE_NTSCM );
- ErrCode |= KB_VtgSetMode( STDENC_MODE_NTSCM );
- break;
- case KB_AV_VIDEO_DISPLAY_SECAM:
- ErrCode = KB_DENCSetMode( STDENC_MODE_SECAM );
- ErrCode |= KB_VtgSetMode( STDENC_MODE_SECAM );
- break;
- default:
- ErrCode = ST_ERROR_BAD_PARAMETER;
- break;
- }
- }
-
- if (ErrCode != ST_NO_ERROR)
- {
- Print("KB_AVSetMode=%sn", KB_ErrorGetText(ErrCode));
- return RETFIAL1;
- }
-
- //added by yyj 2007.6.29
- KB_DBSaveVideoDispMode((UINT8)nMode);
-
- return RETOK;
- }
- /* EOF */