From dcbfb30a62776ffa128f620235a8bacf6137e0d5 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 5 Dec 2007 21:52:18 +0000 Subject: - bugfix: tried to access array element -1 if video contained no audio-stream git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@670 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UVideo.pas | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Game/Code/Classes') diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 65dbc0a2..6c9458f9 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -487,7 +487,11 @@ begin writeln( 'VideoStreamIndex : ' + inttostr(VideoStreamIndex) ); writeln( 'AudioStreamIndex : ' + inttostr(AudioStreamIndex) ); end; - aCodecCtx := VideoFormatContext.streams[ AudioStreamIndex ].codec; + // FIXME: AudioStreamIndex is -1 if video has no sound -> memory access error + // Just a temporary workaround for now + aCodecCtx := nil; + if( AudioStreamIndex >= 0) then + aCodecCtx := VideoFormatContext.streams[ AudioStreamIndex ].codec; {$ifdef FFMpegAudio} // This is the audio ffmpeg audio support Jay is working on. @@ -683,11 +687,11 @@ initialization singleton_VideoFFMpeg := TVideoPlayback_ffmpeg.create(); writeln( 'UVideo_FFMpeg - Register Playback' ); - AudioManager.add( IVideoPlayback( singleton_VideoFFMpeg ) ); + AudioManager.add( singleton_VideoFFMpeg ); finalization - AudioManager.Remove( IVideoPlayback( singleton_VideoFFMpeg ) ); + AudioManager.Remove( singleton_VideoFFMpeg ); end. -- cgit v1.2.3