Changed VIDEO_REF from a DWORD to a pointer to an opaque structure.

This should provide better 64-bit cleanliness, and it also puts it in
line with the rest of the resources.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3100 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2008-11-29 00:50:53 +00:00
parent d1832e6f66
commit 5417b9f06a
3 changed files with 16 additions and 22 deletions
+4 -7
View File
@@ -76,11 +76,10 @@ VidPlaying ()
} }
VIDEO_TYPE VIDEO_TYPE
VidPlayEx (VIDEO_REF VidRef, MUSIC_REF AudRef, MUSIC_REF SpeechRef, VidPlayEx (VIDEO_REF vid, MUSIC_REF AudRef, MUSIC_REF SpeechRef,
DWORD LoopFrame) DWORD LoopFrame)
{ {
VIDEO_TYPE ret; VIDEO_TYPE ret;
TFB_VideoClip* vid = (TFB_VideoClip*) VidRef;
if (!vid) if (!vid)
return NO_FMV; return NO_FMV;
@@ -108,10 +107,10 @@ VidPlayEx (VIDEO_REF VidRef, MUSIC_REF AudRef, MUSIC_REF SpeechRef,
LockMutex (GraphicsLock); LockMutex (GraphicsLock);
SetContext (ScreenContext); SetContext (ScreenContext);
// play video in the center of the screen // play video in the center of the screen
if (TFB_PlayVideo (VidRef, (SCREEN_WIDTH - vid->w) / 2, if (TFB_PlayVideo (vid, (SCREEN_WIDTH - vid->w) / 2,
(SCREEN_HEIGHT - vid->h) / 2)) (SCREEN_HEIGHT - vid->h) / 2))
{ {
_cur_video = VidRef; _cur_video = vid;
ret = SOFTWARE_FMV; ret = SOFTWARE_FMV;
if (SpeechRef) if (SpeechRef)
{ {
@@ -162,10 +161,8 @@ _init_video_file (const char *pStr)
} }
BOOLEAN BOOLEAN
DestroyVideo (VIDEO_REF VideoRef) DestroyVideo (VIDEO_REF vid)
{ {
TFB_VideoClip* vid = (TFB_VideoClip*) VideoRef;
if (!vid) if (!vid)
return FALSE; return FALSE;
+9 -14
View File
@@ -283,9 +283,8 @@ video_play_task (void *data)
} }
bool bool
TFB_PlayVideo (VIDEO_REF VidRef, uint32 x, uint32 y) TFB_PlayVideo (VIDEO_REF vid, uint32 x, uint32 y)
{ {
TFB_VideoClip* vid = (TFB_VideoClip*) VidRef;
RECT scrn_r; RECT scrn_r;
RECT clip_r = {{0, 0}, {vid->w, vid->h}}; RECT clip_r = {{0, 0}, {vid->w, vid->h}};
RECT vid_r = {{0, 0}, {SCREEN_WIDTH, SCREEN_HEIGHT}}; RECT vid_r = {{0, 0}, {SCREEN_WIDTH, SCREEN_HEIGHT}};
@@ -368,7 +367,7 @@ TFB_PlayVideo (VIDEO_REF VidRef, uint32 x, uint32 y)
{ {
vid->playing = false; vid->playing = false;
ClearSemaphore (vp_interthread_lock); ClearSemaphore (vp_interthread_lock);
TFB_StopVideo (VidRef); TFB_StopVideo (vid);
return false; return false;
} }
@@ -377,10 +376,8 @@ TFB_PlayVideo (VIDEO_REF VidRef, uint32 x, uint32 y)
} }
void void
TFB_StopVideo (VIDEO_REF VidRef) TFB_StopVideo (VIDEO_REF vid)
{ {
TFB_VideoClip* vid = (TFB_VideoClip*) VidRef;
if (!vid) if (!vid)
return; return;
@@ -406,10 +403,8 @@ TFB_StopVideo (VIDEO_REF VidRef)
} }
bool bool
TFB_VideoPlaying (VIDEO_REF VidRef) TFB_VideoPlaying (VIDEO_REF vid)
{ {
TFB_VideoClip* vid = (TFB_VideoClip*) VidRef;
if (!vid) if (!vid)
return false; return false;
@@ -420,7 +415,7 @@ static BOOLEAN
TFB_DoVideoInput (void *pIS) TFB_DoVideoInput (void *pIS)
{ {
VIDEO_INPUT_STATE* pVIS = (VIDEO_INPUT_STATE*) pIS; VIDEO_INPUT_STATE* pVIS = (VIDEO_INPUT_STATE*) pIS;
TFB_VideoClip* vid = (TFB_VideoClip*) pVIS->CurVideo; TFB_VideoClip* vid = pVIS->CurVideo;
if (!pVIS->CurVideo || !TFB_VideoPlaying (pVIS->CurVideo)) if (!pVIS->CurVideo || !TFB_VideoPlaying (pVIS->CurVideo))
return FALSE; return FALSE;
@@ -478,7 +473,7 @@ TFB_VideoInput (VIDEO_REF VidRef)
static void static void
vp_BeginFrame (TFB_VideoDecoder* decoder) vp_BeginFrame (TFB_VideoDecoder* decoder)
{ {
TFB_VideoClip* vid = (TFB_VideoClip*) decoder->data; TFB_VideoClip* vid = decoder->data;
if (vid) if (vid)
TFB_DrawCanvas_Lock (vid->frame->NormalImg); TFB_DrawCanvas_Lock (vid->frame->NormalImg);
@@ -487,7 +482,7 @@ vp_BeginFrame (TFB_VideoDecoder* decoder)
static void static void
vp_EndFrame (TFB_VideoDecoder* decoder) vp_EndFrame (TFB_VideoDecoder* decoder)
{ {
TFB_VideoClip* vid = (TFB_VideoClip*) decoder->data; TFB_VideoClip* vid = decoder->data;
if (vid) if (vid)
TFB_DrawCanvas_Unlock (vid->frame->NormalImg); TFB_DrawCanvas_Unlock (vid->frame->NormalImg);
@@ -496,7 +491,7 @@ vp_EndFrame (TFB_VideoDecoder* decoder)
static void* static void*
vp_GetCanvasLine (TFB_VideoDecoder* decoder, uint32 line) vp_GetCanvasLine (TFB_VideoDecoder* decoder, uint32 line)
{ {
TFB_VideoClip* vid = (TFB_VideoClip*) decoder->data; TFB_VideoClip* vid = decoder->data;
if (!vid) if (!vid)
return NULL; return NULL;
@@ -516,7 +511,7 @@ vp_GetTicks (TFB_VideoDecoder* decoder)
static bool static bool
vp_SetTimer (TFB_VideoDecoder* decoder, uint32 msecs) vp_SetTimer (TFB_VideoDecoder* decoder, uint32 msecs)
{ {
TFB_VideoClip* vid = (TFB_VideoClip*) decoder->data; TFB_VideoClip* vid = decoder->data;
if (!vid) if (!vid)
return false; return false;
+3 -1
View File
@@ -29,7 +29,9 @@ typedef enum
SOFTWARE_FMV SOFTWARE_FMV
} VIDEO_TYPE; } VIDEO_TYPE;
typedef DWORD VIDEO_REF; struct tfb_videoclip;
typedef struct tfb_videoclip *VIDEO_REF;
extern BOOLEAN InitVideoPlayer (BOOLEAN UseCDROM); extern BOOLEAN InitVideoPlayer (BOOLEAN UseCDROM);
extern void UninitVideoPlayer (void); extern void UninitVideoPlayer (void);