Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,124 @@
/* ##H_FILE#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FILE : AviFunc.h
DESCRIPTION : Include file of VDO module
How to keep permanently the control of the sound driver when an avi is playing
2 solutions to play "AVI" are used here
- interlaced "AVI", where video and audio are interlacing each other
- "AVI" et "MPD" memory storage of the totality of a sound file and
picture synchronisation of a file of pictures
VERSION : 1.00/Nicolas Meyer/Creation
Nota Bene : This file is only portable on PC platform
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#ifndef _AVIFUNC_H_
#define _AVIFUNC_H_
/* ##INCLUDE#----------------------------------------------------------------------------
Includes Files
---------------------------------------------------------------------------------------*/
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <windef.h>
#include <wingdi.h> /* Definition of "BITMAPINFOHEADER" */
#if defined( __WATCOMC__ ) && ( __WATCOMC__ < 1100 )
#define __inline
#endif
#include <vfw.h> /* Functions "DrawDib..." for management of AVI "Video For Windows" */
#include <mmsystem.h>
#include <msacm.h>
#include <process.h>
#include "MMG.h"
#include "ERM.h"
#include "SCR.h"
#include "SND.h"
#include "VDO.h"
#include "SND.h"
#ifdef _DEBUG/*===================================== BEGIN _DEBUG =================================*/
#include <crtdbg.h> /* "CRT" Debugging function */
#endif/*============================================ END _DEBUG =================================*/
#ifdef _USE_DECOMPRESS/*============================ BEGIN _USE_DECOMPRESS =================================*/
#include "DecompressFunc.h"
#endif/*============================================ END _USE_DECOMPRESS =================================*/
#ifdef _USE_WINDOWS_DISPLAY/*======================= BEGIN _USE_WINDOWS_DISPLAY =================================*/
#include "UserMessage.h"
#endif/*============================================ END _USE_WINDOWS_DISPLAY =================================*/
#ifndef VDO_FOR_F1/*================================ BEGIN VDO_FOR_F1 =================================*/
#include "GLD.h"
#else
#include "drawlib.h"
#endif/*============================================ END VDO_FOR_F1 =================================*/
/* ##CONSTANTE#--------------------------------------------------------------------------
Constantes declaration
---------------------------------------------------------------------------------------*/
#define MAX_STREAM_TYPE 10 /* Maximum number of type of stream maximal (for example 1 video channel + 5 audio channels )*/
#define MAX_DRIVER_ACM_ADPCM 10 /* maximum number of drivers ACM which are able to convert ADPCM */
#define NB_STREAM_PERTYPE 8
#define SIZE_BUFFER_SAMPLE_CONVERT 1024 /* Size (in samples) of the rotating buffer of conversion */
#define NB_BUFFERS_CONVERT 20 /* MUST BE GREATER THAN 1 */
#define SIZE_ALL_BUFFERS ( SIZE_BUFFER_SAMPLE_CONVERT * NB_BUFFERS_CONVERT )
#define TIME_RESOLUTION 1 /* Temporal resolution of 1 ms */
#define TIME_SLICE 20 /* Time (in milliseconds) between 2 slices */
/* type of game
//================================================================================================
// Definition realised in the VDO module
//================================================================================================ */
/*
#define AVI_SYNCH_NOSOUND 0
#define AVI_SYNCH_OBJECT 1
#define AVI_SYNCH_STREAM 2
*/
// Set the index of the sound bank which corresponds to the AVI
#define NB_BANK_BNM 200
/* ##FUNCDEF#----------------------------------------------------------------------------
Functions definition
---------------------------------------------------------------------------------------*/
/* DECLARATION OF PRIVATE FUNCTIONS
//================================================================================================
// High level functions defined in the VDO module
//================================================================================================*/
/*
ACP_tdxBool VDO_fn_bIsRunningAVI( );
void VDO_fn_xDesInitAVI( );
void VDO_fn_xInitAVI( );
void VDO_fn_xPlayVideoAVI( char* szFilename );
void VDO_fn_xSetDirectoryAVI( char* szDirectory );
void VDO_fn_xStopVideoAVI( );
*/
/*================================================================================================*/
void VDO_fn_xSetBankIndice( unsigned short nIndice );
/* Get datas functions */
SIZE AviGetVideoDimensions( );
unsigned long AviGetVideoHeight( );
unsigned long AviGetVideoWidth( );
/* Init functions, parameters modifications, and desinitialisation */
void AviDesInitModule( );
BOOL AviInitModule( char* szFilename );
void __stdcall AviPlayVideo( char* szFilename, unsigned long nType );
#endif // _AVIFUNC_H_

View File

@@ -0,0 +1,219 @@
/* ##C_FILE#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FILE : DecompressFunc.h
DESCRIPTION : Implementation file of module of AVI management : VDO
Set of functions in charge of searching for a video unshrinker and using it.
This module avoids the use of the high level function "AVIStreamGetFrame"
VERSION : 1.00/Nicolas Meyer/Creation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
/* ##INCLUDE#----------------------------------------------------------------------------
Includes Files
---------------------------------------------------------------------------------------*/
#include "DecompressFunc.h"
/* ##GLOBVAR#----------------------------------------------------------------------------
Globale variable declaration
---------------------------------------------------------------------------------------*/
static LPBITMAPINFOHEADER gpBmpInfoHdrOut;
static LPBITMAPINFOHEADER gpBmpInfoHdrIn;
static PAVISTREAM gpAviStream;
static ICINFO gicInfo;
static HIC ghIC;
static unsigned char* gpchDataIn;
static unsigned char* gpchDataOut;
static long gnIndiceFrameLast;
static unsigned long gnNbKeyFrame;
static long* gpIndiceKeyFrame;
static unsigned long gnIndiceLastKey;
/* ##F===================================================================================
NAME : DecompressDesInitModule
DESCRIPTION : uninit the uncompression video module
INPUT :
OUTPUT : BOOL
=========================================================================================
CREATION : Nicolas Meyer
LAST MODIFICATIONS : Date/Author/Modification (5 maximum)
=======================================================================================*/
BOOL DecompressDesInitModule( )
{
BOOL bResult;
bResult = TRUE;
if( ICDecompressEnd( ghIC ) != ICERR_OK ) {
bResult = FALSE;
}
if( ICClose( ghIC ) != ICERR_OK ) {
bResult = FALSE;
}
if( gpBmpInfoHdrOut )
free( gpBmpInfoHdrOut );
if( gpchDataIn )
free( gpchDataIn );
if( gpIndiceKeyFrame )
free( gpIndiceKeyFrame );
memset( & gicInfo, 0, sizeof(ICINFO) );
ghIC = NULL;
gpBmpInfoHdrOut = NULL;
gpBmpInfoHdrIn = NULL;
gpAviStream = NULL;
gpchDataIn = NULL;
gpchDataOut = NULL;
gnIndiceFrameLast = -1;
gnNbKeyFrame = 0;
return bResult;
}/*DecompressDesInitModule*/
/* ##F===================================================================================
NAME : DecompressInitModule
DESCRIPTION : init the uncompression video module, returns TRUE or FALSE depending
of the success or failure of the operation
INPUT : LPBITMAPINFOHEADER pbiIn
LPAVISTREAMINFO pAviStrInfoIn
PAVISTREAM ppAviStream
OUTPUT : BOOL
=========================================================================================
CREATION : Nicolas Meyer
LAST MODIFICATIONS : Date/Author/Modification (5 maximum)
=======================================================================================*/
BOOL DecompressInitModule( LPBITMAPINFOHEADER pBmpInfoHdrIn, LPAVISTREAMINFO pAviStrInfoIn, PAVISTREAM pAviStream )
{
unsigned long nCpt;
unsigned long nIndiceKey;
unsigned long nResult;
long nTemp;
BITMAPINFOHEADER BmpInfoHdrOut;
ghIC = NULL;
if( ! pBmpInfoHdrIn )
return FALSE;
if( ! pAviStrInfoIn )
return FALSE;
if( ! pAviStream )
return FALSE;
ghIC = ICGetDisplayFormat( NULL,
pBmpInfoHdrIn,
& BmpInfoHdrOut,
pBmpInfoHdrIn->biBitCount,
0,
0 );
if( ! ghIC )
return FALSE;
if( ( nResult = ICGetInfo( ghIC, & gicInfo, sizeof(ICINFO) ) ) != sizeof(ICINFO) ) {
ICClose( ghIC );
return FALSE;
}
gpBmpInfoHdrIn = pBmpInfoHdrIn;
gpAviStream = pAviStream;
if( BmpInfoHdrOut.biSizeImage ) {
gpBmpInfoHdrOut = (LPBITMAPINFOHEADER)malloc( BmpInfoHdrOut.biSizeImage + sizeof(BITMAPINFOHEADER) );
gpchDataOut = (unsigned char*)( gpBmpInfoHdrOut + 1 );
}
else {
gpBmpInfoHdrOut = (LPBITMAPINFOHEADER)malloc( BmpInfoHdrOut.biBitCount * BmpInfoHdrOut.biWidth * BmpInfoHdrOut.biHeight >> 3 + sizeof(BITMAPINFOHEADER) );
gpchDataOut = (unsigned char*)( gpBmpInfoHdrOut + 1 );
}
memcpy( gpBmpInfoHdrOut, & BmpInfoHdrOut, sizeof(BITMAPINFOHEADER) );
if( gpBmpInfoHdrIn->biSizeImage )
gpchDataIn = (unsigned char*)malloc( gpBmpInfoHdrIn->biSizeImage );
else
gpchDataIn = (unsigned char*)malloc( gpBmpInfoHdrIn->biBitCount * gpBmpInfoHdrIn->biWidth * gpBmpInfoHdrIn->biHeight >> 3 );
if( ( nResult = ICDecompressBegin( ghIC, gpBmpInfoHdrIn, gpBmpInfoHdrOut ) ) != ICERR_OK ) {
memset( & gicInfo, 0, sizeof(ICINFO) );
ICClose( ghIC );
return FALSE;
}
gnNbKeyFrame = 0;
for( nCpt = 0; nCpt < pAviStrInfoIn->dwLength; /*nCpt++*/ ) {
if( ( nTemp = AVIStreamFindSample( gpAviStream,
(long)nCpt,
FIND_KEY | FIND_NEXT ) ) != -1 ) {
gnNbKeyFrame++;
nCpt = (unsigned long)nTemp + 1;
}
else
break;
}
gpIndiceKeyFrame = (long*)malloc( gnNbKeyFrame * sizeof(long) );
for( nIndiceKey = 0, nCpt = 0; nIndiceKey < gnNbKeyFrame; nIndiceKey++ ) {
gpIndiceKeyFrame[ nIndiceKey ] = AVIStreamFindSample( gpAviStream,
(long)nCpt,
FIND_KEY | FIND_NEXT );
nCpt = gpIndiceKeyFrame[ nIndiceKey ] + 1;
}
gnIndiceFrameLast = -1;
gnIndiceLastKey = 0;
}/*DecompressInitModule*/
/* ##F===================================================================================
NAME : DecompressGetFrame
DESCRIPTION : return a pointer on uncompressed datas
INPUT : long nIndiceFrame
OUTPUT : LPBITMAPINFOHEADER
=========================================================================================
CREATION : Nicolas Meyer
LAST MODIFICATIONS : Date/Author/Modification (5 maximum)
=======================================================================================*/
LPBITMAPINFOHEADER DecompressGetFrame( long nIndiceFrame )
{
long nSamplesRead;
long nBytesRead;
long nResult;
long nDifKeyNext;
long nDifCur;
// nDifKeyLast = abs( nIndiceFrame - gpIndiceKeyFrame[ gnIndiceLastKey ] );
if( gnIndiceFrameLast >= nIndiceFrame )
return gpBmpInfoHdrOut;
else
if( gnIndiceFrameLast == -1 )
gnIndiceFrameLast++;
// Find the position of the "KeyFrame"
while( gnIndiceLastKey < gnNbKeyFrame ) {
if( ( nIndiceFrame >= gpIndiceKeyFrame[ gnIndiceLastKey ] ) &&
( nIndiceFrame < gpIndiceKeyFrame[ gnIndiceLastKey + 1 ] ) )
break;
else {
gnIndiceLastKey++;
gnIndiceFrameLast = gpIndiceKeyFrame[ gnIndiceLastKey ];
}
}
// find the most favourable strategy
nDifKeyNext = abs( nIndiceFrame - gpIndiceKeyFrame[ gnIndiceLastKey + 1 ] );
nDifCur = abs( nIndiceFrame - gnIndiceFrameLast );
if( nDifCur >= nDifKeyNext )
gnIndiceFrameLast = gpIndiceKeyFrame[ gnIndiceLastKey + 1 ];
do {
nResult = AVIStreamRead( gpAviStream,
gnIndiceFrameLast++,
1,
gpchDataIn,
gpBmpInfoHdrIn->biSizeImage,
& nBytesRead,
& nSamplesRead );
nResult = ICDecompress( ghIC,
ICDECOMPRESS_HURRYUP,
gpBmpInfoHdrIn,
gpchDataIn,
gpBmpInfoHdrOut,
gpchDataOut );
}
while( gnIndiceFrameLast < nIndiceFrame + 1 );
gnIndiceFrameLast--;
return gpBmpInfoHdrOut;
}/*DecompressGetFrame*/

View File

@@ -0,0 +1,43 @@
/* ##H_FILE#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FILE : DecompressFunc.h
DESCRIPTION : Include file of VDO module
Set of functions in charge of searching for video expander (decompresseur video)
and using it. This module avoids using the high level function "AVIStreamGetFrame"
VERSION : 1.00/Nicolas Meyer/Creation
Nota Bene : This file is only portable on PC platform
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#ifndef _DECOMPRESSFUNC_H_
#define _DECOMPRESSFUNC_H_
/* ##INCLUDE#----------------------------------------------------------------------------
Includes Files
---------------------------------------------------------------------------------------*/
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <windef.h>
#include <wingdi.h>
#include <vfw.h>
#include <math.h>
#ifdef _DEBUG
#include <crtdbg.h> /* "CRT" Debugging function */
#endif
/* ##FUNCDEF#----------------------------------------------------------------------------
Functions definition
---------------------------------------------------------------------------------------*/
BOOL DecompressDesInitModule( );
BOOL DecompressInitModule( LPBITMAPINFOHEADER pBmpInfoHdrIn, LPAVISTREAMINFO pAviStrInfoIn, PAVISTREAM ppAviStream );
LPBITMAPINFOHEADER DecompressGetFrame( long nIndiceFrame );
#endif // _DECOMPRESSFUNC_H_

View File

@@ -0,0 +1,23 @@
/* ##H_FILE#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FILE : UserMessage.h
DESCRIPTION : Include file of VDO module
Contains the definition of user message used in windowed mode
VERSION : 1.00/Nicolas Meyer/Creation
Nota Bene : This file is only portable on PC platform
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#ifndef _USERMESSAGE_H_
#define _USERMESSAGE_H_
/* ##CONSTANTE#--------------------------------------------------------------------------
Constantes declaration
---------------------------------------------------------------------------------------*/
#define WM_RESIZE WM_USER + 1 /* (LPARAM) to be cast in LPRECT */
#define WM_VISIBLE WM_USER + 2 /* (WPARAM) contains the style */
#endif // _USERMESSAGE_H_

View File

@@ -0,0 +1,168 @@
# Microsoft Developer Studio Project File - Name="Vdo" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=Vdo - Win32 Debug Windows
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Vdo.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Vdo.mak" CFG="Vdo - Win32 Debug Windows"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Vdo - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "Vdo - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "Vdo - Win32 Debug Windows" (based on "Win32 (x86) Static Library")
!MESSAGE "Vdo - Win32 Release Windows" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/tempgrp/VDO", PLFAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
!IF "$(CFG)" == "Vdo - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 2
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /MD /W3 /GX /O2 /I "x:\Cpa\Public\SND" /I "x:\Cpa\Public\GAM" /I "x:\Cpa\Public\VDO" /I "x:\Cpa\Public" /I "t:\dxsdk\sdk\inc" /D "NDEBUG" /D "NUSE_WINDOWS_DISPLAY" /D "WIN32" /D "_WINDOWS" /D "NUSE_FILE_DBG" /D "_AFXDLL" /D "RAYII" /D "RAY2EGYPTE" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"x:\Cpa\Lib\VDOP5_vr.lib"
!ELSEIF "$(CFG)" == "Vdo - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 2
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /MD /W3 /GX /Zi /Od /I "x:\Cpa\Public\SND" /I "x:\Cpa\Public\GAM" /I "x:\Cpa\Public\VDO" /I "x:\Cpa\Public" /I "t:\dxsdk\sdk\inc" /D "_DEBUG" /D "NUSE_WINDOWS_DISPLAY" /D "WIN32" /D "_WINDOWS" /D "NUSE_FILE_DBG" /D "_AFXDLL" /D "RAYII" /D "RAY2EGYPTE" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"x:\Cpa\Lib\VDOP5_vd.lib"
!ELSEIF "$(CFG)" == "Vdo - Win32 Debug Windows"
# PROP BASE Use_MFC 2
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Vdo___W0"
# PROP BASE Intermediate_Dir "Vdo___W0"
# PROP BASE Target_Dir ""
# PROP Use_MFC 2
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug Windows"
# PROP Intermediate_Dir "Debug Windows"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /I "x:\Cpa\Public\GAM" /I "x:\Cpa\Public\VDO" /I "x:\Cpa\Public" /I "t:\dxsdk\sdk\inc" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "NUSE_FILE_DBG" /D "NUSE_WINDOWS_DISPLAY" /D "_AFXDLL" /FR /YX /FD /c
# ADD CPP /nologo /G5 /MD /W3 /GX /Zi /Od /I "x:\Cpa\Public\SND" /I "x:\Cpa\Public\GAM" /I "x:\Cpa\Public\VDO" /I "x:\Cpa\Public" /I "t:\dxsdk\sdk\inc" /D "_DEBUG" /D "_USE_WINDOWS_DISPLAY" /D "WIN32" /D "_WINDOWS" /D "NUSE_FILE_DBG" /D "_AFXDLL" /D "RAYII" /D "RAY2EGYPTE" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"x:\Cpa\Lib\VDOP5_vd.lib"
# ADD LIB32 /nologo /out:"x:\Cpa\Lib\VDOP5W_vd.lib"
!ELSEIF "$(CFG)" == "Vdo - Win32 Release Windows"
# PROP BASE Use_MFC 2
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Vdo___Wi"
# PROP BASE Intermediate_Dir "Vdo___Wi"
# PROP BASE Target_Dir ""
# PROP Use_MFC 2
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release Windows"
# PROP Intermediate_Dir "Release Windows"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "x:\Cpa\Public\GAM" /I "x:\Cpa\Public\VDO" /I "x:\Cpa\Public" /I "t:\dxsdk\sdk\inc" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "NUSE_FILE_DBG" /D "_AFXDLL" /YX /FD /c
# ADD CPP /nologo /G5 /MD /W3 /GX /O2 /I "x:\Cpa\Public\SND" /I "x:\Cpa\Public\GAM" /I "x:\Cpa\Public\VDO" /I "x:\Cpa\Public" /I "t:\dxsdk\sdk\inc" /D "NDEBUG" /D "_USE_WINDOWS_DISPLAY" /D "WIN32" /D "_WINDOWS" /D "NUSE_FILE_DBG" /D "_AFXDLL" /D "RAYII" /D "RAY2EGYPTE" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"x:\Cpa\Lib\VDOP5_vr.lib"
# ADD LIB32 /nologo /out:"x:\Cpa\Lib\VDOP5W_vr.lib"
!ENDIF
# Begin Target
# Name "Vdo - Win32 Release"
# Name "Vdo - Win32 Debug"
# Name "Vdo - Win32 Debug Windows"
# Name "Vdo - Win32 Release Windows"
# Begin Group "Source Files"
# PROP Default_Filter "*.c,*.cpp"
# Begin Source File
SOURCE=X:\Cpa\TempGrp\VDO\avifunc.c
# End Source File
# Begin Source File
SOURCE=X:\Cpa\TempGrp\Vdo\DecompressFunc.c
# End Source File
# Begin Source File
SOURCE=X:\Cpa\TempGrp\VDO\mng_win.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "*.h,*.hpp"
# Begin Source File
SOURCE=X:\Cpa\TempGrp\VDO\AviFunc.h
# End Source File
# Begin Source File
SOURCE=X:\Cpa\TempGrp\Vdo\DecompressFunc.h
# End Source File
# Begin Source File
SOURCE=X:\Cpa\TempGrp\VDO\mng_win.h
# End Source File
# Begin Source File
SOURCE=X:\Cpa\TempGrp\VDO\UserMessage.h
# End Source File
# Begin Source File
SOURCE=X:\Cpa\Public\VDO\VDO_mng.h
# End Source File
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,801 @@
/* ##C_FILE#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FILE : mng_win.cpp
DESCRIPTION : One of mplementation files of module of AVI management : VDO
VERSION : 1.00/Nicolas Meyer/Creation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
/* ##INCLUDE#----------------------------------------------------------------------------
Includes Files
---------------------------------------------------------------------------------------*/
#include "ToolsCPA.h"
//#include <afxtempl.h>
#include "windows.h"
#include <vfw.h>
#include <digitalv.h>
#include <mciavi.h>
#include "GEO.h"
#include "mng_win.h"
#include "INO.h"
/* ##GLOBVAR#----------------------------------------------------------------------------
Globale variable declaration
---------------------------------------------------------------------------------------*/
unsigned char g_state;
VDO_tdxHandleToVideo g_p_VDO_OpenVideoList[C_VDO_MAXOPENVIDEO];
unsigned char g_uc_VDO_CurrentOpenVideo;
HWND g_hParentWindow;
// *g_ad;
// LRESULT (*g_ad)( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
/* ##F===================================================================================
NAME : VDO_fn_szGetCommandLine
DESCRIPTION : Get the command line in VDO
INPUT :
OUTPUT : string
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
char * VDO_fn_szGetCommandLine()
{
return AfxGetApp()->m_lpCmdLine;
}/*VDO_fn_szGetCommandLine*/
/* ##F===================================================================================
NAME : VDO_fn_hGetVideoHandleFromWindowHandle
DESCRIPTION : Get the video handle from a window handle
INPUT : HWND hWnd
OUTPUT : VDO_tdxHandleToVideo
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
VDO_tdxHandleToVideo VDO_fn_hGetVideoHandleFromWindowHandle(HWND hWnd)
{
int i;
VDO_tdxHandleToVideo hVideo=NULL;
for(i=0;i<g_uc_VDO_CurrentOpenVideo;i++)
{
if(g_p_VDO_OpenVideoList[i]->hVideoWindow==hWnd)
{
hVideo=g_p_VDO_OpenVideoList[i];
break;
}
}
return hVideo;
}/*VDO_fn_hGetVideoHandleFromWindowHandle*/
/* ##F===================================================================================
NAME : VDO_fn_vAddVideoHandleToGlobalList
DESCRIPTION : Add a video handle to the global list
INPUT : VDO_tdxHandleToVideo hVideo
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
void VDO_fn_vAddVideoHandleToGlobalList(VDO_tdxHandleToVideo hVideo)
{
g_p_VDO_OpenVideoList[g_uc_VDO_CurrentOpenVideo]=hVideo;
g_uc_VDO_CurrentOpenVideo++;
}/*VDO_fn_vAddVideoHandleToGlobalList*/
/* ##F===================================================================================
NAME : VDO_fn_vRemoveVideoHandleFromGlobalList
DESCRIPTION : Remove a video handle from the global list
INPUT : VDO_tdxHandleToVideo hVideo
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
void VDO_fn_vRemoveVideoHandleFromGlobalList(VDO_tdxHandleToVideo hVideo)
{
int i;
for(i=0;i<g_uc_VDO_CurrentOpenVideo;i++)
{
if(g_p_VDO_OpenVideoList[i]==hVideo)
{
break;
}
}
if(i!=g_uc_VDO_CurrentOpenVideo)
{
g_uc_VDO_CurrentOpenVideo--;
if(i!=g_uc_VDO_CurrentOpenVideo)
{
g_p_VDO_OpenVideoList[i]=g_p_VDO_OpenVideoList[g_uc_VDO_CurrentOpenVideo];
}
}
}/*VDO_fn_vRemoveVideoHandleFromGlobalList*/
/* ##F===================================================================================
NAME : VDO_fn_hCreateVideoWindow
DESCRIPTION : Create a video window
INPUT : VDO_tdxHandleToVideo p_stVideoHandle
unsigned char ucType
char *szFilename
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
void VDO_fn_hCreateVideoWindow(VDO_tdxHandleToVideo p_stVideoHandle,unsigned char ucType,char *szFilename)
{
HWND m_hMciWindow;
p_stVideoHandle->ucMode = C_VDO_ERROR;
// Create the Window:
m_hMciWindow = MCIWndCreate(NULL ,
AfxGetInstanceHandle(), MCIWNDF_NOTIFYALL | MCIWNDF_NOMENU | MCIWNDF_NOPLAYBAR | WS_POPUP , (LPCSTR) szFilename );
SetWindowPos(m_hMciWindow, HWND_TOP, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SWP_NOMOVE );
// Is window created ?
if ( m_hMciWindow == NULL )
{
return;
}
// t ShowWindow( m_hMciWindow, SW_SHOWMAXIMIZED );
// t SetActiveWindow(m_hMciWindow);
p_stVideoHandle->hVideoWindow=m_hMciWindow;
p_stVideoHandle->ucMode = C_VDO_NONE;
return;
}/*VDO_fn_hCreateVideoWindow*/
/* ##F===================================================================================
NAME : VDO_fn_xPlayVideo
DESCRIPTION : Play a video
INPUT : VDO_tdxHandleToVideo p_stVideoHandle
unsigned char ucMode
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
void VDO_fn_xPlayVideo(VDO_tdxHandleToVideo p_stVideoHandle, unsigned char ucMode)
{
MCIERROR mciErrorCode;
if((p_stVideoHandle!=NULL)&&(p_stVideoHandle->ucMode!=C_VDO_ERROR))
{
p_stVideoHandle->ucMode = C_VDO_ERROR;
SND_fn_vReleaseDriverSound();
// SetForegroundWindow(p_stVideoHandle->hVideoWindow);
SetForegroundWindow(p_stVideoHandle->hVideoWindow);
// SetActiveWindow(p_stVideoHandle->hVideoWindow);
// SetFocus(p_stVideoHandle->hVideoWindow);
// t
ShowWindow( p_stVideoHandle->hVideoWindow, SW_SHOWMAXIMIZED );
mciErrorCode=MCIWndPlay(p_stVideoHandle->hVideoWindow);
SetForegroundWindow(p_stVideoHandle->hVideoWindow);
SetActiveWindow(p_stVideoHandle->hVideoWindow);
// if ( NoError() )
if(mciErrorCode==0)
{
p_stVideoHandle->ucMode = C_VDO_PLAY;
g_state=C_VDO_PLAY;
}
else
{
return;
}
MSG lpMsg;
while((p_stVideoHandle->ucMode==C_VDO_PLAY)&&(MCIWndGetPosition(p_stVideoHandle->hVideoWindow)!=MCIWndGetEnd(p_stVideoHandle->hVideoWindow)))
{
while(PeekMessage(&lpMsg,NULL,0,0,PM_REMOVE))
//while(GetMessage(&lpMsg,NULL,0,0))
{
TranslateMessage(&lpMsg);
DispatchMessage(&lpMsg);
switch ( lpMsg.message )
{
case MM_MCINOTIFY:
{
switch ( lpMsg.wParam )
{
case MCI_NOTIFY_ABORTED:
case MCI_NOTIFY_SUCCESSFUL:
VDO_fn_hGetVideoHandleFromWindowHandle(lpMsg.hwnd)->ucMode=C_VDO_STOP;
break;
case MCI_NOTIFY_FAILURE:
TRACE( "Last mci command failed..\n");
VDO_fn_hGetVideoHandleFromWindowHandle(lpMsg.hwnd)->ucMode=C_VDO_STOP;
break;
default:
TRACE( "Unknown notification\n");
}
}
case WM_KEYDOWN:
if(lpMsg.wParam==VK_ESCAPE)
{
VDO_fn_hGetVideoHandleFromWindowHandle(lpMsg.hwnd)->ucMode=C_VDO_STOP;
}
break;
/* case WM_KILLFOCUS:
VDO_fn_hGetVideoHandleFromWindowHandle(hWnd)->ucMode=C_VDO_STOP;
break;
*/
case WM_ERASEBKGND:
TRACE("Erase video background\n");
break;
// Needed to display the first frame
case WM_PAINT:
// a faire
break;
case WM_DESTROY:
break;
default:
break;
}
}
}
VDO_fn_xStopVideo(p_stVideoHandle);
}
return;
}/*VDO_fn_xPlayVideo*/
/* ##F===================================================================================
NAME : VDO_fn_xOpenVideo
DESCRIPTION : Open the video file in VDO
INPUT : *szFilename (name of the video)
OUTPUT : handle of object video
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
VDO_tdxHandleToVideo VDO_fn_xOpenVideo(char *szFilename)
{
// MCIERROR mciErrorCode;
VDO_tdxHandleToVideo p_stVideoHandle;
GEO_M_CPAMalloc( p_stVideoHandle, VDO_tdxHandleToVideo , sizeof(struct tdstVideo_),E_uwGEONotEnoughtMemory);
p_stVideoHandle->ucMode = C_VDO_LOADED;
VDO_fn_hCreateVideoWindow(p_stVideoHandle,1,szFilename);
if((p_stVideoHandle!=NULL)&&(p_stVideoHandle->ucMode!=C_VDO_ERROR))
{
VDO_fn_vAddVideoHandleToGlobalList(p_stVideoHandle);
}
return p_stVideoHandle;
}/*VDO_fn_xOpenVideo*/
/* ##F===================================================================================
NAME : VDO_fn_xStopVideo
DESCRIPTION : Stop the video in VDO
INPUT : p_stVideoHandle (handle of the video object)
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
void VDO_fn_xStopVideo(VDO_tdxHandleToVideo p_stVideoHandle)
{
MCIERROR mciErrorCode;
if(p_stVideoHandle!=NULL)
{
if((p_stVideoHandle->ucMode!=C_VDO_NONE)&&(p_stVideoHandle->ucMode!=C_VDO_ERROR))
{
mciErrorCode=MCIWndStop(p_stVideoHandle->hVideoWindow);
SND_fn_vRestoreDriverSound();
}
}
p_stVideoHandle->ucMode = C_VDO_ERROR;
if(mciErrorCode==0)
{
p_stVideoHandle->ucMode = C_VDO_STOP;
}
else
{
return;
}
return;
}/*VDO_fn_xStopVideo*/
/* ##F===================================================================================
NAME : VDO_fn_xCloseVideo
DESCRIPTION : Close the video file in VDO
INPUT : p_stVideoHandle (handle of the video object)
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
void VDO_fn_xCloseVideo(VDO_tdxHandleToVideo p_stVideoHandle)
{
MCIERROR mciErrorCode;
// ReleaseCapture();
MCI_GENERIC_PARMS mciParameters;
mciParameters.dwCallback = NULL;
// Free the mci device
if(p_stVideoHandle!=NULL)
{
if(p_stVideoHandle->ucMode!=C_VDO_ERROR)
{
mciErrorCode=MCIWndClose(p_stVideoHandle->hVideoWindow);
MCIWndDestroy(p_stVideoHandle->hVideoWindow);
VDO_fn_vRemoveVideoHandleFromGlobalList(p_stVideoHandle);
p_stVideoHandle->hVideoWindow = NULL;
GEO_M_CPAFree(p_stVideoHandle);
}
}
// SetForegroundWindow((AfxGetApp()->m_pMainWnd)->m_hWnd);
}/*VDO_fn_xCloseVideo*/
/* ##F===================================================================================
NAME : fnGenMciStreamWindowProc (Callback)
DESCRIPTION : Event loop of a video window
INPUT : HWND hWnd
UINT uMsg
WPARAM wParam
LPARAM lParam
OUTPUT : LRESULT
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
LRESULT CALLBACK fnGenMciStreamWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
switch ( uMsg )
{
case MM_MCINOTIFY:
{
switch ( wParam )
{
case MCI_NOTIFY_ABORTED:
case MCI_NOTIFY_SUCCESSFUL:
VDO_fn_hGetVideoHandleFromWindowHandle(hWnd)->ucMode=C_VDO_STOP;
break;
case MCI_NOTIFY_FAILURE:
TRACE( "Last mci command failed..\n");
VDO_fn_hGetVideoHandleFromWindowHandle(hWnd)->ucMode=C_VDO_STOP;
break;
default:
TRACE( "Unknown notification\n");
}
return 0L; // Message completely treated
}
case WM_KEYDOWN:
if(wParam==VK_ESCAPE)
{
VDO_fn_hGetVideoHandleFromWindowHandle(hWnd)->ucMode=C_VDO_STOP;
}
break;
/* case WM_KILLFOCUS:
VDO_fn_hGetVideoHandleFromWindowHandle(hWnd)->ucMode=C_VDO_STOP;
break;
*/
case WM_ERASEBKGND:
TRACE("Erase video background\n");
break;
// Needed to display the first frame
case WM_PAINT:
// a faire
break;
case WM_DESTROY:
break;
default:
break;
}
// Let the default procedure do the rest
return ::DefWindowProc( hWnd, uMsg, wParam, lParam );
}/*fnGenMciStreamWindowProc*/
/* ##F===================================================================================
NAME : VDO_fn_vInitVideo
DESCRIPTION : Init the video window
INPUT :
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
void VDO_fn_vInitVideo()
{
WNDCLASS mciWndClass;
g_uc_VDO_CurrentOpenVideo=0;
// GetClassInfo( Instance, g_szGenWndClassName, &mciWndClass );
// Set new callback
mciWndClass.lpfnWndProc = &fnGenMciStreamWindowProc;
// Set new name
mciWndClass.lpszClassName = "Classe MCI Video TT";
// I use GEN DC: faster, and sure it has the good palette selected
mciWndClass.style = CS_OWNDC & CS_NOCLOSE; //&(~WS_BORDER & ~WS_CAPTION & ~WS_SYSMENU ) & WS_MAXIMIZE;
// mciWndClass.style |= CS_OWNDC;
mciWndClass.cbClsExtra = 0;
mciWndClass.cbWndExtra = 0;
mciWndClass.hInstance = AfxGetInstanceHandle();
mciWndClass.hIcon = NULL ;
mciWndClass.hCursor = NULL ;
mciWndClass.hbrBackground = NULL; //(HBRUSH)COLOR_BACKGROUND ;
mciWndClass.lpszMenuName = NULL;
if ( RegisterClass( &mciWndClass ) == 0 )
{
// Problem while registering
return; // Stop here
}
}/*VDO_fn_vInitVideo*/
/* ##F===================================================================================
NAME : VDO_fn_vDesInitVideo
DESCRIPTION : Desinit the video window in VDO
INPUT :
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
void VDO_fn_vDesInitVideo()
{
UnregisterClass( "Classe MCI Video TT", AfxGetInstanceHandle() );
}/*VDO_fn_vDesInitVideo*/
/* ##F===================================================================================
NAME : VDO_fn_hCreateVideoWindowMPEG
DESCRIPTION : Create a window for a MPEG video file
INPUT : VDO_tdxHandleToVideo p_stVideoHandle
unsigned char ucType
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
void VDO_fn_hCreateVideoWindowMPEG(VDO_tdxHandleToVideo p_stVideoHandle,unsigned char ucType)
{
HWND m_hMciWindow;
CRect wndRect;
HDC hdc=NULL;
CWnd* pWnd=NULL;
short wScreenHeight;
short wScreenWidth;
hdc = GetWindowDC(NULL);
wScreenHeight = (short)GetDeviceCaps(hdc, VERTRES);
wScreenWidth = (short)GetDeviceCaps(hdc, HORZRES);
ReleaseDC(NULL, hdc);
switch(ucType)
{
case 0:
pWnd = AfxGetApp()->m_pMainWnd;
pWnd->GetClientRect( &wndRect );
break;
case 1:
MCI_DGV_RECT_PARMS mciRect;
// Get the movie dimensions with MCI_WHERE.
mciSendCommand(p_stVideoHandle->hDeviceId, MCI_WHERE, MCI_DGV_WHERE_SOURCE, (DWORD)(LPSTR)&mciRect);
wndRect.SetRect(0,0, mciRect.rc.right, mciRect.rc.bottom);
break;
}
p_stVideoHandle->ucMode = C_VDO_ERROR;
// Create the Window:
m_hMciWindow = CreateWindow(
"Classe MCI Video TT",
NULL,
WS_POPUP | WS_VISIBLE, // & WS_DLGFRAME,// & (~WS_BORDER & ~WS_CAPTION & ~WS_SYSMENU ) & WS_MAXIMIZE,
0,0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
(AfxGetApp()->m_pMainWnd)->m_hWnd, NULL, AfxGetInstanceHandle(), NULL );
// Is window created ?
if ( m_hMciWindow == NULL )
{
return;
}
SetWindowPos(m_hMciWindow, HWND_TOP,0 ,0,GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SWP_NOMOVE );
ShowWindow( m_hMciWindow, SW_SHOW );
SetActiveWindow(m_hMciWindow);
p_stVideoHandle->hVideoWindow=m_hMciWindow;
p_stVideoHandle->ucMode = C_VDO_NONE;
return;
}/*VDO_fn_hCreateVideoWindowMPEG*/
/* ##F===================================================================================
NAME : VDO_fn_xPlayVideoMPEG
DESCRIPTION : Play a MPEG video
INPUT : p_stVideoHandle (handle of the video object)
ucMode (playing mode)
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
void VDO_fn_xPlayVideoMPEG(VDO_tdxHandleToVideo p_stVideoHandle, unsigned char ucMode)
{
MCIERROR mciErrorCode;
DWORD dwFlags;
if((p_stVideoHandle!=NULL)&&(p_stVideoHandle->ucMode!=C_VDO_ERROR))
{
p_stVideoHandle->ucMode = C_VDO_ERROR;
MCI_STATUS_PARMS mciStatusParameters;
mciStatusParameters.dwCallback = NULL;
mciStatusParameters.dwItem = MCI_STATUS_LENGTH; // Last frame asked
mciStatusParameters.dwTrack = 0;
// Command to mci
mciErrorCode=mciSendCommand( p_stVideoHandle->hDeviceId, MCI_STATUS, MCI_WAIT | MCI_STATUS_ITEM, (DWORD) &mciStatusParameters );
if(mciErrorCode!=0)
{
return;
}
// Parameters
MCI_PLAY_PARMS mciPlayParameters;
mciPlayParameters.dwCallback = (DWORD)((WORD)p_stVideoHandle->hVideoWindow);
mciPlayParameters.dwFrom = 0;
mciPlayParameters.dwTo = mciStatusParameters.dwReturn; // GetMCILastFrame( ); ****************************************************
// Play from current pos to end of video
// The "from" & "to" info are handled by the SE
dwFlags = MCI_NOTIFY;
/* if(ucMode==C_VDO_FULLSCREEN)
{
dwFlags = MCI_NOTIFY | MCI_MCIAVI_PLAY_FULLSCREEN;
}
*/
mciErrorCode=mciSendCommand( p_stVideoHandle->hDeviceId, MCI_PLAY, dwFlags, (DWORD) &mciPlayParameters );
SetForegroundWindow(p_stVideoHandle->hVideoWindow);
/* RECT stRect;
stRect.left=0;
stRect.top=0;
stRect.right=GetSystemMetrics(SM_CXSCREEN);
stRect.bottom=GetSystemMetrics(SM_CYSCREEN);
MCIWndPutDest(p_stVideoHandle->hVideoWindow,&stRect);
*/
// if ( NoError() )
if(mciErrorCode==0)
{
p_stVideoHandle->ucMode = C_VDO_PLAY;
g_state=C_VDO_PLAY;
}
else
{
return;
}
MSG lpMsg;
while(p_stVideoHandle->ucMode==C_VDO_PLAY)
{
while(PeekMessage(&lpMsg,NULL,0,0,PM_REMOVE))
//while(GetMessage(&lpMsg,NULL,0,0))
{
TranslateMessage(&lpMsg);
DispatchMessage(&lpMsg);
}
}
VDO_fn_xStopVideoMPEG(p_stVideoHandle);
}
return;
}/*VDO_fn_xPlayVideoMPEG*/
/* ##F===================================================================================
NAME : VDO_fn_xOpenVideoMPEG
DESCRIPTION : Open a MPEG video file
INPUT : *szFilename (name of the file)
OUTPUT : handle of the video object
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
VDO_tdxHandleToVideo VDO_fn_xOpenVideoMPEG(char *szFilename)
{
MCIERROR mciErrorCode;
char szExtension[32];
VDO_tdxHandleToVideo p_stVideoHandle;
strcpy(szExtension, szFilename + strlen(szFilename) - 3);
//p_stVideoHandle=(VDO_tdxHandleToVideo)M_p_GameMalloc(E_ucGameMiscMemory,sizeof(struct tdstVideo_));
GEO_M_CPAMalloc( p_stVideoHandle, VDO_tdxHandleToVideo , sizeof(struct tdstVideo_),E_uwGEONotEnoughtMemory);
p_stVideoHandle->ucMode = C_VDO_ERROR;
//--- Get the device type into the WIN.INI file
char szDeviceType[1024];
GetProfileString(
"mci extensions", // address of section name
szExtension, // address of key name
"avivideo", // address of default string
szDeviceType, // address of destination buffer
1024); // size of destination buffer
// Here begin hard stuffs:
// For each command, fill a structure with parameters....
// Param for opening
MCI_OPEN_PARMS mciOpeningParameters;
// Callback: procedure to set for notifications.
mciOpeningParameters.dwCallback = NULL;
// This value is set by the driver
mciOpeningParameters.wDeviceID = 0;
// Type for opening
mciOpeningParameters.lpstrDeviceType = szDeviceType;
// Corresponding element
mciOpeningParameters.lpstrElementName = szFilename;//szRealFileName;
// Alias for SendString calls...
mciOpeningParameters.lpstrAlias = "Movie Test";
// Send the command
mciErrorCode=mciSendCommand( 0, MCI_OPEN, MCI_WAIT | MCI_OPEN_TYPE | MCI_OPEN_ELEMENT | MCI_OPEN_ALIAS, (DWORD) &mciOpeningParameters );
// Test if error appeared
if(mciErrorCode==0)
{
p_stVideoHandle->ucMode = C_VDO_LOADED;
p_stVideoHandle->hDeviceId = mciOpeningParameters.wDeviceID;
}
else
{
VDO_fn_xCloseVideo(p_stVideoHandle);
return NULL;
}
VDO_fn_hCreateVideoWindowMPEG(p_stVideoHandle,1);
// Attach the window for the device
MCI_DGV_WINDOW_PARMS mciWindowParameters;
mciWindowParameters.dwCallback = NULL;
mciWindowParameters.hWnd = p_stVideoHandle->hVideoWindow;
mciErrorCode=mciSendCommand( p_stVideoHandle->hDeviceId, MCI_WINDOW, MCI_WAIT | MCI_DGV_WINDOW_HWND, (DWORD) &mciWindowParameters );
// Test if error appeared
if(mciErrorCode==0)
{
p_stVideoHandle->ucMode = C_VDO_STOP;
VDO_fn_vAddVideoHandleToGlobalList(p_stVideoHandle);
}
else
{
VDO_fn_xCloseVideoMPEG(p_stVideoHandle);
return NULL;
}
return p_stVideoHandle;
}/*VDO_fn_xOpenVideoMPEG*/
/* ##F===================================================================================
NAME : VDO_fn_xStopVideoMPEG
DESCRIPTION : Stop a MPEG video
INPUT : p_stVideoHandle (handle of the video object)
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
void VDO_fn_xStopVideoMPEG(VDO_tdxHandleToVideo p_stVideoHandle)
{
MCIERROR mciErrorCode=1;
if(p_stVideoHandle!=NULL)
{
if((p_stVideoHandle->ucMode!=C_VDO_NONE)&&(p_stVideoHandle->ucMode!=C_VDO_ERROR))
{
MCI_GENERIC_PARMS mciParameters;
mciParameters.dwCallback = NULL;
mciErrorCode=mciSendCommand( p_stVideoHandle->hDeviceId, MCI_STOP, MCI_WAIT, (DWORD)&mciParameters );
}
}
p_stVideoHandle->ucMode = C_VDO_ERROR;
if(mciErrorCode==0)
{
p_stVideoHandle->ucMode = C_VDO_STOP;
}
else
{
return;
}
return;
}/*VDO_fn_xStopVideoMPEG*/
/* ##F===================================================================================
NAME : VDO_fn_xCloseVideoMPEG
DESCRIPTION : Close a MPEG video file
INPUT : p_stVideoHandle (handle of the video object)
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
void VDO_fn_xCloseVideoMPEG(VDO_tdxHandleToVideo p_stVideoHandle)
{
MCIERROR mciErrorCode;
ReleaseCapture();
MCI_GENERIC_PARMS mciParameters;
mciParameters.dwCallback = NULL;
// Free the mci device
if(p_stVideoHandle!=NULL)
{
if(p_stVideoHandle->ucMode!=C_VDO_ERROR)
{
mciErrorCode=mciSendCommand( p_stVideoHandle->hDeviceId, MCI_CLOSE, MCI_WAIT, (DWORD)&mciParameters );
VDO_fn_vRemoveVideoHandleFromGlobalList(p_stVideoHandle);
DestroyWindow( p_stVideoHandle->hVideoWindow );
GEO_M_CPAFree(p_stVideoHandle);
SetForegroundWindow((AfxGetApp()->m_pMainWnd)->m_hWnd);
//UnregisterClass( "Classe MCI TT\0", AfxGetInstanceHandle() );
}
}
}/*VDO_fn_xCloseVideoMPEG*/

View File

@@ -0,0 +1,181 @@
/* ##H_FILE#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FILE : mng_win.h
DESCRIPTION : Include file of VDO module
VERSION : 1.00/Nicolas Meyer/Creation
Nota Bene : This file is only portable on PC platform
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#if !defined(_mng_win_h_)
#define _mng_win_h_
#undef CPA_EXPORT
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif
/* ##CONSTANTE#--------------------------------------------------------------------------
Constantes declaration
---------------------------------------------------------------------------------------*/
#define C_VDO_NONE 0
#define C_VDO_STOP 1
#define C_VDO_PLAY 2
#define C_VDO_PAUSE 3
#define C_VDO_LOADED 4
#define C_VDO_ERROR 5
#define C_VDO_FULLSCREEN 0
#define C_VDO_WINDOWED 1
#define C_VDO_MAXOPENVIDEO 4
/* ##TYPEDEF#----------------------------------------------------------------------------
Types definition
---------------------------------------------------------------------------------------*/
/* ##-###########################
## *VDO_tdxHandleToVideo
############################## */
typedef struct tdstVideo_ *VDO_tdxHandleToVideo;
/* ##-###########################
## tdstVideo
############################## */
typedef struct tdstVideo_
{
HWND hVideoWindow;
MCIDEVICEID hDeviceId;
unsigned char ucMode;
} tdstVideo;
/*#define VDO_tdxHandleToVideo HWND; */
extern "C"
{
/* ##F===================================================================================
NAME : VDO_fn_szGetCommandLine
DESCRIPTION : Get the command line in VDO
INPUT :
OUTPUT : string
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
extern CPA_EXPORT char * VDO_fn_szGetCommandLine();
/* ##F===================================================================================
NAME : VDO_fn_vInitVideo
DESCRIPTION : Init the video window
INPUT :
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
extern CPA_EXPORT void VDO_fn_vInitVideo();
/* ##F===================================================================================
NAME : VDO_fn_vDesInitVideo
DESCRIPTION : Desinit the video window in VDO
INPUT :
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
extern CPA_EXPORT void VDO_fn_vDesInitVideo();
/* ##F===================================================================================
NAME : VDO_fn_xOpenVideo
DESCRIPTION : Open the video file in VDO
INPUT : *szFilename (name of the video)
OUTPUT : handle of object video
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
extern CPA_EXPORT VDO_tdxHandleToVideo VDO_fn_xOpenVideo(char *szFilename);
/* ##F===================================================================================
NAME : VDO_fn_xPlayVideo
DESCRIPTION : Play the video in VDO
INPUT : p_stVideoHandle (handle of the video object)
ucMode (playing mode)
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
extern CPA_EXPORT void VDO_fn_xPlayVideo(VDO_tdxHandleToVideo p_stVideoHandle, unsigned char ucMode);
/* ##F===================================================================================
NAME : VDO_fn_xStopVideo
DESCRIPTION : Stop the video in VDO
INPUT : p_stVideoHandle (handle of the video object)
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
extern CPA_EXPORT void VDO_fn_xStopVideo(VDO_tdxHandleToVideo p_stVideoHandle);
/* ##F===================================================================================
NAME : VDO_fn_xCloseVideo
DESCRIPTION : Close the video file in VDO
INPUT : p_stVideoHandle (handle of the video object)
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
extern CPA_EXPORT void VDO_fn_xCloseVideo(VDO_tdxHandleToVideo p_stVideoHandle);
/* ##F===================================================================================
NAME : VDO_fn_xOpenVideoMPEG
DESCRIPTION : Open a MPEG video file
INPUT : *szFilename (name of the file)
OUTPUT : handle of the video object
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
extern CPA_EXPORT VDO_tdxHandleToVideo VDO_fn_xOpenVideoMPEG(char *szFilename);
/* ##F===================================================================================
NAME : VDO_fn_xPlayVideoMPEG
DESCRIPTION : Play a MPEG video
INPUT : p_stVideoHandle (handle of the video object)
ucMode (playing mode)
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
extern CPA_EXPORT void VDO_fn_xPlayVideoMPEG(VDO_tdxHandleToVideo p_stVideoHandle, unsigned char ucMode);
/* ##F===================================================================================
NAME : VDO_fn_xStopVideoMPEG
DESCRIPTION : Stop a MPEG video
INPUT : p_stVideoHandle (handle of the video object)
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
extern CPA_EXPORT void VDO_fn_xStopVideoMPEG(VDO_tdxHandleToVideo p_stVideoHandle);
/* ##F===================================================================================
NAME : VDO_fn_xCloseVideoMPEG
DESCRIPTION : Close a MPEG video file
INPUT : p_stVideoHandle (handle of the video object)
OUTPUT :
=========================================================================================
CREATION : Nicolas Meyer
=======================================================================================*/
extern CPA_EXPORT void VDO_fn_xCloseVideoMPEG(VDO_tdxHandleToVideo p_stVideoHandle);
}
#endif /* _mng_win_h_ */

View File

@@ -0,0 +1,5 @@
SCC = This is a Source Code Control file
[Vdo.dsp]
SCC_Aux_Path = "\\srvprojets-ma\Rayman4_DS\Versions\Rayman4DS\Tools"
SCC_Project_Name = "$/CPA/tempgrp/VDO", XGTAAAAA