aboutsummaryrefslogtreecommitdiffstats
path: root/Game
diff options
context:
space:
mode:
Diffstat (limited to 'Game')
-rw-r--r--Game/Code/Classes/UAudioDecoder_FFMpeg.pas44
-rw-r--r--Game/Code/Classes/UMusic.pas4
2 files changed, 34 insertions, 14 deletions
diff --git a/Game/Code/Classes/UAudioDecoder_FFMpeg.pas b/Game/Code/Classes/UAudioDecoder_FFMpeg.pas
index 18d6c03b..e692df6f 100644
--- a/Game/Code/Classes/UAudioDecoder_FFMpeg.pas
+++ b/Game/Code/Classes/UAudioDecoder_FFMpeg.pas
@@ -110,7 +110,7 @@ type
audio_buf : TAudioBuffer;
procedure Lock(); {$IFDEF HasInline}inline;{$ENDIF}
- procedure Unlock(); {$IFDEF HasInline}inline;{$ENDIF}
+ procedure Unlock(); {$IFDEF HasInline}inline;{$ENDIF}
function GetLockMutex(): PSDL_Mutex; {$IFDEF HasInline}inline;{$ENDIF}
procedure ParseAudio();
@@ -119,7 +119,7 @@ type
public
constructor Create(pFormatCtx: PAVFormatContext;
pCodecCtx: PAVCodecContext; pCodec: PAVCodec;
- ffmpegStreamID : Integer; ffmpegStream: PAVStream);
+ ffmpegStreamIndex: Integer; ffmpegStream: PAVStream);
destructor Destroy(); override;
procedure Close(); override;
@@ -154,7 +154,7 @@ var
constructor TFFMpegDecodeStream.Create(pFormatCtx: PAVFormatContext;
pCodecCtx: PAVCodecContext; pCodec: PAVCodec;
- ffmpegStreamID : Integer; ffmpegStream: PAVStream);
+ ffmpegStreamIndex : Integer; ffmpegStream: PAVStream);
begin
inherited Create();
@@ -229,14 +229,14 @@ begin
end;
procedure TFFMpegDecodeStream.Lock();
-begin
- SDL_mutexP(internalLock);
-end;
-
-procedure TFFMpegDecodeStream.Unlock();
-begin
- SDL_mutexV(internalLock);
-end;
+begin
+ SDL_mutexP(internalLock);
+end;
+
+procedure TFFMpegDecodeStream.Unlock();
+begin
+ SDL_mutexV(internalLock);
+end;
function TFFMpegDecodeStream.GetLockMutex(): PSDL_Mutex;
begin
@@ -634,6 +634,7 @@ begin
{$ENDIF}
ffmpegStreamID := FindAudioStreamIndex(pFormatCtx);
+ //Writeln('ID: ' + inttostr(ffmpegStreamID));
if (ffmpegStreamID < 0) then
exit;
@@ -649,7 +650,26 @@ begin
exit;
end;
- avcodec_open(pCodecCtx, pCodec);
+ // set debug options
+ pCodecCtx^.debug_mv := 0;
+ pCodecCtx^.debug := 0;
+
+ // detect bug-workarounds automatically
+ pCodecCtx^.workaround_bugs := FF_BUG_AUTODETECT;
+
+ // TODO: Not sure if these fields are for audio too
+ //pCodecCtx^.lowres := lowres;
+ //if (fast) then pCodecCtx^.flags2 := pCodecCtx^.flags2 or CODEC_FLAG2_FAST;
+ //pCodecCtx^.skip_frame := skip_frame;
+ //pCodecCtx^.skip_loop_filter := skip_loop_filter;
+ //pCodecCtx^.error_resilience := error_resilience;
+ //pCodecCtx^.error_concealment := error_concealment;
+
+ if (avcodec_open(pCodecCtx, pCodec) < 0) then
+ begin
+ Log.LogStatus('avcodec_open failed!', 'UAudio_FFMpeg');
+ exit;
+ end;
//WriteLn( 'Opened the codec' );
stream := TFFMpegDecodeStream.Create(pFormatCtx, pCodecCtx, pCodec,
diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas
index 699cfa23..e2538c9d 100644
--- a/Game/Code/Classes/UMusic.pas
+++ b/Game/Code/Classes/UMusic.pas
@@ -89,10 +89,10 @@ type
const
FFTSize = 512; // size of FFT data (output: FFTSize/2 values)
type
- TFFTData = array[0..(FFTSize div 2-1)] of Single;
+ TFFTData = array[0..(FFTSize div 2)-1] of Single;
type
- TPCMStereoSample = array[0..1] of Smallint;
+ TPCMStereoSample = array[0..1] of SmallInt;
TPCMData = array[0..511] of TPCMStereoSample;
type