From b74578a2ad4940b467056d75a6888cda13960ddf Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 8 Nov 2010 08:33:31 +0000 Subject: - fix audio-converter initialization - constructors must be public in pascal git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@2714 b956fd51-792f-4845-bead-9b4dfca2ff2c --- mediaplugin/src/media/UAudioConverterPlugin.pas | 27 ++++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'mediaplugin/src') diff --git a/mediaplugin/src/media/UAudioConverterPlugin.pas b/mediaplugin/src/media/UAudioConverterPlugin.pas index b6ede1fb..9a321006 100644 --- a/mediaplugin/src/media/UAudioConverterPlugin.pas +++ b/mediaplugin/src/media/UAudioConverterPlugin.pas @@ -58,17 +58,18 @@ type TPluginAudioConvertStream = class(TAudioConvertStream) private - fPluginInfo: PMediaPluginInfo; fAudioConverter: PAudioConverterInfo; fStream: PAudioConvertStream; function Init(): boolean; - protected - constructor Create(SrcFormatInfo: TAudioFormatInfo; - DstFormatInfo: TAudioFormatInfo); public + // Do not call this directly, use Open() instead + constructor Create(Info: PAudioConverterInfo; + SrcFormatInfo: TAudioFormatInfo; + DstFormatInfo: TAudioFormatInfo); destructor Destroy(); override; - class function Open(SrcFormatInfo: TAudioFormatInfo; + class function Open(Info: PAudioConverterInfo; + SrcFormatInfo: TAudioFormatInfo; DstFormatInfo: TAudioFormatInfo): TPluginAudioConvertStream; function Convert(InputBuffer: PByteArray; OutputBuffer: PByteArray; var InputSize: integer): integer; override; @@ -111,15 +112,20 @@ end; function TAudioConverterPlugin.Open(SrcFormatInfo: TAudioFormatInfo; DstFormatInfo: TAudioFormatInfo): TAudioConvertStream; begin - Result := TPluginAudioConvertStream.Open(SrcFormatInfo, DstFormatInfo); + Result := TPluginAudioConvertStream.Open( + fPluginInfo.audioConverter, + SrcFormatInfo, DstFormatInfo); end; { TAudioConverterPlugin } -constructor TPluginAudioConvertStream.Create(SrcFormatInfo: TAudioFormatInfo; +constructor TPluginAudioConvertStream.Create( + Info: PAudioConverterInfo; + SrcFormatInfo: TAudioFormatInfo; DstFormatInfo: TAudioFormatInfo); begin inherited Create(SrcFormatInfo, DstFormatInfo); + fAudioConverter := Info; end; destructor TPluginAudioConvertStream.Destroy(); @@ -129,13 +135,15 @@ begin inherited; end; -class function TPluginAudioConvertStream.Open(SrcFormatInfo: TAudioFormatInfo; +class function TPluginAudioConvertStream.Open( + Info: PAudioConverterInfo; + SrcFormatInfo: TAudioFormatInfo; DstFormatInfo: TAudioFormatInfo): TPluginAudioConvertStream; var Stream: TPluginAudioConvertStream; begin Result := nil; - Stream := TPluginAudioConvertStream.Create(SrcFormatInfo, DstFormatInfo); + Stream := TPluginAudioConvertStream.Create(Info, SrcFormatInfo, DstFormatInfo); if (not Stream.Init()) then begin Stream.Free; @@ -150,7 +158,6 @@ var CDstFormatInfo: TCAudioFormatInfo; begin Result := false; - fAudioConverter := fPluginInfo.audioConverter; AudioFormatInfoToCStruct(SrcFormatInfo, CSrcFormatInfo); AudioFormatInfoToCStruct(DstFormatInfo, CDstFormatInfo); -- cgit v1.2.3