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

📄 parse_capture_cmdline.c

📁 1. 8623L平台
💻 C
📖 第 1 页 / 共 3 页
字号:
					options->override.ColorFormat = EMhwlibInputColorFormat_16BPP_565;				} else if (! strcmp(argv[argi], "16_1555")) {					options->override.ColorFormat = EMhwlibInputColorFormat_16BPP_1555;				} else if (! strcmp(argv[argi], "16_4444")) {					options->override.ColorFormat = EMhwlibInputColorFormat_16BPP_4444;				} else if (! strcmp(argv[argi], "31_7888")) {					options->override.ColorFormat = EMhwlibInputColorFormat_31BPP_7888;				} else {					RMDBGPRINT((ENABLE, "unknown color format: %s!\n", argv[argi]));					err = RM_ERROR;				}				SCANPARAM(options->override.Width, "please specify a width", 2);				SCANPARAM(options->override.Height, "please specify a height", 3);			} else {				RMDBGPRINT((ENABLE, "please specify a color format after %s\n", argv[argi - 1]));				err = RM_ERROR;			}		}		else if (! strcmp(&(argv[argi][1]), "freerun")) {			if ((argi + 1 < argc) && (argv[argi + 1][0] != '-')) {				SCANPARAM(options->audio_free_run, "please specify a value", 1);			} else {				options->audio_free_run = TRUE;			}		}		else {			err = RM_PENDING;		}	}	if (err == RM_OK) 		*index = argi + 1;		return err;}// return frame size and interlaced statusstatic RMstatus get_video_size(	struct RUA *pInstance, 	enum EMhwlibTVStandard standard,	RMuint32 *x_size,	RMuint32 *y_size, 	RMbool *interlaced){	RMstatus err;	struct EMhwlibTVFormatDigital format;		err = RUAExchangeProperty(pInstance, DisplayBlock, 		RMDisplayBlockPropertyID_TVFormatDigital, 		&standard, sizeof(standard), 		&format, sizeof(format));	if (RMSUCCEEDED(err)) {		*interlaced = format.TopFieldHeight ? TRUE : FALSE;		*x_size = format.ActiveWidth;		*y_size = format.ActiveHeight;		if (*interlaced) {			*y_size += format.ActiveHeight - format.YOffsetBottom + format.YOffsetTop;		}	}		return err;}void get_aspect_ratio_from_video_mode(	enum EMhwlibTVStandard TVStandard, 	struct EMhwlibTVFormatDigital *pTVFormat, 	RMbool wide,  // ambiguous modes (SDTV,EDTV): FALSE=4:3, TRUE=16:9 anamorphic	RMuint32 *asp_x, 	RMuint32 *asp_y){	if (!asp_x || !asp_y) return;		// determine aspect ratio from video mode	switch (TVStandard) {	case EMhwlibTVStandard_Custom:		if (pTVFormat) {			*asp_x = pTVFormat->ActiveWidth;			*asp_y = pTVFormat->ActiveHeight;			reduce_aspect_ratio(asp_x, asp_y, 0);		} else {			*asp_x = 4;			*asp_y = 3;		}		break;	case EMhwlibTVStandard_HDMI_720p59: 	case EMhwlibTVStandard_HDMI_720p60: 	case EMhwlibTVStandard_HDMI_1080i59: 	case EMhwlibTVStandard_HDMI_1080i60: 	case EMhwlibTVStandard_HDMI_1080p59: 	case EMhwlibTVStandard_HDMI_1080p60: 	case EMhwlibTVStandard_HDMI_720p50: 	case EMhwlibTVStandard_HDMI_1080i50: 	case EMhwlibTVStandard_HDMI_1080p50: 	case EMhwlibTVStandard_HDMI_1080p23: 	case EMhwlibTVStandard_HDMI_1080p24: 	case EMhwlibTVStandard_HDMI_1080p25: 	case EMhwlibTVStandard_HDMI_1080p29: 	case EMhwlibTVStandard_HDMI_1080p30: 	case EMhwlibTVStandard_HDMI_1080i50_1250: 	case EMhwlibTVStandard_HDMI_1080i100: 	case EMhwlibTVStandard_HDMI_720p100: 	case EMhwlibTVStandard_HDMI_1080i119: 	case EMhwlibTVStandard_HDMI_1080i120: 	case EMhwlibTVStandard_HDMI_720p119: 	case EMhwlibTVStandard_HDMI_720p120: 	case EMhwlibTVStandard_1080p60: 	case EMhwlibTVStandard_1080p59: 	case EMhwlibTVStandard_1080p50: 	case EMhwlibTVStandard_1080i60: 	case EMhwlibTVStandard_1080i59: 	case EMhwlibTVStandard_1080i50: 	case EMhwlibTVStandard_1080i48: 	case EMhwlibTVStandard_1080i47: 	case EMhwlibTVStandard_1080p30: 	case EMhwlibTVStandard_1080p29: 	case EMhwlibTVStandard_1080p25: 	case EMhwlibTVStandard_1080p24: 	case EMhwlibTVStandard_1080p23: 	case EMhwlibTVStandard_1080i50_1250: 	case EMhwlibTVStandard_1080p50_1250: 	case EMhwlibTVStandard_720p60: 	case EMhwlibTVStandard_720p59: 	case EMhwlibTVStandard_720p50: 	case EMhwlibTVStandard_720p30: 	case EMhwlibTVStandard_720p29: 	case EMhwlibTVStandard_720p25: 	case EMhwlibTVStandard_720p24: 	case EMhwlibTVStandard_720p23: 	case EMhwlibTVStandard_VESA_1360x768x60: 	case EMhwlibTVStandard_VESA_1280x720x60: 	case EMhwlibTVStandard_VESA_1280x720x75: 	case EMhwlibTVStandard_VESA_1920x1080x60i: 		*asp_x = 16;		*asp_y = 9;		break;	case EMhwlibTVStandard_VESA_1280x768x60RB: 	case EMhwlibTVStandard_VESA_1280x768x60: 	case EMhwlibTVStandard_VESA_1280x768x75: 	case EMhwlibTVStandard_VESA_1280x768x85: 		*asp_x = 5;		*asp_y = 3;		break;	case EMhwlibTVStandard_VESA_1280x1024x60: 	case EMhwlibTVStandard_VESA_1280x1024x75: 	case EMhwlibTVStandard_VESA_1280x1024x85: 	case EMhwlibTVStandard_CVT_1280x1024x50: 	case EMhwlibTVStandard_CVT_1280x1024x60: 	case EMhwlibTVStandard_CVT_1280x1024x75: 	case EMhwlibTVStandard_CVT_1280x1024x85: 		*asp_x = 5;		*asp_y = 4;		break;	case EMhwlibTVStandard_VESA_1920x1200x60RB: 	case EMhwlibTVStandard_VESA_1920x1200x60: 	case EMhwlibTVStandard_VESA_1920x1200x75: 	case EMhwlibTVStandard_VESA_1920x1200x85: 	case EMhwlibTVStandard_VESA_1440x900x60RB: 	case EMhwlibTVStandard_VESA_1440x900x60: 	case EMhwlibTVStandard_VESA_1440x900x75: 	case EMhwlibTVStandard_VESA_1680x1050x60RB: 	case EMhwlibTVStandard_VESA_1680x1050x60: 		*asp_x = 8;		*asp_y = 5;		break;	case EMhwlibTVStandard_VESA_720x400x70: 		*asp_x = 9;		*asp_y = 5;		break;		// SD/ED modes, ambiguous	case EMhwlibTVStandard_HDMI_480p59: 	case EMhwlibTVStandard_HDMI_480p60: 	case EMhwlibTVStandard_HDMI_480i59: 	case EMhwlibTVStandard_HDMI_480i60: 	case EMhwlibTVStandard_HDMI_1440x480i59: 	case EMhwlibTVStandard_HDMI_1440x480i60: 	case EMhwlibTVStandard_HDMI_240p59: 	case EMhwlibTVStandard_HDMI_240p60: 	case EMhwlibTVStandard_HDMI_1440x240p59: 	case EMhwlibTVStandard_HDMI_1440x240p60: 	case EMhwlibTVStandard_HDMI_2880x480i59: 	case EMhwlibTVStandard_HDMI_2880x480i60: 	case EMhwlibTVStandard_HDMI_2880x240p59: 	case EMhwlibTVStandard_HDMI_2880x240p60: 	case EMhwlibTVStandard_HDMI_1440x480p59: 	case EMhwlibTVStandard_HDMI_1440x480p60: 	case EMhwlibTVStandard_HDMI_576p50: 	case EMhwlibTVStandard_HDMI_576i50: 	case EMhwlibTVStandard_HDMI_1440x576i50: 	case EMhwlibTVStandard_HDMI_288p50: 	case EMhwlibTVStandard_HDMI_1440x288p50: 	case EMhwlibTVStandard_HDMI_2880x576i50: 	case EMhwlibTVStandard_HDMI_2880x288p50: 	case EMhwlibTVStandard_HDMI_1440x576p50: 	case EMhwlibTVStandard_HDMI_2880x480p59: 	case EMhwlibTVStandard_HDMI_2880x480p60: 	case EMhwlibTVStandard_HDMI_2880x576p50: 	case EMhwlibTVStandard_HDMI_576p100: 	case EMhwlibTVStandard_HDMI_576i100: 	case EMhwlibTVStandard_HDMI_1440x576i100: 	case EMhwlibTVStandard_HDMI_480p119: 	case EMhwlibTVStandard_HDMI_480p120: 	case EMhwlibTVStandard_HDMI_480i119: 	case EMhwlibTVStandard_HDMI_480i120: 	case EMhwlibTVStandard_HDMI_1440x480i119: 	case EMhwlibTVStandard_HDMI_1440x480i120: 	case EMhwlibTVStandard_HDMI_576p200: 	case EMhwlibTVStandard_HDMI_576i200: 	case EMhwlibTVStandard_HDMI_1440x576i200: 	case EMhwlibTVStandard_HDMI_480p239: 	case EMhwlibTVStandard_HDMI_480p240: 	case EMhwlibTVStandard_HDMI_480i239: 	case EMhwlibTVStandard_HDMI_480i240: 	case EMhwlibTVStandard_HDMI_1440x480i239: 	case EMhwlibTVStandard_HDMI_1440x480i240: 	case EMhwlibTVStandard_ITU_Bt656_525: 	case EMhwlibTVStandard_ITU_Bt656_240p: 	case EMhwlibTVStandard_NTSC_M_Japan: 	case EMhwlibTVStandard_NTSC_M: 	case EMhwlibTVStandard_PAL_60: 	case EMhwlibTVStandard_PAL_M: 	case EMhwlibTVStandard_480p59: 	case EMhwlibTVStandard_NTSC_M_Japan_714: 	case EMhwlibTVStandard_NTSC_M_714: 	case EMhwlibTVStandard_PAL_60_714: 	case EMhwlibTVStandard_PAL_M_714: 	case EMhwlibTVStandard_480p59_714: 	case EMhwlibTVStandard_ITU_Bt656_625: 	case EMhwlibTVStandard_ITU_Bt656_288p: 	case EMhwlibTVStandard_PAL_BG: 	case EMhwlibTVStandard_PAL_N: 	case EMhwlibTVStandard_576p50: 	case EMhwlibTVStandard_PAL_BG_702: 	case EMhwlibTVStandard_PAL_N_702: 	case EMhwlibTVStandard_576p50_702: 		if (wide) {			*asp_x = 16;			*asp_y = 9;			break;		}		// all others, 4:3	default:		*asp_x = 4;		*asp_y = 3;		break;	}}static RMstatus build_capture_profile(	struct RUA *pInstance, 	struct capture_cmdline *ip, 	struct DCCCaptureProfile *cp){	RMstatus err;	RMuint32 x_size, y_size;	RMbool interlaced;		if (ip->SurfaceColorSpace == EMhwlibColorSpace_None) 		ip->SurfaceColorSpace = ip->InputColorSpace;		err = get_video_size(pInstance, ip->TVStandard, &x_size, &y_size, &interlaced);	if (RMFAILED(err)) {		RMDBGLOG((ENABLE, "Could not find video format #%u: %s\n", ip->TVStandard, RMstatusToString(err)));		return err;	}		ip->over_pos_x = ip->shift_x - (ip->ov_lft << ((ip->bussize == 8) ? 1 : 0));	ip->over_pos_y = ip->shift_y - ip->ov_top;	ip->over_width = (ip->ov_lft + ip->ov_rgt) << ((ip->bussize == 8) ? 1 : 0);	ip->over_height = ip->ov_top + ip->ov_bot;		cp->SamplingMode = ip->SamplingMode;	cp->ColorMode = ip->ColorMode;	cp->Width = x_size + ip->over_width;	cp->Height = y_size + ip->over_height;	cp->OrigWidth = x_size;	cp->OrigHeight = y_size;	cp->Interlaced = interlaced;	cp->ColorSpace = ip->SurfaceColorSpace;	cp->DeInt = ip->DeInt;	cp->UseV2Pads = ip->UseV2Pads;		if (ip->bussize == 8) {		cp->ColorFormat = EMhwlibColorFormat_16BPP_565;	} else if (ip->bussize == 16) {		switch(ip->InputColorFormat) {		case EMhwlibInputColorFormat_24BPP:		case EMhwlibInputColorFormat_16BPP_565:			cp->ColorFormat = EMhwlibColorFormat_16BPP_565;			break;		case EMhwlibInputColorFormat_24BPP_8565:		case EMhwlibInputColorFormat_24BPP_5676:		case EMhwlibInputColorFormat_32BPP:		case EMhwlibInputColorFormat_16BPP_4444:		case EMhwlibInputColorFormat_31BPP_7888:			cp->ColorFormat = EMhwlibColorFormat_16BPP_4444;			break;		case EMhwlibInputColorFormat_16BPP_1555:			cp->ColorFormat = EMhwlibColorFormat_16BPP_1555;			break;		}	} else if (ip->bussize == 32) {		switch(ip->InputColorFormat) {		case EMhwlibInputColorFormat_24BPP:		case EMhwlibInputColorFormat_16BPP_565:			cp->ColorFormat = EMhwlibColorFormat_24BPP;			break;		case EMhwlibInputColorFormat_24BPP_8565:		case EMhwlibInputColorFormat_24BPP_5676:		case EMhwlibInputColorFormat_32BPP:		case EMhwlibInputColorFormat_16BPP_1555:		case EMhwlibInputColorFormat_16BPP_4444:		case EMhwlibInputColorFormat_31BPP_7888:			cp->ColorFormat = EMhwlibColorFormat_32BPP;			break;		}	}		// convert picture aspect ratio to pixel aspect ratio or vice versa	// TODO use picture aspect ratio directly, when implemented in irq handler.	if (ip->PixelAspectRatio.X && ip->PixelAspectRatio.Y) {		cp->PixelAspectRatio = ip->PixelAspectRatio;		cp->PictureAspectRatio.X = cp->PixelAspectRatio.X * cp->OrigWidth;		cp->PictureAspectRatio.Y = cp->PixelAspectRatio.Y * cp->OrigHeight;		reduce_aspect_ratio(&(cp->PictureAspectRatio.X), &(cp->PictureAspectRatio.Y), 255);	} else {		cp->PictureAspectRatio = ip->PictureAspectRatio;		cp->PixelAspectRatio.X = cp->PictureAspectRatio.X * cp->OrigHeight;		cp->PixelAspectRatio.Y = cp->PictureAspectRatio.Y * cp->OrigWidth;		reduce_aspect_ratio(&(cp->PixelAspectRatio.X), &(cp->PixelAspectRatio.Y), 255);	}		return err;}RMstatus setup_capture(	struct dcc_context *dcc_info, 	struct DCCVideoSource **ppVideoSource, 	struct capture_cmdline *capture_opt, 	RMuint16 **ppVBIData, 	struct ReceiveObject_type **ppR, 	struct RUABufferPool **ppDmaReceive, 	RMuint32 TimerNumber, 	RMbool use_gpio, 	RMbool inv_fid){	RMstatus err;	struct DCCCaptureProfile cp;	RMuint32 old_vbi_size;		if (! ppVideoSource) {		RMDBGLOG((ENABLE, "ppVideoSource can not be NULL!\n"));		return RM_FATALINVALIDPOINTER;	}	// create capture profile from options	err = build_capture_profile(dcc_info->pRUA, capture_opt, &cp);	if (RMFAILED(err)) {		RMDBGLOG((ENABLE, "Could not build capture profile: %s\n", RMstatusToString(err)));		return err;	}		// open (and potentially create) video source	if (EMHWLIB_MODULE_CATEGORY(capture_opt->InputModuleID) == DispVideoInput) {		err = DCCOpenVideoInputSource(dcc_info->pDCC, &cp, TimerNumber, capture_opt->dram, ppVideoSource);	} else if (EMHWLIB_MODULE_CATEGORY(capture_opt->InputModuleID) == DispGraphicInput) {		err = DCCOpenGraphicInputSource(dcc_info->pDCC, &cp, TimerNumber, capture_opt->dram, ppVideoSource);	} else if (EMHWLIB_MODULE_CATEGORY(capture_opt->InputModuleID) == DispColorBars) {		capture_opt->disablescaler = TRUE;		capture_opt->guess = FALSE;		return RM_OK;	} else {		err = RM_ERROR;	}	if (RMFAILED(err)) {		RMDBGLOG((ENABLE, "Could not open video source: %s\n", RMstatusToString(err)));		return err;	}		// set up input	if (capture_opt->InputModuleID == DispGraphicInput) {		err = DCCSetupGraphicInput(dcc_info->pDCC, 			capture_opt->TVStandard, 

⌨️ 快捷键说明

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