/******************************Public*Routine******************************\ * VcdPlayerCloseCmd * \**************************************************************************/ BOOL VcdPlayerCloseCmd( void ) { if(pMpegMovie) { LONG cx, cy; g_State = VCD_NO_CD; pMpegMovie->GetMoviePosition(&lMovieOrgX, &lMovieOrgY, &cx, &cy); pMpegMovie->StopMovie(); pMpegMovie->CloseMovie(); SetDurationLength((REFTIME)0); SetCurrentPosition((REFTIME)0); delete pMpegMovie; pMpegMovie = NULL; } g_bSecondFileLoaded = FALSE; InvalidateRect(hwndApp, NULL, FALSE); UpdateWindow(hwndApp); return TRUE; }
/******************************Public*Routine******************************\ * VcdPlayerChangeTimeFormat * * Tries to change the time format to id. Returns the time format that * actually got set. This may differ from id if the graph does not support * the requested time format. * \**************************************************************************/ int VcdPlayerChangeTimeFormat( int id ) { // Menu items are disabled while we are playing BOOL bRet = FALSE; int idActual = id; ASSERT(pMpegMovie); ASSERT(pMpegMovie->StatusMovie() != MOVIE_NOTOPENED); // Change the time format with the filtergraph switch(id) { case IDM_FRAME: bRet = pMpegMovie->SetTimeFormat(TIME_FORMAT_FRAME); break; case IDM_FIELD: bRet = pMpegMovie->SetTimeFormat(TIME_FORMAT_FIELD); break; case IDM_SAMPLE: bRet = pMpegMovie->SetTimeFormat(TIME_FORMAT_SAMPLE); break; case IDM_BYTES: bRet = pMpegMovie->SetTimeFormat(TIME_FORMAT_BYTE); break; } if(!bRet) { // IDM_TIME and all other cases, everyone should support IDM_TIME bRet = pMpegMovie->SetTimeFormat(TIME_FORMAT_MEDIA_TIME); ASSERT(bRet); idActual = IDM_TIME; } // Pause the movie to get a current position SetDurationLength(pMpegMovie->GetDuration()); SetCurrentPosition(pMpegMovie->GetCurrentPosition()); return idActual; }
/*****************************Private*Routine******************************\ * VideoCd_OnCreate * \**************************************************************************/ BOOL VideoCd_OnCreate( HWND hwnd, LPCREATESTRUCT lpCreateStruct ) { RECT rc; int Pane[2]; InitCommonControls(); /* ** Create the toolbar and statusbar. */ g_hwndToolbar = CreateToolbarEx(hwnd, WS_VISIBLE | WS_CHILD | TBSTYLE_TOOLTIPS | CCS_NODIVIDER, ID_TOOLBAR, NUMBER_OF_BITMAPS, hInst, IDR_TOOLBAR, tbButtons, DEFAULT_TBAR_SIZE, dxBitmap, dyBitmap, dxBitmap, dyBitmap, sizeof(TBBUTTON)); if(g_hwndToolbar == NULL) { return FALSE; } g_hwndStatusbar = CreateStatusWindow(WS_VISIBLE | WS_CHILD | CCS_BOTTOM, TEXT("Example Text"), hwnd, ID_STATUSBAR); GetWindowRect(g_hwndToolbar, &rc); dyToolbar = rc.bottom - rc.top; GetWindowRect(g_hwndStatusbar, &rc); dyStatusbar = rc.bottom - rc.top; dyTrackbar = 30; GetClientRect(hwnd, &rc); Pane[0] = (rc.right - rc.left) / 2 ; Pane[1] = -1; SendMessage(g_hwndStatusbar, SB_SETPARTS, 2, (LPARAM)Pane); g_hwndTrackbar = CreateWindowEx(0, TRACKBAR_CLASS, TEXT("Trackbar Control"), WS_CHILD | WS_VISIBLE | TBS_AUTOTICKS | TBS_ENABLESELRANGE, LEFT_MARGIN, dyToolbar - 1, (rc.right - rc.left) - (2* LEFT_MARGIN), dyTrackbar, hwnd, (HMENU)ID_TRACKBAR, hInst, NULL); SetDurationLength((REFTIME)0); SetCurrentPosition((REFTIME)0); SetTimer(hwnd, StatusTimer, 100, NULL); if(g_hwndStatusbar == NULL || g_hwndTrackbar == NULL) { return FALSE; } return TRUE; }