/** * @brief Stop play * @param None * @retval None */ static void _StopPlay(void) { if(hMovie != 0) { GUI_MOVIE_Delete (hMovie); hMovie = 0; } VideoPlayer_State = VIDEO_IDLE; f_close(&Video_File); }
/** * @brief Start play * @param filename: pointer to the video file name * @retval None */ static uint8_t _StartPlay(GUI_MOVIE_HANDLE *hmovie, char * filename, FIL * file, uint16_t x0, uint16_t y0) { static char tmp[FILEMGR_FILE_NAME_SIZE]; int ms, frames; uint32_t duration; WM_HWIN hItem; if(f_open(file, filename, FA_OPEN_EXISTING | FA_READ) == FR_OK) { PrevFrameIndex = 0; LostFrames = 0; previous_total = 0; GUI_MOVIE_GetInfoEx(_GetData, file, &Video_Info); *hmovie = GUI_MOVIE_CreateEx(_GetData, file, _cbNotify) ; GUI_MOVIE_SetPeriod (*hmovie, VIDEO_FRAME_TIME); if((Video_Info.xSize == 0) || (Video_Info.ySize == 0) || (Video_Info.xSize > 1024) || (Video_Info.ySize > 768)) { GUI_MOVIE_Delete(*hmovie); return 1; } GUI_MOVIE_Show(*hmovie, ((LCD_GetXSize() - Video_Info.xSize)/2), ((LCD_GetYSize() - Video_Info.ySize)/2), 0); hTimer = WM_CreateTimer(playbackwin, 0, 1000, 0); /* Update video total time */ hItem = WM_GetDialogItem(playbackwin, ID_TIME); ms = Video_Info.msPerFrame; frames = Video_Info.NumFrames; duration = (frames * ms)/1000; sprintf((char *)tmp , "%02lu:%02lu", duration/60, duration%60 ); TEXT_SetText(hItem, tmp); WM_InvalidateWindow(playbackwin); elapsed_time = 0; hItem = WM_GetDialogItem(playbackwin, ID_VIDEO_NAME); FILEMGR_GetFileOnly (tmp, filename); TEXT_SetText(hItem, tmp); hItem = WM_GetDialogItem(playbackwin, ID_ELAPSED_TIME); TEXT_SetText(hItem, "00:00"); WM_InvalidateWindow(hItem); WM_Paint(hItem); } return 0; }
/** * @brief Stop play * @param None * @retval None */ static void _StopPlay(GUI_MOVIE_HANDLE *hmovie, FIL * file) { if(hTimer != 0) { WM_DeleteTimer(hTimer); hTimer = 0; } if(*hmovie != 0) { GUI_MOVIE_Delete (*hmovie); *hmovie = 0; } f_close(file); WM_InvalidateWindow(hFrame); }