From af7100ef908a4ee1474a607ed255c707959222f1 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sat, 1 Sep 2007 17:42:46 +0000 Subject: ffmpeg support now with dualscreen mode git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@359 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/SMpeg/Uffmpeg.pas | 19 +++++++++++-------- Game/Code/Screens/UScreenSing.pas | 4 ++-- 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'Game') diff --git a/Game/Code/SMpeg/Uffmpeg.pas b/Game/Code/SMpeg/Uffmpeg.pas index f10f40d3..25e3f5aa 100644 --- a/Game/Code/SMpeg/Uffmpeg.pas +++ b/Game/Code/SMpeg/Uffmpeg.pas @@ -5,7 +5,8 @@ # based on 'An ffmpeg and SDL Tutorial' (http://www.dranger.com/ffmpeg/) # #############################################################################} -//{$define DebugDisplay} +//{$define DebugDisplay} // uncomment if u want to see the debug stuff +//{$define DebugFrames} unit Uffmpeg; @@ -17,7 +18,7 @@ procedure Init; procedure FFmpegOpenFile(FileName: pAnsiChar); procedure FFmpegClose; procedure FFmpegGetFrame(Time: Extended); -procedure FFmpegDrawGL; +procedure FFmpegDrawGL(Screen: integer); procedure FFmpegTogglePause; procedure FFmpegSkip(Time: Single); @@ -197,7 +198,7 @@ begin 'TimeDiff: '+inttostr(floor(TimeDifference*1000))); } if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then begin -{$ifdef DebugDisplay} +{$ifdef DebugFrames} // frame delay debug display GoldenRec.Spawn(200,15,1,16,0,-1,ColoredStar,$00ff00); {$endif} @@ -212,7 +213,7 @@ begin VideoTime:=VideoTime+VideoTimeBase; TimeDifference:=myTime-VideoTime; if TimeDifference >= 3*VideoTimeBase then begin // skip frames -{$ifdef DebugDisplay} +{$ifdef DebugFrames} //frame drop debug display GoldenRec.Spawn(200,55,1,16,0,-1,ColoredStar,$ff0000); {$endif} @@ -257,7 +258,7 @@ begin glTexImage2D(GL_TEXTURE_2D, 0, 3, dataX, dataY, 0, GL_RGB, GL_UNSIGNED_BYTE, TexData); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -{$ifdef DebugDisplay} +{$ifdef DebugFrames} //frame decode debug display GoldenRec.Spawn(200,35,1,16,0,-1,ColoredStar,$ffff00); {$endif} @@ -265,11 +266,13 @@ begin end; end; -procedure FFmpegDrawGL; +procedure FFmpegDrawGL(Screen: integer); begin if not VideoOpened then Exit; - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + if Screen=1 then begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end; glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glColor4f(1, 1, 1, 1); diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 4bf405f6..6ce19c17 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -744,7 +744,7 @@ begin begin try FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL; + FFmpegDrawGL(ScreenAct); // PlaySmpeg; except //If an Error occurs Reading Video: prevent Video from being Drawn again and Close Video @@ -1072,7 +1072,7 @@ begin // todo: find a way to determine, when a new frame is needed // toto: same for the need to skip frames FFmpegGetFrame(Czas.Teraz); - FFmpegDrawGL; + FFmpegDrawGL(ScreenAct); except //If an Error occurs drawing: prevent Video from being Drawn again and Close Video AktSong.VideoLoaded := False; -- cgit v1.2.3