aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UVideo.pas
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-05-14 08:55:29 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-05-14 08:55:29 +0000
commitd018df2903bb8952b9c452ad7f3ec8f6232155d5 (patch)
treed6cbed2edd108ca01c2c6c19849bda1b1fb5021f /Game/Code/Classes/UVideo.pas
parent63f6acfaa23d1404cea29c1b8492b095c03d2a93 (diff)
downloadusdx-d018df2903bb8952b9c452ad7f3ec8f6232155d5.tar.gz
usdx-d018df2903bb8952b9c452ad7f3ec8f6232155d5.tar.xz
usdx-d018df2903bb8952b9c452ad7f3ec8f6232155d5.zip
- bugfix: LoadTexture() did not initialize the TTexture result before it was returned in an error case, so for example the TexNum field was set to some undefined result. This bugfix also fixes the videoBG whitescreen bug. Probably it is better to convert TTexture from a record to a class, so we can do the initialization stuff in a constructor and free assigned textures (TexNum) in the destructor with glDeleteTextures. This may help with theme-switching too.
- added glext in UVideo.pas for GL_BGR, needed for accelerated colorspace conversion with swscale. This is disabled by default because it did not speed up that much in windows (also it was not slower). In Linux it seems to speeds up very well. 3ms instead of 7ms per frame. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1091 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes/UVideo.pas')
-rw-r--r--Game/Code/Classes/UVideo.pas61
1 files changed, 31 insertions, 30 deletions
diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas
index fbe3ec32..d29b713b 100644
--- a/Game/Code/Classes/UVideo.pas
+++ b/Game/Code/Classes/UVideo.pas
@@ -47,6 +47,7 @@ uses
{$ENDIF}
math,
gl,
+ glext,
SysUtils,
UCommon,
UConfig,
@@ -255,36 +256,36 @@ begin
if (errnum < 0) then
begin
// failed to read a frame, check reason
-
- {$IF (LIBAVFORMAT_VERSION_MAJOR >= 52)}
- pbIOCtx := VideoFormatContext^.pb;
- {$ELSE}
- pbIOCtx := @VideoFormatContext^.pb;
- {$IFEND}
-
- // check for end-of-file (eof is not an error)
- if (url_feof(pbIOCtx) <> 0) then
- begin
- EOF := true;
- Exit;
- end;
-
- // check for errors
- if (url_ferror(pbIOCtx) <> 0) then
- Exit;
-
+
+ {$IF (LIBAVFORMAT_VERSION_MAJOR >= 52)}
+ pbIOCtx := VideoFormatContext^.pb;
+ {$ELSE}
+ pbIOCtx := @VideoFormatContext^.pb;
+ {$IFEND}
+
+ // check for end-of-file (eof is not an error)
+ if (url_feof(pbIOCtx) <> 0) then
+ begin
+ EOF := true;
+ Exit;
+ end;
+
+ // check for errors
+ if (url_ferror(pbIOCtx) <> 0) then
+ Exit;
+
// url_feof() does not detect an EOF for some mov-files (e.g. deluxe.mov)
// so we have to do it this way.
if ((VideoFormatContext^.file_size <> 0) and
(pbIOCtx^.pos >= VideoFormatContext^.file_size)) then
begin
EOF := true;
- Exit;
+ Exit;
end;
// no error -> wait for user input
- SDL_Delay(100);
- continue;
+ SDL_Delay(100);
+ continue;
end;
// if we got a packet from the video stream, then decode it
@@ -654,15 +655,15 @@ begin
end;
// set debug options
- VideoCodecContext^.debug_mv := 0;
- VideoCodecContext^.debug := 0;
-
- // detect bug-workarounds automatically
- VideoCodecContext^.workaround_bugs := FF_BUG_AUTODETECT;
- // error resilience strategy (careful/compliant/agressive/very_aggressive)
- //VideoCodecContext^.error_resilience := FF_ER_CAREFUL; //FF_ER_COMPLIANT;
- // allow non spec compliant speedup tricks.
- //VideoCodecContext^.flags2 := VideoCodecContext^.flags2 or CODEC_FLAG2_FAST;
+ VideoCodecContext^.debug_mv := 0;
+ VideoCodecContext^.debug := 0;
+
+ // detect bug-workarounds automatically
+ VideoCodecContext^.workaround_bugs := FF_BUG_AUTODETECT;
+ // error resilience strategy (careful/compliant/agressive/very_aggressive)
+ //VideoCodecContext^.error_resilience := FF_ER_CAREFUL; //FF_ER_COMPLIANT;
+ // allow non spec compliant speedup tricks.
+ //VideoCodecContext^.flags2 := VideoCodecContext^.flags2 or CODEC_FLAG2_FAST;
errnum := avcodec_open(VideoCodecContext, VideoCodec);
if (errnum < 0) then