/** * @brief Close full screen * @param None * @retval None */ 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; } else { n = ny; } 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; }
/** * @brief Show full screen * @param None * @retval None */ static uint8_t _ShowFullScreen(void) { int XPos, YPos, nx, ny, n; WM_HWIN hItem; if(hMovie != 0) { FullScreen = 1; 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; } else { n = ny; } 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); } 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); } } return 0; }
/** * @brief Start play * @param filename: pointer to the video file name * @retval None */ 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 > 320) || (Video_Info.ySize > 240)) { return 1; } hMovie = GUI_MOVIE_CreateEx(_GetData, &Video_File, _cbNotify); VideoPlayer_State = VIDEO_PLAY; __GetWindowRect(&XPos, &YPos, &XSize, &YSize); nx = (XSize * 1000) / Video_Info.xSize; ny = (YSize * 1000) / Video_Info.ySize; if (nx < ny) { n = nx; } else { n = ny; } 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); } return 0; }