Пример #1
0
//-------------------------------------------------------------------------
//  CmdPauseMovie
//-------------------------------------------------------------------------
void CMultiSAP::CmdPauseMovie(sMovieInfo * pMovInf)
{
    int nVMR = -1;

    if( NULL == pMovInf)
    {
        OutputDebugString(TEXT("Invalid parameter sent to CmdPauseMovie()\n"));
        return;
    }

    CMovie *pmovie = NULL;
    pmovie = m_movieList.GetMovie( pMovInf->pdwUserID );

    if( NULL == pmovie)
    {
        OutputDebugString(TEXT("CmdPauseMovie() received unrecognized UserID\n"));
        return;
    }

    OAFilterState State = pmovie->GetStateMovie();
    BOOL fPlaying = (State & State_Running);
    BOOL fPaused  = (State & State_Paused);

    if (fPlaying)
    {
        pmovie->PauseMovie();
    }
    else if (fPaused)
    {
        pmovie->PlayMovie();
    }

    return;
}
Пример #2
0
DWORD WINAPI movieThread(LPVOID param)
{
	CMovie *lpMov = (CMovie *)param;

	while(FALSE==lpMov->bExitMovieThread){
		lpMov->DecodeMovie();
	}
	lpMov->Release();
	CloseHandle(lpMov->hMovieThread);
	lpMov->hMovieThread = NULL;
	ExitThread(TRUE);
	return 0L;
} // movieThread
Пример #3
0
void CGameManager::updateMovies() {
	// Initial iteration to mark all the movies as not yet handled
	for (CMovieList::iterator i = CMovie::_playingMovies->begin();
			i != CMovie::_playingMovies->end(); ++i)
		(*i)->_handled = false;

	bool repeatFlag;
	do {
		repeatFlag = false;

		// Scan for a movie to process
		for (CMovieList::iterator i = CMovie::_playingMovies->begin();
				i != CMovie::_playingMovies->end(); ++i) {
			CMovie *movie = *i;
			if (movie->_handled)
				continue;

			CMovieEventList eventsList;
			if (!movie->handleEvents(eventsList))
				movie->removeFromPlayingMovies();

			while (!eventsList.empty()) {
				CMovieEvent *movieEvent = eventsList.front();

				switch (movieEvent->_type) {
				case MET_MOVIE_END: {
					CMovieEndMsg endMsg(movieEvent->_startFrame, movieEvent->_endFrame);
					endMsg.execute(movieEvent->_gameObject);
					break;
				}

				case MET_FRAME: {
					CMovieFrameMsg frameMsg(movieEvent->_initialFrame, 0);
					frameMsg.execute(movieEvent->_gameObject);
					break;
				}

				default:
					break;
				}

				eventsList.remove(movieEvent);
			}

			// Flag the movie as having been handled
			movie->_handled = true;
			repeatFlag = true;
			break;
		}
	} while (repeatFlag);
}
Пример #4
0
//-------------------------------------------------------------------------
//      Name:   CmdQuit
//      Desc:   correct termination of this thread upon the request from the dialog
//      Parameters:
//      Return:
//      Other:  (1) Stop all movies
//              (2) Set quit event
//-------------------------------------------------------------------------
void CMultiSAP::CmdQuit(sMovieInfo * pMovInf)
{
    for( int i=0; i<m_movieList.GetSize(); i++)
    {
        CMovie *pmovie = m_movieList.GetMovieByIndex(i);
        if( pmovie )
        {
            pmovie->PauseMovie();
            pmovie->StopMovie();
        }
    }

    return;
}
Пример #5
0
//-------------------------------------------------------------------------
//  CmdGetMovieDuration
//
//  gets movie's duration, in   REFTIME
//-------------------------------------------------------------------------
REFTIME CMultiSAP::CmdGetMovieDuration(sMovieInfo * pMovInf)
{
    if( !pMovInf )
    {
        OutputDebugString(TEXT("CmdNotifySelected received a wrong parameter\n"));
        return (REFTIME)0;
    }

    CMovie *pmovie = NULL;
    pmovie = m_movieList.GetMovie( pMovInf->pdwUserID );

    if( NULL == pmovie)
    {
        OutputDebugString(TEXT("CmdNotifySelected received unrecognized UserID\n"));
        ZeroMemory( pMovInf, sizeof(sMovieInfo));
        return (REFTIME)0;
    }

    return pmovie->GetDuration();
}
Пример #6
0
//-------------------------------------------------------------------------
//  CmdSetMoviePosition
//
//  sets media position for the movie
//-------------------------------------------------------------------------
void CMultiSAP::CmdSetMoviePosition(sMovieInfo * pMovInf, REFTIME rtPos)
{
    if( !pMovInf )
    {
        OutputDebugString(TEXT("CmdNotifySelected received a wrong parameter\n"));
        return;
    }

    CMovie *pmovie = NULL;
    pmovie = m_movieList.GetMovie( pMovInf->pdwUserID );

    if( NULL == pmovie)
    {
        OutputDebugString(TEXT("CmdNotifySelected received unrecognized UserID\n"));
        ZeroMemory( pMovInf, sizeof(sMovieInfo));
        return;
    }

    pmovie->SeekToPosition(rtPos, TRUE);
    return;
}
Пример #7
0
//-------------------------------------------------------------------------
//  CmdStopMovie
//-------------------------------------------------------------------------
void CMultiSAP::CmdStopMovie(sMovieInfo * pMovInf)
{
    if( NULL == pMovInf)
    {
        OutputDebugString(TEXT("Invalid parameter sent to CmdStopMovie()\n"));
        return;
    }

    CMovie *pmovie = NULL;
    pmovie = m_movieList.GetMovie( pMovInf->pdwUserID );

    if( NULL == pmovie)
    {
        OutputDebugString(TEXT("CmdStopMovie() received unrecognized UserID\n"));
        return;
    }

    pmovie->StopMovie();

    return;
}
Пример #8
0
//-------------------------------------------------------------------------
//      Name:   CmdAddMovie
//      Desc:   Processes command "add movie" from the parent dialog
//      Parameters:     (sMovieInfo *)lParam;
//      Return:
//      Other:   1. Create CMovie
//               2. Add movie to the end of the list
//               3. Start playing
//-------------------------------------------------------------------------
void CMultiSAP::CmdAddMovie(sMovieInfo* pMovInf)
{

    HRESULT hr = S_OK;
    RECT rc;
    CMovie *pmovie = NULL;

    CAutoLock Lock(&m_AppImageLock);

    CmdAddEffect(eEffectFading,2000, 300, 400, TRUE); // set next videoeffect "fading"

    if( m_pEffect ) // ping video effect change
    {
        m_pEffect->Finish();
    }

    if( !pMovInf)
    {
        OutputDebugString(TEXT("Invalid parameter sent to CmdAddMovie()\n"));
        return;
    }

    if( 0 == m_movieList.GetSize() )
    {
        ShowWindow( m_hwndApp, SW_SHOW);
    }

    pmovie = new CMovie;
    if( !pmovie )
    {
        OutputDebugStringA("Failed to allocate new movie in CmdAddMovie()\n");
        return;
    }
    pmovie->Initialize(pMovInf, this);

    if( FALSE == m_movieList.Add( pmovie ))
    {
        OutputDebugStringA("Failed to add new movie to the list in CmdAddMovie()\n");
        pmovie->Release();
        delete pmovie;
        return;
    }

    try
    {
        if( !m_movieList.GetMovie( pMovInf->pdwUserID) )
            throw;
        hr = m_movieList.GetMovie( pMovInf->pdwUserID)->OpenMovie();
    }
    catch(...)
    {
        pmovie->Release();
        delete pmovie;
        OutputDebugString(TEXT("Unhandled exception when trying to open the movie\n"));
        hr = E_POINTER;
    }

    if( FAILED(hr))
    {
        m_movieList.Delete( pMovInf->pdwUserID );

        if( m_bErrorMessage )
        {
            MessageBox(NULL, m_achErrorMessage, m_achErrorTitle, MB_ICONEXCLAMATION);
            m_bErrorMessage = false;
        }
        else
        {
#ifdef UNICODE
            hr = StringCchPrintfW( m_achErrorMessage, NUMELMS(m_achErrorMessage),TEXT("Direct3D object returned error code 0x%08x.\r\n"), hr);
#else
            hr = StringCchPrintf( m_achErrorMessage, NUMELMS(m_achErrorMessage),TEXT("Direct3D object returned error code 0x%08x.\r\n"), hr);
#endif
            hr = StringCchCat( m_achErrorMessage,  NUMELMS(m_achErrorMessage), TEXT("Please use DirectX Error Lookup tool and verify DirectX\r\n")\
                                          TEXT("capabilities of your video driver. We are sorry for inconvenience.\r\n")\
                                          TEXT("You may want to try a different media file, or try a different video driver."));

            hr = StringCchCopy( m_achErrorTitle, MAX_PATH, TEXT("Error when trying to render media file"));

            MessageBox(NULL, m_achErrorMessage, m_achErrorTitle, MB_ICONEXCLAMATION);
            m_bErrorMessage = false;
        }
        return;
    }

    GetMoviePosition(&rc);
    PutMoviePosition(rc);

    if( m_pEffect )
    {
        m_pEffect->Invalidate();
    }
    try
    {
        hr = PlayMovie(pMovInf->pdwUserID);
    }
    catch(...)
    {
        OutputDebugString(TEXT("Failed to start movie\n"));
        m_movieList.Delete( pMovInf->pdwUserID );
        hr = E_FAIL;
    }

    if( FAILED(hr))
    {
        m_movieList.Delete( pMovInf->pdwUserID );
    }
}
Пример #9
0
//-----------------------------------------------------------------------
//returns status.  see movie.h
int CMovieManager::Run (char* filename, int bHires, int bRequired, int dx, int dy)
{
	CFile			cf;
	CMovie*		movieP = NULL;
	int			result = 1, aborted = 0;
	int			track = 0;
	int			nFrame;
	int			key;
	CMovieLib*	libP = Find (filename);

result = 1;
// Open Movie file.  If it doesn't exist, no movie, just return.
if (!(cf.Open (filename, gameFolders.szDataDir, "rb", 0) || (movieP = Open (filename, bRequired)))) {
	if (bRequired) {
#if TRACE
		console.printf (CON_NORMAL, "movie: RunMovie: Cannot open movie <%s>\n", filename);
#endif
		}
	return MOVIE_NOT_PLAYED;
	}
SetScreenMode (SCREEN_MENU);
//paletteManager.ResumeEffect ();
MVE_memCallbacks (CMovie::Alloc, CMovie::Free);
MVE_ioCallbacks (CMovie::Read);
MVE_sfCallbacks (CMovie::ShowFrame);
MVE_palCallbacks (CMovie::SetPalette);
if (MVE_rmPrepMovie (reinterpret_cast<void*> (movieP ? &movieP->m_cf: &cf), dx, dy, track, libP ? libP->m_bLittleEndian : 1)) {
	Int3 ();
	return MOVIE_NOT_PLAYED;
	}
nFrame = 0;
gameStates.render.fonts.bHires = gameStates.render.fonts.bHiresAvailable && bHires;
ogl.SetRenderQuality (gameOpts->movies.nQuality ? 5 : 0);
while ((result = MVE_rmStepMovie ()) == 0) {
	subTitles.Draw (nFrame);
	//paletteManager.ResumeEffect (); // moved this here because of flashing
	GrUpdate (1);
	key = KeyInKey ();
	// If ESCAPE pressed, then quit movie.
	if (key == KEY_ESC) {
		result = aborted = 1;
		break;
		}
	// If PAUSE pressed, then pause movie
	if (key == KEY_PAUSE) {
		MVE_rmHoldMovie ();
		ShowPauseMessage (TXT_PAUSE);
		while (!KeyInKey ()) 
			;
		ClearPauseMessage ();
		}
	if ((key == KEY_ALTED+KEY_ENTER) || (key == KEY_ALTED+KEY_PADENTER))
		GrToggleFullScreen ();
	nFrame++;
	}
Assert (aborted || result == MVE_ERR_EOF);	 ///movie should be over
MVE_rmEndMovie ();
if (movieP)
	movieP->Close ();
else
	cf.Close ();                           // Close Movie File
// Restore old graphic state
ogl.SetRenderQuality ();
gameStates.video.nScreenMode = -1;  //force reset of screen mode
//paletteManager.ResumeEffect ();
return (aborted ? MOVIE_ABORTED : MOVIE_PLAYED_FULL);
}