1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
37
40
41
42
51
52
53
54
55
56
57
58
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
153
154
155
156
157
158
162
166
170
171
172
177
178
179
180
181
182
183
184
185
197
208
209
210
215
216
217
218
219
220
221
222
223
227
231
232
233
238
239
240
241
242
243
244
245
246
250
254
255
256
261
262
263
264
265
266
267
268
269
273
277
278
279
284
285
286
287
288
289
290
291
292
296
300
301
302
307
308
309
310
311
312
313
314
315
319
323
324
325
330
331
332
333
334
335
336
337
338
342
346
347
348
353
354
355
356
357
358
359
360
361
365
369
370
371
376
387
388
393
404
405
410
421
422
427
438
439
444
455
456
461
472
473
478
489
490
495
506
507
512
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
567
573
574
575
576
577
582
583
584
585
602
608
609
610
611
612
613
614
615
616
617
618
619
620
621
628
629
634
635
636
637
638
639
640
641
642
643
648
649
650
651
652
653
654
655
656
657
658
659
664
665
666
667
668
669
670
671
672
673
674
675
676
681
682
683
684
685
686
687
694
695
696
697
698
699
700
705
733
734
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
789
790
791
792
793
794
795
796
797
798
799
804
805
806
807
808
809
810
811
812
813
814
815
820
830
831
836
845
846
847
852
861
866
881
882
887
907
908
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
935
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
971
972
973
974
975
976
977
978
979
980
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1034
1036
1037
1038
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1137
1143
1144
1145
1146
1147
1148
1149
1150
1162
1163
1164
1165
1166
1167
1168
1169
1170
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1215
1216
1217
1223
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1298
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1315
1319
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1341
1345
1346
1347
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1368
1373
1374
1375
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1513
1514
/* ... */
#include "DIALOG.h"
#include "k_module.h"
#include "videoplayer_res.c"
#include "k_modules_res.h"
#include "k_storage.h"
#include "k_rtc.h"
#include "k_mem.h"
#include "../Modules/filebrowser/filebrowser_app.h"
8 includes
/* ... */
/* ... */
Includes
extern int module_active;
External variables
typedef union
{
uint32_t d32;
struct
{
uint32_t repeat : 2;
uint32_t pause : 2;
uint32_t reserved : 28;
...}b;
...}
VideoSettingsTypeDef;
static void Startup(WM_HWIN hWin, uint16_t xpos, uint16_t ypos);
static void VideoDirectOpen(char *filename);
extern int GUI_MOVIE_ShowScaled (GUI_MOVIE_HANDLE hMovie, int xPos, int yPos, int num, int denom, int DoLoop);
Private function prototypes
K_ModuleItem_Typedef video_player =
{
6,
"Video Player",
&bmvideoplayer,
Startup,
VideoDirectOpen,
...}
;
Private typedef
#define ID_FRAMEWIN_INFO (GUI_ID_USER + 0x01)
#define ID_VIDEO_LIST (GUI_ID_USER + 0x10)
#define ID_VIDEO_FILE (GUI_ID_USER + 0x07)
#define ID_VIDEO_FPS (GUI_ID_USER + 0x08)
#define ID_VIDEO_PROGRESS (GUI_ID_USER + 0x09)
#define ID_VIDEO_DURATION (GUI_ID_USER + 0x0A)
#define ID_VIDEO_EXIT (GUI_ID_USER + 0x0B)
#define ID_REPEAT_BUTTON (GUI_ID_USER + 0x20)
#define ID_CLOSE_BUTTON (GUI_ID_USER + 0x21)
#define ID_PREVIOUS_BUTTON (GUI_ID_USER + 0x23)
#define ID_PLAY_BUTTON (GUI_ID_USER + 0x24)
#define ID_NEXT_BUTTON (GUI_ID_USER + 0x25)
#define ID_STOP_BUTTON (GUI_ID_USER + 0x26)
#define ID_PAUSE_BUTTON (GUI_ID_USER + 0x27)
#define ID_OPEN_BUTTON (GUI_ID_USER + 0x28)
#define ID_PLAY_LIST_BUTTON (GUI_ID_USER + 0x29)
#define ID_FULL_SCREEN_BUTTON (GUI_ID_USER + 0x2A)
#define ID_ADD_BUTTON (GUI_ID_USER + 0x2B)
#define ID_PROGRESS_SLIDER (GUI_ID_USER + 0x31)
#define ID_SLIDER_TIMER 1
#define ID_PLAYLIST_TIMER 2
#define VIDEO_IDLE 0
#define VIDEO_PLAY 1
#define VIDEO_STOP 2
#define VIDEO_PAUSE 3
#define REPEAT_NONE 0
#define REPEAT_ONCE 1
#define REPEAT_ALL 2
28 defines
Private defines
static uint8_t _StartPlay(char * filename);
static void _StopPlay(void);
static void _PausePlay(void);
static void _ResumePlay(void);
static uint8_t _ShowFullScreen(void);
static uint8_t _CloseFullScreen(void);
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
{ WINDOW_CreateIndirect, "Video Player", ID_FRAMEWIN_INFO, 0, 0, 640, 439, 0, 0x64, 0 },
{ LISTVIEW_CreateIndirect, "Listview", ID_VIDEO_LIST, 470, 05, 165, 380, 0, 0x0, 0 },
{ SLIDER_CreateIndirect, "Slider", ID_PROGRESS_SLIDER, 05, 360, 435, 20, 0, 0x0, 0 },
...};
static WM_HWIN VIDEOPLAYER_hWin, hFrame, hBigFrame;
static char const *apDrives[2] = {"0:", "1:"};
static const char acMask_video[] = ".video";
static const char acMask_dir[] = ".dir";
static FILELIST_FileTypeDef *pVideoList;
static CHOOSEFILE_INFO *pFileInfo;
static uint8_t playlist_select = 0;
uint8_t VideoPlayer_State = VIDEO_IDLE;
static uint8_t FullScreen = 0;
static uint32_t Video_file_pos = 0;
static GUI_MOVIE_HANDLE hMovie = 0;
static WM_HTIMER hPlaylistTimer;
FIL Video_File;
GUI_MOVIE_INFO Video_Info;
static VideoSettingsTypeDef PlayerSettings;
/* ... */
static void _OnPaint_repeat(uint32_t repeat_status) {
GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor());
GUI_Clear();
if(PlayerSettings.b.repeat == REPEAT_NONE)
{
GUI_DrawBitmap(&bmrepeat_off, 0, 0);
}if (PlayerSettings.b.repeat == REPEAT_NONE) { ... }
else if(PlayerSettings.b.repeat == REPEAT_ONCE)
{
GUI_DrawBitmap(&bmrepeat1, 0, 0);
}else if (PlayerSettings.b.repeat == REPEAT_ONCE) { ... }
else if(PlayerSettings.b.repeat == REPEAT_ALL)
{
GUI_DrawBitmap(&bmrepeat_all, 0, 0);
}else if (PlayerSettings.b.repeat == REPEAT_ALL) { ... }
}{ ... }
/* ... */
static void _OnPaint_play(BUTTON_Handle hObj) {
int Index;
Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0;
GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor());
GUI_Clear();
if((VideoPlayer_State == VIDEO_IDLE) || (VideoPlayer_State == VIDEO_PAUSE))
{
if(Index)
{
GUI_DrawBitmap(&bmplay_pressed, 0, 0);
}if (Index) { ... }
else
{
GUI_DrawBitmap(&bmplay_not_pressed, 0, 0);
}else { ... }
}if ((VideoPlayer_State == VIDEO_IDLE) || (VideoPlayer_State == VIDEO_PAUSE)) { ... }
else
{
if(Index)
{
GUI_DrawBitmap(&bmpause_pressed, 0, 0);
}if (Index) { ... }
else
{
GUI_DrawBitmap(&bmpause_not_pressed, 0, 0);
}else { ... }
}else { ... }
}{ ... }
/* ... */
static void _OnPaint_stop(BUTTON_Handle hObj) {
int Index;
GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor());
GUI_Clear();
Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0;
if(Index)
{
GUI_DrawBitmap(&bmstop_pressed, 0, 0);
}if (Index) { ... }
else
{
GUI_DrawBitmap(&bmstop_not_pressed, 0, 0);
}else { ... }
}{ ... }
/* ... */
static void _OnPaint_previous(BUTTON_Handle hObj) {
int Index;
GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor());
GUI_Clear();
Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0;
if(Index)
{
GUI_DrawBitmap(&bmprevious_pressed, 0, 0);
}if (Index) { ... }
else
{
GUI_DrawBitmap(&bmprevious_not_pressed, 0, 0);
}else { ... }
}{ ... }
/* ... */
static void _OnPaint_next(BUTTON_Handle hObj) {
int Index;
GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor());
GUI_Clear();
Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0;
if(Index)
{
GUI_DrawBitmap(&bmnext_pressed, 0, 0);
}if (Index) { ... }
else
{
GUI_DrawBitmap(&bmnext_not_pressed, 0, 0);
}else { ... }
}{ ... }
/* ... */
static void _OnPaint_add(BUTTON_Handle hObj) {
int Index;
GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor());
GUI_Clear();
Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0;
if(Index)
{
GUI_DrawBitmap(&bmadd_pressed, 0, 0);
}if (Index) { ... }
else
{
GUI_DrawBitmap(&bmadd_not_pressed, 0, 0);
}else { ... }
}{ ... }
/* ... */
static void _OnPaint_open(BUTTON_Handle hObj) {
int Index;
GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor());
GUI_Clear();
Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0;
if(Index)
{
GUI_DrawBitmap(&bmopen_pressed, 0, 0);
}if (Index) { ... }
else
{
GUI_DrawBitmap(&bmopen_not_pressed, 0, 0);
}else { ... }
}{ ... }
/* ... */
static void _OnPaint_close(BUTTON_Handle hObj) {
int Index;
GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor());
GUI_Clear();
Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0;
if(Index)
{
GUI_DrawBitmap(&bmclose_pressed, 0, 0);
}if (Index) { ... }
else
{
GUI_DrawBitmap(&bmclose_not_pressed, 0, 0);
}else { ... }
}{ ... }
/* ... */
static void _OnPaint_fullscreen(BUTTON_Handle hObj) {
int Index;
GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor());
GUI_Clear();
Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0;
if(Index)
{
GUI_DrawBitmap(&bmwindowfullscreen, 0, 0);
}if (Index) { ... }
else
{
GUI_DrawBitmap(&bmwindownofullscreen, 0, 0);
}else { ... }
}{ ... }
/* ... */
static void _cbButton_play(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
_OnPaint_play(pMsg->hWin);
break;case WM_PAINT:
default:
BUTTON_Callback(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbButton_stop(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
_OnPaint_stop(pMsg->hWin);
break;case WM_PAINT:
default:
BUTTON_Callback(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbButton_repeat(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
_OnPaint_repeat(PlayerSettings.b.repeat);
break;case WM_PAINT:
default:
BUTTON_Callback(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbButton_next(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
_OnPaint_next(pMsg->hWin);
break;case WM_PAINT:
default:
BUTTON_Callback(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbButton_previous(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
_OnPaint_previous(pMsg->hWin);
break;case WM_PAINT:
default:
BUTTON_Callback(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbButton_add(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
_OnPaint_add(pMsg->hWin);
break;case WM_PAINT:
default:
BUTTON_Callback(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbButton_open(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
_OnPaint_open(pMsg->hWin);
break;case WM_PAINT:
default:
BUTTON_Callback(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbButton_close(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
_OnPaint_close(pMsg->hWin);
break;case WM_PAINT:
default:
BUTTON_Callback(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbButton_fullscreen(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
_OnPaint_fullscreen(pMsg->hWin);
break;case WM_PAINT:
default:
BUTTON_Callback(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static int _GetData(void * p, const U8 ** ppData, unsigned NumBytesReq, U32 Off)
{
unsigned int NumBytesRead;
FIL * phFile;
phFile = (FIL *)p;
f_lseek(phFile, Off);
f_read(phFile, (U8 *)*ppData, NumBytesReq, &NumBytesRead);
return NumBytesRead;
}{ ... }
/* ... */
void _cbNotify(GUI_HMEM hMem, int Notification, U32 CurrentFrame)
{
long progress;
WM_HWIN hItem;
switch (Notification) {
case GUI_MOVIE_NOTIFICATION_PREDRAW:
GUI_MULTIBUF_Begin();
break;case GUI_MOVIE_NOTIFICATION_PREDRAW:
case GUI_MOVIE_NOTIFICATION_POSTDRAW:
GUI_MULTIBUF_End();
progress = 100 * GUI_MOVIE_GetFrameIndex(hMovie)/ Video_Info.NumFrames;
hItem = WM_GetDialogItem(VIDEOPLAYER_hWin, ID_PROGRESS_SLIDER);
SLIDER_SetValue(hItem, progress);
break;case GUI_MOVIE_NOTIFICATION_POSTDRAW:
case GUI_MOVIE_NOTIFICATION_STOP:
if(GUI_MOVIE_GetFrameIndex(hMovie) >= (Video_Info.NumFrames - 1))
{
if( FullScreen == 1)
{
WM_InvalidateWindow(hBigFrame);
WM_Update(hBigFrame);
}if (FullScreen == 1) { ... }
_StopPlay();
if(PlayerSettings.b.repeat != REPEAT_NONE)
{
if (PlayerSettings.b.repeat == REPEAT_ALL)
{
if(Video_file_pos < (pVideoList->ptr - 1))
{
Video_file_pos++;
}if (Video_file_pos < (pVideoList->ptr - 1)) { ... }
else
{
Video_file_pos = 0;
}else { ... }
LISTVIEW_SetSel(WM_GetDialogItem(VIDEOPLAYER_hWin, ID_VIDEO_LIST), Video_file_pos);
}if (PlayerSettings.b.repeat == REPEAT_ALL) { ... }
_StartPlay((char *)pVideoList->file[Video_file_pos].name);
}if (PlayerSettings.b.repeat != REPEAT_NONE) { ... }
else
{
hItem = WM_GetDialogItem(VIDEOPLAYER_hWin, ID_PLAY_BUTTON);
WM_InvalidateWindow(hItem);
WM_Update(hItem);
}else { ... }
}if (GUI_MOVIE_GetFrameIndex(hMovie) >= (Video_Info.NumFrames - 1)) { ... }
break;case GUI_MOVIE_NOTIFICATION_STOP:
}switch (Notification) { ... }
}{ ... }
/* ... */
void __GetWindowRect(int *XPos, int *YPos, int *XSize, int *YSize)
{
*XPos = 5;
*YPos = 20;
*XSize = 460;
*YSize = 420;
}{ ... }
/* ... */
static uint8_t _StartPlay(char * filename)
{
int XPos, YPos, XSize, YSize, nx, ny, n;
if(f_open(&Video_File, filename, FA_OPEN_EXISTING | FA_READ) == FR_OK)
{
GUI_MOVIE_GetInfoEx(_GetData, &Video_File, &Video_Info);
if((Video_Info.xSize == 0) || (Video_Info.ySize == 0) ||
(Video_Info.xSize > 1024) || (Video_Info.ySize > 768))
{
return 1;
}if ((Video_Info.xSize == 0) || (Video_Info.ySize == 0) || (Video_Info.xSize > 1024) || (Video_Info.ySize > 768)) { ... }
hMovie = GUI_MOVIE_CreateEx(_GetData, &Video_File, _cbNotify);
VideoPlayer_State = VIDEO_PLAY;
if (FullScreen == 0)
{
__GetWindowRect(&XPos, &YPos, &XSize, &YSize);
nx = (XSize * 1000) / Video_Info.xSize;
ny = (YSize * 1000) / Video_Info.ySize;
if (nx < ny) {
n = nx;
}if (nx < ny) { ... } else {
n = ny;
}else { ... }
XPos = XPos + (XSize - ((Video_Info.xSize * n) / 1000)) / 2;
YPos = YPos + (YSize - ((Video_Info.ySize * n) / 1000)) / 2;
GUI_MOVIE_ShowScaled(hMovie, XPos, YPos, n, 1000, 0);
}if (FullScreen == 0) { ... }
else
{
if((Video_Info.xSize > LCD_GetXSize()) ||(Video_Info.ySize > LCD_GetYSize()))
{
nx = (LCD_GetXSize() * 1000) / Video_Info.xSize;
ny = (LCD_GetYSize() * 1000) / Video_Info.ySize;
if (nx < ny) {
n = nx;
}if (nx < ny) { ... } else {
n = ny;
}else { ... }
XPos = (LCD_GetXSize() - ((Video_Info.xSize * n) / 1000)) / 2;
YPos = (LCD_GetYSize() - ((Video_Info.ySize * n) / 1000)) / 2;
GUI_MOVIE_ShowScaled(hMovie, XPos, YPos, n, 1000, 0);
}if ((Video_Info.xSize > LCD_GetXSize()) ||(Video_Info.ySize > LCD_GetYSize())) { ... }
else
{
XPos = (LCD_GetXSize() - Video_Info.xSize) / 2;
YPos = (LCD_GetYSize() - Video_Info.ySize) / 2;
GUI_MOVIE_Show(hMovie, XPos, YPos, 0);
}else { ... }
}else { ... }
}if (f_open(&Video_File, filename, FA_OPEN_EXISTING | FA_READ) == FR_OK) { ... }
return 0;
}{ ... }
/* ... */
static void _cbFullScreen(WM_MESSAGE * pMsg)
{
GUI_RECT r;
const GUI_PID_STATE * pState;
switch (pMsg->MsgId)
{
case WM_PAINT:
WM_GetInsideRect(&r);
GUI_ClearRectEx(&r);
break;
case WM_PAINT:
case WM_TOUCH:
pState = (const GUI_PID_STATE *)pMsg->Data.p;
if (pState)
{
if (pState->Pressed == 1)
{
_CloseFullScreen();
WM_DeleteWindow(pMsg->hWin);
}if (pState->Pressed == 1) { ... }
}if (pState) { ... }
break;
case WM_TOUCH:
default:
WM_DefaultProc(pMsg);default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static uint8_t _ShowFullScreen(void)
{
int XPos, YPos, nx, ny, n;
WM_HWIN hItem;
if(hMovie != 0)
{
FullScreen = 1;
hBigFrame = WM_CreateWindowAsChild(0, 0, LCD_GetXSize(), LCD_GetYSize(),
WM_HBKWIN,
WM_CF_SHOW | WM_CF_STAYONTOP,
_cbFullScreen,
0);
if((Video_Info.xSize > LCD_GetXSize()) ||(Video_Info.ySize > LCD_GetYSize()))
{
nx = (LCD_GetXSize() * 1000) / Video_Info.xSize;
ny = (LCD_GetYSize() * 1000) / Video_Info.ySize;
if (nx < ny) {
n = nx;
}if (nx < ny) { ... } else {
n = ny;
}else { ... }
XPos = (LCD_GetXSize() - ((Video_Info.xSize * n) / 1000)) / 2;
YPos = (LCD_GetYSize() - ((Video_Info.ySize * n) / 1000)) / 2;
GUI_MOVIE_ShowScaled(hMovie, XPos, YPos, n, 1000, 0);
}if ((Video_Info.xSize > LCD_GetXSize()) ||(Video_Info.ySize > LCD_GetYSize())) { ... }
else
{
XPos = (LCD_GetXSize() - Video_Info.xSize) / 2;
YPos = (LCD_GetYSize() - Video_Info.ySize) / 2;
GUI_MOVIE_Show(hMovie, XPos, YPos, 0);
VideoPlayer_State = VIDEO_PLAY;
hItem = WM_GetDialogItem(VIDEOPLAYER_hWin, ID_PLAY_BUTTON);
WM_InvalidateWindow(hItem);
WM_Update(hItem);
}else { ... }
}if (hMovie != 0) { ... }
return 0;
}{ ... }
/* ... */
static uint8_t _CloseFullScreen(void)
{
WM_HWIN hItem;
int XPos, YPos, XSize, YSize, nx, ny, n;
__GetWindowRect(&XPos, &YPos, &XSize, &YSize);
nx = (XSize * 1000) / Video_Info.xSize;
ny = (YSize * 1000) / Video_Info.ySize;
if (nx < ny) {
n = nx;
}if (nx < ny) { ... } else {
n = ny;
}else { ... }
XPos = XPos + (XSize - ((Video_Info.xSize * n) / 1000)) / 2;
YPos = YPos + (YSize - ((Video_Info.ySize * n) / 1000)) / 2;
GUI_MOVIE_ShowScaled(hMovie, XPos, YPos, n, 1000, 0);
hItem = WM_GetDialogItem(VIDEOPLAYER_hWin, ID_PLAY_BUTTON);
WM_InvalidateWindow(hItem);
WM_Update(hItem);
FullScreen = 0;
return 0;
}{ ... }
/* ... */
static void _StopPlay(void)
{
if(hMovie != 0)
{
GUI_MOVIE_Delete (hMovie);
hMovie = 0;
}if (hMovie != 0) { ... }
VideoPlayer_State = VIDEO_IDLE;
f_close(&Video_File);
}{ ... }
/* ... */
static void _PausePlay(void)
{
if( VideoPlayer_State == VIDEO_PLAY)
{
GUI_MOVIE_Pause(hMovie);
VideoPlayer_State = VIDEO_PAUSE;
}if (VideoPlayer_State == VIDEO_PLAY) { ... }
}{ ... }
/* ... */
static void _ResumePlay(void)
{
if( VideoPlayer_State == VIDEO_PAUSE)
{
GUI_MOVIE_Play(hMovie);
VideoPlayer_State = VIDEO_PLAY;
}if (VideoPlayer_State == VIDEO_PAUSE) { ... }
}{ ... }
/* ... */
static void _cbVideoWindow(WM_MESSAGE * pMsg)
{
GUI_RECT r;
switch (pMsg->MsgId)
{
case WM_PAINT:
WM_GetInsideRect(&r);
GUI_ClearRectEx(&r);
break;
case WM_PAINT:
default:
WM_DefaultProc(pMsg);default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbDrawProgressSlider(WM_MESSAGE * pMsg) {
GUI_RECT Rect;
switch (pMsg->MsgId)
{
case WM_CREATE:
break;
case WM_CREATE:
case WM_PAINT:
WM_GetInsideRect(&Rect);
GUI_DrawGradientH(Rect.x0, Rect.y0, Rect.x1, Rect.y1, GUI_WHITE, 0x3F0000);
break;
case WM_PAINT:
default:
WM_DefaultProc(pMsg);default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _AddEntireFolder(char *Foldername)
{
FRESULT res;
FILINFO fno;
DIR dir;
char *fn;
char tmp[FILEMGR_FULL_PATH_SIZE];
WM_HWIN hItem;
res = f_opendir(&dir, Foldername);
if (res == FR_OK)
{
while (1)
{
res = f_readdir(&dir, &fno);
if (res != FR_OK || fno.fname[0] == 0)
{
break;
}if (res != FR_OK || fno.fname[0] == 0) { ... }
if (fno.fname[0] == '.')
{
continue;
}if (fno.fname[0] == '.') { ... }
fn = fno.fname;
if (pVideoList->ptr < FILEMGR_LIST_DEPDTH)
{
if ((fno.fattrib & AM_DIR) == 0)
{
if(((strstr(fn, ".emf")) || (strstr(fn, ".EMF"))) && (VIDEOPLAYER_hWin != 0))
{
strcpy(tmp, Foldername);
strcat(tmp, "/");
strcat(tmp, fn);
strncpy((char *)pVideoList->file[pVideoList->ptr].name, (char *)tmp, FILEMGR_FILE_NAME_SIZE);
hItem = WM_GetDialogItem(VIDEOPLAYER_hWin, ID_VIDEO_LIST);
LISTVIEW_AddRow(hItem, NULL);
FILEMGR_GetFileOnly (tmp, fn);
LISTVIEW_SetItemText(hItem, 0, pVideoList->ptr, fn);
pVideoList->ptr++;
}if (((strstr(fn, ".emf")) || (strstr(fn, ".EMF"))) && (VIDEOPLAYER_hWin != 0)) { ... }
}if ((fno.fattrib & AM_DIR) == 0) { ... }
}if (pVideoList->ptr < FILEMGR_LIST_DEPDTH) { ... }
}while (1) { ... }
}if (res == FR_OK) { ... }
f_closedir(&dir);
}{ ... }
/* ... */
static void _cbMediaConnection(WM_MESSAGE * pMsg)
{
WM_HWIN hItem;
static WM_HTIMER hStatusTimer;
static uint8_t prev_sd_status = 0;
static uint8_t prev_usb_status = 0;
switch (pMsg->MsgId)
{
case WM_CREATE:
prev_sd_status = k_StorageGetStatus(MSD_DISK_UNIT);
prev_usb_status = k_StorageGetStatus(USB_DISK_UNIT);
hStatusTimer = WM_CreateTimer(pMsg->hWin, 0, 500, 0);
break;
case WM_CREATE:
case WM_TIMER:
if(prev_sd_status != k_StorageGetStatus(MSD_DISK_UNIT))
{
prev_sd_status = k_StorageGetStatus(MSD_DISK_UNIT);
if(pVideoList->file[Video_file_pos].name[0] == '1')
{
if(VideoPlayer_State != VIDEO_IDLE)
{
_StopPlay();
hItem = WM_GetDialogItem(VIDEOPLAYER_hWin, ID_PROGRESS_SLIDER);
SLIDER_SetValue(hItem, 0);
hItem = WM_GetDialogItem(VIDEOPLAYER_hWin, ID_PLAY_BUTTON);
WM_InvalidateWindow(hItem);
WM_Update(hItem);
WM_InvalidateWindow(hFrame);
}if (VideoPlayer_State != VIDEO_IDLE) { ... }
}if (pVideoList->file[Video_file_pos].name[0] == '1') { ... }
}if (prev_sd_status != k_StorageGetStatus(MSD_DISK_UNIT)) { ... }
else if(prev_usb_status != k_StorageGetStatus(USB_DISK_UNIT))
{
prev_usb_status = k_StorageGetStatus(USB_DISK_UNIT);
if(pVideoList->file[Video_file_pos].name[0] == '0')
{
if(VideoPlayer_State != VIDEO_IDLE)
{
_StopPlay();
hItem = WM_GetDialogItem(VIDEOPLAYER_hWin, ID_PROGRESS_SLIDER);
SLIDER_SetValue(hItem, 0);
hItem = WM_GetDialogItem(VIDEOPLAYER_hWin, ID_PLAY_BUTTON);
WM_InvalidateWindow(hItem);
WM_Update(hItem);
WM_InvalidateWindow(hFrame);
}if (VideoPlayer_State != VIDEO_IDLE) { ... }
}if (pVideoList->file[Video_file_pos].name[0] == '0') { ... }
}else if (prev_usb_status != k_StorageGetStatus(USB_DISK_UNIT)) { ... }
WM_RestartTimer(pMsg->Data.v, 500);
break;
case WM_TIMER:
case WM_DELETE:
if(hStatusTimer != 0)
{
WM_DeleteTimer(hStatusTimer);
hStatusTimer = 0;
}if (hStatusTimer != 0) { ... }
break;
case WM_DELETE:
default:
WM_DefaultProc(pMsg);default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void _cbDialog(WM_MESSAGE * pMsg) {
WM_HWIN hItem, hClient;
int NCode;
int Id, Index, newpos;
GUI_RECT r;
int ItemNbr;
int result;
static char tmp[FILEMGR_FILE_NAME_SIZE];
switch (pMsg->MsgId) {
case WM_INIT_DIALOG:
pVideoList = (FILELIST_FileTypeDef *)k_malloc(sizeof(FILELIST_FileTypeDef));
pFileInfo = (CHOOSEFILE_INFO *)k_malloc(sizeof(CHOOSEFILE_INFO));
pVideoList->ptr = 0;
PlayerSettings.d32 = k_BkupRestoreParameter(CALIBRATION_VIDEOPLAYER_SETTING_BKP);
hItem = WM_GetDialogItem(pMsg->hWin, ID_VIDEO_LIST);
LISTVIEW_AddColumn(hItem, 165, "Video", GUI_TA_VCENTER | GUI_TA_LEFT);
LISTVIEW_SetGridVis(hItem, 0);
LISTVIEW_SetAutoScrollV(hItem, 1);
LISTVIEW_SetBkColor(hItem, LISTVIEW_CI_UNSEL, GUI_BLACK);
LISTVIEW_SetTextColor(hItem, LISTVIEW_CI_UNSEL, GUI_CYAN);
hItem = BUTTON_CreateEx(360, 395, 35, 35, pMsg->hWin, WM_CF_SHOW, 0, ID_STOP_BUTTON);
WM_SetCallback(hItem, _cbButton_stop);
hItem = BUTTON_CreateEx(152, 395, 35, 35, pMsg->hWin, WM_CF_SHOW, 0, ID_PREVIOUS_BUTTON);
WM_SetCallback(hItem, _cbButton_previous);
hItem = BUTTON_CreateEx(217, 388, 50, 45, pMsg->hWin, WM_CF_SHOW, 0, ID_PLAY_BUTTON);
WM_SetCallback(hItem, _cbButton_play);
hItem = BUTTON_CreateEx(295, 395, 35, 35, pMsg->hWin, WM_CF_SHOW, 0, ID_NEXT_BUTTON);
WM_SetCallback(hItem, _cbButton_next);
hItem = BUTTON_CreateEx(87, 398, 30, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_REPEAT_BUTTON);
WM_SetCallback(hItem, _cbButton_repeat);
hItem = BUTTON_CreateEx(475, 398, 70, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_OPEN_BUTTON);
WM_SetCallback(hItem, _cbButton_open);
hItem = BUTTON_CreateEx(535, 398, 70, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_ADD_BUTTON);
WM_SetCallback(hItem, _cbButton_add);
hItem = BUTTON_CreateEx(600, 395, 30, 30, pMsg->hWin, WM_CF_SHOW, 0, ID_CLOSE_BUTTON);
WM_SetCallback(hItem, _cbButton_close);
hItem = BUTTON_CreateEx(441, 357, 25, 25, pMsg->hWin, WM_CF_SHOW, 0, ID_FULL_SCREEN_BUTTON);
WM_SetCallback(hItem, _cbButton_fullscreen);
hClient = WM_GetClientWindow(pMsg->hWin);
WM_GetClientRectEx(hClient, &r);
hFrame = WM_CreateWindowAsChild(r.x0 + 5, r.y0 + 5, r.x1 - 179, r.y1 - 85, hClient, WM_CF_SHOW, _cbVideoWindow , 0);
hItem = WM_GetDialogItem(pMsg->hWin, ID_PLAY_BUTTON);
hItem = WM_GetDialogItem(pMsg->hWin, ID_PROGRESS_SLIDER);
SLIDER_SetNumTicks(hItem, 25);
hItem = WM_CreateWindowAsChild(05,
360,
435,
20,
pMsg->hWin,
WM_CF_SHOW | WM_CF_HASTRANS | WM_CF_BGND,
_cbDrawProgressSlider,
0);
WM_CreateWindowAsChild(639, 445, 1, 1, pMsg->hWin, WM_CF_SHOW | WM_CF_HASTRANS, _cbMediaConnection , 0);
break;
case WM_INIT_DIALOG:
case WM_PAINT:
DrawRect3D(05, 386, 460, 50);
DrawRect3D(470, 386, 165, 50);
break;
case WM_PAINT:
case WM_TIMER:
Id = WM_GetTimerId(pMsg->Data.v);
if (Id == ID_PLAYLIST_TIMER)
{
playlist_select = 0;
}if (Id == ID_PLAYLIST_TIMER) { ... }
break;
case WM_TIMER:
case WM_DELETE:
k_BkupSaveParameter(CALIBRATION_VIDEOPLAYER_SETTING_BKP, PlayerSettings.d32);
WM_DeleteTimer(hPlaylistTimer);
break;
case WM_DELETE:
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch(Id) {
case ID_FULL_SCREEN_BUTTON:
switch (NCode) {
case WM_NOTIFICATION_RELEASED:
if( VideoPlayer_State != VIDEO_IDLE)
{
_ShowFullScreen();
}if (VideoPlayer_State != VIDEO_IDLE) { ... }
break;case WM_NOTIFICATION_RELEASED:
}switch (NCode) { ... }
break;
case ID_FULL_SCREEN_BUTTON:
case ID_ADD_BUTTON:
switch(NCode) {
case WM_NOTIFICATION_RELEASED:
pFileInfo->pfGetData = k_GetData;
pFileInfo->pMask = acMask_video;
hItem = CHOOSEFILE_Create(pMsg->hWin, 70, 40, 450, 250, apDrives, GUI_COUNTOF(apDrives), 0, "Add video file to playlist", 0, pFileInfo);
if(VideoPlayer_State == VIDEO_PLAY)
{
GUI_MOVIE_Pause(hMovie);
}if (VideoPlayer_State == VIDEO_PLAY) { ... }
WM_MakeModal(hItem);
result = GUI_ExecCreatedDialog(hItem);
if (result == 0)
{
if((strstr(pFileInfo->pRoot, ".emf")) || (strstr(pFileInfo->pRoot, ".EMF")))
{
if(pVideoList->ptr < FILEMGR_LIST_DEPDTH)
{
strcpy((char *)pVideoList->file[pVideoList->ptr].name, pFileInfo->pRoot);
FILEMGR_GetFileOnly ((char *)tmp, (char *)pFileInfo->pRoot);
hItem = WM_GetDialogItem(pMsg->hWin, ID_VIDEO_LIST);
LISTVIEW_AddRow(hItem, NULL);
LISTVIEW_SetItemText(hItem, 0, pVideoList->ptr, tmp);
pVideoList->ptr++;
}if (pVideoList->ptr < FILEMGR_LIST_DEPDTH) { ... }
}if ((strstr(pFileInfo->pRoot, ".emf")) || (strstr(pFileInfo->pRoot, ".EMF"))) { ... }
WM_InvalidateWindow(hFrame);
}if (result == 0) { ... }
if(VideoPlayer_State == VIDEO_PLAY)
{
GUI_MOVIE_Play(hMovie);
}if (VideoPlayer_State == VIDEO_PLAY) { ... }
break;
case WM_NOTIFICATION_RELEASED:
}switch (NCode) { ... }
break;
case ID_ADD_BUTTON:
case ID_OPEN_BUTTON:
switch(NCode) {
case WM_NOTIFICATION_RELEASED:
pFileInfo->pfGetData = k_GetData;
pFileInfo->pMask = acMask_dir;
hItem = CHOOSEFILE_Create(pMsg->hWin, 70, 40, 450, 250, apDrives, GUI_COUNTOF(apDrives), 0, "Add a folder", 0, pFileInfo);
if(VideoPlayer_State == VIDEO_PLAY)
{
GUI_MOVIE_Pause(hMovie);
}if (VideoPlayer_State == VIDEO_PLAY) { ... }
WM_MakeModal(hItem);
result = GUI_ExecCreatedDialog(hItem);
if (result == 0)
{
_AddEntireFolder(pFileInfo->pRoot);
WM_InvalidateWindow(hFrame);
}if (result == 0) { ... }
if(VideoPlayer_State == VIDEO_PLAY)
{
GUI_MOVIE_Play(hMovie);
}if (VideoPlayer_State == VIDEO_PLAY) { ... }
break;case WM_NOTIFICATION_RELEASED:
}switch (NCode) { ... }
break;
case ID_OPEN_BUTTON:
case ID_CLOSE_BUTTON:
switch (NCode) {
case WM_NOTIFICATION_RELEASED:
k_free(pVideoList);
k_free(pFileInfo);
_StopPlay();
GUI_EndDialog(pMsg->hWin, 0);
module_active = (-1);
break;case WM_NOTIFICATION_RELEASED:
}switch (NCode) { ... }
break;
case ID_CLOSE_BUTTON:
case ID_PLAY_BUTTON:
switch(NCode) {
case WM_NOTIFICATION_RELEASED:
if(VideoPlayer_State == VIDEO_IDLE)
{
if (pVideoList->ptr > 0)
{
_StartPlay((char *)pVideoList->file[Video_file_pos].name);
LISTVIEW_SetSel(WM_GetDialogItem(VIDEOPLAYER_hWin, ID_VIDEO_LIST), Video_file_pos);
}if (pVideoList->ptr > 0) { ... }
else
{
pFileInfo->pfGetData = k_GetData;
pFileInfo->pMask = acMask_video;
hItem = CHOOSEFILE_Create(pMsg->hWin, 70, 40, 450, 250, apDrives, GUI_COUNTOF(apDrives), 0, "Open a video file", 0, pFileInfo);
WM_MakeModal(hItem);
result = GUI_ExecCreatedDialog(hItem);
if (result == 0)
{
if((strstr(pFileInfo->pRoot, ".emf")) || (strstr(pFileInfo->pRoot, ".EMF")))
{
pVideoList->ptr = 0;
strcpy((char *)pVideoList->file[pVideoList->ptr].name, pFileInfo->pRoot);
FILEMGR_GetFileOnly (tmp, pFileInfo->pRoot);
hItem = WM_GetDialogItem(pMsg->hWin, ID_VIDEO_LIST);
strcpy((char *)pVideoList->file[pVideoList->ptr].name, pFileInfo->pRoot);
ItemNbr = LISTVIEW_GetNumRows(hItem);
while(ItemNbr--)
{
LISTVIEW_DeleteRow(hItem, ItemNbr);
}while (ItemNbr--) { ... }
LISTVIEW_AddRow(hItem, NULL);
LISTVIEW_SetItemText(hItem, 0, pVideoList->ptr, tmp);
pVideoList->ptr++;
Video_file_pos = 0;
LISTVIEW_SetSel(hItem, 0);
_StartPlay((char *)pVideoList->file[Video_file_pos].name);
WM_InvalidateWindow(hFrame);
}if ((strstr(pFileInfo->pRoot, ".emf")) || (strstr(pFileInfo->pRoot, ".EMF"))) { ... }
}if (result == 0) { ... }
}else { ... }
}if (VideoPlayer_State == VIDEO_IDLE) { ... }
else if(VideoPlayer_State == VIDEO_PLAY)
{
_PausePlay();
}else if (VideoPlayer_State == VIDEO_PLAY) { ... }
else if(VideoPlayer_State == VIDEO_PAUSE)
{
_ResumePlay();
}else if (VideoPlayer_State == VIDEO_PAUSE) { ... }
break;case WM_NOTIFICATION_RELEASED:
}switch (NCode) { ... }
break;
case ID_PLAY_BUTTON:
case ID_REPEAT_BUTTON:
if(NCode == WM_NOTIFICATION_RELEASED)
{
hItem = WM_GetDialogItem(pMsg->hWin, ID_REPEAT_BUTTON);
if(PlayerSettings.b.repeat == REPEAT_NONE)
{
PlayerSettings.b.repeat = REPEAT_ONCE;
}if (PlayerSettings.b.repeat == REPEAT_NONE) { ... }
else if(PlayerSettings.b.repeat == REPEAT_ONCE)
{
PlayerSettings.b.repeat = REPEAT_ALL;
}else if (PlayerSettings.b.repeat == REPEAT_ONCE) { ... }
else if(PlayerSettings.b.repeat == REPEAT_ALL)
{
PlayerSettings.b.repeat = REPEAT_NONE;
}else if (PlayerSettings.b.repeat == REPEAT_ALL) { ... }
}if (NCode == WM_NOTIFICATION_RELEASED) { ... }
break;
case ID_REPEAT_BUTTON:
case ID_STOP_BUTTON:
_StopPlay();
hItem = WM_GetDialogItem(VIDEOPLAYER_hWin, ID_PROGRESS_SLIDER);
SLIDER_SetValue(hItem, 0);
WM_InvalidateWindow(hFrame);
break;
case ID_STOP_BUTTON:
case ID_NEXT_BUTTON:
switch(NCode) {
case WM_NOTIFICATION_RELEASED:
if(Video_file_pos < (pVideoList->ptr - 1))
{
Video_file_pos++;
}if (Video_file_pos < (pVideoList->ptr - 1)) { ... }
else if(PlayerSettings.b.repeat == REPEAT_ALL)
{
Video_file_pos = 0;
}else if (PlayerSettings.b.repeat == REPEAT_ALL) { ... }
LISTVIEW_SetSel(WM_GetDialogItem(VIDEOPLAYER_hWin, ID_VIDEO_LIST), Video_file_pos);
if(VideoPlayer_State == VIDEO_PLAY)
{
_StopPlay();
_StartPlay((char *)pVideoList->file[Video_file_pos].name);
WM_InvalidateWindow(hFrame);
}if (VideoPlayer_State == VIDEO_PLAY) { ... }
break;case WM_NOTIFICATION_RELEASED:
}switch (NCode) { ... }
break;
case ID_NEXT_BUTTON:
case ID_PREVIOUS_BUTTON:
switch(NCode) {
case WM_NOTIFICATION_RELEASED:
if( pVideoList->ptr > 0)
{
if(Video_file_pos > 0)
{
Video_file_pos--;
}if (Video_file_pos > 0) { ... }
else if(PlayerSettings.b.repeat == REPEAT_ALL)
{
Video_file_pos = (pVideoList->ptr - 1);
}else if (PlayerSettings.b.repeat == REPEAT_ALL) { ... }
LISTVIEW_SetSel(WM_GetDialogItem(VIDEOPLAYER_hWin, ID_VIDEO_LIST), Video_file_pos);
if(VideoPlayer_State == VIDEO_PLAY)
{
_StopPlay();
_StartPlay((char *)pVideoList->file[Video_file_pos].name);
WM_InvalidateWindow(hFrame);
}if (VideoPlayer_State == VIDEO_PLAY) { ... }
}if (pVideoList->ptr > 0) { ... }
break;
case WM_NOTIFICATION_RELEASED:
}switch (NCode) { ... }
break;
case ID_PREVIOUS_BUTTON:
case ID_PROGRESS_SLIDER:
if(NCode == WM_NOTIFICATION_CLICKED)
{
if(VideoPlayer_State != VIDEO_IDLE)
{
GUI_MOVIE_Pause(hMovie);
hItem = WM_GetDialogItem(pMsg->hWin, ID_PROGRESS_SLIDER);
newpos = (SLIDER_GetValue(hItem) * Video_Info.NumFrames)/100;
GUI_MOVIE_GotoFrame(hMovie, newpos);
if(VideoPlayer_State == VIDEO_PLAY)
{
GUI_MOVIE_Play(hMovie);
}if (VideoPlayer_State == VIDEO_PLAY) { ... }
}if (VideoPlayer_State != VIDEO_IDLE) { ... }
}if (NCode == WM_NOTIFICATION_CLICKED) { ... }
break;
case ID_PROGRESS_SLIDER:
case ID_VIDEO_LIST:
if(NCode == WM_NOTIFICATION_CLICKED)
{
hItem = WM_GetDialogItem(pMsg->hWin, ID_VIDEO_LIST);
Index = LISTVIEW_GetSel(hItem);
if(Index < pVideoList->ptr)
{
if(playlist_select == 0)
{
hPlaylistTimer = WM_CreateTimer(pMsg->hWin, ID_PLAYLIST_TIMER, 500, 0);
playlist_select = (Index + 1);
}if (playlist_select == 0) { ... }
else if(playlist_select == (Index + 1))
{
WM_DeleteTimer(hPlaylistTimer);
hPlaylistTimer = 0;
playlist_select = 0;
Video_file_pos = Index;
if(Index < pVideoList->ptr)
{
if(VideoPlayer_State != VIDEO_IDLE)
{
_StopPlay();
}if (VideoPlayer_State != VIDEO_IDLE) { ... }
_StartPlay((char *)pVideoList->file[Index].name);
hItem = WM_GetDialogItem(VIDEOPLAYER_hWin, ID_PLAY_BUTTON);
WM_InvalidateWindow(hItem);
WM_Update(hItem);
WM_InvalidateWindow(hFrame);
}if (Index < pVideoList->ptr) { ... }
}else if (playlist_select == (Index + 1)) { ... }
}if (Index < pVideoList->ptr) { ... }
}if (NCode == WM_NOTIFICATION_CLICKED) { ... }
break; case ID_VIDEO_LIST:
}switch (Id) { ... }
break;case WM_NOTIFY_PARENT:
default:
WM_DefaultProc(pMsg);
break;default
}switch (pMsg->MsgId) { ... }
}{ ... }
/* ... */
static void Startup(WM_HWIN hWin, uint16_t xpos, uint16_t ypos)
{
Video_file_pos = 0;
pVideoList->ptr = 0;
VideoPlayer_State = VIDEO_IDLE;
VIDEOPLAYER_hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, hWin, xpos, ypos);
}{ ... }
/* ... */
static void VideoDirectOpen(char *filename)
{
WM_HWIN hItem;
int ItemNbr;
static char tmp[FILEMGR_FILE_NAME_SIZE];
VIDEOPLAYER_hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_GetDesktopWindowEx(1), 0, 41);
if(VIDEOPLAYER_hWin != 0)
{
pVideoList->ptr = 0;
FILEMGR_GetFileOnly (tmp, filename);
hItem = WM_GetDialogItem(VIDEOPLAYER_hWin, ID_VIDEO_LIST);
strcpy((char *)pVideoList->file[pVideoList->ptr].name, filename);
ItemNbr = LISTVIEW_GetNumRows(hItem);
while(ItemNbr--)
{
LISTVIEW_DeleteRow(hItem, ItemNbr);
}while (ItemNbr--) { ... }
LISTVIEW_AddRow(hItem, NULL);
LISTVIEW_SetItemText(hItem, 0, pVideoList->ptr, tmp);
pVideoList->ptr++;
Video_file_pos = 0;
LISTVIEW_SetSel(hItem, 0);
_StartPlay((char *)pVideoList->file[Video_file_pos].name);
WM_InvalidateWindow(hFrame);
}if (VIDEOPLAYER_hWin != 0) { ... }
}{ ... }
/* ... */
/* ... */