Vidplayer should lock SDL surfaces while accessing the pixel data directly

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2838 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2007-08-13 18:45:39 +00:00
parent aea05211ec
commit c0fe98d42b
3 changed files with 30 additions and 3 deletions
+5 -2
View File
@@ -529,8 +529,6 @@ dukv_RenderFrame (THIS_PTR)
default:
;
}
if (!This->audio_synced)
This->callbacks.SetTimer (This, (uint32) (1000.0f / DUCK_GENERAL_FPS));
}
static const char*
@@ -701,7 +699,12 @@ dukv_DecodeNext (THIS_PTR)
dukv->iframe++;
This->callbacks.BeginFrame (This);
dukv_RenderFrame (This);
This->callbacks.EndFrame (This);
if (!This->audio_synced)
This->callbacks.SetTimer (This, (uint32) (1000.0f / DUCK_GENERAL_FPS));
return 1;
}
+3 -1
View File
@@ -49,7 +49,9 @@ typedef struct tfb_videodecoderfunc
// from the player
typedef struct tfb_videocallbacks
{
// any decoder calls this
// any decoder calls these
void (* BeginFrame) (THIS_PTR);
void (* EndFrame) (THIS_PTR);
void* (* GetCanvasLine) (THIS_PTR, uint32 line);
// non-audio-driven decoders call this to figure out
// when the next frame should be drawn
+22
View File
@@ -25,6 +25,8 @@
#include "libs/log.h"
// video callbacks
static void vp_BeginFrame (TFB_VideoDecoder*);
static void vp_EndFrame (TFB_VideoDecoder*);
static void* vp_GetCanvasLine (TFB_VideoDecoder*, uint32 line);
static uint32 vp_GetTicks (TFB_VideoDecoder*);
static bool vp_SetTimer (TFB_VideoDecoder*, uint32 msecs);
@@ -32,6 +34,8 @@ static bool vp_SetTimer (TFB_VideoDecoder*, uint32 msecs);
TFB_VideoCallbacks vp_DecoderCBs =
{
vp_BeginFrame,
vp_EndFrame,
vp_GetCanvasLine,
vp_GetTicks,
vp_SetTimer
@@ -472,6 +476,24 @@ TFB_VideoInput (VIDEO_REF VidRef)
DoInput (&vis, TRUE);
}
static void
vp_BeginFrame (TFB_VideoDecoder* decoder)
{
TFB_VideoClip* vid = (TFB_VideoClip*) decoder->data;
if (vid)
TFB_DrawCanvas_Lock (vid->frame->NormalImg);
}
static void
vp_EndFrame (TFB_VideoDecoder* decoder)
{
TFB_VideoClip* vid = (TFB_VideoClip*) decoder->data;
if (vid)
TFB_DrawCanvas_Unlock (vid->frame->NormalImg);
}
static void*
vp_GetCanvasLine (TFB_VideoDecoder* decoder, uint32 line)
{