aboutsummaryrefslogtreecommitdiff
path: root/fmb_player_apl/src/scr/SetVideoResolutionDec.c
blob: 086674be6596cb8669d8d3e7ce6e27eb28ab4321 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
/*================================================
 *               ***************                 *
 *            **      \ | /      **              *
 *          *  ****   ****   ****** *            *
 *         * ---**---**-|-**--**--** *           *
 *        *     **  **  |  *  **  **  *          *
 *        *-----**--**--o-----****----*          *
 *        *     **  **  |     **      *          *
 *         * ---**---**-|--*--**---- *           *
 *          *  ****   ****   ****  *             *
 *            **      / | \     **               *
 *               **************                  *
 *      Copyright ICP Electronics (C) 2010       *
 *===============================================*/
/*-----------------------------------------------* 
    $Author: Kenneth $
    $Date: $
    $Revision: $
 *-----------------------------------------------*/
/*
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "FmbCmn.h"
#include "Screen.h"
#include "FmbAp.h"

static const char	*_screenStr = "\
[[[ Decode settings - Sub menu -> Video resolution ]]]\n\
                             'B'<-~~~~~~~~~~~~~~~->Enter\n\
Select following number. (* is current setting)\n\
  1 %c %s\n\
  2 %c %s\n\
  3 %c %s\n\
  4 %c %s\n\
  5 %c %s\n\
  6 %c %s\n\
  7 %c %s\n\
  8 %c %s\n\
  9 %c %s\n\
  i %c %s\n\
  j %c %s\n\
  k %c %s\n\
  l %c %s\n\
  m %c %s\n\
  n %c %s\n\
";


static const char validChars[] = "123456789iIjJkKlLmMnNbB\n";



//Event function when key is input.
static BOOL OnKeyHit(char InputCharacterCode);

//Event function when show the screen.
static BOOL OnShow(void);

/**
*	@brief		Initial screen of the video resolution of the encoding setting.
*	@param[out]	scr	Screen property
*	@return		None
*	@note		None
*	@attention	None
*/
void InitSetVideoResolutionDec(struct Screen *scr)
{
	FMB_FUNC(TRUE);
	scr->displayString = _screenStr;
	scr->OnKeyFunc = OnKeyHit;
	scr->OnShowFunc = OnShow;
	scr->validChars = validChars;
	FMB_FUNC(FALSE);
}

/**
*	@brief		Screen display event
*	@param[in]	None
*	@return		TRUE	Application execution continuance
*	@return		FALSE	Application end
*	@note		None
*	@attention	None
*/
static BOOL OnShow(void)
{
	enum FMBFuncModeEnum	setmode;


	FMB_FUNC(TRUE);

	ASSERT_USR(gp_FmbComProperty->setMode == FMBEnmFuncModeDec, "Function mode is illegal.");

	setmode = gp_FmbComProperty->setMode;

	printOut(_screenStr,
		g_selectMarks[gp_FmbProperty[setmode].videoRsltn][FMBEnmVideoRsltn_1920_1080_60p],
		g_FmbNameVideoRsltn[FMBEnmVideoRsltn_1920_1080_60p],
		g_selectMarks[gp_FmbProperty[setmode].videoRsltn][FMBEnmVideoRsltn_1920_1080_59p],
		g_FmbNameVideoRsltn[FMBEnmVideoRsltn_1920_1080_59p],
		g_selectMarks[gp_FmbProperty[setmode].videoRsltn][FMBEnmVideoRsltn_1920_1080_50p],
		g_FmbNameVideoRsltn[FMBEnmVideoRsltn_1920_1080_50p],
		g_selectMarks[gp_FmbProperty[setmode].videoRsltn][FMBEnmVideoRsltn_1920_1080_60i],
		g_FmbNameVideoRsltn[FMBEnmVideoRsltn_1920_1080_60i],
		g_selectMarks[gp_FmbProperty[setmode].videoRsltn][FMBEnmVideoRsltn_1920_1080_59i],
		g_FmbNameVideoRsltn[FMBEnmVideoRsltn_1920_1080_59i],
		g_selectMarks[gp_FmbProperty[setmode].videoRsltn][FMBEnmVideoRsltn_1920_1080_50i],
		g_FmbNameVideoRsltn[FMBEnmVideoRsltn_1920_1080_50i],
		g_selectMarks[gp_FmbProperty[setmode].videoRsltn][FMBEnmVideoRsltn_1440_1080_60i],
		g_FmbNameVideoRsltn[FMBEnmVideoRsltn_1440_1080_60i],
		g_selectMarks[gp_FmbProperty[setmode].videoRsltn][FMBEnmVideoRsltn_1440_1080_59i],
		g_FmbNameVideoRsltn[FMBEnmVideoRsltn_1440_1080_59i],
		g_selectMarks[gp_FmbProperty[setmode].videoRsltn][FMBEnmVideoRsltn_1440_1080_50i],
		g_FmbNameVideoRsltn[FMBEnmVideoRsltn_1440_1080_50i],
		g_selectMarks[gp_FmbProperty[setmode].videoRsltn][FMBEnmVideoRsltn_1280_720_60p],
		g_FmbNameVideoRsltn[FMBEnmVideoRsltn_1280_720_60p],
		g_selectMarks[gp_FmbProperty[setmode].videoRsltn][FMBEnmVideoRsltn_1280_720_59p],
		g_FmbNameVideoRsltn[FMBEnmVideoRsltn_1280_720_59p],
		g_selectMarks[gp_FmbProperty[setmode].videoRsltn][FMBEnmVideoRsltn_1280_720_50p],
		g_FmbNameVideoRsltn[FMBEnmVideoRsltn_1280_720_50p],
		g_selectMarks[gp_FmbProperty[setmode].videoRsltn][FMBEnmVideoRsltn_720_480_60i],
		g_FmbNameVideoRsltn[FMBEnmVideoRsltn_720_480_60i],
		g_selectMarks[gp_FmbProperty[setmode].videoRsltn][FMBEnmVideoRsltn_720_480_59i],
		g_FmbNameVideoRsltn[FMBEnmVideoRsltn_720_480_59i],
		g_selectMarks[gp_FmbProperty[setmode].videoRsltn][FMBEnmVideoRsltn_720_576_50i],
		g_FmbNameVideoRsltn[FMBEnmVideoRsltn_720_576_50i]);

	SetInputEnabled(TRUE);

	FMB_FUNC(FALSE);
	return TRUE;
}

/**
*	@brief		Event function when key is input.
*	@param[in]	InputCharacterCode	Input character-code
*	@return		TRUE	Application execution continuance
*	@return		FALSE	Application end
*	@note		None
*	@attention	None
*/
static BOOL OnKeyHit(char InputCharacterCode)
{
	enum FMBFuncModeEnum	setmode;
	enum FMBVideoResolutionEnum	resolution_Fmb;

	FMB_FUNC(TRUE);

	ASSERT_USR(gp_FmbComProperty->setMode == FMBEnmFuncModeDec, "Function mode is illegal.");

	setmode = gp_FmbComProperty->setMode;

	switch(InputCharacterCode){
	case	'1':
	case	'2':
	case	'3':
	case	'4':
	case	'5':
	case	'6':
	case	'7':
	case	'8':
	case	'9':
		resolution_Fmb = InputCharacterCode - '1' + FMBEnmVideoRsltn_1920_1080_60p;
		FmbSetVideoFormat(resolution_Fmb, setmode);
		break;
	case	'i':
	case	'j':
	case	'k':
	case	'l':
	case	'm':
	case	'n':
		resolution_Fmb = InputCharacterCode - 'i' + FMBEnmVideoRsltn_1280_720_60p;
		FmbSetVideoFormat(resolution_Fmb, setmode);
		break;
	case	'I':
	case	'J':
	case	'K':
	case	'L':
	case	'M':
	case	'N':
		resolution_Fmb = InputCharacterCode - 'I' + FMBEnmVideoRsltn_1280_720_60p;
		FmbSetVideoFormat(resolution_Fmb, setmode);
		break;
	case	'b':
	case	'B':
		ChangeScreenTo(ScrEnmSetSubMenuDec);
		FMB_FUNC(FALSE);
		return TRUE;
	case '\n':
		OnShow();
		break;
	default:
		//'\n'
		ASSERT_USR(InputCharacterCode=='\n', "Invalid character code.");
		break;
	};

	ChangeScreenTo(ScrEnmSetSubMenuDec);

	FMB_FUNC(FALSE);
	return TRUE;
}