aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code
diff options
context:
space:
mode:
authors_alexander <s_alexander@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-04-03 14:56:10 +0000
committers_alexander <s_alexander@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-04-03 14:56:10 +0000
commit6b0661cdb54c8764d25883065ec22697cc2d18f5 (patch)
tree3797c07bb802e5905158e7fa337f4887a43c5504 /Game/Code
parentb56ce69945c1facd50c7f3c8ee4d5042120f4012 (diff)
downloadusdx-6b0661cdb54c8764d25883065ec22697cc2d18f5.tar.gz
usdx-6b0661cdb54c8764d25883065ec22697cc2d18f5.tar.xz
usdx-6b0661cdb54c8764d25883065ec22697cc2d18f5.zip
second try to fix the problem, that the video is bigger than the screen when unsing swscale
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@999 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code')
-rw-r--r--Game/Code/Classes/UVideo.pas40
1 files changed, 21 insertions, 19 deletions
diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas
index 1db31b92..3be06c9e 100644
--- a/Game/Code/Classes/UVideo.pas
+++ b/Game/Code/Classes/UVideo.pas
@@ -386,7 +386,7 @@ begin
glDisable(GL_BLEND);
{$ifdef Info}
- if VideoSkipTime+VideoTime+VideoTimeBase < 0 then
+ if fVideoSkipTime+VideoTime+VideoTimeBase < 0 then
begin
glColor4f(0.7, 1, 0.3, 1);
SetFontStyle (1);
@@ -603,23 +603,6 @@ begin
Exit;
end;
- {$IFDEF UseSWScale}
- // what the hell it should do?
- SoftwareScaleContext:=sws_getContext(VideoCodecContext^.width,VideoCodecContext^.height,integer(VideoCodecContext^.pix_fmt),
- TexX, TexY, integer(PIX_FMT_RGB24),
- SWS_FAST_BILINEAR, nil, nil, nil);
- if SoftwareScaleContext <> Nil then
- debugwriteln('got swscale context')
- else begin
- debugwriteln('ERROR: didnīt get swscale context');
- av_free(AVFrameRGB);
- av_free(AVFrame);
- avcodec_close(VideoCodecContext);
- av_close_input_file(VideoFormatContext);
- Exit;
- end;
- {$ENDIF}
-
// this is the errnum from avpicture_fill
if errnum >=0 then
begin
@@ -641,7 +624,26 @@ begin
debugwriteln( floattostr(VideoTimeBase) );
{$ifdef DebugDisplay}
showmessage('framerate: '+inttostr(floor(1/videotimebase))+'fps');
-{$endif}
+ {$endif}
+
+ {$IFDEF UseSWScale}
+
+ // what the hell it should do?
+ SoftwareScaleContext:=sws_getContext(VideoCodecContext^.width,VideoCodecContext^.height,integer(VideoCodecContext^.pix_fmt),
+ TexX, TexY, integer(PIX_FMT_RGB24),
+ SWS_FAST_BILINEAR, nil, nil, nil);
+ if SoftwareScaleContext <> Nil then
+ writeln('got swscale context')
+ else begin
+ writeln('ERROR: didnīt get swscale context');
+ av_free(AVFrameRGB);
+ av_free(AVFrame);
+ avcodec_close(VideoCodecContext);
+ av_close_input_file(VideoFormatContext);
+ Exit;
+ end;
+ {$ENDIF}
+
// hack to get reasonable timebase (for divx and others)
if VideoTimeBase < 0.02 then // 0.02 <-> 50 fps
begin