⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 video.c

📁 1. 8623L平台
💻 C
📖 第 1 页 / 共 4 页
字号:
			pVideo->Setup.InputColorFormat, 			pVideo->Setup.InputColorSpace, 			pVideo->Setup.InvertVSync, 			pVideo->Setup.InvertHSync, 			pVideo->Setup.invert_fid, 			pVideo->Setup.use_gpio_fid);		if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "Error setting graphic input: %s\n", RMstatusToString(err)));			return err;		}	} else if (EMHWLIB_MODULE_CATEGORY(pVideo->Setup.InputModuleID) == DispVideoInput) {		if (pVideo->Setup.bussize > 16) {			RMDBGLOG((ENABLE, "video input can't capture 24 or 32 bit video!\n"));			return RM_ERROR;		}		err = DCCSetupVideoInput(pVideo->pDCC, 			pVideo->Setup.TVStandard, 			pVideo->Setup.DigitalTimingSignal, 			pVideo->Setup.UseVideoValid, 			pVideo->Setup.bussize, 			pVideo->Setup.over_pos_x, 			pVideo->Setup.over_pos_y, 			pVideo->Setup.over_width, 			pVideo->Setup.over_height, 			pVideo->Setup.InvertVSync, 			pVideo->Setup.InvertHSync, 			pVideo->Setup.invert_fid, 			pVideo->Setup.use_gpio_fid);		if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "Error setting video input: %s\n", RMstatusToString(err)));			return err;		}	}		DCCSPERR(pVideo->pRUA, 		pVideo->Setup.InputModuleID, 		RMGenericPropertyID_PictureOverride, 		&(pVideo->Setup.override), sizeof(pVideo->Setup.override), 		"Cannot set PictureOverride on input");		if (! pVideo->Setup.disablescaler) {		// get Scaler ModuleID		if (pVideo->Setup.DeInt) {			if (pVideo->Setup.SamplingMode != EMhwlibSamplingMode_422) {				RMDBGLOG((ENABLE, "De-Interlacing with 4:2:2 video only!\n"));				return RM_ERROR;			}			pVideo->ScalerModuleID = EMHWLIB_MODULE(DispMainVideoScaler, 0);		} else if (pVideo->Setup.SamplingMode == EMhwlibSamplingMode_422) {			pVideo->ScalerModuleID = EMHWLIB_MODULE(DispMainVideoScaler, 0);		} else {			pVideo->ScalerModuleID = EMHWLIB_MODULE(DispOSDScaler, 0);		}		if (pVideo->ScalerModuleID == DispVCRMultiScaler) {			pVideo->ScalerModuleID = DispGFXMultiScaler;		}				// set surface into scaler		err = DCCSetSurfaceSource(pVideo->pDCC, pVideo->ScalerModuleID, pVideo->pVideoSource);		if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "Cannot set the surface source %d\n", err));			return err;		}	}		return RM_OK;}/* stop the capture */RMstatus cap_video_stop_capture(	struct cap_video_instance *pVideo){	RMstatus err = RM_OK;		RMDBGLOG((FUNCNAME, "%s\n",__func__));		// close input and remove old surface	if (pVideo->pVideoSource) {		//RMDBGLOG((ENABLE, "Closing VideoSource\n"));		err = DCCCloseVideoSource(pVideo->pVideoSource);		pVideo->pVideoSource = NULL;		if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "Could not clean surface: %s\n", RMstatusToString(err)));		}	}		return err;}const enum EMhwlibTVStandard cap_match_modes[] = {	EMhwlibTVStandard_HDMI_640x480p60, 	EMhwlibTVStandard_HDMI_480p60, 	EMhwlibTVStandard_HDMI_720p60, 	EMhwlibTVStandard_HDMI_1080i60, 	EMhwlibTVStandard_HDMI_480i60, 	EMhwlibTVStandard_HDMI_1440x480i60, 	EMhwlibTVStandard_HDMI_240p60, 	EMhwlibTVStandard_HDMI_1440x240p60, 	EMhwlibTVStandard_HDMI_2880x480i60, 	EMhwlibTVStandard_HDMI_2880x240p60, 	EMhwlibTVStandard_HDMI_1440x480p60, 	EMhwlibTVStandard_HDMI_1080p60, 	EMhwlibTVStandard_HDMI_576p50, 	EMhwlibTVStandard_HDMI_720p50, 	EMhwlibTVStandard_HDMI_1080i50, 	EMhwlibTVStandard_HDMI_576i50, 	EMhwlibTVStandard_HDMI_1440x576i50, 	EMhwlibTVStandard_HDMI_288p50, 	EMhwlibTVStandard_HDMI_1440x288p50, 	EMhwlibTVStandard_HDMI_2880x576i50, 	EMhwlibTVStandard_HDMI_2880x288p50, 	EMhwlibTVStandard_HDMI_1440x576p50, 	EMhwlibTVStandard_HDMI_1080p50, 	EMhwlibTVStandard_HDMI_1080p24, 	EMhwlibTVStandard_HDMI_1080p25, 	EMhwlibTVStandard_HDMI_1080p30, 	EMhwlibTVStandard_HDMI_2880x480p60, 	EMhwlibTVStandard_HDMI_2880x576p50, 	EMhwlibTVStandard_HDMI_1080i50_1250, 	EMhwlibTVStandard_HDMI_1080i100, 	EMhwlibTVStandard_HDMI_720p100, 	EMhwlibTVStandard_HDMI_576p100, 	EMhwlibTVStandard_HDMI_576i100, 	EMhwlibTVStandard_HDMI_1440x576i100, 	EMhwlibTVStandard_HDMI_1080i120, 	EMhwlibTVStandard_HDMI_720p120, 	EMhwlibTVStandard_HDMI_480p120, 	EMhwlibTVStandard_HDMI_480i120, 	EMhwlibTVStandard_HDMI_1440x480i120, 	EMhwlibTVStandard_HDMI_576p200, 	EMhwlibTVStandard_HDMI_576i200, 	EMhwlibTVStandard_HDMI_1440x576i200, 	EMhwlibTVStandard_HDMI_480p240, 	EMhwlibTVStandard_HDMI_480i240, 	EMhwlibTVStandard_HDMI_1440x480i240, 	EMhwlibTVStandard_ITU_Bt656_525, 	EMhwlibTVStandard_ITU_Bt656_240p, 	EMhwlibTVStandard_NTSC_M, 	EMhwlibTVStandard_480p59, 	EMhwlibTVStandard_NTSC_M_714, 	EMhwlibTVStandard_480p59_714, 	EMhwlibTVStandard_ITU_Bt656_625, 	EMhwlibTVStandard_ITU_Bt656_288p, 	EMhwlibTVStandard_PAL_BG, 	EMhwlibTVStandard_576p50, 	EMhwlibTVStandard_PAL_BG_702, 	EMhwlibTVStandard_576p50_702, 	EMhwlibTVStandard_PAL_BG_704, 	EMhwlibTVStandard_576p50_704, 	EMhwlibTVStandard_VESA_640x350x85, 	EMhwlibTVStandard_VESA_640x400x85, 	EMhwlibTVStandard_VESA_720x400x85, 	EMhwlibTVStandard_VESA_640x480x60, 	EMhwlibTVStandard_VESA_640x480x72, 	EMhwlibTVStandard_VESA_640x480x75, 	EMhwlibTVStandard_VESA_640x480x85, 	EMhwlibTVStandard_VESA_848x480x60, 	EMhwlibTVStandard_VESA_800x600x56, 	EMhwlibTVStandard_VESA_800x600x60, 	EMhwlibTVStandard_VESA_800x600x72, 	EMhwlibTVStandard_VESA_800x600x75, 	EMhwlibTVStandard_VESA_800x600x85, 	EMhwlibTVStandard_VESA_1024x768x43, 	EMhwlibTVStandard_VESA_1024x768x60, 	EMhwlibTVStandard_VESA_1024x768x70, 	EMhwlibTVStandard_VESA_1024x768x75, 	EMhwlibTVStandard_VESA_1024x768x85, 	EMhwlibTVStandard_VESA_1152x864x75, 	EMhwlibTVStandard_VESA_1280x768x60RB, 	EMhwlibTVStandard_VESA_1280x768x60, 	EMhwlibTVStandard_VESA_1280x768x75, 	EMhwlibTVStandard_VESA_1280x768x85, 	EMhwlibTVStandard_VESA_1280x960x60, 	EMhwlibTVStandard_VESA_1280x960x85, 	EMhwlibTVStandard_VESA_1280x1024x60, 	EMhwlibTVStandard_VESA_1280x1024x75, 	EMhwlibTVStandard_VESA_1280x1024x85, 	EMhwlibTVStandard_VESA_1360x768x60, 	EMhwlibTVStandard_VESA_1366x768x60, 	EMhwlibTVStandard_VESA_1400x1050x60RB, 	EMhwlibTVStandard_VESA_1400x1050x60, 	EMhwlibTVStandard_VESA_1400x1050x75, 	EMhwlibTVStandard_VESA_1400x1050x85, 	EMhwlibTVStandard_VESA_1600x1200x60, 	EMhwlibTVStandard_VESA_1600x1200x65, 	EMhwlibTVStandard_VESA_1600x1200x70, 	EMhwlibTVStandard_VESA_1600x1200x75, 	EMhwlibTVStandard_VESA_1600x1200x85, 	EMhwlibTVStandard_VESA_1792x1344x60, 	EMhwlibTVStandard_VESA_1792x1344x75, 	EMhwlibTVStandard_VESA_1856x1392x60, 	EMhwlibTVStandard_VESA_1856x1392x75, 	EMhwlibTVStandard_VESA_1920x1200x60RB, 	EMhwlibTVStandard_VESA_1920x1200x60, 	EMhwlibTVStandard_VESA_1920x1200x75, 	EMhwlibTVStandard_VESA_1920x1200x85, 	EMhwlibTVStandard_VESA_1920x1440x60, 	EMhwlibTVStandard_VESA_1920x1440x75, 	EMhwlibTVStandard_VESA_640x350x70, 	EMhwlibTVStandard_VESA_640x480i30, 	EMhwlibTVStandard_VESA_640x480i60, 	EMhwlibTVStandard_VESA_720x400x70, 	EMhwlibTVStandard_VESA_640x480x66, 	EMhwlibTVStandard_VESA_832x624x75, 	EMhwlibTVStandard_VESA_1152x870x75, 	EMhwlibTVStandard_VESA_1280x720x60, 	EMhwlibTVStandard_VESA_1280x720x75, 	EMhwlibTVStandard_VESA_1440x900x60RB, 	EMhwlibTVStandard_VESA_1440x900x60, 	EMhwlibTVStandard_VESA_1440x900x75, 	EMhwlibTVStandard_VESA_1680x1050x60RB, 	EMhwlibTVStandard_VESA_1680x1050x60, 	EMhwlibTVStandard_VESA_1920x1080x60i, 	EMhwlibTVStandard_CVT_640x480x50, 	EMhwlibTVStandard_CVT_640x480x60, 	EMhwlibTVStandard_CVT_640x480x75, 	EMhwlibTVStandard_CVT_640x480x85, 	EMhwlibTVStandard_CVT_800x600x50, 	EMhwlibTVStandard_CVT_800x600x60, 	EMhwlibTVStandard_CVT_800x600x75, 	EMhwlibTVStandard_CVT_800x600x85, 	EMhwlibTVStandard_CVT_1024x768x50, 	EMhwlibTVStandard_CVT_1024x768x60, 	EMhwlibTVStandard_CVT_1024x768x75, 	EMhwlibTVStandard_CVT_1024x768x85, 	EMhwlibTVStandard_CVT_1152x864x50, 	EMhwlibTVStandard_CVT_1152x864x60, 	EMhwlibTVStandard_CVT_1152x864x75, 	EMhwlibTVStandard_CVT_1152x864x85, 	EMhwlibTVStandard_CVT_1280x960x50, 	EMhwlibTVStandard_CVT_1280x960x60, 	EMhwlibTVStandard_CVT_1280x960x75, 	EMhwlibTVStandard_CVT_1280x960x85, 	EMhwlibTVStandard_CVT_1280x1024x50, 	EMhwlibTVStandard_CVT_1280x1024x60, 	EMhwlibTVStandard_CVT_1280x1024x75, 	EMhwlibTVStandard_CVT_1280x1024x85, 	EMhwlibTVStandard_CVT_1600x1200x50, 	EMhwlibTVStandard_CVT_1600x1200x60, };/* guess the video standard, based on the current input signal at the capture port */// TODO algorithm needs improvementRMstatus cap_video_guess_format(	struct cap_video_instance *pVideo){	RMstatus err;	RMuint64 XtalPerField = 0, ClocksPerField = 0, LinesPerField = 0, ClocksPerLine = 0;	RMuint32 i, samples = 0;	RMuint32 VFreq;		RMDBGLOG((FUNCNAME, "%s\n",__func__));	// sample sets of values for averaging	for (i = 0; i < 50; i++) {  // half second		struct Input_Detect_type det;		err = RUAGetProperty(pVideo->pRUA, pVideo->Setup.InputModuleID, 			RMGenericPropertyID_Detect, 			&det, sizeof(det));		if (RMFAILED(err)) RMDBGLOG((LOCALDBG, "Error getting property Detect: %s\n", RMstatusToString(err)));		if (i >= 3) {  // skip first three measurements			XtalPerField += det.XtalPerField;			ClocksPerField += det.ClocksPerField;			LinesPerField += det.LinesPerField;			ClocksPerLine += det.ClocksPerLine;			samples++;		}		RMMicroSecondSleep(10000);	}		// average sampled values	VFreq = XtalPerField ? 2700000000U / (RMuint32)(XtalPerField / samples) : 0;	ClocksPerField /= samples;	LinesPerField /= samples;	ClocksPerLine /= samples;		RMDBGLOG((LOCALDBG, "Guessing captured video format\n  Measured values are: %ld.%02ld Hz, %ld pix/field, %ld lines/field, %ld pix/line\n", 		VFreq / 100, VFreq % 100, 		(RMuint32)ClocksPerField, 		(RMuint32)LinesPerField, 		(RMuint32)ClocksPerLine));		// maintain minimum thresholds: 10 Hz, 10000 cpf, 48 lpf, 128 cpl	if (		(VFreq && (VFreq < 1000)) || 		(ClocksPerField && (ClocksPerField < 10000)) || 		(LinesPerField && (LinesPerField < 48)) || 		(ClocksPerLine && (ClocksPerLine < 128))	) {		RMDBGLOG((LOCALDBG, "No Video!\n"));		return RM_ERROR;	}		// match with closest TVStandard	{		enum EMhwlibTVStandard prevTVStandard = pVideo->Setup.TVStandard;		enum EMhwlibTVStandard best_match = EMhwlibTVStandard_Custom;		RMuint32 curr_VFreq, curr_ClocksPerField, curr_HalfLinesPerField, curr_ClocksPerLine;		RMint32 diff_VFreq, diff_ClocksPerField, diff_LinesPerField, diff_ClocksPerLine;		RMuint64 error, min_err = 0xFFFFFFFFFFFFFFFFULL;//		RMascii *StandardName;		RMuint32 i;				for (i = 0; i < sizeof(cap_match_modes) / sizeof(cap_match_modes[0]); i++) {			struct EMhwlibTVFormatDigital dig;			RMuint32 dig_clk;						pVideo->Setup.TVStandard = cap_match_modes[i];//			GetTVStandardName(pVideo->Setup.TVStandard, &StandardName);						err = RUAExchangeProperty(pVideo->pRUA, DisplayBlock, 				RMDisplayBlockPropertyID_TVFormatDigital, 				&(pVideo->Setup.TVStandard), sizeof(pVideo->Setup.TVStandard), 				&dig, sizeof(dig));			if RMFAILED(err) {//				RMDBGLOG((ENABLE, "Could not get format for TV Standard %s!\n", StandardName));				RMDBGLOG((ENABLE, "Could not get format for TV Standard %u!\n", pVideo->Setup.TVStandard));				return err;			}			err = RUAExchangeProperty(pVideo->pRUA, DisplayBlock, 				RMDisplayBlockPropertyID_TVPixelClockDigital, 				&(pVideo->Setup.TVStandard), sizeof(pVideo->Setup.TVStandard), 

⌨️ 快捷键说明

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