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

📄 process_key.c

📁 Sample code for use on smp 863x processor.
💻 C
📖 第 1 页 / 共 5 页
字号:
				RMDBGLOG((ENABLE, "Cannot set the contrast %d\n", err));				return err;			}			while ((err = RUASetProperty(dcc_info->pRUA, DispComponentOut, RMGenericPropertyID_Contrast, &(dcc_info->disp_info->contrast), sizeof(dcc_info->disp_info->contrast), 0)) == RM_PENDING);			while ((err = RUASetProperty(dcc_info->pRUA, DispCompositeOut, RMGenericPropertyID_Contrast, &(dcc_info->disp_info->contrast), sizeof(dcc_info->disp_info->contrast), 0)) == RM_PENDING);			//These will fail normally on EM862xL & SMP863x, no need to alarm people, deactivate error message. If you are using EM8605 or EM8610, put this sample error msg			//if (RMFAILED(err)) RMDBGPRINT((ENABLE, "Cannot set the contrast on DispComponentOut %d; if you do NOT have EM8605 or EM8610, this is normal\n"));						while ((err = RUASetProperty(dcc_info->pRUA, DispDigitalOut, RMGenericPropertyID_Validate, NULL, 0, 0)) == RM_PENDING);			if (RMFAILED(err)) RMDBGLOG((ENABLE, "Cannot validate contrast on Digital output %d\n", err));			while ((err = RUASetProperty(dcc_info->pRUA, DispMainAnalogOut, RMGenericPropertyID_Validate, NULL, 0, 0)) == RM_PENDING);			if (RMFAILED(err)) {				RMDBGLOG((ENABLE, "Cannot validate contrast on main analog out %d\n", err));				return err;			}			while ((err = RUASetProperty(dcc_info->pRUA, DispComponentOut, RMGenericPropertyID_Validate, NULL, 0, 0)) == RM_PENDING);			while ((err = RUASetProperty(dcc_info->pRUA, DispCompositeOut, RMGenericPropertyID_Validate, NULL, 0, 0)) == RM_PENDING);			//These will fail normally on EM862xL & SMP863x, no need to alarm people, deactivate error message. If you are using EM8605 or EM8610, put the sample error msg						break;		case KEY_CMD_BRIGHTNESS_PLUS:		case KEY_CMD_BRIGHTNESS_MINUS:			if ((key == KEY_CMD_BRIGHTNESS_PLUS) && (dcc_info->disp_info->brightness < 120))				dcc_info->disp_info->brightness += 8;			else if ((key == KEY_CMD_BRIGHTNESS_MINUS) && (dcc_info->disp_info->brightness > -121))				dcc_info->disp_info->brightness -= 8;			fprintf(stderr, "Now brightness is %d\n", dcc_info->disp_info->brightness);						while ((err = RUASetProperty(dcc_info->pRUA, DispDigitalOut, RMGenericPropertyID_Brightness, &(dcc_info->disp_info->brightness), sizeof(dcc_info->disp_info->brightness), 0)) == RM_PENDING);			if (RMFAILED(err)) RMDBGLOG((ENABLE, "Cannot set the brightness on the Digital output\n"));			while ((err = RUASetProperty(dcc_info->pRUA, DispMainAnalogOut, RMGenericPropertyID_Brightness, &(dcc_info->disp_info->brightness), sizeof(dcc_info->disp_info->brightness), 0)) == RM_PENDING);			if (RMFAILED(err)) {				RMDBGLOG((ENABLE, "Cannot set the brightness %d\n", err));				return err;			}			while ((err = RUASetProperty(dcc_info->pRUA, DispComponentOut, RMGenericPropertyID_Brightness, &(dcc_info->disp_info->brightness), sizeof(dcc_info->disp_info->brightness), 0)) == RM_PENDING);			while ((err = RUASetProperty(dcc_info->pRUA, DispCompositeOut, RMGenericPropertyID_Brightness, &(dcc_info->disp_info->brightness), sizeof(dcc_info->disp_info->brightness), 0)) == RM_PENDING);			//These will fail normally on EM862xL & SMP863x, no need to alarm people, deactivate error message. If you are using EM8605 or EM8610, put this sample error msg			//if (RMFAILED(err)) RMDBGPRINT((ENABLE, "Cannot set the brightness on DispComponentOut %d; if you do NOT have EM8605 or EM8610, this is normal\n"));						while ((err = RUASetProperty(dcc_info->pRUA, DispDigitalOut, RMGenericPropertyID_Validate, NULL, 0, 0)) == RM_PENDING);			if (RMFAILED(err)) RMDBGLOG((ENABLE, "Cannot validate brightness on Digital output %d\n", err));			while ((err = RUASetProperty(dcc_info->pRUA, DispMainAnalogOut, RMGenericPropertyID_Validate, NULL, 0, 0)) == RM_PENDING);			if (RMFAILED(err)) {				RMDBGLOG((ENABLE, "Cannot validate brightness on main analog out %d\n", err));				return err;			}			while ((err = RUASetProperty(dcc_info->pRUA, DispComponentOut, RMGenericPropertyID_Validate, NULL, 0, 0)) == RM_PENDING);			while ((err = RUASetProperty(dcc_info->pRUA, DispCompositeOut, RMGenericPropertyID_Validate, NULL, 0, 0)) == RM_PENDING);			//These will fail normally on EM862xL & SMP863x, no need to alarm people, deactivate error message. If you are using EM8605 or EM8610, put the sample error msg			break;		case KEY_CMD_SATURATION_PLUS:		case KEY_CMD_SATURATION_MINUS:			if ((key == KEY_CMD_SATURATION_PLUS) && (dcc_info->disp_info->saturation < 240))				dcc_info->disp_info->saturation += 16;			else if ((key == KEY_CMD_SATURATION_MINUS) && (dcc_info->disp_info->saturation > 15))				dcc_info->disp_info->saturation -= 16;			fprintf(stderr, "Now saturation is %hu\n", dcc_info->disp_info->saturation);			while ((err = RUASetProperty(dcc_info->pRUA, DispDigitalOut, RMGenericPropertyID_CbSaturation, &(dcc_info->disp_info->saturation), sizeof(dcc_info->disp_info->saturation), 0)) == RM_PENDING);			if (RMFAILED(err)) RMDBGLOG((ENABLE, "Cannot set the Cb saturation on the Digital output\n"));			while ((err = RUASetProperty(dcc_info->pRUA, DispMainAnalogOut, RMGenericPropertyID_CbSaturation, &(dcc_info->disp_info->saturation), sizeof(dcc_info->disp_info->saturation), 0)) == RM_PENDING);			if (RMFAILED(err)) {				RMDBGLOG((ENABLE, "Cannot set the Cb saturation %d\n", err));				return err;			}			while ((err = RUASetProperty(dcc_info->pRUA, DispComponentOut, RMGenericPropertyID_CbSaturation, &(dcc_info->disp_info->saturation), sizeof(dcc_info->disp_info->saturation), 0)) == RM_PENDING);			while ((err = RUASetProperty(dcc_info->pRUA, DispCompositeOut, RMGenericPropertyID_CbSaturation, &(dcc_info->disp_info->saturation), sizeof(dcc_info->disp_info->saturation), 0)) == RM_PENDING);			//These will fail normally on EM862xL & SMP863x, no need to alarm people, deactivate error message. If you are using EM8605 or EM8610, put this sample error msg			//if (RMFAILED(err)) RMDBGPRINT((ENABLE, "Cannot set the Cb saturation on DispComponentOut %d; if you do NOT have EM8605 or EM8610, this is normal\n"));				while ((err = RUASetProperty(dcc_info->pRUA, DispDigitalOut, RMGenericPropertyID_CrSaturation, &(dcc_info->disp_info->saturation), sizeof(dcc_info->disp_info->saturation), 0)) == RM_PENDING);			if (RMFAILED(err)) RMDBGLOG((ENABLE, "Cannot set the Cr saturation %d on the Digital output\n", err));						while ((err = RUASetProperty(dcc_info->pRUA, DispMainAnalogOut, RMGenericPropertyID_CrSaturation, &(dcc_info->disp_info->saturation), sizeof(dcc_info->disp_info->saturation), 0)) == RM_PENDING);			if (RMFAILED(err)) {				RMDBGLOG((ENABLE, "Cannot set the Cr saturation %d\n", err));				return err;			}			while ((err = RUASetProperty(dcc_info->pRUA, DispComponentOut, RMGenericPropertyID_CrSaturation, &(dcc_info->disp_info->saturation), sizeof(dcc_info->disp_info->saturation), 0)) == RM_PENDING);			while ((err = RUASetProperty(dcc_info->pRUA, DispCompositeOut, RMGenericPropertyID_CrSaturation, &(dcc_info->disp_info->saturation), sizeof(dcc_info->disp_info->saturation), 0)) == RM_PENDING);			//These will fail normally on EM862xL & SMP863x, no need to alarm people, deactivate error message. If you are using EM8605 or EM8610, put this sample error msg			//if (RMFAILED(err)) RMDBGPRINT((ENABLE, "Cannot set the Cr saturation on DispComponentOut %d; if you do NOT have EM8605 or EM8610, this is normal\n"));						while ((err = RUASetProperty(dcc_info->pRUA, DispDigitalOut, RMGenericPropertyID_Validate, NULL, 0, 0)) == RM_PENDING);			if (RMFAILED(err)) RMDBGLOG((ENABLE, "Cannot validate saturation on the Digital output %d\n", err));			while ((err = RUASetProperty(dcc_info->pRUA, DispMainAnalogOut, RMGenericPropertyID_Validate, NULL, 0, 0)) == RM_PENDING);			if (RMFAILED(err)) {				RMDBGLOG((ENABLE, "Cannot validate main analog out saturation %d\n", err));				return err;			}			while ((err = RUASetProperty(dcc_info->pRUA, DispComponentOut, RMGenericPropertyID_Validate, NULL, 0, 0)) == RM_PENDING);			while ((err = RUASetProperty(dcc_info->pRUA, DispCompositeOut, RMGenericPropertyID_Validate, NULL, 0, 0)) == RM_PENDING);			//These will fail normally on EM862xL & SMP863x, no need to alarm people, deactivate error message. If you are using EM8605 or EM8610, put the example			break;		case KEY_CMD_HUE_PLUS:		case KEY_CMD_HUE_MINUS:			if ((key == KEY_CMD_HUE_PLUS) && (dcc_info->disp_info->hue < 61))				dcc_info->disp_info->hue += 4;			else if ((key == KEY_CMD_HUE_MINUS) && (dcc_info->disp_info->hue > -61))				dcc_info->disp_info->hue -= 4;						fprintf(stderr, "Now hue is %d\n", dcc_info->disp_info->hue);						while ((err = RUASetProperty(dcc_info->pRUA, DispDigitalOut, RMGenericPropertyID_Hue, &(dcc_info->disp_info->hue), sizeof(dcc_info->disp_info->hue), 0)) == RM_PENDING);			if (RMFAILED(err)) RMDBGLOG((ENABLE, "Cannot set the hue on the Digital output\n"));			while ((err = RUASetProperty(dcc_info->pRUA, DispMainAnalogOut, RMGenericPropertyID_Hue, &(dcc_info->disp_info->hue), sizeof(dcc_info->disp_info->hue), 0)) == RM_PENDING);			if (RMFAILED(err)) {				RMDBGLOG((ENABLE, "Cannot set the hue %d\n", err));				return err;			}			while ((err = RUASetProperty(dcc_info->pRUA, DispComponentOut, RMGenericPropertyID_Hue, &(dcc_info->disp_info->hue), sizeof(dcc_info->disp_info->hue), 0)) == RM_PENDING);			while ((err = RUASetProperty(dcc_info->pRUA, DispCompositeOut, RMGenericPropertyID_Hue, &(dcc_info->disp_info->hue), sizeof(dcc_info->disp_info->hue), 0)) == RM_PENDING);			//These will fail normally on EM862xL & SMP863x, no need to alarm people, deactivate error message. If you are using EM8605 or EM8610, put this sample error msg			//if (RMFAILED(err)) RMDBGPRINT((ENABLE, "Cannot set the hue on DispComponentOut %d; if you do NOT have EM8605 or EM8610, this is normal\n"));						while ((err = RUASetProperty(dcc_info->pRUA, DispDigitalOut, RMGenericPropertyID_Validate, NULL, 0, 0)) == RM_PENDING);			if (RMFAILED(err)) RMDBGLOG((ENABLE, "Cannot validate hue on Digital output %d\n", err));			while ((err = RUASetProperty(dcc_info->pRUA, DispMainAnalogOut, RMGenericPropertyID_Validate, NULL, 0, 0)) == RM_PENDING);			if (RMFAILED(err)) {				RMDBGLOG((ENABLE, "Cannot validate hue on main analog out %d\n", err));				return err;			}			while ((err = RUASetProperty(dcc_info->pRUA, DispComponentOut, RMGenericPropertyID_Validate, NULL, 0, 0)) == RM_PENDING);			while ((err = RUASetProperty(dcc_info->pRUA, DispCompositeOut, RMGenericPropertyID_Validate, NULL, 0, 0)) == RM_PENDING);			//These will fail normally on EM862xL & SMP863x, no need to alarm people, deactivate error message. If you are using EM8605 or EM8610, put the sample error msg			break;		case KEY_CMD_DEFAULT_OUTPUT:			set_default_out_window(dcc_info->disp_info->active_window);			update_out_window = TRUE;			break;		case KEY_CMD_HALF_OUTPUT:			dcc_info->disp_info->active_window->X = 2048;			dcc_info->disp_info->active_window->Y = 2048;			dcc_info->disp_info->active_window->Width  = 2048;			dcc_info->disp_info->active_window->Height = 2048;			update_out_window = TRUE;			break;		case KEY_CMD_MINUS_OUTPUT_SIZE:			if (dcc_info->disp_info->active_window->Width > 128) 				dcc_info->disp_info->active_window->Width  -= 128;			else				dcc_info->disp_info->active_window->Width = 0;						if (dcc_info->disp_info->active_window->Height > 128) 				dcc_info->disp_info->active_window->Height  -= 128;			else				dcc_info->disp_info->active_window->Height = 0;			update_out_window = TRUE;			break;		case KEY_CMD_PLUS_OUTPUT_SIZE:			dcc_info->disp_info->active_window->Width  += 128;			dcc_info->disp_info->active_window->Height += 128;			update_out_window = TRUE;			break;		case KEY_CMD_TOP_OUTPUT:			dcc_info->disp_info->active_window->Y -= 128;			update_out_window = TRUE;			break;		case KEY_CMD_BOTTOM_OUTPUT:			dcc_info->disp_info->active_window->Y += 128;			update_out_window = TRUE;			break;			case KEY_CMD_LEFT_OUTPUT:			dcc_info->disp_info->active_window->X -= 128;			update_out_window = TRUE;			break;		case KEY_CMD_RIGHT_OUTPUT:			dcc_info->disp_info->active_window->X += 128;			update_out_window = TRUE;			break;				case KEY_CMD_SWITCH_OUTPUT:			if (dcc_info->disp_info->active_window == &(dcc_info->disp_info->out_window)) {				if (dcc_info->pOSDSource[0] != NULL){					dcc_info->disp_info->active_window = &(dcc_info->disp_info->osd_window[0]);				}			}			else {				if (dcc_info->pVideoSource != NULL){					dcc_info->disp_info->active_window = &(dcc_info->disp_info->out_window);				}			}						break;					case KEY_CMD_ENABLE_OUTPUT:			if (dcc_info->disp_info->active_window == &(dcc_info->disp_info->out_window)) 				dcc_info->disp_info->video_enable = ! dcc_info->disp_info->video_enable;			else				dcc_info->disp_info->osd_enable[0] = ! dcc_info->disp_info->osd_enable[0];			update_out_window = TRUE;			break;					case KEY_CMD_DUMP_OSD_INFO:			if (dcc_info->pOSDSource[0] != NULL) {				RMuint32 Y_addr, Y_size, UV_addr, UV_size;				err = DCCGetOSDVideoSourceInfo(dcc_info->pOSDSource[0], &Y_addr, &Y_size, &UV_addr, &UV_size);				if (RMFAILED(err)) {					RMDBGLOG((ENABLE, "Cannot get OSD information %d\n", err));					return err;				}				fprintf(stderr,"OSD is 0x%08lx %lu 0x%08lx %lu\n", Y_addr, Y_size, UV_addr, UV_size);								err = DCCClearOSDVideoSource(dcc_info->pOSDSource[0]);				if (RMFAILED(err)) {					RMDBGLOG((ENABLE, "Cannot clear OSD %d\n", err));					return err;				}			}			break;				case KEY_CMD_NONLINEAR_MINUS:			if (dcc_info->disp_info->nonlinearmode.Width >= 3) dcc_info->disp_info->nonlinearmode.Width = 0;			else dcc_info->disp_info->nonlinearmode.Width ++;			if (dcc_info->disp_info->nonlinearmode.Width) dcc_info->disp_info->blackstrip.Vertical = 256;			else dcc_info->disp_info->blackstrip.Vertical = 4096;			fprintf(stderr, "Non-linear scaling width: %ld\n", dcc_info->disp_info->nonlinearmode.Width);			update_out_window = TRUE;			break;		case KEY_CMD_NONLINEAR_PLUS:			if (dcc_info->disp_info->nonlinearmode.Level >= 3) dcc_info->disp_info->nonlinearmode.Level = 0;			else dcc_info->disp_info->nonlinearmode.Level ++;			fprintf(stderr, "Non-linear scaling level: %ld\n", dcc_info->disp_info->nonlinearmode.Level);			update_out_window = TRUE;			break;		case KEY_CMD_ROTATE_PICTURE:			*cmd = RM_ROTATE_PICTURE;			break;				default:			processed = FALSE;		}	}		if (processed == TRUE)		goto out_key;	if (keyflags & SET_KEY_SPI) {		processed = TRUE;		switch (key) {		case KEY_CMD_CHANGE_CHANNEL:			*cmd = RM_CHANNEL_CHANGE;			break;		case KEY_CMD_PAT_INFO:			*cmd = RM_PAT_INFO;			break;		case KEY_CMD_CHANGE_PMT:			*cmd = RM_PMT_CHANGE;			break;		case KEY_CMD_CHANGE_AUDIO: {			RMuint32 streamNumber;			RMDBGLOG((ENABLE,"audio stream change (select mode)\n"));			RMDBGLOG((ENABLE, "switch to audio stream: "));			RMTermGetUint32(&streamNumber);			dcc_info->selectAudioStream = (RMint32) streamNumber;			dcc_info->state = RM_AUDIO_STREAM_CHANGE;			dcc_info->trickmode_id = RM_NO_TRICKMODE;			*cmd = RM_PLAY;			break;		}		case KEY_CMD_CYCLE_AUDIO:			RMDBGLOG((ENABLE,"audio stream change (cycle mode)\n"));			dcc_info->selectAudioStream = -1;			dcc_info->state = RM_AUDIO_STREAM_CHANGE;			dcc_info->trickmode_id = RM_NO_TRICKMODE;			*cmd = RM_PLAY;			break;		case KEY_CMD_CHANGE_VIDEO:			*cmd = RM_VIDEO_STREAM_CHANGE;			break;		default:			processed = FALSE;		}	}		if ( key ==  KEY_CMD_QUIT){		*cmd = RM_QUIT;		goto out_key;	}	 out_key:	if (update_out_window) {		err = set_display_out_window(dcc_info);		if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "Error setting out window %d\n", err));			return err;		}	}		return processed ? RM_OK : RM_PENDING;}/* prototypes required for process_command() */RMbool handle_audio_keys(struct dcc_context *dcc_info, struct RM_PSM_Actions *actions, RMascii key);RMbool handle_spi_keys(struct dcc_context *dcc_info, struct RM_PSM_Actions *actions, RMascii key);RMstatus handle_playback_keys(struct dcc_context *dcc_info, struct RM_PSM_Actions *actions, RMascii key);RMstatus handle_display_keys(struct dcc_context *dcc_info, struct RM_PSM_Actions *actions, RMascii key);enum RM_PSM_State RM_PSM_GetState(struct RM_PSM_Context *PSMcontext, struct dcc_context *dcc_info_array[]) {	struct dcc_context *dcc_info;	if ((PSMcontext->currentActivePSMContext <= PSMcontext->validPSMContexts) &&	    (PSMcontext->currentActivePSMContext != 0)) {		RMDBGLOG((DISABLE, "GetState for context %lu\n", PSMcontext->currentActivePSMContext));		dcc_info = dcc_info_array[PSMcontext->currentActivePSMContext - 1];		switch (dcc_info->FSMstate) {		case RM_PSM_IPaused:			return RM_PSM_Paused;		case RM_PSM_INextPic:			return RM_PSM_NextPic;		default:			return dcc_info->FSMstate;		}	}	RMDBGLOG((DISABLE, "GetState for defaut context\n"));	dcc_info = dcc_info_array[0];	switch (dcc_info->FSMstate) {	case RM_PSM_IPaused:		return RM_PSM_Paused;	case RM_PSM_INextPic:		return RM_PSM_NextPic;	

⌨️ 快捷键说明

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