diff --git a/components/acs/Src/classes/acs_audio.pas b/components/acs/Src/classes/acs_audio.pas new file mode 100644 index 000000000..bcedf2e1a --- /dev/null +++ b/components/acs/Src/classes/acs_audio.pas @@ -0,0 +1,830 @@ +(* + this file is a part of audio components suite + see the license file for more details. + you can contact me at mail@z0m3ie.de + +$Log: acs_audio.pas,v $ +Revision 1.12 2006/07/07 15:51:19 z0m3ie +*** empty log message *** + +Revision 1.11 2006/07/04 18:38:32 z0m3ie +*** empty log message *** + +Revision 1.10 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.4 2006/01/02 18:54:46 z0m3ie +*** empty log message *** + +Revision 1.3 2006/01/01 18:46:40 z0m3ie +*** empty log message *** + +Revision 1.2 2005/12/26 17:31:38 z0m3ie +fixed some problems in acs_dsfiles +fixed some problems in acs_vorbis +reworked all buffers + +Revision 1.1 2005/12/19 18:34:35 z0m3ie +*** empty log message *** + +Revision 1.14 2005/12/18 17:01:54 z0m3ie +delphi compatibility + +Revision 1.13 2005/12/04 16:54:33 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.12 2005/11/28 21:57:24 z0m3ie +mostly FileOut fixes +moved PBuffer to PBuffer8 +set all to dynamically Buffering + +Revision 1.11 2005/11/27 16:50:33 z0m3ie +add ACS VolumeQuerry +make ACS_VolumeQuerry localizeable +some little errorfixes (buffersize for linuxdrivers was initially 0) +make TAudioIn workable + +Revision 1.10 2005/10/02 16:51:46 z0m3ie +*** empty log message *** + +Revision 1.9 2005/09/23 14:04:58 z0m3ie +*** empty log message *** + +Revision 1.8 2005/09/18 19:28:59 z0m3ie +more progress on driver handling + +Revision 1.7 2005/09/16 17:34:29 z0m3ie +*** empty log message *** + +Revision 1.6 2005/09/15 20:59:37 z0m3ie +start translate the documentation in the source for pasdoc + +Revision 1.5 2005/09/14 21:19:37 z0m3ie +*** empty log message *** + +Revision 1.4 2005/09/13 21:54:11 z0m3ie +acs is localizeable now (ACS_Strings) + +Revision 1.3 2005/09/13 20:14:52 z0m3ie +driver handling classes (basic audio class) +*) + +{ +@abstract(this unit introduces the base classes for acs) +@author(Andrei Borovsky (2003-2005)) +@author(Christian Ulrich (2005)) +} + +unit acs_audio; + +interface + +uses + ACS_Types, ACS_Classes,Classes,ACS_Strings,SysUtils; + +type + { Audio Formats used in DeviceInfo record + format constants mask : af + where 1, 2, 4 means sample rate of 11025, 22050, and 44100 Hz respectively + M, S means mono or stereo, 08, 16 means 8 or 16 bits per sample. + For example, af4S16 corresponds to 44100 Hz stereo 16 bit format. + } + + TACSAudioFormat = (af1M08, af1M16, af1S08, af1S16, af2M08, af2M16, af2S08, af2S16, + af4M08, af4M16, af4S08, af4S16); + TACSAudioFormats = set of TACSAudioFormat; + TACSBaseAudioOut = class; + TACSBaseAudioIn = class; + + { This record is used to get an deviceinfo from the Drivers + } + TACSDeviceInfo = record + DeviceName : String; + DrvVersion : LongWord; + Formats : TACSAudioFormats; + Stereo : Boolean; + end; + + { This introduces an base class for the drivers + } + + { TAudioOut } + + { TACSAudioOut } + + TACSAudioOut = class(TComponent) + private + FDriver: string; + FOutput : TACSBaseAudioOut; + FInput : TACSCustomInput; + FOnDone: TACSOutputDoneEvent; + FOnProgress: TACSOutputProgressEvent; + FOnThreadException: TACSThreadExceptionEvent; + FLatency : Integer; + FBufferSize : Integer; + function GetBufferSize: Integer; + function GetBusy: Boolean; + function GetDelay: Integer; + function GetPriority: TTPriority; + function GetProgress: real; + function GetStatus: TACSOutputStatus; + function GetSuspend: Boolean; + function GetTE: Integer; + procedure SetBufferSize(const AValue: Integer); + procedure SetDelay(const AValue: Integer); + procedure SetPriority(const AValue: TTPriority); + procedure SetSuspend(const AValue: Boolean); + + procedure ThreadException(Sender : TComponent;E : Exception); + procedure OutputDone(Sender : TComponent); + procedure OutputProgress(Sender : TComponent); + protected + FBaseChannel: Integer; + FVolume: Byte; + + procedure SetInput(Input : TACSCustomInput); + + procedure SetDevice(Ch : Integer);virtual; + function GetDeviceInfo : TACSDeviceInfo;virtual; + function GetDeviceCount : Integer;virtual; + procedure SetDriver(Driver : string);virtual; + + function GetDriverName(idx : Integer) : string; + function GetDriversCount : Integer; + + procedure Done; + function DoOutput(Abort : Boolean):Boolean; + procedure Prepare; + public + constructor Create(AOwner: TComponent);override; + destructor Destroy;override; + { The result returns an deviceinfo record that can be used to enumerate devices + just set device property from 0 to DeviceCount-1 and read deviceInfo to + enumerate all Devices from current Driver + } + property DeviceInfo : TACSDeviceInfo read GetDeviceInfo; + { Returns the count of devices supported by actual driver + } + property DeviceCount : Integer read GetDeviceCount; + { This can be used to enumerate the Drivers + just use Driverscount as index it returns the DriverName + } + property Drivers[idx : Integer] : string read GetDriverName; + { Returns the total count of avalible drivers + } + property DriversCount : Integer read GetDriversCount; + { pauses the output. + } + procedure Pause;virtual; + { Resumes previously paused output. + } + procedure Resume;virtual; + { This is the most important method in the output components. + After an input component has been assigned, call Run to start audio-processing chain. + } + procedure Run; + { Stops the running output process. + } + procedure Stop; + { Output components perform output in their own threads. + Use this property to set the priority for the thread. + } + property ThreadPriority : TTPriority read GetPriority write SetPriority; + { Read Progress to get the output progress in percents. + This value is meaningful only after the input component has been set + and only if the input component can tell the size of its stream. + } + property Progress : real read GetProgress; + { This property indicates the output component's current status. Possible values are: + + tosPlaying: the component is working; + + tosPaused: the component is paused (the Pause method was called); + + tosIdle: the component is idle; + } + property Status : TACSOutputStatus read GetStatus; + property TimeElapsed : Integer read GetTE; + property Latency : Integer read FLatency; + published + { The output buffer size in bytes default is 4000 + } + property Buffersize : Integer read GetBufferSize write SetBufferSize; + { use this property to set an driver, on create of this component the driver + with lowest latency is used for default + } + property Driver : string read FDriver write SetDriver stored True; + { Use this property to set the output device + } + property Busy : Boolean read GetBusy; + property Device : Integer read FBaseChannel write SetDevice stored True; + property Volume : Byte read FVolume write FVolume; + property Input : TACSCustomInput read FInput write SetInput; + { Use this property to set the delay (in milliseconds) in output thread. + This property allows the user to reduce the stress the output thread puts + on the CPU (especially under Windows). + Be careful with this property when using TAudioOut component. + Assigning too large values to it can cause dropouts in audio playback. + } + property Delay : Integer read GetDelay write SetDelay; + property SuspendWhenIdle : Boolean read GetSuspend write SetSuspend; + property OnDone : TACSOutputDoneEvent read FOnDone write FOndone; + property OnProgress : TACSOutputProgressEvent read FOnProgress write FOnProgress; + property OnThreadException : TACSThreadExceptionEvent read FOnThreadException write FOnThreadException; + end; + + { TAudioIn } + + TACSAudioIn = class(TACSCustomInput) + private + FInput : TACSBaseAudioIn; + FDriver : string; + function GetBPS : Integer;override; + function GetCh : Integer;override; + function GetSR : Integer;override; + procedure SetDevice(Ch : Integer); + function GetDeviceInfo : TACSDeviceInfo; + function GetTotalTime : real;override; + function GetDriverName(idx : Integer) : string; + function GetDriversCount : Integer; + procedure SetDriver(Driver : string); + protected + FBPS: Integer; + FChan: Integer; + FFreq: Integer; + FRecTime: Integer; + FBaseChannel: Integer; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer;override; + procedure Init;override; + procedure Flush;override; + { The result returns an deviceinfo record that can be used to enumerate devices + just set device property from 0 to DeviceCount-1 and read deviceInfo to + enumerate all Devices from current Driver + } + property DeviceInfo : TACSDeviceInfo read GetDeviceInfo; + { This can be used to enumerate the Drivers + just use Driverscount as index it returns the DriverName + } + property Drivers[idx : Integer] : string read GetDriverName; + { Returns the total count of avalible drivers + } + property DriversCount : Integer read GetDriversCount; + published + { use this property to set an driver, on create of this component the driver + with lowest latency is used for default + } + property Driver : string read FDriver write SetDriver stored True; + { Use this property to set the output device + } + property Device : Integer read FBaseChannel write SetDevice stored True; + { Use this property to set the number of bits per sample for the input audio stream. + Possible values are 8 and 16. + } + property InBitsPerSample : Integer read GetBPS write FBPS stored True; + { Use this property to set the number of channels for the input audio stream. + Possible values are 1 (mono) and 2 (stereo). + } + property InChannels : Integer read GetCh write FChan stored True; + { Use this property to set the sample rate for the input audio stream. + Possible values are determined by the soundcard hardware. + } + property InSampleRate : Integer read GetSR write FFreq stored True; + { This property allow you to set the record duration time in seconds. + If you assign -1 to this property TAudioIn will never stop recording by itself. + In both cases you can stop recording at any time by calling Stop method of + the respective output component. + } + property RecTime : Integer read FRecTime write FRecTime stored True; + end; + + { This class is an abstract base class for the drivers + } + + { TBaseAudioOut } + + TACSBaseAudioOut = class(TACSCustomOutput) + private + FDriver: string; + FOutput : TACSAudioOut; + protected + FBaseChannel: Integer; + FVolume: Byte; + procedure SetDevice(Ch : Integer);virtual;abstract; + function GetDeviceInfo : TACSDeviceInfo;virtual;abstract; + function GetDeviceCount : Integer;virtual;abstract; + public + constructor Create(AOwner: TComponent);override; + destructor Destroy;override; + property DeviceInfo : TACSDeviceInfo read GetDeviceInfo; + property DeviceCount : Integer read GetDeviceCount; + property Buffersize : Integer read FBufferSize write FBufferSize; + published + property Device : Integer read FBaseChannel write SetDevice stored True; + property Volume : Byte read FVolume write FVolume; + end; + + { This class is an abstract base class for the drivers + } + + { TBaseAudioIn } + + TACSBaseAudioIn = class(TACSCustomInput) + private + FInput : TACSAudioIn; + FDriver : string; + protected + FBPS: Integer; + FChan: Integer; + FFreq: Integer; + FRecTime: Integer; + FBaseChannel: Integer; + procedure SetDevice(Ch : Integer);virtual;abstract; + function GetDeviceInfo : TACSDeviceInfo;virtual;abstract; + function GetDeviceCount : Integer;virtual;abstract; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + property DeviceInfo : TACSDeviceInfo read GetDeviceInfo; + published + property Device : Integer read FBaseChannel write SetDevice stored True; + property InBitsPerSample : Integer read GetBPS write FBPS stored True; + property InChannels : Integer read GetCh write FChan stored True; + property InSampleRate : Integer read GetSR write FFreq stored True; + property RecTime : Integer read FRecTime write FRecTime stored True; + end; + + TACSAudioOutClass = class of TACSBaseAudioOut; + TACSAudioInClass = class of TACSBaseAudioIn; + + TACSOutDriverinfo = record + DriverName : string; + Latency : Integer; + DrvClass : TACSAudioOutClass; + end; + + TACSInDriverinfo = record + DriverName : string; + Latency : Integer; + DrvClass : TACSAudioInClass; + end; + + { This procedure must be used to register drivers to the system + just call them at initialization of the driver main unit + } + procedure RegisterAudioOut(DrvName : string;OutClass : TACSAudioOutClass;Latency : Integer); + { This procedure must be used to register drivers to the system + just call them at initialization of the driver main unit + } + procedure RegisterAudioIn(DrvName : string;InClass : TACSAudioInClass;Latency : Integer); + +var + OutDriverInfos : array of TACSOutDriverInfo; + InDriverInfos : array of TACSInDriverInfo; + + +implementation + +{ TAudioOut } + +function TACSAudioOut.GetDelay: Integer; +begin + if Assigned(FOutput) then + Result := FOutput.GetDelay + else + Result := -1; +end; + +function TACSAudioOut.GetBufferSize: Integer; +begin + if Assigned(FOutput) then + Result := FOutput.BufferSize + else + Result := -1; +end; + +function TACSAudioOut.GetBusy: Boolean; +begin + if Assigned(FOutput) then + Result := FOutput.Busy; +end; + +function TACSAudioOut.GetPriority: TTPriority; +begin + if not Assigned(FOutput) then + raise EACSException(strNoDriverselected); + Result := FOutput.GetPriority; +end; + +function TACSAudioOut.GetProgress: real; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoDriverselected); + Result := FOutput.GetProgress; +end; + +function TACSAudioOut.GetStatus: TACSOutputStatus; +begin + if not Assigned(FOutput) then + Result := tosUndefined + else + Result := FOutput.Status; +end; + +function TACSAudioOut.GetSuspend: Boolean; +begin + if Assigned(FOutput) then + Result := FOutput.GetSuspend; +end; + +function TACSAudioOut.GetTE: Integer; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoDriverselected); + Result := FOutput.GetTE; +end; + +procedure TACSAudioOut.SetBufferSize(const AValue: Integer); +begin + if Assigned(FOutput) then + FOutput.BufferSize := AValue; + FBufferSize := AValue; +end; + +procedure TACSAudioOut.SetDelay(const AValue: Integer); +begin + if Assigned(FOutput) then + FOutput.SetDelay(AValue); +end; + +procedure TACSAudioOut.SetPriority(const AValue: TTPriority); +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoDriverselected); + FOutput.SetPriority(AValue); +end; + +procedure TACSAudioOut.SetSuspend(const AValue: Boolean); +begin + if Assigned(FOutput) then + FOutput.SetSuspend(AValue); +end; + +procedure TACSAudioOut.ThreadException(Sender: TComponent; E: Exception); +begin + if Assigned(FOnThreadException) then + FOnThreadException(Sender,E); +end; + +procedure TACSAudioOut.OutputDone(Sender: TComponent); +begin + if Assigned(FOnDone) then + FOnDone(Sender); +end; + +procedure TACSAudioOut.OutputProgress(Sender: TComponent); +begin + if Assigned(FOnProgress) then + FOnProgress(Sender); +end; + +procedure TACSAudioOut.SetInput(Input: TACSCustomInput); +begin + FInput := Input; + if Assigned(FOutput) then + FOutput.Input := Input; +end; + +procedure TACSAudioOut.SetDevice(Ch: Integer); +begin + FBaseChannel := ch; + if Assigned(FOutput) then + FOutput.SetDevice(ch); +end; + +function TACSAudioOut.GetDeviceInfo : TACSDeviceInfo; +begin + if Assigned(FOutput) then + Result := FOutput.DeviceInfo; +end; + +function TACSAudioOut.GetDeviceCount : Integer; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoDriverselected); + Result := FOutput.GetDeviceCount; +end; + +procedure TACSAudioOut.SetDriver(Driver: string); +var + i : Integer; +begin + if Driver = '' then + exit; + if Assigned(Foutput) then + FOutput.Free; + FOutput := nil; + for i := 0 to length(OutDriverInfos)-1 do + if OutDriverInfos[i].DriverName = Driver then + begin + FOutput := OutDriverInfos[i].DrvClass.Create(nil); + try + FOutput.SetDevice(FBaseChannel); + except + FOutput.SetDevice(0); + end; + FDriver := OutDriverInfos[i].DriverName; + FLatency := OutDriverInfos[i].Latency; + if Assigned(FInput) then + FOutput.Input := FInput; + FOutput.OnDone := OutputDone; + FOutput.OnProgress := OutputProgress; + Foutput.OnThreadException := ThreadException; + Foutput.Buffersize := FBuffersize; + exit; + end; +end; + +function TACSAudioOut.GetDriverName(idx: Integer): string; +begin + if (idx < 0) or (idx > length(OutDriverInfos)-1)then + exit; + Result := OutDriverInfos[idx].DriverName; +end; + +function TACSAudioOut.GetDriversCount: Integer; +begin + Result := length(OutDriverInfos); +end; + +procedure TACSAudioOut.Done; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoDriverselected); + Foutput.Done; +end; + +function TACSAudioOut.DoOutput(Abort: Boolean): Boolean; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoDriverselected); + FOutput.DoOutput(Abort); +end; + +procedure TACSAudioOut.Prepare; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoDriverselected); + FOutput.Prepare; +end; + +constructor TACSAudioOut.Create(AOwner: TComponent); +var + lowestindex,lowest,minlat,i : Integer; + tmp : string; + exc: Boolean; +label retry; +begin + inherited Create(AOwner); + minlat := 0; +retry: + lowest := 99999; + for i := 0 to length(OutDriverInfos)-1 do + if (OutDriverInfos[i].Latency < lowest) and (OutDriverInfos[i].Latency > minlat) then + begin + lowest := OutDriverInfos[i].Latency; + lowestindex := i; + end; + if lowest < 99999 then + begin + try + SetDriver(OutDriverInfos[lowestindex].DriverName); + exc := false; + except + minlat := lowest+1; + exc := true; + end; + if exc then + goto retry; + end + else + FDriver := 'No Driver'; +end; + +destructor TACSAudioOut.Destroy; +begin + FOutput.Free; + inherited Destroy; +end; + +procedure TACSAudioOut.Pause; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoDriverselected); + FOutput.Pause; +end; + +procedure TACSAudioOut.Resume; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoDriverselected); + FOutput.Resume; +end; + +procedure TACSAudioOut.Run; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoDriverselected); + FOutput.Run; +end; + +procedure TACSAudioOut.Stop; +begin + if Assigned(FOutput) then + FOutput.Stop; +end; + +{ TACSAudioIn } + +function TACSAudioIn.GetBPS: Integer; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoDriverselected); + Result := FInput.GetBPS; +end; + +function TACSAudioIn.GetCh: Integer; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoDriverselected); + Result := FInput.GetCh; +end; + +function TACSAudioIn.GetSR: Integer; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoDriverselected); + Result := FInput.GetSr; +end; + +procedure TACSAudioIn.SetDevice(Ch: Integer); +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoDriverselected); + FInput.SetDevice(Ch); +end; + +function TACSAudioIn.GetDeviceInfo : TACSDeviceInfo; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoDriverselected); + //TODO: Complete +end; + +function TACSAudioIn.GetTotalTime : real; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoDriverselected); + Result := FInput.GetTotalTime; +end; + +function TACSAudioIn.GetDriverName(idx: Integer): string; +begin + if (idx < 0) or (idx > length(InDriverInfos)-1)then + exit; + Result := InDriverInfos[idx].DriverName; +end; + +function TACSAudioIn.GetDriversCount: Integer; +begin + Result := length(InDriverInfos); +end; + +procedure TACSAudioIn.SetDriver(Driver: string); +var + i : Integer; +begin + if Assigned(FInput) then + FInput.Free; + for i := 0 to length(InDriverInfos)-1 do + if InDriverInfos[i].DriverName = Driver then + begin + FDriver := InDriverInfos[i].DriverName; + FInput := InDriverInfos[i].DrvClass.Create(nil); + FInput.SetDevice(FBaseChannel); + exit; + end; +end; + +constructor TACSAudioIn.Create(AOwner: TComponent); +var + lowestindex,lowest,i : Integer; + minlat: Integer; + exc: Boolean; +label retry; +begin + inherited Create(AOwner); + minlat := 0; +retry: + lowest := 99999; + for i := 0 to length(InDriverInfos)-1 do + if (InDriverInfos[i].Latency < lowest) and (InDriverInfos[i].Latency > minlat) then + begin + lowest := InDriverInfos[i].Latency; + lowestindex := i; + end; + if lowest < 99999 then + begin + try + SetDriver(InDriverInfos[lowestindex].DriverName); + exc := false; + except + minlat := lowest+1; + exc := true; + end; + if exc then + goto retry; + end + else + FDriver := 'No Driver'; +end; + +destructor TACSAudioIn.Destroy; +begin + inherited Destroy; +end; + +function TACSAudioIn.GetData(Buffer: Pointer; BufferSize: Integer): Integer; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoDriverselected); + Result := FInput.GetData(Buffer,BufferSize); +end; + +procedure TACSAudioIn.Init; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoDriverselected); + FInput.Init; +end; + +procedure TACSAudioIn.Flush; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoDriverselected); + FInput.Flush; +end; + +procedure RegisterAudioOut(DrvName : string;OutClass : TACSAudioOutClass;Latency : Integer); +begin + Setlength(OutDriverInfos,length(OutdriverInfos)+1); + OutDriverInfos[length(OutDriverInfos)-1].DriverName := DrvName; + OutDriverInfos[length(OutDriverInfos)-1].Latency := Latency; + OutDriverInfos[length(OutDriverInfos)-1].DrvClass := OutClass; +end; + +procedure RegisterAudioIn(DrvName : string;InClass : TACSAudioInClass;Latency : Integer); +begin + Setlength(InDriverInfos,length(IndriverInfos)+1); + InDriverInfos[length(InDriverInfos)-1].DriverName := DrvName; + InDriverInfos[length(InDriverInfos)-1].Latency := Latency; + InDriverInfos[length(InDriverInfos)-1].DrvClass := InClass; +end; + +{ TACSBaseAudioOut } + +constructor TACSBaseAudioOut.Create(AOwner: TComponent); +begin + inherited Create(AOwner); +end; + +destructor TACSBaseAudioOut.Destroy; +begin + inherited Destroy; +end; + +{ TBaseAudioIn } + +constructor TACSBaseAudioIn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); +end; + +destructor TACSBaseAudioIn.Destroy; +begin + inherited Destroy; +end; + +initialization + + Setlength(OutDriverInfos,0); + Setlength(InDriverInfos,0); + +finalization + + Setlength(OutDriverInfos,0); + Setlength(InDriverInfos,0); + +end. diff --git a/components/acs/Src/classes/acs_audiomix.pas b/components/acs/Src/classes/acs_audiomix.pas new file mode 100644 index 000000000..46ff199f6 --- /dev/null +++ b/components/acs/Src/classes/acs_audiomix.pas @@ -0,0 +1,409 @@ +(* + this file is a part of audio components suite. + see the license file for more details. + you can contact me at mail@z0m3ie.de + +$Log: acs_audiomix.pas,v $ +Revision 1.6 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.1 2005/12/19 18:34:35 z0m3ie +*** empty log message *** + +Revision 1.4 2005/12/04 16:54:33 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.3 2005/09/15 20:59:37 z0m3ie +start translate the documentation in the source for pasdoc + +Revision 1.2 2005/09/13 21:54:11 z0m3ie +acs is localizeable now (ACS_Strings) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.3 2005/08/23 19:45:51 z0m3ie +changed to Version 2.31 + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress +*) + +{ +@abstract(this unit introduces the base classes for acs) +@author(Andrei Borovsky (2003-2005)) +@author(Christian Ulrich (2005)) +} + +{$hints off} +unit acs_audiomix; + +interface + +uses + Classes, SysUtils, ACS_Types, ACS_Classes, ACS_Strings; + +const + BUF_SIZE = $100000; + +type + TACSAudioMixerMode = (amMix, amConcatenate, amRTMix, amCustomMix); + TACSAudioMixer = class(TACSCustomInput) + private + FInput1, FInput2 : TACSCustomInput; + BufStart, BufEnd : Integer; + ByteCount : Cardinal; // add by leozhang + FVolume1, FVolume2 : Byte; + EndOfInput1, EndOfInput2 : Boolean; + InBuf1, InBuf2 : array[1..BUF_SIZE] of Byte; + Buisy : Boolean; + FMode : TACSAudioMixerMode; + FInput2Start: Cardinal; + FLock : Boolean; + FFgPlaying : Boolean; + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + procedure SetInput1(aInput : TACSCustomInput); + procedure SetInput2(aInput : TACSCustomInput); + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + property FgPlaying : Boolean read FFgPlaying; + published + property Input1 : TACSCustomInput read FInput1 write SetInput1; + property Input2 : TACSCustomInput read FInput2 write SetInput2; + property Mode : TACSAudioMixerMode read FMode write FMode; + property Input2Start :Cardinal read FInput2Start write FInput2Start; + property Volume1 : Byte read FVolume1 write FVolume1; + property Volume2 : Byte read FVolume2 write FVolume2; + end; + +implementation + +procedure MixChannels16(Buf1, Buf2 : PACSBuffer16; Vol1, Vol2, InSize : Integer); +var // optimized by leozhang + i, tmp : Integer; + V1,V2: Real; +begin + V1 := Vol1 / 127; + V2 := Vol2 / 127; + for i := 0 to (Insize shr 1) - 1 do + begin + if Buf2[i] = 0 then + begin + Buf2[i] := Round(Buf1[i] * V1); + end else + if Buf1[i] = 0 then + begin + Buf2[i] := Round(Buf2[i] * V2); + end else + Buf2[i] := Round(Buf1[i] * V1) + Round(Buf2[i] * V2); + end; +end; + + constructor TACSAudioMixer.Create; + begin + inherited Create(AOwner); + FVolume1 := 127; + FVolume2 := 127; + FInput2Start := 0; + end; + + destructor TACSAudioMixer.Destroy; + begin + inherited Destroy; + end; + + function TACSAudioMixer.GetBPS; + begin + if not Assigned(FInput1) then + raise EACSException.Create(strInputnotAssigned); + Result := FInput1.BitsPerSample; + end; + + function TACSAudioMixer.GetCh; + begin + if not Assigned(FInput1) then + raise EACSException.Create(strInputnotAssigned); + Result:= FInput1.Channels; + end; + + function TACSAudioMixer.GetSR; + begin + if not Assigned(FInput1) then + raise EACSException.Create(strInputnotAssigned); + Result := FInput1.SampleRate; + end; + + procedure TACSAudioMixer.Init; + var + In2StartByte : Cardinal; // add by zhangl. + begin + Buisy := True; + FPosition := 0; + BufStart := 1; + BufEnd := 0; + EndOfInput1 := False; + EndOfInput2 := False; + if not Assigned(FInput1) then + raise EACSException.Create(strInputnotAssigned); + if FMode = amRTMix then + begin + FInput1.Init; + FSize := FInput1.Size; + if Assigned(FInput2) then + begin + FInput2.Init; + FFgPlaying := True; + end else EndOfInput2 := True; + FLock := False; + end else + begin + if not Assigned(FInput2) then + raise EACSException.Create(strInputnotAssigned); + FInput1.Init; + FInput2.Init; + case FMode of + amMix : + if FInput1.Size > FInput2.Size then FSize := FInput1.Size + else FSize := FInput2.Size; + amConcatenate : + FSize := FInput1.Size + FInput2.Size; //determine the size of the output stream in bytes + amCustomMix: + // add by leozhang + begin + In2StartByte := Round(Int((FInput2Start * FInput2.SampleRate) /1000) * + (FInput2.Channels) * ((FInput2.BitsPerSample) shr 3)); + ByteCount := In2StartByte; + if Cardinal(FInput1.Size) > In2StartByte + FInput2.Size then + FSize := FInput1.Size + else + FSize := In2StartByte + FInput2.Size; + FLock := False; + end; + // leozhang + end; + end; + end; + procedure TACSAudioMixer.Flush; + begin + FInput1.Flush; + if (FMode <> amRTMix) or Assigned(FInput2) then + FInput2.Flush; + Buisy := False; + end; + function TACSAudioMixer.GetData; + var + l1, l2 : Integer; + InSize : Integer; + begin + if not Buisy then raise EACSException.Create(strStreamnotopen); + if BufStart > BufEnd then + begin + if EndOfInput1 and EndOfInput2 then + begin + Result := 0; + Exit; + end; + if (FMode = amRTMix) and EndOfInput1 then + begin + Result := 0; + Exit; + end; + BufStart := 1; + case Mode of + amMix : + begin + l1 := 0; + l2 := 0; + FillChar(InBuf1[1], BUF_SIZE, 0); + FillChar(InBuf2[1], BUF_SIZE, 0); + if not EndOfInput1 then + begin + l1 := FInput1.GetData(@InBuf1[1], BUF_SIZE); + InSize := l1; + while (InSize <> 0) and (l1 < BUF_SIZE) do + begin + InSize := FInput1.GetData(@InBuf1[l1+1], BUF_SIZE - l1); + Inc(l1, InSize); + end; + if InSize = 0 then EndOfInput1 := True; + end; + if not EndOfInput2 then + begin + l2 := FInput2.GetData(@InBuf2[1], BUF_SIZE); + InSize := l2; + while (InSize <> 0) and (l2 < BUF_SIZE) do + begin + InSize := FInput2.GetData(@InBuf2[l2+1], BUF_SIZE - l2); + Inc(l2, InSize); + end; + if InSize = 0 then EndOfInput2 := True; + end; + if (l1 = 0) and (l2 = 0) then + begin + Result := 0; + Exit; + end; + if l1 > l2 then BufEnd := l1 else BufEnd := l2; + MixChannels16(@InBuf1[1], @InBuf2[1], FVolume1, FVolume2, BufEnd); + end; + amConcatenate : + begin + if not EndOfInput1 then + begin + l1 := FInput1.GetData(@InBuf2[1], BUF_SIZE); + if l1 = 0 then EndOfInput1 := True + else BufEnd := l1; + end; + if EndOfInput1 then + begin + l2 := FInput2.GetData(@InBuf2[1], BUF_SIZE); + if l2 = 0 then + begin + Result := 0; + Exit; + end + else BufEnd := l2; + end; + end; + // add by leo.zhang + amCustomMix: + begin + l1 := 0; + l2 := 0; + FillChar(InBuf1[1], BUF_SIZE, 0); + FillChar(InBuf2[1], BUF_SIZE, 0); + if not EndOfInput1 then + begin + l1 := FInput1.GetData(@InBuf1[1], BUF_SIZE); + InSize := l1; + while (InSize <> 0) and (l1 < BUF_SIZE) do + begin + InSize := FInput1.GetData(@InBuf1[l1+1], BUF_SIZE - l1); + Inc(l1, InSize); + end; + if InSize = 0 then EndOfInput1 := True; + end; + if not (FLock or EndOfInput2) then + begin + FLock := True; + if ByteCount > BUF_SIZE then + begin + ByteCount := ByteCount - BUF_SIZE; + l2 := BUF_SIZE; InSize := l2; + end else + begin + l2 := FInput2.GetData(@InBuf2[ByteCount+1],BUF_SIZE - ByteCount); + InSize := l2; + if ByteCount <> 0 then + begin + Inc(l2,ByteCount); + InSize := l2; + ByteCount := 0; + end; + while (InSize <> 0) and (l2 < BUF_SIZE) do + begin + InSize := FInput2.GetData(@InBuf2[l2+1], BUF_SIZE - l2); + Inc(l2, InSize); + end; + end; + if InSize = 0 then EndOfInput2 := True; + FLock := False; + end; + if (l1 = 0) and (l2 = 0) then + begin + Result := 0; + Exit; + end; + if l1 > l2 then BufEnd := l1 else BufEnd := l2; + MixChannels16(@InBuf1[1], @InBuf2[1], FVolume1, FVolume2, BufEnd); + end; + // leo.zhang. + amRTMix : + begin + l1 := 0; + l2 := 0; + FillChar(InBuf1[1], BUF_SIZE, 0); + FillChar(InBuf2[1], BUF_SIZE, 0); + if not EndOfInput1 then + begin + l1 := FInput1.GetData(@InBuf1[1], BUF_SIZE); + InSize := l1; + while (InSize <> 0) and (l1 < BUF_SIZE) do + begin + InSize := FInput1.GetData(@InBuf1[l1+1], BUF_SIZE - l1); + Inc(l1, InSize); + end; + if InSize = 0 then EndOfInput1 := True; + end; + if not (FLock or EndOfInput2) then + begin + FLock := True; + l2 := FInput2.GetData(@InBuf2[1], BUF_SIZE); + InSize := l2; + while (InSize <> 0) and (l2 < BUF_SIZE) do + begin + InSize := FInput2.GetData(@InBuf2[l2+1], BUF_SIZE - l2); + Inc(l2, InSize); + end; + if InSize = 0 then + begin + EndOfInput2 := True; + FFGPlaying := False; + FInput2.Flush; + FInput2 := nil; + end; + FLock := False; + end; + if (l1 = 0) and (l2 = 0) then + begin + Result := 0; + Exit; + end; + if l1 > l2 then BufEnd := l1 else BufEnd := l2; + MixChannels16(@InBuf1[1], @InBuf2[1], FVolume1, FVolume2, BufEnd); + end; + end; // case end. + end; // endif. + if BufferSize < (BufEnd - BufStart + 1) + then Result := BufferSize + else Result := BufEnd - BufStart + 1; + Move(InBuf2[BufStart], Buffer^, Result); + Inc(BufStart, Result); + Inc(FPosition, Result); + end; // procedure end. + procedure TACSAudioMixer.SetInput1; + begin + if Buisy then + raise EACSException.Create(strBusy); + FInput1 := aInput; + end; + procedure TACSAudioMixer.SetInput2; + begin + if not Buisy then FInput2 := aInput + else + if FMode = amRTMix then + begin + if FFgPlaying then + begin + while Flock do; + FLock := True; + Input2.Flush; + end; + FInput2 := aInput; + Finput2.Init; + Flock := False; + FFgPlaying := True; + EndOfInput2 := False; + end else + raise EACSException.Create(strNotinFBMode); + end; + +end. diff --git a/components/acs/Src/classes/acs_cdrom.pas b/components/acs/Src/classes/acs_cdrom.pas new file mode 100644 index 000000000..0e990ac3b --- /dev/null +++ b/components/acs/Src/classes/acs_cdrom.pas @@ -0,0 +1,317 @@ +(* + this file is a part of audio components suite + see the license file for more details. + you can contact me at mail@z0m3ie.de + + Special thanks to Thomas Grelle for improving this unit. + +$Log: acs_cdrom.pas,v $ +Revision 1.11 2006/08/31 20:10:54 z0m3ie +*** empty log message *** + +Revision 1.10 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.2 2005/12/26 17:31:38 z0m3ie +fixed some problems in acs_dsfiles +fixed some problems in acs_vorbis +reworked all buffers + +Revision 1.1 2005/12/19 18:34:35 z0m3ie +*** empty log message *** + +Revision 1.7 2005/12/18 17:01:54 z0m3ie +delphi compatibility + +Revision 1.6 2005/12/04 16:54:33 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.5 2005/11/28 21:57:24 z0m3ie +mostly FileOut fixes +moved PBuffer to PBuffer8 +set all to dynamically Buffering + +Revision 1.4 2005/10/02 16:51:46 z0m3ie +*** empty log message *** + +Revision 1.3 2005/09/15 20:59:38 z0m3ie +start translate the documentation in the source for pasdoc + +Revision 1.2 2005/09/13 21:54:11 z0m3ie +acs is localizeable now (ACS_Strings) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.6 2005/09/09 21:33:42 z0m3ie +linux corrections + +Revision 1.5 2005/09/08 22:18:59 z0m3ie +completed akrip based CDIn + +Revision 1.4 2005/09/07 20:53:22 z0m3ie +begon to add MPEG and WMA support using DirectX + +Revision 1.3 2005/09/04 17:59:37 z0m3ie +moving CDIn support to AKRip mostly +begon to add mpegin support for Win with mpg123 + +Revision 1.2 2005/08/28 20:31:17 z0m3ie +linux restructuring for 2.4 + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.5 2005/08/22 20:17:02 z0m3ie +changed Headers to log +changed mail adress +*) + +{ +@abstract(this unit introduces the base classes for acs) +@author(Andrei Borovsky (2003-2005)) +@author(Christian Ulrich (2005)) +} + + +unit acs_cdrom; + +interface + +uses + Classes, SysUtils, ACS_Classes,ACS_Strings,ACS_Types + {$IFDEF MSWINDOWS} + ,Windows, MMSystem, akrip32 + {$ELSE} + ,Libc,cd_rom + {$ENDIF} + ; + +type + {$IFDEF MSWINDOWS} + {$IFDEF FPC} + TAuxCaps = AUXCAPS; + {$ENDIF} + {$ENDIF} + + TACSCDStatus = (cdsNotReady, cdsReady, cdsPlaying, cdsPaused); + TACSTrackType = (ttAudio, ttData); + TACSCDInfo = (cdiNoDisc, cdiDiscAudio, cdiDiscData, cdiDiscMixed, cdiUnknown); + TACSMCN = array[0..13] of Char; + + TACSCDMSF = record + Minute : Byte; + Second : Byte; + Frame : Byte; + end; + PACSCDMSF = ^TACSCDMSF; + + TACSCDTrackInfo = record + TrackStart: TACSCDMSF; + TrackLength : TACSCDMSF; + TrackType : TACSTrackType; + end; + + TACSCDPosition = record + Track : Integer; + MSF : TACSCDMSF; + end; + +const + + EndOfDisc : TACSCDPosition = (Track : 100; MSF : (Minute : 0; Second : 0; Frame : 0)); + CD_FRAMESIZE_RAW = 2352; + BUF_SIZE = 50; // 75 frames - 1 sec + +var + AppPath : String; + WinPath : String; + +type + + { This is the cdreader component of acs it reads in windows with aspi + and linux direct from device + } + + TACSCDIn = class(TACSCustomInput) + private + FBuffer : array of byte; + FCurrentDrive : Integer; + FStartTrack, FEndTrack : Integer; + FStartPos, FEndPos: TACSCDPosition; + FRipEnd : Integer; + FCDDBId: Longint; + {$IFDEF LINUX} + FOpened : Integer; + FCurPos,FEndMSF : TACSCDMSF; + FDrivesCount : Integer; + _cd_fd : Integer; + BufSize : Integer; + {$ELSE} + FToc: TOC; + FCDList: CDLIST; + FCDHandle : HCDROM; + FPlaying : Boolean; + FRipStart : LongInt; + FiBuffer : PTRACKBUF; + {$ENDIF} + procedure OpenCD; + procedure CloseCD; + function GetStatus : TACSCDStatus; + function GetNumTracks : Integer; + function GetTrackInfo(const vIndex : Integer) : TACSCDTrackInfo; + procedure SetST(Track : Integer); + procedure SetET(Track : Integer); + procedure SetSP(Pos : TACSCDPosition); + procedure SetEP(Pos : TACSCDPosition); + function GetSize : Integer; + function GetInfo : TACSCDInfo; + function GetDrivesCount : Integer; + procedure SetCurrentDrive(Value : Integer); + function GetDriveName : String; + function GetCDDBID : LongInt; + function GetTotalTime : real; override; + protected + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + procedure Eject; + procedure CloseTray; + property DiscInfo: TACSCDInfo read GetInfo; + property Status: TACSCDStatus read GetStatus; + property Tracks[const vIndex : Integer] : TACSCDTrackInfo read GetTrackInfo; + property TracksCount : Integer read GetNumTracks; + property DriveName : String read GetDriveName; + property DrivesCount : Integer read GetDrivesCount; + property StartPos : TACSCDPosition read FStartPos write SetSP; + property EndPos : TACSCDPosition read FEndPos write SetEP; + property CDDBId : LongInt read GetCDDBID; + published + property CurrentDrive : Integer read FCurrentDrive write SetCurrentDrive; + property StartTrack: Integer read FStartTrack write SetSt; + property EndTrack: Integer read FEndTrack write SetET; + end; + + function MSFToStr(const MSF : TACSCDMSF) : String; + procedure Frames2MSF(Frames : Integer; var MSF : TACSCDMSF); + function MSF2Frames(const MSF : TACSCDMSF) : Integer; + + {$IFDEF LINUX} + var + DrivesCount : Integer; + DrivesPaths : array of string; + + procedure CountDrives; + {$ENDIF} + +implementation + +{$I ACS_CDROM.inc} + + function MSFToStr(const MSF : TACSCDMSF) : String; + var + sep : String; + sec, min : Integer; + begin + min := MSF.Minute; + if MSF.Frame > 37 then + begin + sec := MSF.Second + 1; + if sec = 60 then + begin + Inc(min); + sec := 0; + end; + end + else sec := MSF.Second; + if sec<10 then sep := ':0' + else sep := ':'; + Result := IntToStr(min) + sep + IntToStr(sec); + end; + + procedure Frames2MSF(Frames : Integer; var MSF : TACSCDMSF); + var + Temp : Integer; + begin + Temp := Frames div 75; + MSF.Minute := Temp div 60; + MSF.Second := Temp mod 60; + MSF.Frame := Frames mod 75; + end; + + function MSF2Frames(const MSF : TACSCDMSF) : Integer; + begin + Result := ((MSF.Minute * 60) + MSF.Second) * 75 + MSF.Frame; + end; + + function TACSCDIn.GetBPS : Integer; + begin + Result := 16; + end; + + function TACSCDIn.GetCh : Integer; + begin + Result := 2; + end; + + function TACSCDIn.GetSR : Integer; + begin + Result := 44100; + end; + + function TACSCDIn.GetTotalTime : real; + begin + if (SampleRate = 0) or (Channels = 0) or (BitsPerSample = 0) then + Exit; + Result := Size/(SampleRate*Channels*(BitsPerSample shr 3)); + end; + + function TACSCDIn.GetCDDBID: LongInt; + FUNCTION prg_sum(n: integer): integer; + VAR + buf: STRING; + ib: Integer; + BEGIN + buf := IntToStr(n); + Result := 0; + FOR ib := 1 TO Length(buf) DO + Result := Result + (StrToInt(Copy(Buf, ib, 1))); + END; + VAR + i, N, L: Longint; + CDM: TACSCDMSF; + BEGIN + N := 0; + L := 0; + FOR i := 0 TO GetNumTracks-1 DO + BEGIN + WITH Tracks[i].TrackStart DO + BEGIN + N := N + prg_sum((minute * 60) + second + 2); + L := L + MSF2Frames(Tracks[i].TrackLength); + // adjust the length of last audio track if a data track is following + IF (i > 0) AND (i = TracksCount - 2) AND (Tracks[i + 1].TrackType = ttData) THEN + inc(L, 152 * 75); + END; + END; + Frames2MSF(L, CDM); + L := CDM.Minute * 60 + CDM.Second; + Result := ((N MOD $0FF) SHL 24) XOR (L SHL 8) XOR TracksCount; + FCDDBId := Result; + end; + +{$IFDEF LINUX} +initialization + CountDrives; +{$ENDIF} + +end. diff --git a/components/acs/Src/classes/acs_classes.pas b/components/acs/Src/classes/acs_classes.pas new file mode 100644 index 000000000..01454e662 --- /dev/null +++ b/components/acs/Src/classes/acs_classes.pas @@ -0,0 +1,1376 @@ +(* + this file is a part of audio components suite. + see the license file for more details. + you can contact me at mail@z0m3ie.de + +$Log: acs_classes.pas,v $ +Revision 1.22 2006/09/10 18:26:02 z0m3ie +*** empty log message *** + +Revision 1.21 2006/09/04 14:40:15 z0m3ie +*** empty log message *** + +Revision 1.20 2006/08/31 20:10:54 z0m3ie +*** empty log message *** + +Revision 1.19 2006/07/09 16:40:34 z0m3ie +*** empty log message *** + +Revision 1.18 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.7 2006/01/01 18:46:40 z0m3ie +*** empty log message *** + +Revision 1.6 2005/12/30 13:24:27 z0m3ie +waveformat corrections, localizing + +Revision 1.5 2005/12/30 11:10:57 z0m3ie +some corrections to lazarus-linux depending things + +Revision 1.4 2005/12/27 05:43:03 z0m3ie +fixed little bug with TDoneThread + +Revision 1.3 2005/12/26 17:31:38 z0m3ie +fixed some problems in acs_dsfiles +fixed some problems in acs_vorbis +reworked all buffers + +Revision 1.2 2005/12/20 20:11:52 z0m3ie +updated package + +Revision 1.1 2005/12/19 18:34:35 z0m3ie +*** empty log message *** + +Revision 1.8 2005/12/04 16:54:33 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.7 2005/11/28 21:57:24 z0m3ie +mostly FileOut fixes +moved PBuffer to PBuffer8 +set all to dynamically Buffering + +Revision 1.6 2005/11/28 19:10:14 z0m3ie +*** empty log message *** + +Revision 1.5 2005/10/02 16:51:46 z0m3ie +*** empty log message *** + +Revision 1.4 2005/09/16 17:34:29 z0m3ie +*** empty log message *** + +Revision 1.3 2005/09/15 20:59:38 z0m3ie +start translate the documentation in the source for pasdoc + +Revision 1.2 2005/09/13 21:54:11 z0m3ie +acs is localizeable now (ACS_Strings) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.8 2005/09/09 21:33:42 z0m3ie +linux corrections + +Revision 1.7 2005/09/04 17:59:37 z0m3ie +moving CDIn support to AKRip mostly +begon to add mpegin support for Win with mpg123 + +Revision 1.6 2005/09/02 16:27:49 z0m3ie +*** empty log message *** + +Revision 1.5 2005/08/28 20:31:18 z0m3ie +linux restructuring for 2.4 + +Revision 1.4 2005/08/28 18:35:53 z0m3ie +created Delphi package for 2.4 +more Mixer stuff +updated some things for Delphi + +Revision 1.3 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress +*) + +{ +@abstract(this unit introduces the base classes for acs) +@author(Andrei Borovsky (2003-2005)) +@author(Christian Ulrich (2005)) +} + +unit acs_classes; + +interface + +uses + +{$IFDEF MSWINDOWS} + Windows,Dialogs, +{$ENDIF} + ACS_Strings,Classes, SysUtils,ACS_Types; + +type + + TACSOutputStatus = (tosUndefined,tosPlaying, tosPaused, tosIdle); + TACSFileOutputMode = (foRewrite = 0, foAppend); + TACSOutputFunc = function(Abort : Boolean):Boolean of object; + + //TThreadDoneEvent = procedure of object; + + TACSThreadExceptionEvent = procedure(Sender : TComponent; E : Exception) of object; + TACSHandleThreadException = procedure(E : Exception) of object; + TACSOutputDoneEvent = procedure(Sender : TComponent) of object; + TACSOutputProgressEvent = procedure(Sender : TComponent) of object; + +{$IFDEF LINUX} +// File access mask constants +const + famUserRead = 64; + famUserWrite = 128; + famGroupRead = 8; + famGroupWrite = 16; + famOthersRead = 1; + famOthersWrite = 2; +{$ENDIF} + +type +{$IFNDEF FPC} +{$IFDEF LINUX} + TTPriority = Integer; +{$ENDIF} +{$IFDEF MSWINDOWS} + TTPriority = TThreadPriority; +{$ENDIF} +{$ELSE} + TTPriority = TThreadPriority; +{$ENDIF} + {Basic exception class for ACS} + EACSException = class(Exception) + end; + + {Basic Thread class for ACS} + + { TACSThread } + + TACSThread = class(TThread) + private + procedure CallOnProgress; + public + Parent : TObject; + bSuspend, Terminating : Boolean; + Stop : Boolean; + HandleException : TACSHandleThreadException; + Delay : Integer; + CS : TRTLCriticalSection; + constructor Create; + procedure DoPause; + procedure DoResume; + procedure Execute; override; + end; + + TACSVerySmallThread = class(TThread) + public + FOnDone : TACSOutputDoneEvent; + Sender : TComponent; + procedure Execute; override; + procedure CallOnDone; + end; + + { TACSInput is the base class for all input and converter components. + } + + { TACSInput } + + { TACSCustomInput } + + TACSCustomInput = class(TComponent) + protected + FPosition : Integer; + FSize : Integer; + FBusy : Boolean; + BufStart, BufEnd : Integer; + FBuffer : array of byte; + (* We don't declare the buffer variable here + because different descendants may need different buffer sizes *) + function GetBPS : Integer; virtual; + function GetCh : Integer; virtual; + function GetSR : Integer; virtual; + function GetTotalTime : real; virtual; + procedure SetBufferSize(S : Integer);virtual; + function GetBufferSize : Integer; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + { This is an abstract method. + In TACSInput descendands this function reads the audio stream data into the Buffer. + Returns the number of bytes actually read. + Returns zero at the end of stream. + + Note: usually this method is called internally by the output or converter component + to which the input component is assigned. You can call this method if you want to + get direct access to the audio stream. In such a case the sequence of calls should + look like this: + + InputComponent.Init; + + InputComponent.GetData(...); // in a loop + + InputComponent.Flush; + } + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; virtual; abstract; + { This function is called from output component when the buffer must be filled. + } + procedure Reset; virtual; + { This is an abstract method. In TACSInput descendands it prepares input + component for reading data. + } + procedure Init; virtual; abstract; + { This is an abstract method. In TACSInput descendands it closes the current input, + clearing up all temporary structures alocated during data transfer. + + Note: usually this method is called internally by the output or converter component to + which the input component is assigned. You can call this method if you want to get direct + access to the audio stream. + } + procedure Flush; virtual; abstract; + { Read this property to determine the number of bits per sample in the input audio stream. + Possible values are 8 and 16. + } + property BitsPerSample : Integer read GetBPS; + property Position : Integer read FPosition; + { Read this property to get the sample rate (sampling frequency) in Hz + for the input audio stream. + } + property SampleRate : Integer read GetSR; + { Read Channles to determine the number of channels in the input audio stream. + Possible values are 1 (mono) and 2 (stereo). + } + property Channels : Integer read GetCh; + { Read Size to determine the size of the input stream in bytes. + } + property Size : Integer read FSize; + { Read this property to get the total time of the input stream in seconds. + If the total time cannot be determined this property contains 0. + } + property TotalTime : Real read GetTotalTime; + { This property sets the buffersize of the component + } + property BufferSize : Integer read GetBufferSize write SetBufferSize; + property Busy : Boolean read FBusy; + end; + + { TACSOutput is the base class for all ACS output components. + } + + { TACSOutput } + + TACSCustomOutput = class(TComponent) + protected + CanOutput : Boolean; + CurProgr : real; + Thread : TACSThread; + FInput : TACSCustomInput; + FOnDone : TACSOutputDoneEvent; + FOnProgress : TACSOutputProgressEvent; + Busy : Boolean; // Set to true by Run and to False by WhenDone. + FOnThreadException : TACSThreadExceptionEvent; + InputLock : Boolean; + FBufferSize : Integer; + FBuffer : PACSBuffer8; + function GetPriority : TTPriority; + function GetSuspend : Boolean; + function GetProgress : real; + procedure SetInput(vInput : TACSCustomInput); virtual; + procedure SetPriority(Priority : TTPriority); + procedure SetSuspend(v : Boolean); + procedure WhenDone; + function GetTE : Integer; + function GetStatus : TACSOutputStatus; + function GetDelay : Integer; + procedure SetDelay(Value : Integer); + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + procedure HandleThreadException(E : Exception); + procedure SetBufferSize(S : Integer); + public + procedure Prepare; virtual; abstract; // Calls FInput.init + function DoOutput(Abort : Boolean):Boolean; virtual; abstract; + procedure Done; virtual; abstract; // Calls FInput.Flush + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + {$IFDEF MSWINDOWS} + procedure Abort; + {$ENDIF} + { pauses the output (the output thread is suspended). + } + procedure Pause;virtual; + { Resumes previously paused output. + } + procedure Resume;virtual; + { This is the most important method in the output components. + After an input component has been assigned, call Run to start audio-processing chain. + } + procedure Run; + { Stops the running output process. + } + procedure Stop; + { Use this property to set the delay (in milliseconds) in output thread. + This property allows the user to reduce the stress the output thread puts + on the CPU (especially under Windows). + Be careful with this property when using TAudioOut component. + Assigning too large values to it can cause dropouts in audio playback. + } + property Delay : Integer read GetDelay write SetDelay; + { Output components perform output in their own threads. + Use this property to set the priority for the thread. + } + property ThreadPriority : TTPriority read GetPriority write SetPriority; + { Read Progress to get the output progress in percents. + This value is meaningful only after the input component has been set + and only if the input component can tell the size of its stream. + } + property Progress : real read GetProgress; + { This property indicates the output component's current status. Possible values are: + + tosPlaying: the component is working; + + tosPaused: the component is paused (the Pause method was called); + + tosIdle: the component is idle; + } + property Status : TACSOutputStatus read GetStatus; + property TimeElapsed : Integer read GetTE; + published + { This property allows you to set the input component for the output component. + The valid input components must be descendants of TACSInput. + } + property Input : TACSCustomInput read Finput write SetInput; + { If this property is set to True the output thread suspends every time the + output component becomes inactive, otherwise the thread executes permanently. + This property is introduced to simplify the debugging process ander + Kylix IDE. Output components perform output in their own threads. + The signals received by multi-threaded applications under IDE can cause problems. + Set this property to False when debugging your application + and to True in the final release. + } + property SuspendWhenIdle : Boolean read GetSuspend write SetSuspend; + { This event is invoked when the output is finished. + + Note: don't try to start other output job before OnDone event from the + previous job is triggered. An attempt to do so will cause the + "Component is buisy" exception. + It is a good practice to desable output-starting controls in the + method where the output component's Run method is called and to enable + them in the output component's OnDone event handler. + } + property OnDone : TACSOutputDoneEvent read FOnDone write FOndone; + { This event is invoked every time the Progress property value changes. + Be careful when referencing GUI interface components in OnProgress event's handler. + } + property OnProgress : TACSOutputProgressEvent read FOnProgress write FOnProgress; + { Thread procedure should never terminate. + For this reason all the exceptions that might arise in the thread + procedure are caught within the procedure itself. + The thread generates OnThreadException event to inform the application + that an exception has occurred. + Avoid any potential exception-rising actions in this event’s handler! + Use the handler to reset application controls (if needed) and call the + input component’s Reset method. + See the CD ripper demo for an example of handling thread exceptions. + } + property OnThreadException : TACSThreadExceptionEvent read FOnThreadException write FOnThreadException; + { This Property sets the Buffersize of the component + } + property BufferSize : Integer read FBufferSize write SetBufferSize; + end; + + { TACSStreamedInput introduces Stream property. + This property allows input components that descend from TACSStreamedInput + to get data not only from files on disc but from any kind of stream. + The descendats of this class are TACSFileIn (and all its descendats except TMACIn), + and TStreamIn component that is designed to read raw audio data from streams. + } + TACSStreamedInput = class(TACSCustomInput) + protected + FStream : TStream; + FStreamAssigned : Boolean; + FSeekable : Boolean; + procedure SetStream(aStream : TStream); + public + { If you write network applications with ACS, you are encouraged to use custom + streams as it is described in programmer's introduction + (see also OggStream demo). + + Usually these custom streams will not be seekable. + Unfortunately TStream class has no way to indicate it is not seekable + (all standart TStream descendats are seekable). + So this property has been added to allow you to specify if the stream is seekable or not. + The default value of this property is True, and if the stream you're planning + to use with this component is not seekable, you have to set Seekable to False. + Note that if the stream is not seekable, such properties as Channels, SampleRate, + BitsPerSample, and Valid will not return correct values until the input + component starts performing the actual playback. + } + property Seekable : Boolean read FSeekable write FSeekable; + { Use this property to set the input stream for the input component. + Remember that you have to create, destroy and position the input stream explicitly. + In TACSFileIn descendants the stream assigned to this property takes over + the FileName property, i. e. if both Stream and FileName property are assigned, + the stream and not the file will be used for the actual input. + To unassign this property set it to nil. + If the stream is seekable it will be reset to the beginning at the end of the playback. + } + property Stream : TStream read FStream write SetStream; + constructor Create(AOwner: TComponent); override; + end; + + { TACSStreamedOutput introduces Stream property. + This property allows output components that descend from TACSStreamedOutput + to store data not only to files on disc but to any kind of stream as well. + } + TACSStreamedOutput = class(TACSCustomOutput) + protected + { Use this property to set the output stream for the corresponding output component. + Remember that you have to create, destroy and position the input stream explicitly. + In file-handling TACSStreamedOutput descendants the stream assigned to this property + takes over the FileName property, i. e. if both Stream and FileName property are assigned, + the stream and not the file will be used for the actual output. + To unassign this property set it to nil. + } + FStream : TStream; + FStreamAssigned : Boolean; + procedure SetStream(aStream : TStream); + public + property Stream : TStream read FStream write SetStream; + end; + + { This class introduces an simple handler for an file tag it can hold any streamable + piece of data or an string + } + TACSFileTag = CLASS + private + function GetName : string;virtual; + public + property Name : string read GetName; + function AsString : string;virtual; + function Streamable : Boolean;virtual; + procedure SaveToStream(Stream : TStream);virtual; + procedure LoadFromStream(Stream : TStream);virtual; + end; + + { This class introduces an base class for file tag lists + } + + { TACSFileInfo } + + TACSFileInfo = CLASS + private + procedure ReadFromFile;virtual; + procedure SetStringTag(Idx : string; const AValue: TACSFileTag); + function GetStringTag(Idx : string): TACSFileTag; + public + procedure SaveToFile;virtual; + property Tags[Idx : string] : TACSFileTag read GetStringTag write SetStringTag; + end; + + { TACSFileIn is the base class for all input components that read data from files + (or from other streams in the corresponding file format). + It introduces such properties as FileName, StartSample, EndSample, Loop, + and Valid and Jump, Seek, SetStartTime, SetEndTime methods. + } + TACSCustomFileIn = class(TACSStreamedInput) + protected + FFileName : TFileName; + FOffset : real; + FOpened : Integer; + FValid : Boolean; + FBPS, FSR, FChan : Integer; + FTime : Integer; + FLoop : Boolean; + FStartSample, FEndSample : Integer; + FTotalSamples : Integer; + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + function GetTime : Integer; + function GetValid : Boolean; + (* Note on FSize calculation: + FSize is calculated in OpenFile method as the FULL file size. + More precise calculations regarding StartSample/EndSample are done in Init. *) + procedure OpenFile; virtual; abstract; + procedure CloseFile; virtual; abstract; + function GetTotalTime : real; override; + public + constructor Create(AOwner: TComponent); override; + procedure Reset; override; + procedure Flush; override; + procedure Init; override; + function Seek(SampleNum : Integer) : Boolean; virtual; abstract; + function SetStartTime(Minutes, Seconds : Integer) : Boolean; + function SetEndTime(Minutes, Seconds : Integer) : Boolean; + procedure Jump(Offs : real); + { Read this property to determine the total playing time of the file in seconds. + } + property Time : Integer read GetTime; + { Use this property to read the total number of samples in the file/stream assigned + to the component. The sample in this context means the minimum playable + portion of audio data. For mono 8-bit sound 1 sample = 1 byte, + while for stereo 16-bit sound 1 sample = 4 bytes. + } + property TotalSamples : Integer read FTotalSamples; + { Read this property to determine if the file is valid. + It is a good practice to check this property before performing other + operations on audio stream. + } + property Valid : Boolean read GetValid; + published + { Use this property to set the number of the end sample in the file that + the playback should stop at. + The value of -1 (default) tells the component to play the file up to the end. + The sample in this context means the minimum playable portion of audio data. + For mono 8-bit sound 1 sample = 1 byte, + while for stereo 16-bit sound 1 sample = 4 bytes. + You can get the total number of samples in the file by reading TotalSamples property. + + Note that in some cases (for example, with ADPCM files) sample positioning is not quite precise. + } + property EndSample : Integer read FEndSample write FEndSample; + { Use this property to set the name of the file to read data from. + } + property FileName : TFileName read FFileName write FFileName stored True; + { The default value of Loop is False. If this property is set to True, + the file playback will be looped, in other words the file will start playing + again right after it is finished. Note, that if Loop is set to True, it will not + present end conditions to the corresponding output component. + You can stop the looped input component either by setting Loop to False, + or by calling Stop method of the corresponding output component. + } + property Loop : Boolean read FLoop write FLoop; + { Use this property to set the number of the sample in the file that the + playback should start from. The value of 0 (default) tells the component + to play the file from the beginning. + The sample in this context means the minimum playable portion of audio data. + For mono 8-bit sound 1 sample = 1 byte, while for stereo 16-bit sound 1 sample = 4 bytes. + You can get the total number of samples in the file by reading TotalSamples property. + + Note that in some cases (for example, with ADPCM files) sample positioning is not quite precise. + } + property StartSample : Integer read FStartSample write FStartSample; + end; + + TACSCustomFileOut = class(TACSStreamedOutput) + protected + FFileName : TFileName; + FFileMode : TACSFileOutputMode; + FAccessMask : Integer; + procedure SetFileMode(aMode : TACSFileOutputMode); virtual; + public + constructor Create(AOwner: TComponent); override; + {$IFDEF LINUX} + { Use this property to set the file access mask. The default value is $1B6, + which corresponds to rw-rw-rw- access mask. + } + property AccessMask : Integer read FAccessMask write FAccessMask; + {$ENDIF} + published + { There are two possible values for this property: foRewrite and foAppend. + When foRewrite (default value) is set and the file with the specified + name already exists (or a stream is assigned) the contents of the file + (stream) is rewritten. + + In the foAppend mode the new data is appended to the end of the existing + file (stream). + Currently only TWaveOut and TVorbisOut components support foAppend mode. + } + property FileMode : TACSFileOutputMode read FFileMode write SetFileMode; + { Use this property to set the name of the file to save data to. + } + property FileName : TFileName read FFileName write FFileName; + end; + + TACSCustomConverter = class(TACSCustomInput) + protected + InputLock : Boolean; + FInput : TACSCustomInput; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + procedure SetInput(aInput : TACSCustomInput); virtual; + public + procedure UnlockInput; + published + property Input : TACSCustomInput read FInput write SetInput; + end; + +const + + STREAM_BUFFER_SIZE = $80000; + +type + + // Circular buffer with TStream interface + + TACSBufferMode = (bmBlock, bmReport); + + TACSBufferStream = class(TStream) + private + Buff : array[0..STREAM_BUFFER_SIZE-1] of Byte; + ReadCur, WriteCur : Integer; + FBufferMode : TACSBufferMode; +// fBreak : Boolean; + FBytesInBuffer : Integer; + BlockEventName : String; +// LockEventName : String; + FBytesRead : Integer; + {$IFDEF MSWINDOWS} + BlockEvent : THandle; + CS : TRTLCriticalSection; + {$ENDIF} + public + constructor Create; + destructor Destroy; override; + function Read(var Buffer; Count: Longint): Longint; override; + procedure Reset; + function Seek(Offset: Longint; Origin: Word): Longint; overload; override; + function Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; overload; override; + function Write(const Buffer; Count: Longint): Longint; override; + property BytesInBuffer : Integer read FBytesInBuffer; + property BufferMode : TACSBufferMode read FBufferMode write FBufferMode; + end; + + +implementation + + constructor TACSCustomInput.Create(AOwner: TComponent); + begin + inherited Create(AOwner); + Fposition := 0; + end; + + destructor TACSCustomInput.Destroy; + begin + inherited Destroy; + end; + + procedure TACSThread.Execute; + var + DoneThread : TACSVerySmallThread; + ParentComponent : TACSCustomOutput; + Res : Boolean; + begin + bSuspend := false; + ParentComponent := TACSCustomOutput(Parent); + while not Terminating do + if not bSuspend then + begin + EnterCriticalSection(CS); + if Delay > 5 then sleep(Delay); + try + if ParentComponent.Progress <> ParentComponent.CurProgr then + begin + ParentComponent.CurProgr := ParentComponent.Progress; + if Assigned(ParentComponent.FOnProgress) then Synchronize(CallOnProgress); + end; + Res := ParentComponent.DoOutput(Stop); + if Stop or (not Res) then + begin + Stop := False; + ParentComponent.WhenDone; + // This ensures that OnDone event is called outside this thread + DoneThread := TACSVerySmallThread.Create(True); + DoneThread.Sender := ParentComponent; + DoneThread.FOnDone := ParentComponent.FOnDone; + DoneThread.FreeOnTerminate := True; + Stop := True; + Res := True; + DoneThread.Resume; + //Dont Suspend the thread maybe Stop has been set to false during OnDone + //check this first + if (Stop or (not Res)) and bSuspend then + Self.Suspend; + end; + except + on E : Exception do + begin + Stop := False; + HandleException(E); + if bSuspend then + Self.Suspend; + end; + end; + LeaveCriticalSection(CS); + end; + //DoOutput(True); // Why I'm doing this? I don't remember :-) + Terminating := False; + end; + + constructor TACSCustomOutput.Create(AOwner: TComponent); + begin + inherited Create(AOwner); + Thread := TACSThread.Create; + Thread.Parent := Self; +// Thread.DoOutput := Self.DoOutput; +// Thread.FOnDone := Self.WhenDone; + Thread.FreeOnTerminate := True; + Thread.HandleException := HandleThreadException; + {$IFDEF MSWINDOWS} + SetSuspend(True); + InitializeCriticalSection(Thread.CS); + {$ENDIF} + end; + + destructor TACSCustomOutput.Destroy; + begin +// if Thread.Suspended then +// Thread.Resume; + if not Thread.Suspended then + Thread.Terminating := True; + while Thread.Terminating do; + {$IFDEF MSWINDOWS} + DeleteCriticalSection(Thread.CS); + {$ENDIF} + inherited Destroy; + end; + + procedure TACSCustomOutput.WhenDone; + begin + if not Busy then Exit; + CanOutput := False; + Done; + Busy := False; + end; + + procedure TACSCustomOutput.Run; + begin + if Busy then raise EACSException.Create(strBusy); + if not Assigned(FInput) then raise EACSException.Create(strInputnotAssigned); + InputLock := False; + if not Thread.Suspended then Thread.Suspend; + try + Prepare; + Busy := True; + Thread.Stop := False; + CanOutput := True; + if Thread.Suspended then Thread.Resume; + except + on E : Exception do HandleThreadException(E); + end; + end; + + procedure TACSCustomOutput.Stop; + begin + Thread.Stop := True; + end; + + function TACSCustomOutput.GetStatus : TACSOutputStatus; + begin + if Busy then + begin + if Self.Thread.Suspended then Result := tosPaused + else Result := tosPlaying; + end else Result := tosIdle; + end; + + procedure TACSCustomOutput.SetPriority(Priority : TTPriority); + begin + Thread.Priority := Priority; + end; + + function TACSCustomOutput.GetPriority:TTPriority; + begin + Result := Thread.Priority; + end; + + procedure TACSCustomOutput.SetInput(vInput : TACSCustomInput); + var + OldInput, NewInput : TACSCustomInput; + begin + if Busy then + begin + NewInput := vInput; + NewInput.Init; + OldInput := FInput; + while InputLock do; + InputLock := True; + FInput := NewInput; + InputLock := False; + OldInput.Flush; + end else + FInput := vInput; + end; + + function TACSCustomOutput.GetProgress : real; + begin + if not Assigned(Finput) then + begin + Result := 0; + Exit; + end; + case Finput.Size of + 0: Result := 0; + -1: Result := -1; + else Result := (FInput.Position/FInput.Size)*100; + end; + end; + + procedure TACSCustomOutput.Pause; + begin + Thread.DoPause; + end; + + procedure TACSCustomOutput.Resume; + begin + Thread.DoResume; + end; + + function TACSCustomOutput.GetSuspend : Boolean; + begin + Result := Thread.bSuspend; + end; + + procedure TACSCustomOutput.SetSuspend(v : Boolean); + begin + Thread.bSuspend := v; + end; + + constructor TACSStreamedInput.Create; + begin + inherited Create(AOwner); + FSeekable := True; + end; + + function TACSCustomFileIn.GetBPS : Integer; + begin + if FSeekable then + begin + OpenFile; + Result := FBPS; + CloseFile; + end else Result := FBPS; + end; + + function TACSCustomFileIn.GetCh : Integer; + begin + if FSeekable then + begin + OpenFile; + Result := FChan; + CloseFile; + end else Result := FChan; + end; + + function TACSCustomFileIn.GetSR : Integer; + begin + if FSeekable then + begin + OpenFile; + Result := FSR; + CloseFile; + end else Result := FSR; + end; + + function TACSCustomFileIn.GetTime : Integer; + begin + if FSeekable then + begin + OpenFile; + Result := FTime; + CloseFile; + end else Result := FTime; + end; + + function TACSCustomFileIn.GetValid : Boolean; + begin + if (not FStreamAssigned) and (FileName = '') then + begin + Result := False; + end else + if FSeekable then + begin + OpenFile; + Result := FValid; + CloseFile; + end else Result := FValid; + end; + + procedure TACSCustomFileIn.Init; + begin + if Busy then raise EACSException.Create(strBusy); + if not FStreamAssigned then + if FFileName = '' then raise EACSException.Create(strFilenamenotassigned); + OpenFile; + if StartSample <> 0 then Seek(StartSample); + if (StartSample <> 0) or (FEndSample <> -1) then + begin + FSize := FEndSample - FStartSample; + if FEndSample = -1 then FSize := FSize + FTotalSamples + 1; + FSize := FSize*(BitsPerSample shr 3)*FChan; + end; + FBusy := True; + BufStart := 1; + BufEnd := 0; + FPosition := 0; + end; + + procedure TACSCustomFileIn.Flush; + begin + CloseFile; + FBusy := False; + end; + + procedure TACSCustomFileIn.Jump(Offs : real); + begin + FOffset := Offs; + end; + + function TACSCustomOutput.GetTE : Integer; + begin + if not Assigned(FInput) then + Result := 0 + else + Result := Round(FInput.Position/((FInput.BitsPerSample shr 3) *FInput.Channels*FInput.SampleRate)); + end; + + function TACSCustomOutput.GetDelay : Integer; + begin + if Assigned(Thread) then Result := Thread.Delay + else Result := 0; + end; + + procedure TACSCustomOutput.SetDelay(Value : Integer); + begin + if Assigned(Thread) then + if Value <= 100 then Thread.Delay := Value; + end; + + function TACSCustomInput.GetBPS: Integer; + begin + Result := -1; + end; + + function TACSCustomInput.GetCh: Integer; + begin + Result := -1; + end; + + function TACSCustomInput.GetSR: Integer; + begin + Result := -1; + end; + + function TACSCustomInput.GetTotalTime : real; + begin + Result := 0; // Default result for the streams. + end; + + procedure TACSCustomInput.SetBufferSize(S: Integer); + begin + if Busy then + raise EACSException.Create(strBusy); + setlength(FBuffer,S); + end; + + function TACSCustomInput.GetBufferSize: Integer; + begin + Result := length(FBuffer); + end; + + function TACSCustomFileIn.GetTotalTime : real; + begin + OpenFile; + Result := 0; + if (SampleRate = 0) or (Channels = 0) or (BitsPerSample = 0) then Exit; + Result := Size/(SampleRate*Channels*(BitsPerSample shr 3)); + CloseFile; + end; + + procedure TACSStreamedInput.SetStream; + begin + FStream := aStream; + if FStream <> nil then FStreamAssigned := True + else FStreamAssigned := False; + end; + + procedure TACSStreamedOutput.SetStream; + begin + FStream := aStream; + if FStream <> nil then FStreamAssigned := True + else FStreamAssigned := False; + end; + + procedure TACSCustomOutput.Notification(AComponent: TComponent; Operation: TOperation); + begin + // Remove the following two lines if they cause troubles in your IDE + if (AComponent = FInput) and (Operation = opRemove ) + then Input := nil; + inherited Notification(AComponent, Operation); + end; + + procedure TACSCustomInput.Reset; + begin + try + Flush; + except + end; + FBusy := False; + end; + + procedure TACSCustomOutput.HandleThreadException(E : Exception); + var + Conv : TACSCustomConverter; + begin + InputLock := False; + if Status <> tosIdle then + begin + try + if FInput is TACSCustomConverter then + begin + Conv := FInput as TACSCustomConverter; + Conv.UnlockInput; + end; + except + end; + try + Done; + except + end; + end; + CanOutput := False; + Busy := False; + if Assigned(FOnThreadException) then FOnThreadException(Self, E); + end; + + procedure TACSCustomOutput.SetBufferSize(S : Integer); + begin + if Busy then + raise EACSException.Create(strBusy); + FBufferSize := S; + end; + + + procedure TACSCustomFileIn.Reset; + begin + inherited Reset; + FOpened := 0; + end; + + + constructor TACSCustomFileOut.Create; + begin + inherited Create(AOwner); + {$IFDEF LINUX} + FAccessMask := $1B6; // rw-rw-rw- + {$ENDIF} + end; + + procedure TACSCustomFileOut.SetFileMode; + begin + FFileMode := foRewrite; + end; + + procedure TACSCustomConverter.Notification; + begin + // Remove the following two lines if they cause troubles in your IDE + if (AComponent = FInput) and (Operation = opRemove ) + then Input := nil; + inherited Notification(AComponent, Operation); + end; + + procedure TACSCustomConverter.SetInput(aInput : TACSCustomInput); + var + OldInput, NewInput : TACSCustomInput; + begin + if aInput = Self then Exit; + if Busy then + begin + NewInput := aInput; + NewInput.Init; + OldInput := FInput; + while InputLock do; + InputLock := True; + FInput := NewInput; + InputLock := False; + OldInput.Flush; + end else + FInput := aInput; + end; + + procedure TACSCustomConverter.UnlockInput; + var + Conv : TACSCustomConverter; + begin + InputLock := False; + if Assigned(FInput) then + if FInput is TACSCustomConverter then + begin + Conv := FInput as TACSCustomConverter; + Conv.UnlockInput; + end; + end; + + function TACSCustomFileIn.SetStartTime(Minutes, Seconds : Integer) : Boolean; + var + Sample : Integer; + begin + Result := False; + if not FSeekable then Exit; + OpenFile; + CloseFile; + Sample := (Minutes*60+Seconds)*FSR; + if Sample > FTotalSamples then Exit; + FStartSample := Sample; + Result := True; + end; + + function TACSCustomFileIn.SetEndTime(Minutes, Seconds : Integer) : Boolean; + var + Sample : Integer; + begin + Result := False; + if not FSeekable then Exit; + OpenFile; + CloseFile; + Sample := (Minutes*60+Seconds)*FSR; + if Sample > FTotalSamples then Exit; + FEndSample := Sample; + Result := True; + end; + + constructor TACSCustomFileIn.Create(AOwner: TComponent); + begin + inherited Create(AOwner); + FStartSample := 0; + FEndSample := -1; + end; + + procedure TACSVerySmallThread.Execute; + begin + Synchronize(CallOnDone); + end; + + procedure TACSVerySmallThread.CallOnDone; + begin + if Assigned(FOnDone) then FOnDone(Sender); + end; + + procedure TACSThread.CallOnProgress; + var + ParentComponent : TACSCustomOutput; + begin + ParentComponent := TACSCustomOutput(Parent); + ParentComponent.FOnProgress(ParentComponent); + end; + + constructor TACSThread.Create; + begin + bSuspend := False; + inherited Create(True); + end; + + procedure TACSThread.DoPause; + begin + If not Suspended then Suspended := True; + bSuspend := true; + end; + + procedure TACSThread.DoResume; + begin + If Suspended then Suspended := False; + bSuspend := false; + end; + +{$IFDEF MSWINDOWS} + procedure TACSCustomOutput.Abort; + begin + TerminateThread(Thread.Handle, 0); + WhenDone; + end; +{$ENDIF} + + constructor TACSBufferStream.Create; + begin + inherited Create; + {$IFDEF MSWINDOWS} + BlockEventName := 'Block' + IntToStr(LongWord(Self)); // this way we guarantee that the name is unique + BlockEvent := CreateEvent(nil, True, False, @BlockEventName[1]); + InitializeCriticalSection(CS); + {$ENDIF} + end; + + destructor TACSBufferStream.Destroy; + begin + {$IFDEF MSWINDOWS} + DeleteCriticalSection(CS); + CloseHandle(BlockEvent); + {$ENDIF} + inherited Destroy; + end; + + function TACSBufferStream.Write(const Buffer; Count: Longint): Longint; + var + addr : Pointer; + S1, S2 : Integer; + begin + if WriteCur >= ReadCur then + begin + {$IFDEF MSWINDOWS} + EnterCriticalSection(CS); + {$ENDIF} + S1 := STREAM_BUFFER_SIZE-WriteCur; + if (Count <= S1) then + begin + Move(Buffer, Buff[WriteCur], Count); + Inc(WriteCur, Count); + Inc(FBytesInBuffer, Count); + Result := Count; + end else + begin + Move(Buffer, Buff[WriteCur], S1); + addr := Pointer(Integer(@Buffer) + S1); + S2 := Count - S1; + if S2 > ReadCur then + S2 := ReadCur; + Move(addr^, Buff[0], S2); + WriteCur := S2; + Inc(FBytesInBuffer, S1+S2); + Result := S1+S2; + end; + end else + begin + S2 := ReadCur-WriteCur; + if Count < S2 then + S2 := Count; + Move(Buffer, Buff[WriteCur], S2); + Inc(WriteCur, S2); + Inc(FBytesInBuffer, S2); + Result := S2; + end; + {$IFDEF MSWINDOWS} + if Result <> 0 then + if FBufferMode = bmBlock then PulseEvent(BlockEvent); + LeaveCriticalSection(CS); + {$ENDIF} + end; + + function TACSBufferStream.Read(var Buffer; Count : Integer) : Integer; + var + addr : Pointer; + S1, S2 : Integer; + begin + {$IFDEF MSWINDOWS} + if ReadCur = WriteCur then + if FBufferMode = bmBlock then + begin + WaitForSingleObject(BlockEvent, INFINITE); + ResetEvent(BlockEvent); + end; + EnterCriticalSection(CS); + {$ENDIF} + if ReadCur <= WriteCur then + begin + S2 := WriteCur - ReadCur; + if Count < S2 then S2 := Count; + Move(Buff[ReadCur], Buffer, S2); + Inc(ReadCur, S2); + Dec(FBytesInBuffer, S2); + Result := S2; + end else + begin + S1 := STREAM_BUFFER_SIZE-ReadCur; + if Count <= S1 then + begin + Move(Buff[ReadCur], Buffer, Count); + Inc(ReadCur, Count); + Dec(FBytesInBuffer, Count); + Result := Count; + end else + begin + S2 := WriteCur; + if Count - S1 < S2 then S2 := Count; + Move(Buff[ReadCur], Buffer, S1); + addr := Pointer(Integer(@Buffer) + S1); + Move(Buff[0], addr^, S2); + ReadCur := S2; + Dec(FBytesInBuffer, S1+S2); + Result := S1+S2; + end; + end; + Inc(FBytesRead, Result); + {$IFDEF MSWINDOWS} + LeaveCriticalSection(CS); + {$ENDIF} + end; + + procedure TACSBufferStream.Reset; + begin + {$IFDEF MSWINDOWS} + EnterCriticalSection(CS); + {$ENDIF} + ReadCur := 0; + WriteCur := 0; + FBytesRead := 0; + {$IFDEF MSWINDOWS} + SetEvent(BlockEvent); + LeaveCriticalSection(CS); + {$ENDIF} + end; + + // the following property is implemented 'cause tstreams position property uses them + + function TACSBufferStream.Seek(Offset: Longint; Origin: Word) : Integer; + begin + if (Offset = 0) and (Origin = 0) then + Result := FBytesRead + else + raise EACSException.Create(strSeeknotimplemented); + end; + + function TACSBufferStream.Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; + begin + if (Offset = 0) and (Origin = soCurrent) then + Result := FBytesRead + else + raise EACSException.Create(strSeeknotimplemented); + end; + +{ TACSFileInfo } + +function TACSFileInfo.GetStringTag(Idx : string): TACSFileTag; +begin +end; + +procedure TACSFileInfo.ReadFromFile; +begin +end; + +procedure TACSFileInfo.SetStringTag(Idx : string; const AValue: TACSFileTag); +begin +end; + +procedure TACSFileInfo.SaveToFile; +begin +end; + +{ TACSFileTag } + +function TACSFileTag.GetName: string; +begin +end; + +function TACSFileTag.AsString: string; +begin +end; + +function TACSFileTag.Streamable: Boolean; +begin + Result := False; +end; + +procedure TACSFileTag.SaveToStream(Stream: TStream); +begin +end; + +procedure TACSFileTag.LoadFromStream(Stream: TStream); +begin +end; + +end. + + diff --git a/components/acs/Src/classes/acs_converters.pas b/components/acs/Src/classes/acs_converters.pas new file mode 100644 index 000000000..2c1b16cb8 --- /dev/null +++ b/components/acs/Src/classes/acs_converters.pas @@ -0,0 +1,906 @@ +(* + this file is a part of audio components suite. + see the license file for more details. + you can contact me at mail@z0m3ie.de + +$Log: acs_converters.pas,v $ +Revision 1.6 2006/08/31 20:10:54 z0m3ie +*** empty log message *** + +Revision 1.5 2006/07/04 18:38:32 z0m3ie +*** empty log message *** + +Revision 1.4 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.2 2006/01/01 18:46:40 z0m3ie +*** empty log message *** + +Revision 1.1 2005/12/19 18:34:35 z0m3ie +*** empty log message *** + +Revision 1.4 2005/12/04 16:54:33 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.3 2005/09/15 20:59:38 z0m3ie +start translate the documentation in the source for pasdoc + +Revision 1.2 2005/09/13 21:54:11 z0m3ie +acs is localizeable now (ACS_Strings) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.4 2005/09/01 19:55:48 z0m3ie +again Delphi corrections + +Revision 1.3 2005/08/31 20:30:39 z0m3ie +Mixer Channelname work now +minior corrections for Converters + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress +*) + +{ +@abstract(this unit introduces the base classes for acs) +@author(Andrei Borovsky (2003-2005)) +@author(Christian Ulrich (2005)) +} + +unit acs_converters; + +interface + +uses + Classes, SysUtils, ACS_Types, ACS_Procs, ACS_Classes, ACS_Strings, Math; + +const + BUF_SIZE = $8000; + + KERNEL_WIDTH = 64; + + SD_BUF_SIZE = 2048; + +type + + TACSMSConverterMode = (msmMonoToBoth, msmMonoToLeft, msmMonoToRight); + + TDA = array[0..63] of Double; + PDA = ^TDA; + + + TACSRateConverter = class(TACSCustomConverter) + private + FOutSampleRate : Integer; + WantedSize : Integer; + EndOfInput : Boolean; + remainder : Integer; + InBufM, OutBufM : PACSBuffer16; + InBufS, OutBufS : PACSStereoBuffer16; + DAM : array of Double; + DAS : array of TACSStereoSampleD; + Kernel : array of Double; + FKernelWidth : Integer; + FFilterWindow : TACSFilterWindowType; + Tail : Pointer; + LBS : TACSStereoSample16; + function ConvertFreqs16Mono(InSize : Integer): Integer; + function ConvertFreqs16Stereo(InSize : Integer): Integer; + procedure SetOutSampleRate(aSR : Integer); + procedure SetKernelWidth(aKW : Integer); + protected + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + published + property FilterWindow : TACSFilterWindowType read FFilterWindow write FFilterWindow; + property KernelWidth : Integer read FKernelWidth write SetKernelWidth; + property OutSampleRate : Integer read FOutSampleRate write SetOutSampleRate; + end; + + TACSMSConverter = class(TACSCustomConverter) + private + WantedSize : Integer; + EndOfInput : Boolean; + InOutBuf : array[1..BUF_SIZE] of Byte; + FMode : TACSMSConverterMode; + protected + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + published + property Mode : TACSMSConverterMode read FMode write FMode; + end; + + TACSSampleConverter = class(TACSCustomConverter) + private + WantedSize : Integer; + EndOfInput : Boolean; + InOutBuf : array[1..BUF_SIZE] of Byte; + protected + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + end; + + TACSStereoBalance = class(TACSCustomConverter) + private + FBalance : Single; + procedure SetBalance(a : Single); + protected + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + published + property Balance : Single read FBalance write SetBalance; + end; + +implementation + + function TACSRateConverter.ConvertFreqs16Mono(InSize : Integer): Integer; + var + i, step, j, k, s, m : Integer; + D : Double; + TailMono : PACSBuffer16; + TailMonoD : PACSDoubleArray; + begin + TailMono := Tail; + s := InSize shr 1; + if FInput.SampleRate > FOutSampleRate then + begin + step := FInput.SampleRate - FOutSampleRate; + j := 0; + if remainder < 0 then remainder := FOutSampleRate; + for i := 0 to s - 1 do + begin + if remainder > FOutSampleRate then Dec(remainder, FOutSampleRate) + else begin + D := 0; + for k := 0 to FKernelWidth - 1 do + if i-k >= 0 then + D := D + InBufM[i-k]*Kernel[FKernelWidth - 1 - k] + else + D := D + TailMono[FKernelWidth-1+i-k]*Kernel[FKernelWidth - 1 - k]; + OutBufM[j] := Round(D); + Inc(j); + Inc(remainder, step); + end; + end; + for i := 0 to FKernelWidth-2 do TailMono[i] := InBufM[i+s-FKernelWidth+1] + end else + begin + TailMonoD := Tail; + FillChar(DAM[0], Length(DAM)*8, 0); + for i := 0 to FKernelWidth-2 do + begin + DAM[i] := TailMonoD[i]; + TailMonoD[i] := 0; + end; + Step := Finput.SampleRate; + j := 0; + if remainder < 0 then remainder := 0; + while remainder < FOutSampleRate do + begin + m := Round(((FOutSampleRate - remainder)*LBS.Left + remainder*InBufM[0])/FOutSampleRate); + for k := 0 to FKernelWidth-1 do + DAM[j+k] := DAM[j+k] + m*Kernel[k]; + Inc(j); + Inc(remainder, step); + end; + Dec(remainder, FOutSampleRate); + for i := 0 to s - 2 do + begin + while remainder < FOutSampleRate do + begin + m := Round(((FOutSampleRate - remainder)*InBufM[i] + remainder*InBufM[i+1])/FOutSampleRate); + for k := 0 to FKernelWidth-1 do + DAM[j+k] := DAM[j+k] + m*Kernel[k]; + Inc(j); + Inc(remainder, step); + end; + Dec(remainder, FOutSampleRate); + end; + LBS.Left := InBufM[s-1]; + for i := 0 to j-1 do + OutBufM[i] := Round(DAM[i]); + for i := 0 to FKernelWidth-2 do TailMonoD[i] := DAM[i+j]; + end; + Result := j shl 1; + end; + + function TACSRateConverter.ConvertFreqs16Stereo(InSize : Integer): Integer; + var + i, step, j, k, s, m1, m2 : Integer; + D1, D2 : Double; + TailStereo : PACSStereoBuffer16; + TailStereoD : PACSStereoBufferD; + begin + TailStereo := Tail; + s := InSize shr 2; + if FInput.SampleRate > FOutSampleRate then + begin + step := FInput.SampleRate - FOutSampleRate; + j := 0; + if remainder < 0 then remainder := FOutSampleRate; + for i := 0 to s - 1 do + begin + try + if remainder > FOutSampleRate then Dec(remainder, FOutSampleRate) + else begin + D1 := 0; + D2 := 0; + for k := 0 to FKernelWidth - 1 do + if i-k >= 0 then + begin + D1 := D1 + InBufS[i-k].Left*Kernel[FKernelWidth - 1 - k]; + D2 := D2 + InBufS[i-k].Right*Kernel[FKernelWidth - 1 - k]; + end else + begin + D1 := D1 + TailStereo[FKernelWidth-1+i-k].Left*Kernel[FKernelWidth - 1 - k]; + D2 := D2 + TailStereo[FKernelWidth-1+i-k].Right*Kernel[FKernelWidth - 1 - k]; + end; + OutBufS[j].Left := Round(D1); + OutBufS[j].Right := Round(D2); + Inc(j); + Inc(remainder, step); + end; + except + end; + end; + for i := 0 to FKernelWidth-2 do TailStereo[i] := InBufS[i+s-FKernelWidth+1] + //Move(InBufS[s-FKernelWidth+1], TailStereo[0], FKernelWidth-1); + end else + begin + TailStereoD := Tail; + FillChar(DAS[0], Length(DAS)*16, 0); + for i := 0 to FKernelWidth-2 do + begin + DAS[i] := TailStereoD[i]; + TailStereoD[i].Left := 0; + TailStereoD[i].Right := 0; + end; + Step := Finput.SampleRate; + j := 0; + if remainder < 0 then remainder := 0; + while remainder < FOutSampleRate do + begin + m1 := Round(((FOutSampleRate - remainder)*LBS.Left + remainder*InBufS[0].Left)/FOutSampleRate); + m2 := Round(((FOutSampleRate - remainder)*LBS.Right + remainder*InBufS[0].Right)/FOutSampleRate); + for k := 0 to FKernelWidth-1 do + begin + DAS[j+k].Left := DAS[j+k].Left + m1*Kernel[k]; //InBufS[i].Left*Kernel[k]; + DAS[j+k].Right := DAS[j+k].Right + m2*Kernel[k]; //InBufS[i].Right*Kernel[k]; + end; + Inc(j); + Inc(remainder, step); + end; + Dec(remainder, FOutSampleRate); + for i := 0 to s - 2 do + begin + while remainder < FOutSampleRate do + begin + m1 := Round(((FOutSampleRate - remainder)*InBufS[i].Left + remainder*InBufS[i+1].Left)/FOutSampleRate); + m2 := Round(((FOutSampleRate - remainder)*InBufS[i].Right + remainder*InBufS[i+1].Right)/FOutSampleRate); + for k := 0 to FKernelWidth-1 do + begin + DAS[j+k].Left := DAS[j+k].Left + m1*Kernel[k]; //InBufS[i].Left*Kernel[k]; + DAS[j+k].Right := DAS[j+k].Right + m2*Kernel[k]; //InBufS[i].Right*Kernel[k]; + end; + Inc(j); + Inc(remainder, step); + end; + Dec(remainder, FOutSampleRate); + end; + LBS := InBufS[s-1]; + for i := 0 to j-1 do + begin + OutBufS[i].Left := Round(DAS[i].Left); + OutBufS[i].Right := Round(DAS[i].Right); + end; + for i := 0 to FKernelWidth-2 do TailStereoD[i] := DAS[i+j]; + end; + Result := j shl 2; + end; + + procedure Convert16To8(InOutBuf : PACSBuffer8; InSize : Integer); + var + i : Integer; + P : PACSBuffer16; + begin + P := @InOutBuf[0]; + for i := 0 to (Insize shr 1) -1 do + InOutBuf[i] := Hi(P[i]+$8000); + end; + + procedure Convert8To16(InOutBuf : PACSBuffer8; InSize : Integer); + var + i : Integer; + P : PACSBuffer16; + begin + P := @InOutBuf[0]; + for i := Insize - 1 downto 0 do P[i] := (InOutBuf[i] shl 8) - $8000; + end; + + procedure ConvertStereoToMono16(InOutBuf : PACSBuffer16; InSize : Integer); + var + i : Integer; + begin + for i := 0 to (Insize shr 2) - 1 do + begin + InOutBuf[i] := (InOutBuf[i shl 1] + InOutBuf[(i shl 1)+1]) div 2; + end; + end; + + + procedure ConvertMonoToStereo16(InOutBuf : PACSBuffer16; InSize : Integer; Mode : TACSMSConverterMode); + var + i : Integer; + begin + case Mode of + msmMonoToBoth : + for i := (Insize shr 1) - 1 downto 0 do + begin + InOutBuf[i shl 1] := InOutBuf[i]; + InOutBuf[(i shl 1)+1] := InOutBuf[i]; + end; + msmMonoToLeft : + for i := (Insize shr 1) - 1 downto 0 do + begin + InOutBuf[i shl 1] := 0; + InOutBuf[(i shl 1)+1] := InOutBuf[i]; + end; + msmMonoToRight : + for i := (Insize shr 1) - 1 downto 0 do + begin + InOutBuf[i shl 1] := InOutBuf[i]; + InOutBuf[(i shl 1)+1] := 0; + end; + end; + end; + + function GCD(a, b : Integer) : Integer; + var + p, q, r : Integer; + begin + p := a; + q := b; + r := p mod q; + while r <> 0 do + begin + p := q; + q := r; + r := p mod q; + end; + Result := q; + end; + + constructor TACSRateConverter.Create; + begin + inherited Create(AOwner); + FOutSampleRate := 22050; + FKernelWidth := 30; + FFilterWindow := fwBlackman; + end; + + destructor TACSRateConverter.Destroy; + begin + Kernel := nil; + DAS := nil; + DAM := nil; + inherited Destroy; + end; + + function TACSRateConverter.GetBPS : Integer; + begin + Result := 16; + end; + + function TACSRateConverter.GetCh : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + Result := FInput.Channels; + end; + + function TACSRateConverter.GetSR : Integer; + begin + Result := FOutSampleRate; + end; + + procedure TACSRateConverter.Init; + var + Ratio : Single; + TailSize : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + FInput.Init; + InputLock := False; + FBusy := True; + FPosition := 0; + BufStart := 1; + BufEnd := 0; + EndOfInput := False; + Ratio := FOutSampleRate/Finput.SampleRate; + if Ratio > 1. then + WantedSize := (Trunc(BUF_SIZE/Ratio) shr 2) * 4 + else WantedSize := BUF_SIZE; + if Finput.Channels = 1 then + begin + GetMem(InBufM, WantedSize); + GetMem(OutBufM, BUF_SIZE); + if Ratio < 1. then + TailSize := (KernelWidth-1)*2 + else + begin + SetLength(DAM, (BUF_SIZE div 2)+KernelWidth); + TailSize := (KernelWidth-1)*8; + end; + FillChar(DAM[0], Length(DAM)*Sizeof(DAM[0]), 0); + end else + begin + GetMem(InBufS, WantedSize); + GetMem(OutBufS, BUF_SIZE); + if Ratio < 1. then + TailSize := (KernelWidth-1)*4 + else + begin + SetLength(DAS, (BUF_SIZE div 4)+KernelWidth); + TailSize := (KernelWidth-1)*16; + end; + end; + GetMem(Tail, TailSize); + FillChar(Tail^, TailSize, 0); + FSize := Round(FInput.Size*Ratio); + remainder := -1; + if Ratio > 1. then Ratio := 1/Ratio; + Ratio := Ratio*0.4; + SetLength(Kernel, FKernelWidth); + CalculateSincKernel(@Kernel[0], Ratio, FKernelWidth, FFilterWindow); + end; + + procedure TACSRateConverter.Flush; + begin + FreeMem(Tail); + FInput.Flush; + if Finput.Channels = 1 then + begin + FreeMem(InBufM); + FreeMem(OutBufM); + end else + begin + FreeMem(InBufS); + FreeMem(OutBufS); + end; + FBusy := False; + end; + + function TACSRateConverter.GetData(Buffer : Pointer; BufferSize : Integer): Integer; + var + l : Integer; + InSize : Integer; + P : PACSBuffer8; + begin + if not Busy then raise EACSException.Create(strStreamnotopen); + if BufStart > BufEnd then + begin + if EndOfInput then + begin + Result := 0; + Exit; + end; + BufStart := 1; + if FInput.Channels = 1 then P := Pointer(InBufM) + else P := Pointer(InBufS); + while InputLock do; + InputLock := True; + l := Finput.GetData(@P[0], WantedSize); + InputLock := False; + if l = 0 then + begin + Result := 0; + Exit; + end; + InSize := l; + while (l<>0) and (InSize < WantedSize) do + begin + while InputLock do; + InputLock := True; + l := Finput.GetData(@P[InSize], WantedSize - InSize); + InputLock := False; + Inc(InSize, l); + end; + if l = 0 then + begin + EndOfInput := True; + if InSize < FKernelWidth*2 then + begin // stop buffer corruption? + Result := 0; + Exit; + end; + end; + if Self.Channels = 1 then + begin + BufEnd := ConvertFreqs16Mono(InSize); + end else + begin + BufEnd := ConvertFreqs16Stereo(InSize); + end; + end; + if BufferSize < (BufEnd - BufStart + 1) + then Result := BufferSize + else Result := BufEnd - BufStart + 1; + if FInput.Channels = 1 then P := Pointer(OutBufM) + else P := Pointer(OutBufS); + Move(P[BufStart-1], Buffer^, Result); + Inc(BufStart, Result); +// FPosition := Round(FInput.Position*(FSize/FInput.Size)); + Inc(FPosition, Result); + end; + + constructor TACSMSConverter.Create; + begin + inherited Create(AOwner); + end; + + destructor TACSMSConverter.Destroy; + begin + inherited Destroy; + end; + + function TACSMSConverter.GetBPS : Integer; + begin + Result := 16; + end; + + function TACSMSConverter.GetCh : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + if FInput.Channels = 1 then Result := 2 + else Result := 1; + end; + + function TACSMSConverter.GetSR : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + Result := FInput.SampleRate; + end; + + procedure TACSMSConverter.Init; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + FInput.Init; + FBusy := True; + FPosition := 0; + BufStart := 1; + BufEnd := 0; + InputLock := False; + EndOfInput := False; + if FInput.Channels = 2 then WantedSize := BUF_SIZE else + WantedSize := BUF_SIZE shr 1; + if FInput.Channels = 2 then + FSize := FInput.Size shr 1 + else FSize := FInput.Size shl 1; + end; + + procedure TACSMSConverter.Flush; + begin + FInput.Flush; + FBusy := False; + end; + + function TACSMSConverter.GetData(Buffer : Pointer; BufferSize : Integer): Integer; + var + l : Integer; + InSize : Integer; + begin + if not Busy then raise EACSException.Create(strStreamnotopen); + if BufStart > BufEnd then + begin + if EndOfInput then + begin + Result := 0; + Exit; + end; + BufStart := 1; + while InputLock do; + InputLock := True; + l := Finput.GetData(@InOutBuf[1], WantedSize); + InputLock := False; + if l = 0 then + begin + Result := 0; + Exit; + end; + InSize := l; + while (l<>0) and (InSize < WantedSize) do + begin + while InputLock do; + InputLock := True; + l := Finput.GetData(@InOutBuf[InSize+1], WantedSize - InSize); + InputLock := False; + Inc(InSize, l); + end; + if l = 0 then EndOfInput := True; + if FInput.Channels = 2 then + begin + ConvertStereoToMono16(@InOutBuf[1], InSize); + BufEnd := InSize shr 1; + end else + begin + ConvertMonoToStereo16(@InOutBuf[1], InSize, FMode); + BufEnd := InSize shl 1; + end; + end; + if BufferSize < (BufEnd - BufStart + 1) + then Result := BufferSize + else Result := BufEnd - BufStart + 1; + Move(InOutBuf[BufStart], Buffer^, Result); + Inc(BufStart, Result); +// FPosition := Round(FInput.Position*(FSize/FInput.Size)); + Inc(FPosition, Result); + end; + + constructor TACSSampleConverter.Create; + begin + inherited Create(AOwner); + end; + + destructor TACSSampleConverter.Destroy; + begin + inherited Destroy; + end; + + function TACSSampleConverter.GetBPS : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + if FInput.BitsPerSample = 16 then Result := 8 + else Result := 16; + end; + + function TACSSampleConverter.GetCh : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + Result:= FInput.Channels; + end; + + function TACSSampleConverter.GetSR : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + Result := FInput.SampleRate; + end; + + procedure TACSSampleConverter.Init; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + FInput.Init; + FBusy := True; + FPosition := 0; + BufStart := 1; + BufEnd := 0; + InputLock := False; + EndOfInput := False; + if FInput.BitsPerSample = 16 then WantedSize := BUF_SIZE else + WantedSize := BUF_SIZE shr 1; + if FInput.BitsPerSample = 16 then + FSize := FInput.Size shr 1 + else FSize := FInput.Size shl 1; + end; + + procedure TACSSampleConverter.Flush; + begin + FInput.Flush; + FBusy := False; + end; + + function TACSSampleConverter.GetData(Buffer : Pointer; BufferSize : Integer): Integer; + var + l : Integer; + InSize : Integer; + begin + if not Busy then raise EACSException.Create(strStreamnotopen); + if BufStart > BufEnd then + begin + if EndOfInput then + begin + Result := 0; + Exit; + end; + BufStart := 1; + while InputLock do; + InputLock := True; + l := Finput.GetData(@InOutBuf[1], WantedSize); + InputLock := False; + if l = 0 then + begin + Result := 0; + Exit; + end; + InSize := l; + while (l<>0) and (InSize < WantedSize) do + begin + while InputLock do; + InputLock := True; + l := Finput.GetData(@InOutBuf[InSize+1], WantedSize - InSize); + InputLock := False; + Inc(InSize, l); + end; + if l = 0 then EndOfInput := True; + if FInput.BitsPerSample = 16 then + begin + Convert16To8(@InOutBuf[1], InSize); + BufEnd := InSize shr 1; + end else + begin + Convert8To16(@InOutBuf[1], InSize); + BufEnd := InSize shl 1; + end; + end; + if BufferSize < (BufEnd - BufStart + 1) + then Result := BufferSize + else Result := BufEnd - BufStart + 1; + Move(InOutBuf[BufStart], Buffer^, Result); + Inc(BufStart, Result); + FPosition := Round(FInput.Position*(FSize/FInput.Size)); + // Inc(FPosition, Result); + end; + + procedure TACSRateConverter.SetOutSampleRate(aSR : Integer); + begin + if (aSR > 0) {and (not Busy)} then FOutSampleRate := aSR; + end; + + procedure TACSRateConverter.SetKernelWidth; + begin + if (aKW > 1) and (not Busy) then FKernelWidth := aKW; + end; + + constructor TACSStereoBalance.Create; + begin + inherited Create(AOwner); + FBalance := 0.5; + end; + + destructor TACSStereoBalance.Destroy; + begin + inherited Destroy; + end; + + procedure TACSStereoBalance.SetBalance; + begin + if (a >= 0) and (a <=1) then FBalance := a; + end; + + function TACSStereoBalance.GetBPS : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + Result := FInput.BitsPerSample; + end; + + function TACSStereoBalance.GetCh : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + Result := 2; + end; + + function TACSStereoBalance.GetSR : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + Result := FInput.SampleRate; + end; + + procedure TACSStereoBalance.Init; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + FInput.Init; + FBusy := True; + if FInput.Channels = 2 then FSize := FInput.Size + else FSize := FInput.Size*2; + FPosition := 0; + InputLock := False; + end; + + procedure TACSStereoBalance.Flush; + begin + FInput.Flush; + FBusy := False; + end; + + function TACSStereoBalance.GetData(Buffer : Pointer; BufferSize : Integer): Integer; + var + WantedSize, i : Integer; + P16 : PACSBuffer16; + P8 : PACSBuffer8; + Diff : Double; + begin + if not Busy then raise EACSException.Create(strStreamnotopen); + while InputLock do; + InputLock := True; + if FInput.Channels = 2 then WantedSize := BufferSize + else WantedSize := BufferSize shr 1; + Result := Finput.GetData(Buffer, WantedSize); + InputLock := False; + if Result = 0 then Exit; + if FInput.Channels = 1 then + begin + if FInput.BitsPerSample = 8 then + begin + P8 := Buffer; + for i := Result*2-1 downto 1 do P8[i] := P8[i shr 1]; + end else + begin + P16 := Buffer; + for i := Result-1 downto 1 do + P16[i] := P16[i shr 1]; + end; + Result := Result*2; + end; + if FInput.BitsPerSample = 8 then + begin + P8 := Buffer; + if FBalance > 0.5 then + begin + Diff := 1-Balance; + for i := 0 to (Result shr 1) -1 do + P8[i*2] := Round(P8[i*2]*Diff); + end else + begin + for i := 0 to (Result shr 1) -1 do + P8[i*2+1] := Round(P8[i*2+1]*FBalance); + end; + end else + begin + P16 := Buffer; + if FBalance > 0.5 then + begin + Diff := 1-Balance; + for i := 0 to (Result shr 2) -1 do + P16[i*2] := Round(P16[i*2]*Diff); + end else + begin + for i := 0 to (Result shr 2) -1 do + P16[i*2+1] := Round(P16[i*2+1]*FBalance); + end; + end; + FPosition := Round(FSize/FInput.Size)*FInput.Position; + end; + +end. diff --git a/components/acs/Src/classes/acs_file.pas b/components/acs/Src/classes/acs_file.pas new file mode 100644 index 000000000..fd2f9c16c --- /dev/null +++ b/components/acs/Src/classes/acs_file.pas @@ -0,0 +1,657 @@ +(* + this file is a part of audio components suite. + see the license file for more details. + you can contact me at mail@z0m3ie.de + +$Log: acs_file.pas,v $ +Revision 1.11 2006/08/03 17:31:09 z0m3ie +*** empty log message *** + +Revision 1.10 2006/07/09 16:40:34 z0m3ie +*** empty log message *** + +Revision 1.9 2006/07/07 15:51:19 z0m3ie +*** empty log message *** + +Revision 1.8 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.3 2006/01/01 18:46:40 z0m3ie +*** empty log message *** + +Revision 1.2 2005/12/26 17:31:38 z0m3ie +fixed some problems in acs_dsfiles +fixed some problems in acs_vorbis +reworked all buffers + +Revision 1.1 2005/12/19 18:34:35 z0m3ie +*** empty log message *** + +Revision 1.10 2005/12/18 17:01:54 z0m3ie +delphi compatibility + +Revision 1.9 2005/12/04 16:54:33 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.8 2005/10/05 20:26:36 z0m3ie +Linux changes + +Revision 1.7 2005/10/02 16:51:46 z0m3ie +*** empty log message *** + +Revision 1.6 2005/09/15 20:59:38 z0m3ie +start translate the documentation in the source for pasdoc + +Revision 1.5 2005/09/13 21:54:11 z0m3ie +acs is localizeable now (ACS_Strings) + +Revision 1.4 2005/09/13 20:14:25 z0m3ie +driver handling classes (basic audio class) + +Revision 1.3 2005/09/13 04:37:30 z0m3ie +*** empty log message *** + +Revision 1.2 2005/09/13 04:04:50 z0m3ie +First release without Components for Fileformats +only TFileIn and TFileOut are Visible +*) + +{ +@abstract(this unit introduces the base classes for acs) +@author(Christian Ulrich (2005)) + +this unit introduces basic fileformat support +} + +unit acs_file; + +interface + +uses + Classes, ACS_Classes, Dialogs, SysUtils, ACS_Strings; + +type + TACSFileInClass = class of TACSCustomFileIn; + TACSFileOutClass = class of TACSCustomFileOut; + + TACSFileCapTyp = (fcLoad,fcSave); + TACSFileCapTyps = set of TACSFileCapTyp; + + { TACSFileFormat } + + TACSFormatClass = class of TComponent; + + TACSFileFormat = class + public + FileClass : TACSFormatClass; + Extension : String; + Description : String; + end; + + { To this List all Filefomats must be added, + use initialization section of your format units to add your format to acs + so the user must only add your unit to the uses clausle to have support for + your fileformat. + } + tacsfileformatslist = class (tlist) + public + procedure Add(const Ext, Desc: String; AClass: TACSFormatClass); + function FindExt(ext : string;Typs : TACSFileCapTyps) : TACSFormatClass; + function FindFromFileName(const fileName : String;Typs : TACSFileCapTyps) : TACSFormatClass; + procedure Remove(AClass: TACSFormatClass); + procedure BuildFilterStrings(var descriptions: String;Typs : TACSFileCapTyps); + end; + + { This class is an wrapper for all fileformats + } + + { TFileIn } + + TACSFileIn = CLASS(TACSCustomFileIn) + private + FEndSample: Integer; + FFileName: string; + FInput : TACSCustomFileIn; + FDialog : TOpenDialog; + FLoop: Boolean; + FStartSample: Integer; + FTotalSamples: Integer; + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + function GetTime : Integer; + function GetValid : Boolean; + function GetTotalTime : real; override; + procedure Reset; override; + procedure SetFileName(const AValue : String); + function GetSize : Integer; + function GetPosition : Integer; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy;override; + procedure Open; + + procedure Flush; override; + procedure Init; override; + function Seek(SampleNum : Integer) : Boolean; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer;override; + function SetStartTime(Minutes, Seconds : Integer) : Boolean; + function SetEndTime(Minutes, Seconds : Integer) : Boolean; + procedure Jump(Offs : real); + property Time : Integer read GetTime; + property TotalSamples : Integer read FTotalSamples; + property Valid : Boolean read GetValid; + property Size : Integer read GetSize; + property Position : Integer read GetPosition; + published + property EndSample : Integer read FEndSample write FEndSample; + property FileName : string read FFileName write SetFileName; + property Loop : Boolean read FLoop write FLoop; + property StartSample : Integer read FStartSample write FStartSample; + end; + + + { This class is an wrapper for all fileformats + } + + { TFileOut } + + TACSFileOut = class(TComponent) + private + FBufferSize: Integer; + FFileMode: TACSFileOutputMode; + FFileName: string; + FOnDone: TACSOutputDoneEvent; + FOnProgress: TACSOutputProgressEvent; + FOnThreadException: TACSThreadExceptionEvent; + FOutput : TACSCustomFileOut; + FDialog : TSaveDialog; + FInput : TACSCustomInput; +{$IFDEF LINUX} + FAccessMask : Integer; +{$ENDIF} + function GetDelay: Integer; + function GetPriority: TTPriority; + function GetProgress: real; + function GetStatus: TACSOutputStatus; + function GetTE: Integer; + procedure SetDelay(const AValue: Integer); + procedure SetPriority(const AValue: TTPriority); + + procedure ThreadException(Sender : TComponent;E : Exception); + procedure OutputDone(Sender : TComponent); + procedure OutputProgress(Sender : TComponent); + protected + FBaseChannel: Integer; + procedure SetInput(vInput : TACSCustomInput); + procedure Done; + function DoOutput(Abort : Boolean):Boolean; + procedure Prepare; + procedure SetFileMode(aMode : TACSFileOutputMode); virtual; + procedure SetFileName(const AValue: string); + public + destructor Destroy;override; + procedure Open; + property Buffersize : Integer read FBufferSize write FBufferSize; + procedure Pause;virtual; + procedure Resume;virtual; + procedure Run; + procedure Stop; + property Delay : Integer read GetDelay write SetDelay; + property ThreadPriority : TTPriority read GetPriority write SetPriority; + property Progress : real read GetProgress; + property Status : TACSOutputStatus read GetStatus; + property TimeElapsed : Integer read GetTE; +{$IFDEF LINUX} + property AccessMask : Integer read FAccessMask write FAccessMask; +{$ENDIF} + published + property FileMode : TACSFileOutputMode read FFileMode write SetFileMode; + property FileName : string read FFileName write SetFileName; + property Input : TACSCustomInput read FInput write SetInput; + property OnDone : TACSOutputDoneEvent read FOnDone write FOndone; + property OnProgress : TACSOutputProgressEvent read FOnProgress write FOnProgress; + property OnThreadException : TACSThreadExceptionEvent read FOnThreadException write FOnThreadException; + end; + +var + FileFormats : TACSFileFormatsList; + +implementation + +{ TFileIn } + +function TACSFileIn.GetBPS: Integer; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoFileOpened); + Result := FInput.BitsPerSample; +end; + +function TACSFileIn.GetCh: Integer; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoFileOpened); + Result := FInput.Channels; +end; + +function TACSFileIn.GetSR: Integer; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoFileOpened); + Result := FInput.SampleRate; +end; + +function TACSFileIn.GetTime: Integer; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoFileOpened); + Result := FInput.Time; +end; + +function TACSFileIn.GetValid: Boolean; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoFileOpened); + Result := FInput.Valid; +end; + +function TACSFileIn.GetTotalTime: real; +begin + if not Assigned(FInput) then + exit; + Result := FInput.TotalTime; +end; + +procedure TACSFileIn.Reset; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoFileOpened); + FInput.Reset; +end; + +procedure TACSFileIn.SetFileName(const AValue: string); +begin + FFileName := AValue; + if Assigned(FInput) then + FInput.Free; + FInput := nil; + if AValue = '' then + exit; + FInput := TACSFileInClass(FileFormats.FindFromFileName(AValue,[fcLoad])).Create(nil); + if Assigned(FInput) then + FInput.FileName := FFilename; +end; + +function TACSFileIn.GetSize: Integer; +begin + Result := 1; + if Assigned(FInput) then + Result := FInput.Size; +end; + +function TACSFileIn.GetPosition: Integer; +begin + Result := 0; + if Assigned(FInput) then + Result := FInput.Position; +end; + +constructor TACSFileIn.Create(AOwner: TComponent); +begin + inherited Create(AOwner); +end; + +destructor TACSFileIn.Destroy; +begin + if Assigned(FInput) then + FInput.Free; + inherited Destroy; +end; + +procedure TACSFileIn.Open; +var + desc : string; +begin + FDialog := TOpenDialog.Create(nil); + FileFormats.BuildFilterStrings(desc,[fcLoad]); + FDialog.Filter := desc; + if FDialog.Execute then + begin + if Assigned(FInput) then + FInput.Free; + FInput := TACSFileInClass(FileFormats.FindFromFileName(FDialog.FileName,[fcLoad])).Create(nil); + FFileName := FDialog.FileName; + if Assigned(FInput) then + FInput.FileName := FFilename; + end; + FDialog.Free; +end; + +procedure TACSFileIn.Flush; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoFileOpened); + FInput.Flush; +end; + +procedure TACSFileIn.Init; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoFileOpened); + FInput.Init; +end; + +function TACSFileIn.Seek(SampleNum : Integer): Boolean; +begin + if not Assigned(Finput) then + EACSException.Create(strnoFileOpened); + FInput.Seek(SampleNum); +end; + +function TACSFileIn.GetData(Buffer: Pointer; BufferSize: Integer): Integer; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoFileOpened); + Result:=FInput.GetData(Buffer, BufferSize); +end; + +function TACSFileIn.SetStartTime(Minutes, Seconds: Integer): Boolean; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoFileOpened); + Result := FInput.SetStartTime(Minutes,Seconds); +end; + +function TACSFileIn.SetEndTime(Minutes, Seconds: Integer): Boolean; +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoFileOpened); + Result := FInput.SetEndTime(Minutes,Seconds); +end; + +procedure TACSFileIn.Jump(Offs: real); +begin + if not Assigned(FInput) then + raise EACSException.Create(strNoFileOpened); + FInput.Jump(Offs); +end; + +{ TACSFileOut } + +procedure TACSFileOut.SetFileName(const AValue: string); +begin + if FFileName=AValue then exit; + if Assigned(FOutput) then + FOutput.Free; + FOutput := nil; + FOutput := TACSFileOutClass(FileFormats.FindFromFileName(AValue,[fcSave])).Create(nil); + if Assigned(FOutput) then + begin + FOutput.FileName:=AValue; + foutput.FileMode := FFileMode; //GAK:20060731 + FOutput.Input := FInput; + FOutput.OnDone := OutputDone; + FOutput.OnProgress := OutputProgress; + Foutput.OnThreadException := ThreadException; + ffilename := avalue;//GAK:20060731 + end; +end; + +procedure TACSFileOut.Done; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoFileOpened); + FOutput.Done; +end; + +function TACSFileOut.DoOutput(Abort: Boolean): Boolean; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoFileOpened); + Result := FOutput.DoOutput(Abort); +end; + +procedure TACSFileOut.Prepare; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoFileOpened); + FOutput.Prepare; +end; + +function TACSFileOut.GetDelay: Integer; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoFileOpened); + result := FOutput.Delay; +end; + +function TACSFileOut.GetPriority: TTPriority; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoFileOpened); + Result := FOutput.ThreadPriority; +end; + +function TACSFileOut.GetProgress: real; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoFileOpened); + Result := FOutput.Progress; +end; + +function TACSFileOut.GetStatus: TACSOutputStatus; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoFileOpened); + Result := FOutput.Status; +end; + +function TACSFileOut.GetTE: Integer; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoFileOpened); + Result := FOutput.TimeElapsed; +end; + +procedure TACSFileOut.SetDelay(const AValue: Integer); +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoFileOpened); + FOutput.Delay := AValue; +end; + +procedure TACSFileOut.SetPriority(const AValue: TTPriority); +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoFileOpened); + FOutput.ThreadPriority := AValue; +end; + +procedure TACSFileOut.ThreadException(Sender : TComponent;E: Exception); +begin + if Assigned(OnThreadException) then + OnThreadException(Sender,E); +end; + +procedure TACSFileOut.OutputDone(Sender: TComponent); +begin + if Assigned(OnDone) then + OnDone(Sender); +end; + +procedure TACSFileOut.OutputProgress(Sender: TComponent); +begin + if Assigned(OnProgress) then + OnProgress(Sender); +end; + +procedure TACSFileOut.SetInput(vInput: TACSCustomInput); +begin + FInput := vInput; + if Assigned(FOutput) then + FOutput.Input := FInput; +end; + +procedure TACSFileOut.SetFileMode(aMode: TACSFileOutputMode); +begin +//GAK:20060731 changed whole of this method, as it was stopping component loading/creating + if amode <> ffilemode then + begin + FFileMode := amode; + if Assigned(FOutput) then FOutput.FileMode := aMode; + end; +end; + +procedure TACSFileOut.Open; +var + desc : string; + +begin + FDialog := TSaveDialog.Create(nil); + FileFormats.BuildFilterStrings(desc,[fcSave]); + FDialog.Filter := desc; + if FDialog.Execute then + begin + FOutput := TACSFileOutClass(FileFormats.FindFromFileName(FDialog.FileName,[fcSave])).Create(nil); + FileName := FDialog.FileName; + foutput.FileMode := ffilemode; + FOutput.Input := FInput; + FInput := FInput; + FOutput.OnDone := OutputDone; + FOutput.OnProgress := OutputProgress; + Foutput.OnThreadException := ThreadException; + end; + FDialog.Free; +end; + +procedure TACSFileOut.Pause; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoFileOpened); + FOutput.Pause; +end; + +procedure TACSFileOut.Resume; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoFileOpened); + FOutput.Resume; +end; + +procedure TACSFileOut.Run; +begin + if not Assigned(FOutput) then + raise EACSException.Create(strNoFileOpened); + FOutput.Run; +end; + +procedure TACSFileOut.Stop; +begin + if Assigned(FOutput) then + FOutput.Stop; +end; + +destructor TACSFileOut.Destroy; +begin + if Assigned(FOutput) then + FOutput.Free; + inherited Destroy; +end; + +{ TACSFileFormatsList } + +procedure TACSFileFormatsList.Add(const Ext, Desc: String;AClass: TACSFormatClass); +var + newRec : TACSFileFormat; +begin + newRec:=TACSFileFormat.Create; + with newRec do + begin + Extension:=LowerCase(Ext); + FileClass:=AClass; + Description:=Desc; + end; + inherited Add(newRec); +end; + +function TACSFileFormatsList.FindExt(ext: string;Typs : TACSFileCapTyps): TACSFormatClass; +var + i : Integer; +begin + ext:=LowerCase(ext); + for i:=Count-1 downto 0 do + with TACSFileFormat(Items[I]) do + begin + if ((fcLoad in Typs) and (TACSFileFormat(Items[I]).FileClass.InheritsFrom(TACSCustomFileIn))) or ((fcSave in Typs) and (TACSFileFormat(Items[I]).FileClass.InheritsFrom(TACSCustomFileOut))) then + if Extension=ext then + begin + Result:=TACSFileFormat(Items[I]).FileClass; + Exit; + end; + end; + Result:=nil; +end; + +function TACSFileFormatsList.FindFromFileName(const fileName: String;Typs : TACSFileCapTyps): TACSFormatClass; +var + ext : String; +begin + ext:=ExtractFileExt(Filename); + System.Delete(ext, 1, 1); + Result:=FindExt(ext,Typs); + if not Assigned(Result) then + raise EACSException.CreateFmt(strUnknownExtension, [ext]); +end; + +procedure TACSFileFormatsList.Remove(AClass: TACSFormatClass); +var + i : Integer; +begin + for i:=Count-1 downto 0 do begin + if TACSFileFormat(Items[i]).FileClass.InheritsFrom(AClass) then + begin + TACSFileFormat(Items[i]).Free; + Delete(i); + end; + end; +end; + +procedure TACSFileFormatsList.BuildFilterStrings(var descriptions : String;Typs : TACSFileCapTyps); +var + k, i : Integer; + p : TACSFileFormat; + filters : string; +begin + descriptions:=''; + filters := ''; + k:=0; + for i:=0 to Count-1 do + begin + p:=TACSFileFormat(Items[i]); + if ((fcLoad in Typs) and (p.FileClass.InheritsFrom(TACSCustomFileIn))) or ((fcSave in Typs) and (p.FileClass.InheritsFrom(TACSCustomFileOut))) then + with p do + begin + if k<>0 then + begin + descriptions:=descriptions+'|'; + filters := filters+';'; + end; + descriptions:=descriptions+Description+' (*.'+Extension+')|'+'*.'+Extension; + filters := filters+'*.'+Extension; + Inc(k); + end; + end; + descriptions := strAllFormats+'|'+filters+'|'+descriptions; +end; + +initialization + + FileFormats := TACSFileFormatsList.Create; + +finalization + + FileFormats.Free; + +end. + diff --git a/components/acs/Src/classes/acs_filters.pas b/components/acs/Src/classes/acs_filters.pas new file mode 100644 index 000000000..60b374463 --- /dev/null +++ b/components/acs/Src/classes/acs_filters.pas @@ -0,0 +1,768 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: acs_filters.pas,v $ +Revision 1.4 2006/08/31 20:10:54 z0m3ie +*** empty log message *** + +Revision 1.3 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.1 2005/12/19 18:34:35 z0m3ie +*** empty log message *** + +Revision 1.3 2005/12/04 16:54:33 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.2 2005/09/13 21:54:11 z0m3ie +acs is localizeable now (ACS_Strings) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + +unit acs_filters; + +interface + +uses + Classes, SysUtils, ACS_Types, ACS_Procs, ACS_Classes, ACS_Strings, Math; + +const + BUF_SIZE = $4000; + +type + + TACSFilterType = (ftBandPass, ftBandReject, ftHighPass, ftLowPass, ftAllPass); + + TACSBWFilter = class(TACSCustomConverter) + private + a3 : array[0..2] of Double; + b2 : array[0..1] of Double; + x0, x1, y0, y1 : array[0..1] of Double; + FLowFreq, FHighFreq : Integer; + FAmplification : Word; + FFilterType : TACSFilterType; + InBuf : array[1..BUF_SIZE] of Byte; + procedure SetHighFreq(aFreq : Integer); + procedure SetLowFreq(aFreq : Integer); + procedure SetAmplification(Ampl : Word); + protected + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + published + property Amplification : Word read FAmplification write SetAmplification; + property FilterType : TACSFilterType read FFilterType write FFilterType; + property HighFreq : Integer read FHighFreq write SetHighFreq; + property LowFreq : Integer read FLowFreq write SetLowFreq; + end; + + TACSSincFilter = class(TACSCustomConverter) + private + Lock : Boolean; + Kernel : array of Double; + DA : PACSDoubleArray; + DAS : PACSStereoBufferD; + inBuf : array[1..BUF_SIZE] of Byte; + FFilterType : TACSFilterType; + FKernelWidth : Integer; + FLowFreq, FHighFreq : Integer; + FWindowType : TACSFilterWindowType; + procedure SetFilterType(aFT : TACSFilterType); + procedure SetKernelWidth(aKW : Integer); + procedure SetWindowType(aWT : TACSFilterWindowType); + procedure SetHighFreq(aFreq : Integer); + procedure SetLowFreq(aFreq : Integer); + procedure CalculateFilter; + protected + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + procedure GetKernel(var K : PACSDoubleArray); + published + property FilterType : TACSFilterType read FFilterType write SetFilterType; + property HighFreq : Integer read FHighFreq write SetHighFreq; + property KernelWidth : Integer read FKernelWidth write SetKernelWidth; + property LowFreq : Integer read FLowFreq write SetLowFreq; + property WindowType : TACSFilterWindowType read FWindowType write SetWindowType; + end; + + TACSConvolver = class(TACSCustomConverter) + private + Lock : Boolean; + Kernel : array of Double; + DA : PACSDoubleArray; + DAS : PACSStereoBufferD; + inBuf : array[1..BUF_SIZE] of Byte; + FKernelWidth : Integer; + FAllPass : Boolean; + procedure SetKernelWidth(a : Integer); + protected + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + procedure SetKernel(K : PACSDoubleArray; Inverted : Boolean); + property KrenelWidth : Integer read FKernelWidth write SetKernelWidth; + published + property AllPass : Boolean read FAllPass write FAllPass; + end; + +implementation + + constructor TACSBWFilter.Create; + begin + inherited Create(AOwner); + FFilterType := ftBandPass; + FAmplification := 1; + end; + + destructor TACSBWFilter.Destroy; + begin + inherited Destroy; + end; + + function TACSBWFilter.GetBPS : Integer; + begin + Result := 16; + end; + + function TACSBWFilter.GetCh : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + Result := FInput.Channels; + end; + + function TACSBWFilter.GetSR : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + Result := FInput.SampleRate; + end; + + procedure TACSBWFilter.SetHighFreq; + begin + if FFilterType = ftLowPass then + FHighFreq := 0 + else FHighFreq := aFreq; + end; + + procedure TACSBWFilter.SetLowFreq; + begin + if FFilterType = ftHighPass then + FLowFreq := 0 + else FLowFreq := aFreq; + end; + + procedure TACSBWFilter.SetAmplification; + begin + if Ampl > 0 then FAmplification := Ampl; + end; + + procedure TACSBWFilter.Init; + var + C, D : Double; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + FInput.Init; + if ((FHighFreq - FlowFreq) < 0) or (((FHighFreq - FlowFreq) * 2) >= FInput.SampleRate) then + begin + FInput.Flush; + raise EACSException.Create(strIllegalFrequency); + end; + FBusy := True; + FPosition := 0; + BufStart := 1; + BufEnd := 0; + FSize := FInput.Size; + x0[0] := 0.0; + x0[1] := 0.0; + x1[0] := 0.0; + x1[1] := 0.0; + y0[0] := 0.0; + y0[1] := 0.0; + y1[0] := 0.0; + y1[1] := 0.0; + case FFilterType of + ftBandPass : + begin + C := 1 / Tan(Pi * (FHighFreq-FLowFreq+1) / FInput.SampleRate); + D := 2 * Cos(2 * Pi * ((FHighFreq+FLowFreq) shr 1) / FInput.SampleRate); + a3[0] := 1 / (1 + C); + a3[1] := 0.0; + a3[2] := -a3[0]; + b2[0] := -C * D * a3[0]; + b2[1] := (C - 1) * a3[0]; + end; + ftBandReject: // This doesn't seem to work well + begin + C := Tan(Pi * (FHighFreq-FLowFreq+1) / FInput.SampleRate); + D := 2 * Cos(2 * Pi * ((FHighFreq+FLowFreq) shr 1) / FInput.SampleRate); + a3[0] := 1 / (1 + C); + a3[1] := -D * a3[0]; + a3[2] := a3[0]; + b2[0] := a3[1]; + b2[1] := (1 - C) * a3[0]; + end; + ftLowPass: + begin + C := 1 / Tan(Pi * FLowFreq / FInput.SampleRate); + a3[0] := 1 / (1 + Sqrt(2) * C + C * C); + a3[1] := 2 * a3[0]; + a3[2] := a3[0]; + b2[0] := 2 * (1 - C * C) * a3[0]; + b2[1] := (1 - Sqrt(2) * C + C * C) * a3[0]; + end; + ftHighPass: + begin + C := Tan(Pi * FHighFreq / FInput.SampleRate); + a3[0] := 1 / (1 + Sqrt(2) * C + C * C); + a3[1] := -2 * a3[0]; + a3[2] := a3[0]; + b2[0] := 2 * (C * C - 1) * a3[0]; + b2[1] := (1 - Sqrt(2) * C + C * C) * a3[0]; + end; + end; + end; + + procedure TACSBWFilter.Flush; + begin + FInput.Flush; + FBusy := False; + end; + + function TACSBWFilter.GetData(Buffer : Pointer; BufferSize : Integer): Integer; + var + i : Integer; + InBufMono : PACSBuffer16; + InBufStereo : PACSStereoBuffer16; + arg, res : Double; + begin + if not Busy then raise EACSException.Create(strStreamnotopen); + if BufStart > BufEnd then + begin + BufStart := 1; + BufEnd := FInput.GetData(@InBuf[1], BUF_SIZE); + if BufEnd = 0 then + begin + Result := 0; + Exit; + end; + if Self.Channels = 1 then + begin + InBufMono := @InBuf[1]; + for i := 0 to (BufEnd shr 1) - 1 do + begin + arg := InBufMono[i]; + res := a3[0] * arg + a3[1] * x0[0] + a3[2] * x1[0] - + b2[0] * y0[0] - b2[1] * y1[0]; + InBufMono[i] := Round(res); + x1[0] := x0[0]; + x0[0] := arg; + y1[0] := y0[0]; + y0[0] := res; + InBufMono[i] := FAmplification * InBufMono[i]; + end; + end else + begin + InBufStereo := @InBuf[1]; + for i := 0 to (BufEnd shr 2) - 1 do + begin + arg := InBufStereo[i].Left; + res := a3[0] * arg + a3[1] * x0[0] + a3[2] * x1[0] - + b2[0] * y0[0] - b2[1] * y1[0]; + InBufStereo[i].Left := Round(res); + x1[0] := x0[0]; + x0[0] := arg; + y1[0] := y0[0]; + y0[0] := res; + arg := InBufStereo[i].Right; + res := a3[0] * arg + a3[1] * x0[1] + a3[2] * x1[1] - + b2[0] * y0[1] - b2[1] * y1[1]; + InBufStereo[i].Right := Round(res); + x1[1] := x0[1]; + x0[1] := arg; + y1[1] := y0[1]; + y0[1] := res; + InBufStereo[i].Right := FAmplification * InBufStereo[i].Right; + InBufStereo[i].Left := FAmplification * InBufStereo[i].Left; + end; + end; + end; + if BufferSize < (BufEnd - BufStart + 1) + then Result := BufferSize + else Result := BufEnd - BufStart + 1; + Move(InBuf[BufStart], Buffer^, Result); + Inc(BufStart, Result); + FPosition := Round(FInput.Position*(FSize/FInput.Size)); + // Inc(FPosition, Result); + end; + + constructor TACSSincFilter.Create; + begin + inherited Create(AOwner); + FKernelWidth := 31; + FWindowType := fwBlackman; + FLowFreq := 8000; + FHighFreq := 16000; + DA := nil; + DAS := nil; + end; + + destructor TACSSincFilter.Destroy; + begin + Kernel := nil; + if DA <> nil then FreeMem(DA); + if DAS <> nil then FreeMem(DAS); + Inherited Destroy; + end; + + procedure TACSSincFilter.CalculateFilter; + var + Kernel1, Kernel2 : array of Double; + CutOff : Double; + i, j : Integer; + Sum : Double; + begin + if csDesigning in ComponentState then Exit; + if not Assigned(FInput) then Exit; + if (FLowFreq > FInput.SampleRate/2) or (FHighFreq > FInput.SampleRate/2) then + raise EACSException.Create(strCutofftolow); + while Lock do; + Lock := True; + case FilterType of + ftLowPass: + begin + SetLength(Kernel, FKernelWidth); + CutOff := FLowFreq/FInput.SampleRate; + CalculateSincKernel(@Kernel[0], CutOff, FKernelWidth, FWindowType); + end; + ftHighPass: + begin + if not Odd(FKernelWidth) then Inc(FKernelWidth); + SetLength(Kernel, FKernelWidth); + CutOff := FHighFreq/FInput.SampleRate; + CalculateSincKernel(@Kernel[0], CutOff, FKernelWidth, FWindowType); + for i := 0 to FKernelWidth - 1 do + Kernel[i] := -Kernel[i]; + Kernel[(FKernelWidth shr 1)] := Kernel[(FKernelWidth shr 1)] + 1; + end; + ftBandPass: + begin + if not Odd(FKernelWidth) then Inc(FKernelWidth); + SetLength(Kernel1, FKernelWidth); + CutOff := FLowFreq/FInput.SampleRate; + CalculateSincKernel(@Kernel1[0], CutOff, FKernelWidth, FWindowType); + for i := 0 to FKernelWidth - 1 do + Kernel1[i] := -Kernel1[i]; + Kernel1[(FKernelWidth shr 1)] := Kernel1[(FKernelWidth shr 1)] + 1; + SetLength(Kernel2, FKernelWidth); + CutOff := FHighFreq/FInput.SampleRate; + CalculateSincKernel(@Kernel2[0], CutOff, FKernelWidth, FWindowType); + SetLength(Kernel, 2*FKernelWidth); + FillChar(Kernel[0], Length(Kernel)*SizeOf(Double), 0); + for i := 0 to KernelWidth - 1 do + for j := 0 to KernelWidth - 1 do + Kernel[i+j] := Kernel[i+j] + Kernel1[i]*Kernel2[j]; + SetLength(Kernel, FKernelWidth); + Kernel1 := nil; + Kernel2 := nil; + end; + ftBandReject: + begin + if not Odd(FKernelWidth) then Inc(FKernelWidth); + SetLength(Kernel1, FKernelWidth); + CutOff := FHighFreq/FInput.SampleRate; + CalculateSincKernel(@Kernel1[0], CutOff, FKernelWidth, FWindowType); + for i := 0 to FKernelWidth - 1 do + Kernel1[i] := -Kernel1[i]; + Kernel1[(FKernelWidth shr 1)] := Kernel1[(FKernelWidth shr 1)] + 1; + SetLength(Kernel2, FKernelWidth); + CutOff := FLowFreq/FInput.SampleRate; + CalculateSincKernel(@Kernel2[0], CutOff, FKernelWidth, FWindowType); + SetLength(Kernel, FKernelWidth); + for i := 0 to FKernelWidth - 1 do + Kernel[i] := Kernel1[i] + Kernel2[i]; + Kernel1 := nil; + Kernel2 := nil; + end; + ftAllPass : + begin + SetLength(Kernel, FKernelWidth); + FillChar(Kernel[0], Length(Kernel)*SizeOf(Double), 0); + Kernel[FKernelWidth shr 1] := 1; + end; + end; + Lock := False; + end; + + procedure TACSSincFilter.SetFilterType; + begin + FFilterType := aFT; + if Busy then CalculateFilter; + end; + + procedure TACSSincFilter.SetKernelWidth; + begin + if aKW > 2 then + if not Busy then FKernelWidth := aKW; + end; + + procedure TACSSincFilter.SetWindowType; + begin + FWindowType := aWT; + if Busy then CalculateFilter; + end; + + procedure TACSSincFilter.SetHighFreq; + begin + if aFreq > 0 then + FHighFreq := aFreq; + if csDesigning in ComponentState then Exit; + if Assigned(Finput) then + if FHighFreq > Finput.SampleRate div 2 then + FHighFreq := Finput.SampleRate div 2; + if FHighFreq < FLowFreq then + FLowFreq := FHighFreq; + if Busy then CalculateFilter; + end; + + procedure TACSSincFilter.SetLowFreq; + begin + if aFreq > 0 then + FLowFreq := aFreq; + if csDesigning in ComponentState then Exit; + if Assigned(Finput) then + if FlowFreq > Finput.SampleRate div 2 then + FLowFreq := Finput.SampleRate div 2; + if FHighFreq < FLowFreq then + FHighFreq := FLowFreq; + if Busy then CalculateFilter; + end; + + function TACSSincFilter.GetBPS : Integer; + begin + if not Assigned(Input) then + raise EACSException.Create(strInputnotassigned); + Result := FInput.BitsPerSample; + end; + + function TACSSincFilter.GetCh : Integer; + begin + if not Assigned(Input) then + raise EACSException.Create(strInputnotassigned); + Result := FInput.Channels; + end; + + function TACSSincFilter.GetSR : Integer; + begin + if not Assigned(Input) then + raise EACSException.Create(strInputnotassigned); + Result := FInput.SampleRate; + end; + + procedure TACSSincFilter.Init; + begin + if not Assigned(Input) then + raise EACSException.Create(strInputnotassigned); + Lock := False; + InputLock := False; + FBusy := True; + FInput.Init; + FPosition := 0; + CalculateFilter; + if FInput.Channels = 1 then + begin + GetMem(DA, ((BUF_SIZE div 2)+FKernelWidth-1)*SizeOf(Double)); + FillChar(DA[0], ((BUF_SIZE div 2)+FKernelWidth-1)*SizeOf(Double), 0); + end else + begin + GetMem(DAS, ((BUF_SIZE div 2)+(FKernelWidth-1)*2)*SizeOf(Double)); + FillChar(DAS[0], ((BUF_SIZE div 2)+(FKernelWidth-1)*2)*SizeOf(Double), 0); + end; + BufStart := 1; + BufEnd := 0; + FSize := FInput.Size; + end; + + procedure TACSSincFilter.Flush; + begin + FInput.Flush; + if DA <> nil then FreeMem(DA); + if DAS <> nil then FreeMem(DAS); + DA := nil; + DAS := nil; + FBusy := False; + end; + + function TACSSincFilter.GetData(Buffer : Pointer; BufferSize : Integer): Integer; + var + i, j, NumSamples : Integer; + InBufMono : PACSBuffer16; + InBufStereo : PACSStereoBuffer16; + begin + if not Busy then raise EACSException.Create(strStreamnotopen); + if BufStart > BufEnd then + begin + while Lock do; + Lock := True; + BufStart := 1; + while InputLock do; + InputLock := True; + BufEnd := FInput.GetData(@InBuf[1], BUF_SIZE); + InputLock := False; + if BufEnd = 0 then + begin + Result := 0; + Exit; + end; + if FInput.Channels = 1 then + begin + InBufMono := @InBuf[1]; + NumSamples := BufEnd div 2; + for i := 0 to NumSamples-1 do + for j := 0 to FKernelWidth-1 do + DA[i+j] := DA[i+j] + InbufMono[i]*Kernel[j]; + for i := 0 to NumSamples-1 do + InBufMono[i] := Round(DA[i]); + BufEnd := NumSamples*2; + FillChar(DA[0], NumSamples*SizeOf(Double), 0); + Move(DA[NumSamples], DA[0], (FKernelWidth-1)*SizeOf(Double)); + end else + begin + InBufStereo := @InBuf[1]; + NumSamples := BufEnd div 4; + for i := 0 to NumSamples-1 do + for j := 0 to FKernelWidth-1 do + begin + DAS[i+j].Left := DAS[i+j].Left + InbufStereo[i].Left*Kernel[j]; + DAS[i+j].Right := DAS[i+j].Right + InbufStereo[i].Right*Kernel[j]; + end; + for i := 0 to NumSamples-1 do + begin + InBufStereo[i].Left := Round(DAS[i].Left); + InBufStereo[i].Right := Round(DAS[i].Right); + end; + BufEnd := NumSamples*4; + FillChar(DAS[0], NumSamples*2*SizeOf(Double), 0); + for i := 0 to FKernelWidth-2 do + begin + DAS[i] := DAS[NumSamples+i]; + DAS[NumSamples+i].Left := 0; + DAS[NumSamples+i].Right := 0; + end; + //Move(DAS[NumSamples], DAS[0], (FKernelWidth-1)*2*SizeOf(Double)); + end; + Lock := False; + end; + if BufferSize < (BufEnd - BufStart + 1) + then Result := BufferSize + else Result := BufEnd - BufStart + 1; + Move(InBuf[BufStart], Buffer^, Result); + Inc(BufStart, Result); + FPosition := Round(FInput.Position*(FSize/FInput.Size)); + end; + + procedure TACSSincFilter.GetKernel; + begin + K := @Kernel[0]; + end; + + constructor TACSConvolver.Create; + begin + inherited Create(AOwner); + FKernelWidth := 31; + if csDesigning in ComponentState then Exit; + SetLength(Kernel, FKernelWidth); + FillChar(Kernel[1], Length(Kernel)*SizeOf(Double), 0); + DA := nil; + DAS := nil; + end; + + destructor TACSConvolver.Destroy; + begin + Kernel := nil; + if DA <> nil then FreeMem(DA); + if DAS <> nil then FreeMem(DAS); + Inherited Destroy; + end; + + procedure TACSConvolver.SetKernelWidth; + begin + if a > 2 then + if not Busy then FKernelWidth := a; + end; + + function TACSConvolver.GetBPS : Integer; + begin + if not Assigned(Input) then + raise EACSException.Create(strInputnotassigned); + Result := FInput.BitsPerSample; + end; + + function TACSConvolver.GetCh : Integer; + begin + if not Assigned(Input) then + raise EACSException.Create(strInputnotassigned); + Result := FInput.Channels; + end; + + function TACSConvolver.GetSR : Integer; + begin + if not Assigned(Input) then + raise EACSException.Create(strInputnotassigned); + Result := FInput.SampleRate; + end; + + procedure TACSConvolver.Init; + begin + if not Assigned(Input) then + raise EACSException.Create(strInputnotassigned); + Lock := False; + InputLock := False; + FBusy := True; + FInput.Init; + FPosition := 0; + if FInput.Channels = 1 then + begin + GetMem(DA, ((BUF_SIZE div 2)+FKernelWidth-1)*SizeOf(Double)); + FillChar(DA[0], ((BUF_SIZE div 2)+FKernelWidth-1)*SizeOf(Double), 0); + end else + begin + GetMem(DAS, ((BUF_SIZE div 2)+(FKernelWidth-1)*2)*SizeOf(Double)); + FillChar(DAS[0], ((BUF_SIZE div 2)+(FKernelWidth-1)*2)*SizeOf(Double), 0); + end; + BufStart := 1; + BufEnd := 0; + FSize := FInput.Size; + end; + + procedure TACSConvolver.Flush; + begin + FInput.Flush; + if DA <> nil then FreeMem(DA); + if DAS <> nil then FreeMem(DAS); + DA := nil; + DAS := nil; + FBusy := False; + end; + + function TACSConvolver.GetData(Buffer : Pointer; BufferSize : Integer): Integer; + var + i, j, NumSamples : Integer; + InBufMono : PACSBuffer16; + InBufStereo : PACSStereoBuffer16; + begin + if not Busy then raise EACSException.Create(strStreamNotopen); + if BufStart > BufEnd then + begin + while Lock do; + Lock := True; + BufStart := 1; + while InputLock do; + InputLock := True; + BufEnd := FInput.GetData(@InBuf[1], BUF_SIZE); + InputLock := False; + if BufEnd = 0 then + begin + Result := 0; + Exit; + end; + if not FAllPass then + begin + if FInput.Channels = 1 then + begin + InBufMono := @InBuf[1]; + NumSamples := BufEnd div 2; + for i := 0 to NumSamples-1 do + for j := 0 to FKernelWidth-1 do + DA[i+j] := DA[i+j] + InbufMono[i]*Kernel[j]; + for i := 0 to NumSamples-1 do + InBufMono[i] := Round(DA[i]); + BufEnd := NumSamples*2; + FillChar(DA[0], NumSamples*SizeOf(Double), 0); + Move(DA[NumSamples], DA[0], (FKernelWidth-1)*SizeOf(Double)); + end else + begin + InBufStereo := @InBuf[1]; + NumSamples := BufEnd div 4; + for i := 0 to NumSamples-1 do + for j := 0 to FKernelWidth-1 do + begin + DAS[i+j].Left := DAS[i+j].Left + InbufStereo[i].Left*Kernel[j]; + DAS[i+j].Right := DAS[i+j].Right + InbufStereo[i].Right*Kernel[j]; + end; + for i := 0 to NumSamples-1 do + begin + InBufStereo[i].Left := Round(DAS[i].Left); + InBufStereo[i].Right := Round(DAS[i].Right); + end; + BufEnd := NumSamples*4; + FillChar(DAS[0], NumSamples*2*SizeOf(Double), 0); + for i := 0 to FKernelWidth-2 do + begin + DAS[i] := DAS[NumSamples+i]; + DAS[NumSamples+i].Left := 0; + DAS[NumSamples+i].Right := 0; + end; + //Move(DAS[NumSamples], DAS[0], (FKernelWidth-1)*2*SizeOf(Double)); + end; + end; + Lock := False; + end; + if BufferSize < (BufEnd - BufStart + 1) + then Result := BufferSize + else Result := BufEnd - BufStart + 1; + Move(InBuf[BufStart], Buffer^, Result); + Inc(BufStart, Result); + FPosition := Round(FInput.Position*(FSize/FInput.Size)); + end; + + procedure TACSConvolver.SetKernel; + var + i : Integer; + begin + while Lock do; + Lock := True; + if not Inverted then + for i := 0 to FKernelWidth - 1 do + Kernel[i] := K[i] + else + for i := 0 to FKernelWidth - 1 do + Kernel[i] := K[FKernelWidth - 1-i]; + Lock := False; + end; + + +end. diff --git a/components/acs/Src/classes/acs_indicator.pas b/components/acs/Src/classes/acs_indicator.pas new file mode 100644 index 000000000..18a3c9c5c --- /dev/null +++ b/components/acs/Src/classes/acs_indicator.pas @@ -0,0 +1,203 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: acs_indicator.pas,v $ +Revision 1.2 2006/08/31 20:10:54 z0m3ie +*** empty log message *** + +Revision 1.1 2005/12/19 18:34:35 z0m3ie +*** empty log message *** + +Revision 1.4 2005/12/04 16:54:33 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.3 2005/10/02 16:51:46 z0m3ie +*** empty log message *** + +Revision 1.2 2005/09/13 21:54:11 z0m3ie +acs is localizeable now (ACS_Strings) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + + +unit acs_indicator; + +interface + +uses + Classes, ACS_Types, ACS_Classes, ACS_Procs, ACS_Strings; + +type + + TACSSoundIndicator = class(TACSCustomConverter) + private + Lock : Boolean; + Window : array[0..1023] of Double; + FValues : array[0..31] of Double; + protected + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure GetValues(var Values : array of Double); + procedure Init; override; + procedure Flush; override; + end; + +implementation + + constructor TACSSoundIndicator.Create; + begin + inherited Create(AOwner); + HannWindow(@Window, 1024, True); + end; + + destructor TACSSoundIndicator.Destroy; + begin + inherited Destroy; + end; + + function TACSSoundIndicator.GetBPS : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotassigned); + Result := FInput.BitsPerSample; + end; + + function TACSSoundIndicator.GetCh : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotassigned); + Result := FInput.Channels; + end; + + function TACSSoundIndicator.GetSR : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotassigned); + Result := FInput.SampleRate; + end; + + procedure TACSSoundIndicator.Init; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotassigned); + FBusy := True; + FInput.Init; + FSize := FInput.Size; + FillChar(FValues[0], SizeOf(Double)*32, 0); + Lock := False; + FPosition := 0; + end; + + procedure TACSSoundIndicator.Flush; + begin + FInput.Flush; + FBusy := False; + Lock := False; + end; + + function TACSSoundIndicator.GetData(Buffer : Pointer; BufferSize : Integer): Integer; + var + i, j, k, NumSamples : Integer; + P : Pointer; + P8 : PACSBuffer8; + P16 : PACSBuffer16; + PS8 : PACSStereoBuffer8; + PS16 : PACSStereoBuffer16; + DA : array[0..63] of Double; + C1 : array[0..63] of TACSComplex; + begin + if not Busy then raise EACSException.Create(strStreamnotopen); + while InputLock do; + InputLock := True; + Result := FInput.GetData(Buffer, BufferSize); + InputLock := False; + FPosition := Finput.Position; + if Result = 0 then Exit; + if Lock then Exit; + Lock := True; + k := Result; + GetMem(P, k); + Move(Buffer^, P^, k); + if FInput.BitsPerSample = 8 then + begin + if FInput.Channels = 1 then NumSamples := k + else NumSamples := k shr 1; + end else + begin + if FInput.Channels = 1 then NumSamples := k shr 1 + else NumSamples := k shr 2; + end; + for i := 0 to (NumSamples div 64) - 1 do + begin + if FInput.BitsPerSample = 8 then + begin + if FInput.Channels = 1 then + begin + P8 := P; + for j := 0 to 63 do DA[j] := P8[i*64+j]; + end else + begin + PS8 := P; + for j := 0 to 63 do DA[j] := (PS8[i*64+j].Left+PS8[i*64+j].Right)/2; + end + end else + begin + if FInput.Channels = 1 then + begin + P16 := P; + for j := 0 to 63 do DA[j] := P16[i*64+j]; + end else + begin + PS16 := P; + for j := 0 to 63 do DA[j] := (PS16[i*64+j].Left+PS16[i*64+j].Right)/2; + end + end; + MultDoubleArrays(@Window[0], @DA[0], 64); + for j := 0 to 63 do + begin + C1[j].Re := DA[j]; + C1[j].Im := 0; + end; + ComplexFFT(@C1, 64, 1); + LgMagnitude(@C1[0], @DA[0], 64, 0); + try + for j := 0 to 31 do FValues[j]:=FValues[j]+DA[j]; + except + for j := 0 to 31 do FValues[j] := 0; + end; + end; + for j := 0 to 31 do FValues[j]:=FValues[j]/(NumSamples div 64); + FreeMem(P); + Lock := False; + end; + + procedure TACSSoundIndicator.GetValues; + var + i : Integer; + begin + while Lock do; + Lock := True; + for i := 0 to 31 do Values[i] := FValues[i]*0.4; //ValCount; + for i := 0 to 31 do FValues[i] := 0; + Lock := False; + end; + +end. diff --git a/components/acs/Src/classes/acs_misc.pas b/components/acs/Src/classes/acs_misc.pas new file mode 100644 index 000000000..38cab7592 --- /dev/null +++ b/components/acs/Src/classes/acs_misc.pas @@ -0,0 +1,543 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: acs_misc.pas,v $ +Revision 1.4 2006/08/31 20:10:54 z0m3ie +*** empty log message *** + +Revision 1.3 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.1 2005/12/19 18:34:35 z0m3ie +*** empty log message *** + +Revision 1.4 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.3 2005/09/13 21:54:11 z0m3ie +acs is localizeable now (ACS_Strings) + +Revision 1.2 2005/09/13 04:04:50 z0m3ie +First release without Components for Fileformats +only TFileIn and TFileOut are Visible + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.9 2005/09/07 20:53:22 z0m3ie +begon to add MPEG and WMA support using DirectX + +Revision 1.8 2005/09/04 17:59:37 z0m3ie +moving CDIn support to AKRip mostly +begon to add mpegin support for Win with mpg123 + +Revision 1.7 2005/08/28 18:35:53 z0m3ie +created Delphi package for 2.4 +more Mixer stuff +updated some things for Delphi + +Revision 1.6 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + +unit acs_misc; + +interface + +uses + Classes, SysUtils, ACS_Types, ACS_Classes, ACS_Strings + {$IFDEF LINUX} + , libc, LibAO + {$ENDIF}; + +const + BUF_SIZE = $4000; + +type + TACSOnBufferDone = procedure(Sender : TComponent) of object; + + TACSAudioProcessorInitEvent = procedure(Sender : TComponent; var TotalSize : Integer) of object; + TACSAudioProcessorFlushEvent = procedure(Sender : TComponent) of object; + + TACSGetParameterEvent = procedure(Sender : TComponent; var Param : Integer) of object; + + TACSGetRealParameterEvent = procedure(Sender : TComponent; var Param : real) of object; + + TACSGetDataEvent = procedure(Sender : TComponent; Data : Pointer; var n : Integer) of object; + + TACSMemoryIn = class(TACSCustomInput) + private + FBuffer : PACSBuffer8; + FDataSize : Integer; + FOnBufferDone : TACSOnBufferDone; + Busy : Boolean; + BufStart, BufEnd : Integer; + FBPS, FSR, FChan : Integer; + function GetBuffer : Pointer; + procedure SetBuffer(v : Pointer); + protected + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + property DataBuffer : Pointer read GetBuffer write SetBuffer; + property DataSize : Integer read FDataSize write FDataSize; + published + property GlobalSize : Integer read FSize write FSize; + property InBitsPerSample : Integer read GetBPS write FBPS; + property InChannels : Integer read GetCh write FChan; + property InSampleRate : Integer read GetSR write FSR; + property OnBufferDone : TACSOnBufferDone read FOnBufferDone write FOnBufferDone; + end; + + TACSAudioProcessor = class(TACSCustomConverter) + private + FOnInit : TACSAudioProcessorInitEvent; + FOnFlush : TACSAudioProcessorFlushEvent; + FOnGetData : TACSGetDataEvent; + FOnGetSampleRate : TACSGetParameterEvent; + FOnGetBitsPerSample : TACSGetParameterEvent; + FOnGetChannels : TACSGetParameterEvent; + FOnGetTotalTime : TACSGetRealParameterEvent; + FOnGetSize : TACSGetParameterEvent; + protected + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + function GetTotalTime : real; override; + public + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + published + property OnFlush : TACSAudioProcessorFlushEvent read FOnFlush write FOnFlush; + property OnGetBitsPerSample : TACSGetParameterEvent read FOnGetBitsPerSample write FOnGetBitsPerSample; + property OnGetChannels : TACSGetParameterEvent read FOnGetChannels write FOnGetChannels; + property OnGetData : TACSGetDataEvent read FOnGetData write FOnGetData; + property OnGetSampleRate : TACSGetParameterEvent read FOnGetSampleRate write FOnGetSampleRate; + property OnGetSize : TACSGetParameterEvent read FOnGetSize write FOnGetSize; + property OnGetTotalTime : TACSGetrealParameterEvent read FOnGetTotalTime write FOnGetTotalTime; + property OnInit : TACSAudioProcessorInitEvent read FOnInit write FOnInit; + end; + + TACSNULLOut = class(TACSCustomOutput) + private + Buf : array[0..BUF_SIZE-1] of Byte; + protected + procedure Done; override; + function DoOutput(Abort : Boolean):Boolean; override; + procedure Prepare; override; + end; + + TACSInputItem = class(TCollectionItem) + protected + FInput : TACSCustomInput; + function GetOwner : TPersistent; override; + published + property Input : TACSCustomInput read FInput write FInput; + end; + + TACSInputItems = class(TOwnedCollection) + end; + + TACSInputChangedEvent = procedure(Sender : TComponent; var Index : Integer; var Continue : Boolean) of object; + + TACSInputList = class(TACSCustomInput) + private + FCurrentInput : Integer; + FInputItems : TACSInputItems; + Lock : Boolean; + FOnInputChanged : TACSInputChangedEvent; + FIndicateProgress : Boolean; + procedure SetCurrentInput(aInput : Integer); + procedure SetInputItems(aItems : TACSInputItems); + protected + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + property CurrentInput : Integer read FCurrentInput write SetCurrentInput; + published + property IndicateProgress : Boolean read FIndicateProgress write FIndicateProgress; + property InputItems : TACSInputItems read FInputItems write SetInputItems; + property OnInputChanged : TACSInputChangedEvent read FOnInputChanged write FOnInputChanged; + end; + + +implementation + +{$IFDEF LINUX} + +var + AOInitialized : Integer = 0; + +{$ENDIF} + + constructor TACSMemoryIn.Create; + begin + inherited Create(AOwner); + FSize := -1; + end; + + destructor TACSMemoryIn.Destroy; + begin + inherited Destroy; + end; + + function TACSMemoryIn.GetBPS : Integer; + begin + if (FBPS in [8, 16]) = False then FBPS := 16; + Result := FBPS; + end; + + function TACSMemoryIn.GetCh : Integer; + begin + if (FChan in [1..2]) = False then FChan := 1; + Result := FChan; + end; + + function TACSMemoryIn.GetSR : Integer; + begin + if (FSR < 4000) or (FSR > 48000) then FSR := 8000; + Result := FSR; + end; + + procedure TACSMemoryIn.Init; + begin + FPosition := 0; + BufEnd := FDataSize; + BufStart := 1; + Busy := True; + end; + + procedure TACSMemoryIn.Flush; + begin + Busy := False; + FDataSize := 0; + end; + + function TACSMemoryIn.GetData(Buffer : Pointer; BufferSize : Integer): Integer; + begin + if not Busy then raise EACSException.Create(strStreamnotopen); + if not Assigned(FBuffer) then + begin + Result := 0; + Exit; + end; + if BufStart > BufEnd then + begin + BufStart := 1; + if FDataSize = 0 then + begin + if Assigned(FOnBufferDone) then FOnBufferDone(Self) + else + begin + Result := 0; + Exit; + end; + end; + BufEnd := FDataSize; + if FDataSize = 0 then + begin + Result := 0; + Exit; + end; + end; + if BufferSize < (BufEnd - BufStart + 1) + then Result := BufferSize + else Result := BufEnd - BufStart + 1; + Move(FBuffer[BufStart-1], Buffer^, Result); + Inc(BufStart, Result); + Inc(FPosition, Result); + Dec(FDataSize, Result); + end; + + function TACSMemoryIn.GetBuffer : Pointer; + begin + Result := Pointer(FBuffer); + end; + + procedure TACSMemoryIn.SetBuffer; + begin + FBuffer := PACSBuffer8(v); + end; + + function TACSAudioProcessor.GetBPS : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + if Assigned(FOnGetBitsPerSample) then FOnGetBitsPerSample(Self, Result) else + Result := FInput.BitsPerSample; + end; + + function TACSAudioProcessor.GetSR : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + if Assigned(FOnGetSampleRate) then FOnGetSampleRate(Self, Result) else + Result := FInput.SampleRate; + end; + + function TACSAudioProcessor.GetCh : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + if Assigned(FOnGetChannels) then FOnGetChannels(Self, Result) else + Result := FInput.Channels; + end; + + function TACSAudioProcessor.GetTotalTime : real; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + if Assigned(FOnGetTotalTime) then FOnGetTotalTime(Self, Result) else + Result := FInput.TotalTime; + end; + + function TACSAudioProcessor.GetData(Buffer : Pointer; BufferSize : Integer): Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + Result := BufferSize; + if Assigned(FOnGetData) then FOnGetData(Self, Buffer, Result) + else Result := FInput.GetData(Buffer, BufferSize); + Inc(FPosition, Result); +// if Result = 0 then +// Result := Result shl 1; + end; + + procedure TACSAudioProcessor.Init; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + if Assigned(FOnInit) then FOnInit(Self, FSize) + else + begin + FInput.Init; + if Assigned(FOnGetSize) then FOnGetSize(Self, FSize) + else FSize := Finput.Size; + end; + FBusy := True; + FPosition := 0; + end; + + procedure TACSAudioProcessor.Flush; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + if Assigned(FOnFlush) then FOnFlush(Self) + else FInput.Flush; + FBusy := False; + end; + +procedure TACSNULLOut.Prepare; +begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + FInput.Init; +end; + +function TACSNULLOut.DoOutput(Abort : Boolean):Boolean; +begin + Result := True; + if not Busy then Exit; + if Abort or (not CanOutput) then + begin + Result := False; + Exit; + end; + if Finput.GetData(@Buf[0], BUF_SIZE) > 0 then Result := True + else + begin + Result := False; + Exit; + end; +end; + +procedure TACSNULLOut.Done; +begin + FInput.Flush; +end; + +function TACSInputItem.GetOwner : TPersistent; +begin + Result := Collection; +end; + +constructor TACSInputList.Create; +begin + inherited Create(AOwner); + FInputItems := TACSInputItems.Create(Self, TACSInputItem); + FPosition := 0; + FSize := -1; + FIndicateProgress := True; +end; + +destructor TACSInputList.Destroy; +begin + FInputItems.Free; + Inherited Destroy; +end; + +procedure TACSInputList.SetCurrentInput; +var + I : TACSInputItem; +begin + if aInput <> 0 then + if (aInput < 0) or (aInput >= FInputItems.Count) then + raise EACSException.Create(Format(strListIndexOOB,[aInput])); + if Busy then + begin + while Lock do; + Lock := True; + I := TACSInputItem(InputItems.Items[FCurrentInput]); + I.Input.Flush; + I := TACSInputItem(InputItems.Items[aInput]); + I.Input.Init; + if FIndicateProgress then + FSize := I.Input.Size + else FSize := -1; + FPosition := 0; + Lock := False; + end; + FCurrentInput := aInput; +end; + +function TACSInputList.GetBPS : Integer; +var + I : TACSInputItem; +begin + if Busy then + begin + I := TACSInputItem(InputItems.Items[FCurrentInput]); + Result := I.Input.BitsPerSample; + end else + if InputItems.Count > 0 then + begin + I := TACSInputItem(InputItems.Items[0]); + Result := I.Input.BitsPerSample; + end; +end; + +function TACSInputList.GetCh : Integer; +var + I : TACSInputItem; +begin + if Busy then + begin + I := TACSInputItem(InputItems.Items[FCurrentInput]); + Result := I.Input.Channels; + end else + if InputItems.Count > 0 then + begin + I := TACSInputItem(InputItems.Items[0]); + Result := I.Input.Channels; + end; +end; + +function TACSInputList.GetSR : Integer; +var + I : TACSInputItem; +begin + if Busy then + begin + I := TACSInputItem(InputItems.Items[FCurrentInput]); + Result := I.Input.SampleRate; + end else + if InputItems.Count > 0 then + begin + I := TACSInputItem(InputItems.Items[0]); + Result := I.Input.SampleRate; + end; +end; + +procedure TACSInputList.Init; +var + I : TACSInputItem; +begin + if Busy then + raise EACSException.Create(strBusy); + if InputItems.Count = 0 then + raise EACSException.Create(strNoInputItems); + I := TACSInputItem(InputItems.Items[FCurrentInput]); + if not Assigned(I.Input) then + raise EACSException.Create(Format(strNoInputAssigned,[FCurrentInput])); + FBusy := True; + I.Input.Init; + if FIndicateProgress then + FSize := I.Input.Size + else FSize := -1; + FPosition := 0; +end; + +procedure TACSInputList.Flush; +var + I : TACSInputItem; +begin + I := TACSInputItem(InputItems.Items[FCurrentInput]); + I.Input.Flush; + FCurrentInput := 0; + Lock := False; + FBusy := False; +end; + +function TACSInputList.GetData(Buffer : Pointer; BufferSize : Integer): Integer; +var + I : TACSInputItem; + Continue : Boolean; +begin + while Lock do; + Lock := True; + I := TACSInputItem(InputItems.Items[FCurrentInput]); + Result := I.Input.GetData(Buffer, BufferSize); + while Result = 0 do + begin + if FCurrentInput < InputItems.Count -1 then + begin + I.Input.Flush; + Inc(FCurrentInput); + Continue := True; + if Assigned(FonInputChanged) then + FonInputChanged(Self, FCurrentInput, Continue); + if Continue then + begin + I := TACSInputItem(InputItems.Items[FCurrentInput]); + if not Assigned(I.Input) then + raise EACSException.Create(Format(strNoInputAssigned,[FCurrentInput])); + I.Input.Init; + if FIndicateProgress then + FSize := I.Input.Size + else FSize := -1; + FPosition := 0; + Result := I.Input.GetData(Buffer, BufferSize); + end else Break; + end else Break; + end; + if FIndicateProgress then + FPosition := I.Input.Position; + Lock := False; +end; + +procedure TACSInputList.SetInputItems; +begin + FInputItems.Assign(aItems); +end; +end. diff --git a/components/acs/Src/classes/acs_mixer.pas b/components/acs/Src/classes/acs_mixer.pas new file mode 100644 index 000000000..6be879a75 --- /dev/null +++ b/components/acs/Src/classes/acs_mixer.pas @@ -0,0 +1,258 @@ +(* + this file is a part of audio components suite v 2.4. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: acs_mixer.pas,v $ +Revision 1.2 2005/12/30 12:54:42 z0m3ie +some error checks + +Revision 1.1 2005/12/19 18:34:35 z0m3ie +*** empty log message *** + +Revision 1.3 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.2 2005/10/02 16:51:46 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.11 2005/09/01 19:55:48 z0m3ie +again Delphi corrections + +Revision 1.10 2005/08/31 20:30:39 z0m3ie +Mixer Channelname work now +minior corrections for Converters + +Revision 1.9 2005/08/31 14:37:59 z0m3ie +*** empty log message *** + +Revision 1.8 2005/08/31 14:33:16 z0m3ie +fixed delphi issue with TControlEntry + +Revision 1.7 2005/08/30 22:10:55 z0m3ie +Mixer mostly completed + +Revision 1.6 2005/08/29 21:46:43 z0m3ie +*** empty log message *** + +Revision 1.5 2005/08/28 20:31:18 z0m3ie +linux restructuring for 2.4 + +Revision 1.4 2005/08/28 18:35:53 z0m3ie +created Delphi package for 2.4 +more Mixer stuff +updated some things for Delphi + +Revision 1.3 2005/08/26 17:12:56 z0m3ie +*** empty log message *** + +Revision 1.2 2005/08/26 17:03:20 z0m3ie +begon to make acs resourcestring aware +more advanced tmixer for windows +restructured tmixer its better handleable now + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + + +unit acs_mixer; + +interface + +uses + Classes, SysUtils, ACS_Classes, ACS_Strings + {$IFDEF MSWINDOWS} + ,MMSystem,Windows,Dialogs + ,Math + {$ELSE} + ,Soundcard, Libc + {$ENDIF} + ; + +type + TACSMixerChannel = (mcUnknown, + mcVolume, + mcTreble, + mcBass, + mcSynth, + mcPCM, + mcSpeaker, + mcLine, + mcMic, + mcCD, + mcIMix, + mcAltPCM, + mcRecLev, + mcDigital, + mcMonitor, + mcHeadphone, + mcTelephone); + + {$IFDEF MSWINDOWS} +const + FirstSource = MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED - MIXERLINE_COMPONENTTYPE_SRC_FIRST ; + LastSource = MIXERLINE_COMPONENTTYPE_SRC_ANALOG - MIXERLINE_COMPONENTTYPE_SRC_FIRST ; + FirstDest = MIXERLINE_COMPONENTTYPE_DST_FIRST; + LastDest = MIXERLINE_COMPONENTTYPE_DST_LAST; + +type + {$IFDEF LCL} + TMixerLine = MIXERLINE; + TMixerCaps = MIXERCAPS; + TMixerControl = MIXERCONTROL; + TMixerLineControls = MIXERLINECONTROLS; + TMixerControlDetails = MIXERCONTROLDETAILS; + {$ENDIF} + + TDataArray = ARRAY[FirstSource .. LastSource] OF MIXERCONTROLDETAILS_UNSIGNED; + PDataArray = ^TDataArray; + PControlEntry = ^TControlEntry; + TControlEntry = RECORD + IsInited : Boolean; + CHandle : Thandle; + CDestination : INTEGER; + CID : INTEGER; + CName : String[MIXER_SHORT_NAME_CHARS]; + CConnect : INTEGER; + CCControls : INTEGER; + CControlTyp : INTEGER; + CKanal : INTEGER; + CControl : INTEGER; + CComponentTyp : DWORD; + CMin, Cmax : INTEGER; + Cdetails : TDataArray; + CMultItems : INTEGER; + CcSteps : DWORD; + END; + {$ENDIF} + + TACSMixerLevel = record + case Word of + 1 : + ( + Left, Right : Byte; + ); + 2 : (Main : Byte;); + end; + + { TACSMixer } + + TACSMixer = class(TComponent) + private + FDevNum : Integer; + FChannels : array of TACSMixerChannel; + {$IFDEF LINUX} + _mix_fd : Integer; + FFileName : String; + {$ELSE} + FMixer : HMixer; + FMixerCaps : TMixerCaps; + FControls : array of TControlEntry; + FMuteControls : array of TControlEntry; + {$ENDIF} + FMixerName : String; + function GetRecSource : Integer; + function GetVolume(vChannel : integer) : TACSMixerLevel; + procedure SetVolume(vChannel : integer; vLevel : TACSMixerLevel); + procedure SetRecSource(vChannel : integer); + procedure SetDevNum(Num : Integer); + function GetChannel(Num : Integer) : TACSMixerChannel; + function GetDevCount : Integer; + function GetChannelCount : Integer; + function GetChannelName(vChannel : Integer) : string; + function GetMute(vChannel : integer) : Boolean; + procedure SetMute(vChannel : integer; Mute : Boolean); + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function IsStereo(vChannel : Integer) : Boolean; + function IsRecordable(vChannel : Integer) : Boolean; + property Channel[vChannel : Integer] : TACSMixerChannel read GetChannel; + property Level[vChannel : Integer] : TACSMixerLevel read GetVolume write SetVolume; + property Mute[vChannels : Integer] : Boolean read GetMute write SetMute; + property ChannelName[vChannel : Integer] : string read GetChannelName; + property RecordSource : Integer read GetRecSource write SetRecSource; + property DevCount : Integer read GetDevCount; + property Channelcount : Integer read GetChannelCount; + published + property DevNum : Integer read FDevNum write SetDevNum stored True; + property MixerName : String read FMixerName; + end; + +var + MixersCount : Byte; + + function ChannelToStr(ch : TACSMixerChannel) : String; + +implementation + +{$I ACS_Mixer.inc} + + function ChannelToStr(ch : TACSMixerChannel) : String; + begin + case ch of + mcVolume: Result := strMixerVolume; + mcTreble: Result := strMixerTreble; + mcBass: Result := strMixerBass; + mcSynth: Result := strMixerSynth; + mcPCM: Result := strMixerPCM; + mcSpeaker: Result := strMixerSpeaker; + mcLine: Result := strMixerLine; + mcMic: Result := strMixerMic; + mcCD: Result := strMixerCD; + mcIMix: Result := strMixerIMix; + mcAltPCM: Result := strMixerAlt; + mcRecLev: Result := strMixerRec; + mcUnknown: Result := strMixerUnknown; + else Result := IntToStr(Integer(ch)); + end; + end; + + constructor TACSMixer.Create; + begin + inherited Create(AOwner); + if MixersCount > 0 then + SetDevNum(0); + end; + + function TACSMixer.GetChannel(Num: Integer): TACSMixerChannel; + begin + if (Num < 0) or (Num > (length(FChannels)-1)) then + exit; + Result := FChannels[Num]; + end; + + function TACSMixer.GetDevCount : Integer; + begin + Result := MixersCount; + end; + + function TACSMixer.GetChannelCount : Integer; + begin + result := length(FChannels); + end; + + function TACSMixer.GetChannelName(vChannel : Integer) : string; + begin + if (vChannel > -1) and (vChannel < ChannelCount) then + Result := ChannelToStr(FChannels[vChannel]); + end; + +initialization + MixersCount := CountMixers; +end. diff --git a/components/acs/Src/classes/acs_multimix.pas b/components/acs/Src/classes/acs_multimix.pas new file mode 100644 index 000000000..9bf7d3810 --- /dev/null +++ b/components/acs/Src/classes/acs_multimix.pas @@ -0,0 +1,295 @@ +(* +this file is a part of audio components suite, +copyright (c) 2005 ross levis. all rights reserved. +see the license file for more details. + +TMultiMixer provides for an unlimited number of inputs (channels) +to be mixed into one audio buffer. Only supports 44100/16/2 + +TMultiMixer + - property TotalChannels: Integer; // get/set the number of channels + - property Channel[Index: Integer]: TChannel; default + TChannel + - procedure Preload; // runs Input.Init to make starting faster (optional) + - procedure Start; // Start channel + - procedure Stop; // Stop channel + - property Input: TACSInput + - property Volume: Word; // 0 = silent, 32768 = 100% + +eg. + MultiMixer.TotalChannels := 1; + MultiMixer[0].Input := VorbisIn1; + AudioOut1.Run; + MultiMixer.TotalChannels := 2; // Channels can be added or removed while playing + MultiMixer[1].Input := WAVEIn1; + MultiMixer[1].Volume := 16384; // 50% volume + MultiMixer[1].Start; // while at least 1 mixer is playing, others + MultiMixer[0].Stop; // can be started and stopped individually. + +*) + +{ +$Log: acs_multimix.pas,v $ +Revision 1.3 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.1 2005/12/19 18:34:35 z0m3ie +*** empty log message *** + +Revision 1.3 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.2 2005/09/13 21:54:11 z0m3ie +acs is localizeable now (ACS_Strings) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 21:02:31 z0m3ie +TMultiMixer by Ross Levis added + +} + +{$hints off} +unit acs_multimix; + +interface + +uses + Classes, SysUtils, ACS_Types, ACS_Classes, ACS_Strings; + +const + BUF_SIZE = 8820; + +type + TACSMultiMixer = class; + + TACSChannel = class + private + FOwner: TACSMultiMixer; + FInput: TACSCustomInput; + FVolume: Word; + EndOfInput: Boolean; + Preloaded: Boolean; + InBuf: array[1..BUF_SIZE] of Byte; + public + constructor Create(AOwner: TACSMultiMixer); virtual; + destructor Destroy; override; + procedure Preload; + procedure Start; + procedure Stop; + property Input: TACSCustomInput read FInput write FInput; + property Volume: Word read FVolume write FVolume; + end; + + TACSMultiMixer = class(TACSCustomInput) + private + FChannel: array of TACSChannel; + FTotalChannels: Integer; + OutBuf: array[1..BUF_SIZE] of Byte; + Buisy : Boolean; + FLock: Boolean; + function GetChannel(Index: Integer): TACSChannel; + procedure SetTotalChannels(Num: Integer); + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + property Channel[Index: Integer]: TACSChannel read GetChannel; default; + function GetData(Buffer: Pointer; BufferSize: Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + published + property TotalChannels: Integer read FTotalChannels write SetTotalChannels; + end; + +implementation + + // TChannel + + constructor TACSChannel.Create; + begin + inherited Create; + FOwner := AOwner; + FVolume := 32768; + EndOfInput := True; + Preloaded := False; + end; + + destructor TACSChannel.Destroy; + begin + inherited Destroy; + end; + + procedure TACSChannel.Preload; + begin + if EndOfInput and not Preloaded and Assigned(FInput) then + begin + FInput.Init; + Preloaded := True; + end; + end; + + procedure TACSChannel.Start; + begin + if FOwner.Buisy and EndOfInput and Assigned(FInput) then + begin + if not Preloaded then Preload; + EndOfInput := False; + end; + end; + + procedure TACSChannel.Stop; + begin + if not EndOfInput then + begin + EndOfInput := True; + Preloaded := False; + while FOwner.Flock do; + FOwner.FLock := True; + FInput.Flush; + FOwner.Flock := False; + end; + end; + + // TACSMultiMixer + + constructor TACSMultiMixer.Create; + begin + inherited Create(AOwner); + FLock := False; + end; + + destructor TACSMultiMixer.Destroy; + begin + SetTotalChannels(0); // free channels + inherited Destroy; + end; + + procedure TACSMultiMixer.SetTotalChannels(Num: Integer); + var + chan: Integer; + begin + if (Num >= 0) and (Num <> FTotalChannels) then + begin + while Flock do; + FLock := True; + if Num < FTotalChannels then // remove channels + begin + for chan := FTotalChannels-1 downto Num do + with FChannel[chan] do + begin + if not EndOfInput then FInput.Flush; + Free; + end; + SetLength(FChannel,Num); + end + else begin // add channels + SetLength(FChannel,Num); + for chan := FTotalChannels to Num-1 do + FChannel[chan] := TACSChannel.Create(Self); + end; + FTotalChannels := Num; + FLock := False; + end; + end; + + function TACSMultiMixer.GetBPS; + begin + Result := 16; + end; + + function TACSMultiMixer.GetCh; + begin + Result:= 2; + end; + + function TACSMultiMixer.GetSR; + begin + Result := 44100; + end; + + procedure TACSMultiMixer.Init; + var + chan: Integer; + begin + Buisy := True; + FPosition := 0; + for chan := 0 to FTotalChannels-1 do + FChannel[chan].Start; + FSize := 0; + FLock := False; + end; + + procedure TACSMultiMixer.Flush; + var + chan: Integer; + begin + for chan := 0 to FTotalChannels-1 do + with FChannel[chan] do + begin + if Assigned(FInput) then FInput.Flush; + EndOfInput := True; + Preloaded := False; + end; + Buisy := False; + end; + + function TACSMultiMixer.GetData; + var + i, chan, ReadSize, BufSize: Integer; + InBuf16, OutBuf16: PACSBuffer16; + begin + if not Buisy then raise EACSException.Create(strStreamnotopen); + begin + while Flock do sleep(0); + Flock := True; + BufSize := 0; + if BufferSize > BUF_SIZE then BufferSize := BUF_SIZE; + for chan := 0 to FTotalChannels-1 do + with FChannel[chan] do + if not EndOfInput then + begin + ReadSize := FInput.GetData(@InBuf[1], BufferSize); + while (ReadSize < BufferSize) and (ReadSize <> 0) do + begin + Result := FInput.GetData(@InBuf[ReadSize+1], BufferSize-ReadSize); + Inc(ReadSize, Result); + end; + FillChar(InBuf[ReadSize+1], BufferSize-ReadSize, 0); // zero rest of buffer + if ReadSize = 0 then EndOfInput := True + else if ReadSize > BufSize then BufSize := ReadSize; + end; + if BufSize = 0 then + begin + Flock := False; + Result := 0; + Exit; + end; + // mix + FillChar(OutBuf[1], BufferSize, 0); + OutBuf16 := @OutBuf; + for chan := 0 to FTotalChannels-1 do + with FChannel[chan] do + if not EndOfInput then + begin + InBuf16 := @InBuf; + for i := 0 to (BufSize shr 1) - 1 do + OutBuf16[i] := OutBuf16[i] + (InBuf16[i] * FVolume div 32768); + end; + Flock := False; + end; + Result := BufSize; + Move(OutBuf[1], Buffer^, Result); + Inc(FPosition, Result); + end; + + function TACSMultiMixer.GetChannel(Index: Integer): TACSChannel; + begin + Result := FChannel[Index]; + end; + +end. diff --git a/components/acs/Src/classes/acs_procs.pas b/components/acs/Src/classes/acs_procs.pas new file mode 100644 index 000000000..ab265a948 --- /dev/null +++ b/components/acs/Src/classes/acs_procs.pas @@ -0,0 +1,331 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: acs_procs.pas,v $ +Revision 1.4 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.1 2005/12/19 18:34:35 z0m3ie +*** empty log message *** + +Revision 1.2 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + +unit acs_procs; + +interface + +uses + SysUtils, ACS_Types, Math; + +type + + TACSFilterWindowType = (fwHamming, fwHann, fwBlackman); + +{$IFDEF LINUX} + function FindLibs(const Pattern : String) : String; +{$ENDIF} + + + // Direction = 1 - forward FFT, Direction = -1 - inverse FFT. + procedure ComplexFFT(Data : PACSComplexArray; DataSize, Direction : Integer); + + procedure HannWindow(OutData : PACSDoubleArray; Width : Integer; Symmetric : Boolean); + + procedure HammingWindow(OutData : PACSDoubleArray; Width : Integer; Symmetric : Boolean); + + procedure BlackmanWindow(OutData : PACSDoubleArray; Width : Integer; Symmetric : Boolean); + + procedure CalculateSincKernel(OutData : PACSDoubleArray; CutOff : Double; Width : Integer; WType : TACSFilterWindowType); + + procedure SmallIntArrayToDouble(InData : PSmallInt; OutData : PDouble; DataSize : Integer); + + procedure SmallIntArrayToComplex(InData : PSmallInt; OutData : PACSComplex; DataSize : Integer); + + + // Computes Op2[i] = Op1[i]*Op2[i], i = [0..DataSize-1] + + procedure MultDoubleArrays(Op1, Op2 : PDouble; DataSize : Integer); + + (* + Performs calculation of + / + | Lg(Abs(InData[i])) + Shift, if Lg(Abs(InData[i])) + Shift >= 0 + OutData[i] = < 0, if Lg(Abs(InData[i])) + Shift < 0 + | 0, if Abs(InData[i]) = 0. + \ + i = [0..DataSize-1] + *) + procedure LgMagnitude(InData : PACSComplex; OutData : PDouble; DataSize, Shift : Integer); + +implementation + +{$IFDEF LINUX} + function FindLibs(const Pattern : String) : String; + var + Path : String; + SR : TSearchRec; + begin + Path := '/usr/lib/'; + if FindFirst(Path + Pattern, faAnyFile, SR) = 0 then + begin + Result := SR.Name; + FindClose(SR); + Exit; + end; + Path := '/usr/local/lib/'; + if FindFirst(Path + Pattern, faAnyFile, SR) = 0 then + begin + Result := SR.Name; + FindClose(SR); + Exit; + end; + Result := ''; + end; +{$ENDIF} + + + (* This routine is converted from the original C code by P. Burke + Direction = 1 - forward FFT, Direction = -1 - inverse FFT. *) + procedure ComplexFFT(Data : PACSComplexArray; DataSize, Direction : Integer); + var + i, i1, j, k, i2, l, l1, l2, Log2n : Integer; + c1, c2, tx, ty, t1, t2, u1, u2, z : Double; + begin + Log2n := Trunc(Log2(DataSize)); + // Do the bit reversal + i2 := DataSize shr 1; + j := 0; + for i := 0 to DataSize-2 do + begin + if i < j then + begin + tx := Data[i].Re; + ty := Data[i].Im; + Data[i].Re := Data[j].Re; + Data[i].Im := Data[j].Im; + Data[j].Re := tx; + Data[j].Im := ty; + end; + k := i2; + while k <= j do + begin + Dec(j, k); + k := k shr 1; + end; + Inc(j, k); + end; + // Compute the FFT + c1 := -1.0; + c2 := 0.0; + l2 := 1; + for l := 0 to Log2n-1 do + begin + l1 := l2; + l2 := l2 shl 1; + u1 := 1.0; + u2 := 0.0; + for j := 0 to l1-1 do + begin + i := j; + while i < DataSize do + begin + i1 := i + l1; + t1 := u1 * Data[i1].Re - u2 * Data[i1].Im; + t2 := u1 * Data[i1].Im + u2 * Data[i1].Re; + Data[i1].Re := Data[i].Re - t1; + Data[i1].Im := Data[i].Im - t2; + Data[i].Re := Data[i].Re + t1; + Data[i].Im := Data[i].Im + t2; + Inc(i, l2); + end; + z := u1*c1 - u2*c2; + u2 := u1*c2 + u2*c1; + u1 := z; + end; + c2 := Sqrt((1.0 - c1)/2.0); + if Direction = 1 then c2 := -c2; + c1 := Sqrt((1.0 + c1)/2.0); + end; + + // Scaling for forward transform + if Direction = 1 then + for i := 0 to DataSize-1 do + begin + Data[i].Re := Data[i].Re/DataSize; + Data[i].Im := Data[i].Im/DataSize; + end; + end; + + procedure HannWindow(OutData : PACSDoubleArray; Width : Integer; Symmetric : Boolean); + var + i, n : Integer; + begin + if Symmetric then n := Width-1 + else n := Width; + for i := 0 to Width-1 do OutData[i] := (1-Cos(TwoPi*i/n))/2; + end; + + procedure HammingWindow(OutData : PACSDoubleArray; Width : Integer; Symmetric : Boolean); + var + i, n : Integer; + begin + if Symmetric then n := Width-1 + else n := Width; + for i := 0 to Width-1 do OutData[i] := 0.54-0.46*Cos(TwoPi*i/n); + end; + + procedure BlackmanWindow(OutData : PACSDoubleArray; Width : Integer; Symmetric : Boolean); + var + i, n : Integer; + begin + if Symmetric then n := Width-1 + else n := Width; + for i := 0 to Width-1 do OutData[i] := 0.42-0.5*Cos(TwoPi*i/n) + 0.08*Cos(2*TwoPi*i/n); + end; + + procedure CalculateSincKernel(OutData : PACSDoubleArray; CutOff : Double; Width : Integer; WType : TACSFilterWindowType); + var + i : Integer; + S : Double; + Window : array of Double; + begin +// SetLength(OutData, Width); + SetLength(Window, Width); + case WType of + fwHamming : HammingWindow(@Window[0], Width, False); + fwHann : HannWindow(@Window[0], Width, False); + fwBlackman : BlackmanWindow(@Window[0], Width, False); + end; + S := 0; + for i := 0 to Width-1 do + begin + if i-(Width shr 1) <> 0 then + OutData[i] := Sin(TwoPi*CutOff*(i-(Width shr 1)))/(i-(Width shr 1))*Window[i] + else OutData[i] := TwoPi*CutOff*Window[i]; + S := S + OutData[i]; + end; + for i := 0 to Width-1 do OutData[i] := OutData[i]/S; + end; + + procedure SmallIntArrayToDouble(InData : PSmallInt; OutData : PDouble; DataSize : Integer); + begin + asm + MOV EDX, DataSize; + SHL EDX, 3; + MOV ECX, OutData; + ADD EDX, ECX; + MOV EAX, InData; + @test: CMP EDX, ECX; + JE @out; + FILD WORD[EAX]; + ADD EAX, 2; + FSTP QWORD[ECX]; + ADD ECX, 8; + JMP @test; + @out: ; + end; + end; + + procedure SmallIntArrayToComplex(InData : PSmallInt; OutData : PACSComplex; DataSize : Integer); + begin + asm + MOV EDX, DataSize; + SHR EDX, 4; + MOV ECX, OutData; + ADD EDX, ECX; + MOV EAX, InData; + @test: CMP EDX, ECX; + JE @out; + FILD WORD[EAX]; + ADD EAX, 2; + FSTP QWORD[EAX]; + ADD ECX, 16; + JMP @test; + @out: ; + end; + end; + + procedure MultDoubleArrays(Op1, Op2 : PDouble; DataSize : Integer); + begin + asm + MOV EDX, DataSize; + SHL EDX, 3; + MOV ECX, Op1; + ADD EDX, ECX; + MOV EAX, Op2; + @test: CMP EDX, ECX; + JE @out; + FLD QWORD[ECX]; + FLD QWORD[EAX]; + FMUL; + FSTP QWORD[EAX]; + ADD ECX, 8; + ADD EAX, 8; + JMP @test; + @out: ; + end; + end; + + procedure LgMagnitude(InData : PACSComplex; OutData : PDouble; DataSize, Shift : Integer); + var + LogBase : Double; + begin + asm + FLD1; + FLDL2T; + FDIVP; + FSTP LogBase; + MOV EDX, DataSize; + SHL EDX, 3; + MOV ECX, OutData; + ADD EDX, ECX; + MOV EAX, InData; + @test: CMP EDX, ECX; + JE @out; + FLD QWORD[EAX]; + FMUL ST(0), ST(0); + ADD EAX, 8; + FLD QWORD[EAX]; + FMUL ST(0), ST(0); + FADDP; + FSQRT; + FTST; + PUSH EAX; + FSTSW AX; + SAHF; + JE @skip; + FLD LogBase; + FXCH; + FYL2X; + FIADD Shift; + FTST; + FSTSW AX; + SAHF; + JAE @skip; + FSTP QWORD[ECX]; + FLDZ; + @skip: POP EAX; + ADD EAX, 8; + FSTP QWORD[ECX]; + ADD ECX, 8; + JMP @test; + @out: ; + end; + end; +end. diff --git a/components/acs/Src/classes/acs_streams.pas b/components/acs/Src/classes/acs_streams.pas new file mode 100644 index 000000000..a33ae907b --- /dev/null +++ b/components/acs/Src/classes/acs_streams.pas @@ -0,0 +1,220 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: acs_streams.pas,v $ +Revision 1.5 2006/08/31 20:10:54 z0m3ie +*** empty log message *** + +Revision 1.4 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.1 2005/12/19 18:34:35 z0m3ie +*** empty log message *** + +Revision 1.4 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.3 2005/11/27 16:50:33 z0m3ie +add ACS VolumeQuerry +make ACS_VolumeQuerry localizeable +some little errorfixes (buffersize for linuxdrivers was initially 0) +make TAudioIn workable + +Revision 1.2 2005/09/13 21:54:11 z0m3ie +acs is localizeable now (ACS_Strings) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + + +unit acs_streams; + + +interface + +uses + Classes, SysUtils, ACS_Classes, ACS_Strings; + +const + + OUTBUF_SIZE = $4000; + + +type + + TACSStreamOut = class(TACSStreamedOutput) + private + function GetSR : Integer; + function GetBPS : Integer; + function GetCh : Integer; + protected + procedure Done; override; + function DoOutput(Abort : Boolean):Boolean; override; + procedure Prepare; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + property OutSampleRate : Integer read GetSR; + property OutBitsPerSample : Integer read GetBPS; + property OutChannles : Integer read GetCh; + end; + + TACSStreamIn = class(TACSStreamedInput) + private + FBPS, FChan, FFreq : Integer; + protected + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + published + property InBitsPerSample : Integer read FBPS write FBPS; + property InChannels : Integer read FChan write FChan; + property InSampleRate : Integer read FFreq write FFreq; + end; + + +implementation + +procedure TACSStreamOut.Prepare; +begin + if not FStreamAssigned then + raise EACSException.Create(strStreamObjectnotassigned); + FInput.Init; +end; + +procedure TACSStreamOut.Done; +begin + FInput.Flush; +end; + +function TACSStreamOut.DoOutput(Abort : Boolean):Boolean; +var + Len : Integer; + P : Pointer; +begin + // No exceptions Here + Result := True; + if not Busy then Exit; + if Abort or (not CanOutput) then + begin + Result := False; + Exit; + end; + GetMem(P, OUTBUF_SIZE); + while InputLock do; + InputLock := True; + Len := Finput.GetData(P, OUTBUF_SIZE); + InputLock := False; + if Len > 0 then + begin + Result := True; + FStream.WriteBuffer(P^, Len); + end + else Result := False; + FreeMem(P); +end; + +constructor TACSStreamOut.Create; +begin + inherited Create(AOwner); +end; + +destructor TACSStreamOut.Destroy; +begin + inherited Destroy; +end; + +constructor TACSStreamIn.Create; +begin + inherited Create(AOwner); + FBPS := 8; + FChan := 1; + FFreq := 8000; + FSize := -1; +end; + +destructor TACSStreamIn.Destroy; +begin + inherited Destroy; +end; + +procedure TACSStreamIn.Init; +begin + if Busy then raise EACSException.Create(strBusy); + if not Assigned(FStream) then raise EACSException.Create(strStreamObjectnotassigned); + FPosition := FStream.Position; + FBusy := True; + FSize := FStream.Size; +end; + +procedure TACSStreamIn.Flush; +begin +// FStream.Position := 0; + FBusy := False; +end; + +function TACSStreamIn.GetData(Buffer : Pointer; BufferSize : Integer): Integer; +begin + Result := FStream.Read(Buffer^, BufferSize); + FPosition := FStream.Position; + // Inc(FPosition, Result); + if FPosition >= FSize then + Result := 0; +end; + +function TACSStreamOut.GetSR : Integer; +begin + if not Assigned(Input) then + raise EACSException.Create(strInputnotassigned); + Result := FInput.SampleRate; +end; + +function TACSStreamOut.GetBPS : Integer; +begin + if not Assigned(Input) then + raise EACSException.Create(strInputnotassigned); + Result := FInput.BitsPerSample; +end; + +function TACSStreamOut.GetCh : Integer; +begin + if not Assigned(Input) then + raise EACSException.Create(strInputnotassigned); + Result := FInput.Channels; +end; + +function TACSStreamIn.GetBPS : Integer; +begin + Result := FBPS +end; + +function TACSStreamIn.GetCh : Integer; +begin + Result := FChan; +end; + +function TACSStreamIn.GetSR : Integer; +begin + Result := Self.FFreq; +end; + + +end. diff --git a/components/acs/Src/classes/acs_strings.pas b/components/acs/Src/classes/acs_strings.pas new file mode 100644 index 000000000..15c8f302b --- /dev/null +++ b/components/acs/Src/classes/acs_strings.pas @@ -0,0 +1,61 @@ +(* + this file is a part of audio components suite v 2.4. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +unit acs_strings; + +interface + +resourcestring + strCoudntloadLib = 'Library %s could not be loaded.'; + strcoudntopendevice = 'Could not open device "%s" for input'; + strCoudntopendeviceOut = 'Could not open device "%s" for output'; + strBusy = 'The component is busy'; + strInputstartfailed = 'Failed to start input'; + strFailedtostartOutput = 'Failed to start output'; + strStreamnotopen = 'The Stream is not opened'; + strBufferoverrun = 'Buffer overrun.'; + strUnknownExtension = 'Unknown file extension %s'; + strAllFormats = 'All formats'; + strInputnotAssigned = 'Input not Assigned'; + strFilenamenotassigned = 'Filename not Assigned'; + strSeeknotImplemented = 'Seek: method not implemented'; + strNotinFBMode = 'The component is not in amFB mode.'; + strIllegalFrequency = 'Illegal frequency'; + strCutofftolow = 'Cut-off frequencies are greater than the half of the sample rate.'; + strListIndexOOB = 'List Index Out of Bounds %d'; + strNoInputItems = 'No input items in the list.'; + strNoInputAssigned = 'No input assigned to current item'; + strStreamObjectnotassigned = 'Stream object not assigned'; + strBufferunderrun = 'Buffer underrun'; + strDevnotplayable = 'Cannot play on the device "%s"'; + strTrackOutofRange = 'Track out of range'; + strNoAudioCD = 'Not an audio disc'; + strChannelNotRecordable = 'Channel %d is not recordable'; + strDrivenotready = 'The drive is not ready'; + strnoAudioTreck = 'This is no audio track'; + strChannelNotAvailable = 'Channel %d is not available'; + strFailedtoCreateDSdev = 'Failed to create DirectSound device'; + strFailedtoCreateDSbuf = 'Failed to create DirectSound buffer'; + strnoDriverselected = 'No driver is selected, please select an driver first !'; + strnoFileOpened = 'No file opened !'; + + strMixerVolume = 'Master output'; + strMixerTreble = 'Treble output'; + strMixerBass = 'Bass output'; + strMixerSynth = 'Synthesizer input'; + strMixerPCM = 'Audio output'; + strMixerSpeaker = 'Speaker output'; + strMixerLine = 'Line input'; + strMixerMic = 'Michrophone input'; + strMixerCD = 'CD input'; + strMixerIMix = 'Record monitor'; + strMixerAlt = 'Alternate output'; + strMixerRec = 'Record level'; + strMixerUnknown = 'Unknown channel'; + +implementation + +end. diff --git a/components/acs/Src/classes/acs_types.pas b/components/acs/Src/classes/acs_types.pas new file mode 100644 index 000000000..3f2288ff3 --- /dev/null +++ b/components/acs/Src/classes/acs_types.pas @@ -0,0 +1,84 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: acs_types.pas,v $ +Revision 1.6 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.1 2005/12/19 18:34:35 z0m3ie +*** empty log message *** + +Revision 1.2 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + +unit acs_types; + +interface + +type + + TACSBuffer16 = array[0..0] of SmallInt; + PACSBuffer16 = ^TACSBuffer16; + + TACSBuffer8 = array[0..0] of Byte; + PACSBuffer8 = ^TACSBuffer8; + + TACSStereoSample16 = packed record + Left, Right : SmallInt; + end; + + TACSStereoBuffer16 = array[0..0] of TACSStereoSample16; + PACSStereoBuffer16 = ^TACSStereoBuffer16; + + TACSStereoSample8 = packed record + Left, Right : Byte; + end; + + TACSStereoBuffer8 = array[0..0] of TACSStereoSample8; + PACSStereoBuffer8 = ^TACSStereoBuffer8; + + + TACSComplex = packed record + Re, Im : Double; + end; + + PACSComplex = ^TACSComplex; + + TACSComplexArray = array[0..0] of TACSComplex; + PACSComplexArray = ^TACSComplexArray; + + TACSDoubleArray = array[0..0] of Double; + PACSDoubleArray = ^TACSDoubleArray; + + TACSStereoSampleD = record + Left : Double; + Right : Double; + end; + + TACSStereoBufferD = array[0..0] of TACSStereoSampleD; + PACSStereoBufferD = ^TACSStereoBufferD; + +const + + Pi = 3.14159265359; + TwoPi = 6.28318530718; + HalfPi = 1.57079632679; + +implementation + +end. diff --git a/components/acs/Src/classes/acs_volumequery.pas b/components/acs/Src/classes/acs_volumequery.pas new file mode 100644 index 000000000..cf27983a9 --- /dev/null +++ b/components/acs/Src/classes/acs_volumequery.pas @@ -0,0 +1,223 @@ +(* +this file is a part of audio components suite v 2.4, +copyright (c) 2005 ross levis. all rights reserved. + +Provides linear volume in volLeft and volRight in the range 0 (min) to 32767 (max). +Supports 8 and 16 bit samples, mono and stereo. +dbLeft and dbRight returns the volume in decibels. +Delay is in blocks of 50ms and is required due to unknown output buffer size. +Increase Delay to bring VU levels in line with output audio. +Suggest using a 50ms Timer to read values. + +$Log: acs_volumequery.pas,v $ +Revision 1.2 2006/08/31 20:10:54 z0m3ie +*** empty log message *** + +Revision 1.1 2005/12/19 18:34:35 z0m3ie +*** empty log message *** + +Revision 1.2 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.1 2005/11/27 16:50:33 z0m3ie +add ACS VolumeQuerry +make ACS_VolumeQuerry localizeable +some little errorfixes (buffersize for linuxdrivers was initially 0) +make TAudioIn workable + +*) + +unit acs_volumequery; + +interface + +uses + Classes, Math, ACS_Types, ACS_Classes,ACS_Strings; + +type + + TACSVolumeQuery = class(TACSCustomConverter) + private + Lock : Boolean; + FLeft, FRight: Array of Word; + FDelay, F50ms: Word; + FSR,FBPS,FCh: Integer; + protected + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function volLeft: Word; + function volRight: Word; + function dbLeft: Single; + function dbRight: Single; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + published + property Delay: Word read FDelay write FDelay; + end; + +implementation + + constructor TACSVolumeQuery.Create; + begin + inherited Create(AOwner); + end; + + destructor TACSVolumeQuery.Destroy; + begin + inherited Destroy; + end; + + function TACSVolumeQuery.GetBPS : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + Result := FInput.BitsPerSample; + end; + + function TACSVolumeQuery.GetCh : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + Result := FInput.Channels; + end; + + function TACSVolumeQuery.GetSR : Integer; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + Result := FInput.SampleRate; + end; + + procedure TACSVolumeQuery.Init; + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputnotAssigned); + SetLength(FLeft,FDelay+1); + SetLength(FRight,FDelay+1); + FillChar(FLeft[0], SizeOf(Word)*(FDelay+1), 0); + FillChar(FRight[0], SizeOf(Word)*(FDelay+1), 0); + // + FBusy := True; + FInput.Init; + // calc 50ms worth of data + FSR := GetSR; + FBPS := GetBPS; + FCH := GetCh; + FPosition := 0; + FSize := FInput.Size; + F50ms := FSR * FBPS * FCh div 160; + Lock := False; + end; + + procedure TACSVolumeQuery.Flush; + begin + FInput.Flush; + FBusy := False; + Lock := False; + end; + + function TACSVolumeQuery.GetData(Buffer: Pointer; BufferSize: Integer): Integer; + var + LVol, RVol, LMax, RMax: Word; + i, NumSamples: Integer; + begin + if not Busy then raise EACSException.Create(strStreamnotopen); + //if FOrigBufferSize = -1 then FOrigBufferSize := BufferSize + if BufferSize > F50ms then BufferSize := F50ms; + while InputLock do; + InputLock := True; + Result := FInput.GetData(Buffer, BufferSize); + InputLock := False; + FPosition := FInput.Position; + if Result = 0 then Exit; + if Lock then Exit; + Lock := True; + // + if FBPS = 8 then + begin + if FCh = 1 then NumSamples := Result + else NumSamples := Result shr 1; + end + else begin + if FCh = 1 then NumSamples := Result shr 1 + else NumSamples := Result shr 2; + end; + // + LMax := 0; + RMax := 0; + for i := 0 to NumSamples-1 do + begin + if FBPS = 8 then + begin + if FCh = 1 then + begin + LVol := ABS(PACSBuffer8(Buffer)[i]-127)*256; + RVol := LVol; + end + else begin + LVol := ABS(PACSStereoBuffer8(Buffer)[i].Left-127)*256; + RVol := ABS(PACSStereoBuffer8(Buffer)[i].Right-127)*256; + end; + end + else begin + if FCh = 1 then + begin + LVol := ABS(PACSBuffer16(Buffer)[i]); + RVol := LVol; + end + else begin + LVol := ABS(PACSStereoBuffer16(Buffer)[i].Left); + RVol := ABS(PACSStereoBuffer16(Buffer)[i].Right); + end; + end; + if LVol > LMax then LMax := LVol; + if RVol > RMax then RMax := RVol; + end; + if FDelay > 0 then + begin + Move(FLeft[1],FLeft[0],FDelay*Sizeof(Word)); + Move(FRight[1],FRight[0],FDelay*Sizeof(Word)); + end; + FLeft[FDelay] := LMax; + FRight[FDelay] := RMax; + Lock := False; + end; + + function TACSVolumeQuery.volLeft: Word; + begin + Lock := True; + if Busy then Result := FLeft[0] + else Result := 0; + Lock := False; + end; + + function TACSVolumeQuery.volRight: Word; + begin + Lock := True; + if Busy then Result := FRight[0] + else Result := 0; + Lock := False; + end; + + function TACSVolumeQuery.dbLeft: Single; + begin + Lock := True; + if Busy then Result := 10 * Log10((FLeft[0]+1)/32768) + else Result := -96; + Lock := False; + end; + + function TACSVolumeQuery.dbRight: Single; + begin + Lock := True; + if Busy then Result := 10 * Log10((FRight[0]+1)/32768) + else Result := -96; + Lock := False; + end; + +end. diff --git a/components/acs/Src/classes/linux/acs_cdrom.inc b/components/acs/Src/classes/linux/acs_cdrom.inc new file mode 100644 index 000000000..a3f29585c --- /dev/null +++ b/components/acs/Src/classes/linux/acs_cdrom.inc @@ -0,0 +1,372 @@ +{ +$Log: acs_cdrom.inc,v $ +Revision 1.7 2006/08/31 20:10:56 z0m3ie +*** empty log message *** + +Revision 1.6 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.2 2005/12/26 17:31:39 z0m3ie +fixed some problems in acs_dsfiles +fixed some problems in acs_vorbis +reworked all buffers + +} + + function GetTocEntry(cd_fd, Track : Integer): TACSCDTrackInfo; + var + Entry : cdrom_tocentry; + toc : cdrom_tochdr; + frames1, frames2 : Integer; + begin + ioctl(cd_fd, CDROMREADTOCHDR, @toc); + Entry.cdte_format := CDROM_MSF; + Entry.cdte_track := Track+toc.cdth_trk0-1; + ioctl(cd_fd, CDROMREADTOCENTRY, @Entry); + frames1 := MSF2Frames(TACSCDMSF(Entry.cdte_addr.msf)); + if (Entry.cdte_adr_ctrl and CDROM_DATA_TRACK) <> 0 then + Result.TrackType := ttData + else Result.TrackType := ttAudio; + if Entry.cdte_track < toc.cdth_trk1 then Inc(Entry.cdte_track) + else Entry.cdte_track := CDROM_LEADOUT; + ioctl(cd_fd, CDROMREADTOCENTRY, @Entry); + frames2 := MSF2Frames(TACSCDMSF(Entry.cdte_addr.msf)); + Frames2MSF(frames2-frames1, Result.TrackLength); + end; + + function GetCDStatus(cd_fd : Integer) : TACSCDStatus; + (* not all drivers support the CDROM_DRIVE_STATUS ioctl + we use this ioctl first and then some other tecnique + if it is not supported. *) + var + sci : cdrom_subchnl; + res :Integer; + begin + res := ioctl(cd_fd, CDROM_DRIVE_STATUS, CDSL_CURRENT); + case res of + CDS_TRAY_OPEN, CDS_NO_DISC, CDS_DRIVE_NOT_READY: + begin + Result := cdsNotReady; + Exit; + end; + end; + (* Either the disc is ok or no information + from the driver. Trying CDROMSUBCHNL.*) + sci.cdsc_format := CDROM_MSF; + if ioctl(cd_fd, CDROMSUBCHNL, @sci) < 0 then + begin + Result := cdsNotReady; + Exit; + end; + case sci.cdsc_audiostatus of + CDROM_AUDIO_PLAY : Result := cdsPlaying; + CDROM_AUDIO_PAUSED : Result := cdsPaused; + CDROM_AUDIO_ERROR : Result := cdsNotReady; + else Result := cdsReady; + end; + end; + + function GetCDInfo(cd_fd : Integer) : TACSCDInfo; + var + res : Integer; + begin + Result := cdiUnknown; + res := ioctl(cd_fd, CDROM_DRIVE_STATUS, CDSL_CURRENT); + case res of + CDS_TRAY_OPEN, CDS_NO_DISC: Result := cdiNoDisc; + CDS_DISC_OK : + begin + res := ioctl(cd_fd, CDROM_DISC_STATUS, CDSL_CURRENT); + case res of + CDS_AUDIO : Result := cdiDiscAudio; + CDS_MIXED : Result := cdiDiscMixed; + else Result := cdiDiscData; + end; + end; + end; + end; + + procedure TACSCDIn.OpenCD; + begin + if FCurrentDrive >= length(DrivesPaths) then + exit; + if FOpened = 0 then + begin + _cd_fd := open(PChar(DrivesPaths[FCurrentDrive]), O_RDONLY or O_NONBLOCK); + if _cd_fd < 0 then + raise EACSException.Create(strerror(errno)); + end; + Inc(FOpened); + end; + + + procedure TACSCDIn.CloseCD; + begin + if FOpened = 1 then __close(_cd_fd); + if FOpened > 0 then Dec(FOpened); + end; + + function TACSCDIn.GetInfo; + begin + if Busy then raise EACSException.Create(strBusy); + OpenCD; + Result := GetCDInfo(_cd_fd); + CloseCD; + end; + + function TACSCDIn.GetStatus; + begin + if FCurrentDrive >= length(DrivesPaths) then + exit; + if Busy then raise EACSException.Create(strBusy); + if Fopened = 0 then + _cd_fd := open(PChar(DrivesPaths[FCurrentDrive]), O_RDONLY or O_NONBLOCK); + if _cd_fd < 0 then + begin + Result := cdsNotReady; + Exit; + end; + Inc(FOpened); + Result := GetCDStatus(_cd_fd); + CloseCD; + end; + + function TACSCDIn.GetNumTracks; + var + toc : cdrom_tochdr; + begin + if Busy then raise EACSException.Create(strBusy); + OpenCD; + if GetStatus <> cdsNotReady then + begin + ioctl(_cd_fd, CDROMREADTOCHDR, @toc); + Result := toc.cdth_trk1 - toc.cdth_trk0 + 1; + end else Result := 0; + CloseCD; + end; + + function TACSCDIn.GetTrackInfo; + begin + if Busy then raise EACSException.Create(strBusy); + OpenCD; + if (vIndex in [1..GetNumTracks]) = False then + begin + __close(_cd_fd); + FOpened := 0; + raise EACSException.Create(strTrackOutofRange); + end; + Result := GetTocEntry(_cd_fd, vIndex); + CloseCD; + end; + + function GetTrackMSF(cd_fd, Track : Integer) : TACSCDMSF; + var + entry : cdrom_tocentry; + hdr : cdrom_tochdr; + begin + ioctl(cd_fd, CDROMREADTOCHDR, @hdr); + entry.cdte_format := CDROM_MSF; + entry.cdte_track := Track + hdr.cdth_trk0 - 1; + if entry.cdte_track > hdr.cdth_trk1 then + entry.cdte_track := CDROM_LEADOUT; + ioctl(cd_fd, CDROMREADTOCENTRY, @entry); + Result := TACSCDMSF(entry.cdte_addr.msf); + end; + + function GetPosMSF(cd_fd : Integer; Pos : TACSCDPosition) : TACSCDMSF; + var + msf1 : TACSCDMSF; + frames : Integer; + begin + msf1 := TACSCDMSF(GetTrackMSF(cd_fd, Pos.Track)); + frames := MSF2Frames(msf1); + frames := frames + MSF2Frames(Pos.MSF); + Frames2MSF(frames, msf1); + Result := msf1; + end; + + procedure TACSCDIn.SetST; + begin + if Self.Busy then raise EACSException.Create(strBusy); + FStartTrack := Track; + FStartPos.Track := FStartTrack; + FillChar(FStartPos.MSF, SizeOf(FStartPos.MSF), 0); + end; + + procedure TACSCDIn.SetET; + begin + if Self.Busy then raise EACSException.Create(strBusy); + FEndTrack := Track; + OpenCD; + FEndPos.Track := FEndTrack + 1; + FillChar(FEndPos.MSF, SizeOf(FEndPos.MSF), 0); + CloseCD; + end; + + procedure TACSCDIn.SetSP; + begin + if Self.Busy then raise EACSException.Create(strBusy); + Self.FStartPos := Pos; + end; + + procedure TACSCDIn.SetEP; + begin + if Self.Busy then raise EACSException.Create(strBusy); + Self.FEndPos := Pos; + end; + + constructor TACSCDIn.Create; + begin + inherited Create(AOwner); + FCurrentDrive := 0; + end; + + function TACSCDIn.GetSize; + var + msf1, msf2 : TACSCDMSF; + begin + if Busy then raise EACSException.Create(strBusy); + OpenCD; + msf1 := GetPosMSF(_cd_fd, FStartPos); + msf2 := GetPosMSF(_cd_fd, FEndPos); + CloseCD; + Result := ((msf2.minute*60 + msf2.second)*75 + msf2.frame - + ((msf1.minute*60 + msf1.second)*75 + msf1.frame))*CD_FRAMESIZE_RAW; + end; + + procedure TACSCDIn.Init; + begin + if Busy then raise EACSException.Create(strBusy); + if not (DiscInfo in [cdiDiscAudio, cdiDiscMixed]) then + raise EACSException.Create(strNoAudioCD); + FSize := GetSize; + FBusy := True; + BufStart := 1; + BufEnd := 0; + FPosition := 0; + OpenCD; + FCurPos := GetPosMSF(_cd_fd, FStartPos); + FEndMSF := GetPosMSF(_cd_fd, FEndPos); +// GetMem(FBuffer,BUF_SIZE * CD_FRAMESIZE_RAW); + end; + + procedure TACSCDIn.Flush; + begin + CloseCD; + FBusy := False; +// FreeMem(FBuffer); + FSize := 0; + end; + + function TACSCDIn.GetData; + var + StartFrame, EndFrame : Integer; + cdaudio : cdrom_read_audio; + begin + if not Busy then raise EACSException.Create(strStreamnotopen); + StartFrame := MSF2Frames(FCurPos); + EndFrame := MSF2Frames(FEndMSF); + if BufStart > BufEnd then + begin + if EndFrame = StartFrame then + begin + Result := 0; + Exit; + end; + BufStart := 1; + if (EndFrame - StartFrame) > (BUF_SIZE) then + cdaudio.nframes := BUF_SIZE + else + cdaudio.nframes := EndFrame - StartFrame; + cdaudio.addr_format := CDROM_MSF; + cdaudio.addr.msf := cdrom_msf0(FCurPos); + cdaudio.buf := Pointer(FBuffer); + ioctl(_cd_fd, CDROMREADAUDIO, @cdaudio); + BufEnd := cdaudio.nframes * CD_FRAMESIZE_RAW; + StartFrame := MSF2Frames(FCurPos) + cdaudio.nframes; + Frames2MSF(StartFrame, FCurPos); + end; + if BufferSize < (BufEnd - BufStart + 1) + then Result := BufferSize + else Result := BufEnd - BufStart + 1; + Move(FBuffer[BufStart], Buffer^, Result); + Inc(BufStart, Result); + Inc(FPosition, Result); + end; + + procedure TACSCDIn.Eject; + begin + if Busy then raise EACSException.Create(strBusy); + OpenCD; + ioctl(_cd_fd, CDROMEJECT); + CloseCD; + end; + + procedure TACSCDIn.CloseTray; + begin + OpenCD; + ioctl(_cd_fd, CDROMCLOSETRAY); + CloseCD; + end; + + procedure CountDrives; + var + _cd_fd, i : Integer; + fname : String; + sci : cdrom_subchnl; + res :Integer; + begin + DrivesCount := 0; + for i := 0 to 3 do + begin + fname := '/dev/hd'+chr(ord('a')+i); + _cd_fd := open(PChar(fname), O_RDONLY or O_NONBLOCK); + if _cd_fd >= 0 then + begin + res := ioctl(_cd_fd, CDROM_DRIVE_STATUS, CDSL_CURRENT); + case res of + CDS_TRAY_OPEN, CDS_NO_DISC, CDS_DRIVE_NOT_READY: + begin + inc(DrivesCount); + setlength(DrivesPaths,DrivesCount); + DrivesPaths[DrivesCount-1] := fname; + __close(_cd_fd); + continue; + end; + end; + (* Either the disc is ok or no information + from the driver. Trying CDROMSUBCHNL.*) + sci.cdsc_format := CDROM_MSF; + if ioctl(_cd_fd, CDROMSUBCHNL, @sci) >= 0 then + begin + inc(DrivesCount); + setlength(DrivesPaths,DrivesCount); + DrivesPaths[DrivesCount-1] := fname; + end; + __close(_cd_fd); + end; + end; + end; + + function TACSCDIn.GetDrivesCount : Integer; + begin + Result := DrivesCount; + end; + + procedure TACSCDIn.SetCurrentDrive(Value : Integer); + begin + if Busy then raise EACSException.Create(strBusy); + FCurrentDrive := Value; + end; + + function TACSCDIn.GetDriveName : String; + begin + Result := ''; + end; + + destructor TACSCDIn.Destroy; + begin + inherited Destroy; + end; + + diff --git a/components/acs/Src/classes/linux/acs_mixer.inc b/components/acs/Src/classes/linux/acs_mixer.inc new file mode 100644 index 000000000..aa9efd429 --- /dev/null +++ b/components/acs/Src/classes/linux/acs_mixer.inc @@ -0,0 +1,293 @@ +{ +$Log: acs_mixer.inc,v $ +Revision 1.2 2005/12/30 12:54:42 z0m3ie +some error checks + +Revision 1.1 2005/12/19 18:35:03 z0m3ie +*** empty log message *** + +Revision 1.3 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.2 2005/09/13 21:54:11 z0m3ie +acs is localizeable now (ACS_Strings) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.4 2005/09/09 21:33:43 z0m3ie +linux corrections + +Revision 1.3 2005/08/31 20:30:40 z0m3ie +Mixer Channelname work now +minior corrections for Converters + +Revision 1.2 2005/08/28 20:31:18 z0m3ie +linux restructuring for 2.4 + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +} + + +type + TMixerInfo = record + Path : String; + Name : String; + end; + +const + MAX_MIXERS = 5; (* There shouldn't be more than + 5 valid mixers in the system. + Right? *) + +var + Mixers : array[0..MAX_MIXERS] of TMixerInfo; // one extra slot for /dev/mixer device + + function GetChannelMask(Ch : TACSMixerChannel; Request : Integer): LongWord; + begin + Result := 0; + case Request of + 0: + case Ch of + mcVolume: Result := SOUND_MIXER_VOLUME; + mcTreble: Result := SOUND_MIXER_TREBLE; + mcBass: Result := SOUND_MIXER_BASS; + mcSynth: Result := SOUND_MIXER_SYNTH; + mcPCM: Result := SOUND_MIXER_PCM; + mcSpeaker: Result := SOUND_MIXER_SPEAKER; + mcLine: Result := SOUND_MIXER_LINE; + mcMic: Result := SOUND_MIXER_MIC; + mcCD: Result := SOUND_MIXER_CD; + mcIMix: Result := SOUND_MIXER_IMIX; + mcAltPCM: Result := SOUND_MIXER_ALTPCM; + mcRecLev: Result := SOUND_MIXER_RECLEV; + mcUnknown: Result := 0; + end; + 1: + case Ch of + mcVolume: Result := SOUND_MIXER_WRITE_VOLUME; + mcTreble: Result := SOUND_MIXER_WRITE_TREBLE; + mcBass: Result := SOUND_MIXER_WRITE_BASS; + mcSynth: Result := SOUND_MIXER_WRITE_SYNTH; + mcPCM: Result := SOUND_MIXER_WRITE_PCM; + mcSpeaker: Result := SOUND_MIXER_WRITE_SPEAKER; + mcLine: Result := SOUND_MIXER_WRITE_LINE; + mcMic: Result := SOUND_MIXER_WRITE_MIC; + mcCD: Result := SOUND_MIXER_WRITE_CD; + mcIMix: Result := SOUND_MIXER_WRITE_IMIX; + mcAltPCM: Result := SOUND_MIXER_WRITE_ALTPCM; + mcRecLev: Result := SOUND_MIXER_WRITE_RECLEV; + mcUnknown: Result := 0; + end; + 2: + case Ch of + mcVolume: Result := SOUND_MIXER_READ_VOLUME; + mcTreble: Result := SOUND_MIXER_READ_TREBLE; + mcBass: Result := SOUND_MIXER_READ_BASS; + mcSynth: Result := SOUND_MIXER_READ_SYNTH; + mcPCM: Result := SOUND_MIXER_READ_PCM; + mcSpeaker: Result := SOUND_MIXER_READ_SPEAKER; + mcLine: Result := SOUND_MIXER_READ_LINE; + mcMic: Result := SOUND_MIXER_READ_MIC; + mcCD: Result := SOUND_MIXER_READ_CD; + mcIMix: Result := SOUND_MIXER_READ_IMIX; + mcAltPCM: Result := SOUND_MIXER_READ_ALTPCM; + mcRecLev: Result := SOUND_MIXER_READ_RECLEV; + mcUnknown: Result := 0; + end; + end; + end; + + function GetChannelType(Mask : Integer) : TACSMixerChannel; + begin + case Mask of + SOUND_MIXER_VOLUME: Result := mcVolume; + SOUND_MIXER_TREBLE: Result := mcTreble; + SOUND_MIXER_BASS: Result := mcBass; + SOUND_MIXER_SYNTH: Result := mcSynth; + SOUND_MIXER_PCM: Result := mcPCM; + SOUND_MIXER_SPEAKER: Result := mcSpeaker; + SOUND_MIXER_LINE: Result := mcLine; + SOUND_MIXER_MIC: Result := mcMic; + SOUND_MIXER_CD: Result := mcCD; + SOUND_MIXER_IMIX: Result := mcIMix; + SOUND_MIXER_ALTPCM: Result := mcAltPCM; + SOUND_MIXER_RECLEV: Result := mcRecLev; + else Result := mcUnknown; + end; + end; + + procedure TACSMixer.SetDevNum(Num : Integer); + var + DevMask, i : Integer; + Channel : TACSMixerChannel; + begin + if Num in [0..MixersCount - 1] then // check [0..0] [0..-1] + begin + FFileName := Mixers[Num].Path; + FMixerName := Mixers[Num].Name; + setlength(FChannels,0); + _mix_fd := open(PChar(FFileName), O_RDONLY); + ioctl(_mix_fd, SOUND_MIXER_READ_DEVMASK, @DevMask); + __close(_mix_fd); + for i:=0 to 31 do + begin + if (DevMask and (1 shl i)) <> 0 then + begin + Channel := GetChannelType(i); + if Channel <> mcUnknown then + begin + setlength(FChannels,length(FChannels)+1); + FChannels[length(FChannels)-1] := Channel; + end; + end; + end; + end; + end; + + function TACSMixer.GetRecSource; + var + rs, pow,i : Integer; + begin + Result := -1; + _mix_fd := open(PChar(FFileName), O_RDONLY); + ioctl(_mix_fd, SOUND_MIXER_READ_RECSRC, @rs); + __close(_mix_fd); + pow := 0; + while rs <> 1 do + begin + rs := rs shr 1; + Inc(pow); + end; + for i := 0 to length(FChannels)-1 do + if FChannels[i] = GetChannel(pow) then + Result := i; + end; + + function TACSMixer.GetVolume; + var + vol, chan : Integer; + begin + _mix_fd := open(PChar(FFileName), O_RDONLY); + chan := GetChannelMask(FChannels[vChannel], 2); + ioctl(_mix_fd, chan, @vol); + __close(_mix_fd); + if vol > 255 then + begin + Result.Left := Lo(vol); + Result.Right := Lo(vol shr 8); + end else Result.Main := vol; + end; + + function TACSMixer.IsStereo; + var + mask, chan : Integer; + begin + _mix_fd := open(PChar(FFileName), O_RDONLY); + ioctl(_mix_fd, SOUND_MIXER_READ_STEREODEVS, @mask); + chan := GetChannelMask(FChannels[vChannel], 0); + __close(_mix_fd); + Result := (mask and (1 shl chan))<>0; + end; + + function TACSMixer.IsRecordable; + var + mask, chan : Integer; + begin + _mix_fd := open(PChar(FFileName), O_RDONLY); + ioctl(_mix_fd, SOUND_MIXER_READ_RECMASK, @mask); + chan := GetChannelMask(FChannels[vChannel], 0); + __close(_mix_fd); + Result := (mask and (1 shl chan))<>0; + end; + + procedure TACSMixer.SetRecSource; + var + chan : Integer; + begin + chan := 1 shl GetChannelMask(FChannels[vChannel], 0); + _mix_fd := open(PChar(FFileName), O_WRONLY); + ioctl(_mix_fd, SOUND_MIXER_WRITE_RECSRC, @chan); + __close(_mix_fd); + if chan <> (1 shl GetChannelMask(FChannels[vChannel], 0)) then + raise EACSException.Create(Format(strChannelnotRecordable,[vChannel])); + end; + + function TACSMixer.GetMute(vChannel : integer) : Boolean; + begin + Result := False; + end; + + procedure TACSMixer.SetMute(vChannel : integer; Mute : Boolean); + begin + end; + + procedure TACSMixer.SetVolume; + var + vol, chan : Integer; + begin + chan := GetChannelMask(FChannels[vChannel], 1); + if IsStereo(vChannel) then + vol := vLevel.Left + (vLevel.Right shl 8) + else vol := vLevel.Main; + _mix_fd := open(PChar(FFileName), O_WRONLY); + ioctl(_mix_fd, chan, @vol); + __close(_mix_fd); + end; + + destructor TACSMixer.Destroy; + begin + Setlength(FChannels,0); + inherited Destroy; + end; + + function CountMixers : Byte; + var + fd, i, DevMask : Integer; + fname : String; + mi : mixer_info; + begin + Result := 0; + for i := 0 to MAX_MIXERS-1 do + begin + fname := '/dev/mixer'+IntToStr(i-1); + try + fd := open(PChar(fname), O_RDONLY); + except + Break; + end; + if fd = -1 then Break; + DevMask := 0; + ioctl(fd, SOUND_MIXER_READ_DEVMASK, @DevMask); + if DevMask <> 0 then + begin + Mixers[Result].Path := fname; + ioctl(fd, SOUND_MIXER_INFO, @mi); + Mixers[Result].Name := String(mi.name); + Inc(Result); + end; + __close(fd); + end; + fname := '/dev/mixer'; + try + fd := open(PChar(fname), O_RDONLY); + except + Exit; + end; + if fd = -1 then Exit; + ioctl(fd, SOUND_MIXER_READ_DEVMASK, @DevMask); + if DevMask <> 0 then + begin + Mixers[Result].Path := fname; + ioctl(fd, SOUND_MIXER_INFO, @mi); + Mixers[Result].Name := String(mi.name); + end; + __close(fd); + Inc(Result); + end; + diff --git a/components/acs/Src/classes/linux/cd_rom.pas b/components/acs/Src/classes/linux/cd_rom.pas new file mode 100644 index 000000000..c3b8c3045 --- /dev/null +++ b/components/acs/Src/classes/linux/cd_rom.pas @@ -0,0 +1,392 @@ +(* cd_rom kylix unit + translated from cdrom.h by andrei borovsky. + + this unit contains declarations translated + from the huge cdrom.h header file. In fact + cdrom.h covers a lot of stuff concerning + CDs, DVDs, writable CDs, etc. Of all these + there are only the declarations needed for + reading/playing CDs in this unit. *) +(* + This file is a part of Audio Components Suite v 2.3. + Copyright (c) 2002-2005 Andrei Borovsky. All rights reserved. + See the LICENSE file for more details. + You can contact me at mail@z0m3ie.de +*) + +{ +$Log: cd_rom.pas,v $ +Revision 1.3 2005/12/19 18:35:03 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + + +unit cd_rom; + +interface + +uses + Libc; + +type + __U8 = Byte; + request_sense = Byte; + (* request_sense is a bitmask : veeeeeee + v - valid + eeeeeee - error code + *) + PRequest_sense = ^request_sense; + +const + EDRIVE_CANT_DO_THIS = EOPNOTSUPP; + + (* + The CD-ROM IOCTL commands -- these should be supported by } + all the various cdrom drivers. For the CD-ROM ioctls, we } + will commandeer byte 0x53, or 'S'. *) + +const + + CDROMPAUSE = $5301; // Pause Audio Operation + CDROMRESUME = $5302; // Resume paused Audio Operation + CDROMPLAYMSF = $5303; // Play Audio MSF (struct cdrom_msf) + CDROMPLAYTRKIND = $5304; // Play Audio Track/index + CDROMREADTOCHDR = $5305; // Read TOC header + CDROMREADTOCENTRY = $5306; // Read TOC entry + CDROMSTOP = $5307; // Stop the cdrom drive + CDROMSTART = $5308; // Start the cdrom drive + CDROMEJECT = $5309; // Ejects the cdrom media + CDROMVOLCTRL = $530a; // Control output volume + CDROMSUBCHNL = $530b; // Read subchannel data + CDROMREADMODE2 = $530c; // Read CDROM mode 2 data (2336 Bytes) + CDROMREADMODE1 = $530d; // Read CDROM mode 1 data (2048 Bytes) + CDROMREADAUDIO = $530e; // (struct cdrom_read_audio) + CDROMEJECT_SW = $530; // enable(1)/disable(0) auto-ejecting + CDROMMULTISESSION = $5310; // Obtain the start-of-last-session + CDROM_GET_MCN = $5311; // Obtain the "Universal Product Code" + CDROM_GET_UPC = CDROM_GET_MCN; // depricated + CDROMRESET = $5312; // hard-reset the drive + CDROMVOLREAD = $5313; // Get the drive's volume setting + CDROMREADRAW = $5314; // read data in raw mode (2352 Bytes) + + { These ioctls are used only used in aztcd.c and optcd.c } + + CDROMREADCOOKED = $5315; // read data in cooked mode + CDROMSEEK = $5316; // seek msf address + + { This ioctl is only used by the scsi-cd driver. } + { It is for playing audio in logical block addressing mode. } + + CDROMPLAYBLK = $5317; // (struct cdrom_blk) + + { These ioctls are only used in optcd.c } + + CDROMREADALL = $5318; // read all 2646 bytes + +(* These ioctls are (now) only in ide-cd.c for controlling + drive spindown time. They should be implemented in the + Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, + GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... + -Erik *) + +const + + CDROMGETSPINDOWN = $531d; + CDROMSETSPINDOWN = $531e; + + (* These ioctls are implemented through the uniform CD-ROM driver + They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM + drivers are eventually ported to the uniform CD-ROM driver interface. *) + +const + + CDROMCLOSETRAY = $5319; // pendant of CDROMEJECT + CDROM_SET_OPTIONS = $5320; // Set behavior options + CDROM_CLEAR_OPTIONS = $5321; // Clear behavior options + CDROM_SELECT_SPEED = $5322; // Set the CD-ROM speed + CDROM_SELECT_DISC = $5323; // Select disc (for juke-boxes) + CDROM_MEDIA_CHANGED = $5325; // Check is media changed + CDROM_DRIVE_STATUS = $5326; // Get tray position, etc. + CDROM_DISC_STATUS = $5327; // Get disc type, etc. + CDROM_CHANGER_NSLOTS = $5328; // Get number of slots + CDROM_LOCKDOOR = $5329; // lock or unlock door + CDROM_DEBUG = $5330; // Turn debug messages on/off + CDROM_GET_CAPABILITY = $5331; // get capabilities + +// This ioctl is only used by sbpcd at the moment + + CDROMAUDIOBUFSIZ = $5382; // set the audio buffer size + CDROM_SEND_PACKET = $5393; // send a packet to the drive + CDROM_NEXT_WRITABLE = $5394; // get next writable block + CDROM_LAST_WRITTEN = $5395; // get last block written on disc + +//******************************************************} +// CDROM IOCTL structures +//******************************************************} + +type + +// Address in MSF format + cdrom_msf0 = record + minute: __U8; + second: __U8; + frame: __U8; + end; + +// Address in either MSF or logical format + cdrom_addr = record + case Word of + 1: (msf: cdrom_msf0;); + 2: (lba: Integer;); + end; + + + +(* cdrom_msf renamed to cdrom_msf_t since there is + also a cdrom_msf constant in this unit *) + +// This struct is used by the CDROMPLAYMSF ioctl + cdrom_msf_t = record + cdmsf_min0: __U8; // start minute + cdmsf_sec0: __U8; // start second + cdmsf_frame0: __U8; // start frame + cdmsf_min1: __U8; // end minute + cdmsf_sec1: __U8; // end second + cdmsf_frame1: __U8; // end frame + end; + +// This struct is used by the CDROMPLAYTRKIND ioctl + cdrom_ti = record + cdti_trk0: __U8; // start track + cdti_ind0: __U8; // start index + cdti_trk1: __U8; // end track + cdti_ind1: __U8; // end index + end; + +// This struct is used by the CDROMREADTOCHDR ioctl + cdrom_tochdr = record + cdth_trk0: __U8; // start track + cdth_trk1: __U8; // end track + end; + +// This struct is used by the CDROMVOLCTRL and CDROMVOLREAD ioctls + cdrom_volctrl = record + channel0: __U8; + channel1: __U8; + channel2: __U8; + channel3: __U8; + end; + +// This struct is used by the CDROMSUBCHNL ioctl + cdrom_subchnl = record + cdsc_format: __U8; + cdsc_audiostatus: __U8; + CDSC_ADR_CTRL : __U8; // 4 bits - ADR, 4 bits - CTRL + cdsc_trk: __U8; + cdsc_ind: __U8; + cdsc_absaddr: cdrom_addr; + cdsc_reladdr: cdrom_addr; + end; + + +// This struct is used by the CDROMREADTOCENTRY ioctl + cdrom_tocentry = record + cdte_track: __U8; + cdte_adr_ctrl: __U8; + cdte_format: __U8; + cdte_addr: cdrom_addr; + cdte_datamode: __U8; + end; + +// This struct is used by the CDROMREADMODE1, and CDROMREADMODE2 ioctls + cdrom_read = record + cdread_lba: Integer; + cdread_bufaddr: PChar; + cdread_buflen: Integer; + end; + +// This struct is used by the CDROMREADAUDIO ioctl + cdrom_read_audio = record + addr: cdrom_addr; // frame address + addr_format: __U8; // CDROM_LBA or CDROM_MSF + nframes: Integer; // number of 2352-byte-frames to read at once + buf: PChar; // frame buffer (size: nframes*2352 bytes) + end; + +// This struct is used with the CDROMMULTISESSION ioctl + cdrom_multisession = record + addr: cdrom_addr; + (* frame address: start-of-last-session + (not the new "frame 16"!). Only valid + if the "xa_flag" is true. *) + xa_flag: __U8; // 1: "is XA disk" + addr_format: __U8; // CDROM_LBA or CDROM_MSF } + end; + +(* This struct is used with the CDROM_GET_MCN ioctl. + Very few audio discs actually have Universal Product Code information, + which should just be the Medium Catalog Number on the box. Also note + that the way the codeis written on CD is _not_ uniform across all discs! *) + + cdrom_mcn = record + medium_catalog_number: array[0..13] of __U8; + { 13 ASCII digits, null-terminated } + end; + +// This is used by the CDROMPLAYBLK ioctl +type + cdrom_blk = record + from: Word; + len: Word; + end; + +const + CDROM_PACKET_SIZE = 12; + CGC_DATA_UNKNOWN = 0; + CGC_DATA_WRITE = 1; + CGC_DATA_READ = 2; + CGC_DATA_NONE = 3; + +// for CDROM_PACKET_COMMAND ioctl +type + cdrom_generic_command = record + cmd: array[0..CDROM_PACKET_SIZE-1] of Byte; + buffer: PByte; + buflen: Word; + stat: Integer; + sense: PREQUEST_SENSE; + data_direction: Byte; + quiet: Integer; + timeout: Integer; + reserved: array[0..0] of Pointer; + end; + +// Some generally useful CD-ROM information -- mostly based on the above +const + + CD_MINS = 74; // max. minutes per CD, not really a limit + CD_SECS = 60; // seconds per minute + CD_FRAMES = 75; // frames per second + CD_SYNC_SIZE = 12; // 12 sync bytes per raw data frame + CD_MSF_OFFSET = 150; // MSF numbering offset of first frame + CD_CHUNK_SIZE = 24; // lowest-level 'data bytes piece' + CD_NUM_OF_CHUNKS = 98; // chunks per frame + CD_FRAMESIZE_SUB = 96; // subchannel data 'frame' size + CD_HEAD_SIZE = 4; // header (address) bytes per raw data frame + CD_SUBHEAD_SIZE = 8; // subheader bytes per raw XA data frame + CD_EDC_SIZE = 4; // bytes EDC per most raw data frame types + CD_ZERO_SIZE = 8; // bytes zero per yellow book mode 1 frame + CD_ECC_SIZE = 276; // bytes ECC per most raw data frame types + CD_FRAMESIZE = 2048; // bytes per frame, 'cooked' mode + CD_FRAMESIZE_RAW = 2352; // bytes per frame, 'raw' mode + CD_FRAMESIZE_RAWER = 2646; // The maximum possible returned bytes + + // most drives don't deliver everything: + + CD_FRAMESIZE_RAW1 = (CD_FRAMESIZE_RAW-CD_SYNC_SIZE); //2340 + CD_FRAMESIZE_RAW0 = (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE); //2336 + CD_XA_HEAD = (CD_HEAD_SIZE+CD_SUBHEAD_SIZE); // 'before data' part of raw XA frame + CD_XA_TAIL = (CD_EDC_SIZE+CD_ECC_SIZE); // 'after data' part of raw XA frame + CD_XA_SYNC_HEAD = (CD_SYNC_SIZE+CD_XA_HEAD); // sync bytes + header of XA frame + +// CD-ROM address types (cdrom_tocentry.cdte_format) + + CDROM_LBA = $01; // 'logical block': first frame is #0 + CDROM_MSF = $02; // 'minute-second-frame': binary, not bcd here! + +// bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl) + + CDROM_DATA_TRACK = $40; + +// The leadout track is always 0xAA, regardless of # of tracks on disc + + CDROM_LEADOUT = $AA; + +// audio states (from SCSI-2, but seen with other drives, too) + + CDROM_AUDIO_INVALID = $00; // audio status not supported + CDROM_AUDIO_PLAY = $11; // audio play operation in progress + CDROM_AUDIO_PAUSED = $12; // audio play operation paused + CDROM_AUDIO_COMPLETED = $13; // audio play successfully completed + CDROM_AUDIO_ERROR = $14; // audio play stopped due to error + CDROM_AUDIO_NO_STATUS = $15; // no current audio status to return + +// capability flags used with the uniform CD-ROM driver + + CDC_CLOSE_TRAY = $1; // caddy systems _can't_ close + CDC_OPEN_TRAY = $2; // but _can_ eject. + CDC_LOCK = $4; // disable manual eject + CDC_SELECT_SPEED = $8; // programmable speed + CDC_SELECT_DISC = $10; // select disc from juke-box + CDC_MULTI_SESSION = $20; // read sessions>1 + CDC_MCN = $40; // Medium Catalog Number + CDC_MEDIA_CHANGED = $80; // media changed + CDC_PLAY_AUDIO = $100; // audio functions + CDC_RESET = $200; // hard reset device + CDC_IOCTLS = $400; // driver has non-standard ioctls + CDC_DRIVE_STATUS = $800; // driver implements drive status + CDC_GENERIC_PACKET = $1000; // driver implements generic packets + CDC_CD_R = $2000; // drive is a CD-R + CDC_CD_RW = $4000; // drive is a CD-RW + CDC_DVD = $8000; // drive is a DVD + CDC_DVD_R = $10000; // drive can write DVD-R + CDC_DVD_RAM = $20000; // drive can write DVD-RAM + +// drive status possibilities returned by CDROM_DRIVE_STATUS ioctl + + CDS_NO_INFO = 0; // if not implemented + CDS_NO_DISC = 1; + CDS_TRAY_OPEN = 2; + CDS_DRIVE_NOT_READY = 3; + CDS_DISC_OK = 4; + +(* return values for the CDROM_DISC_STATUS ioctl + can also return CDS_NO_[INFO|DISC], from above *) + + CDS_AUDIO = 100; + CDS_DATA_1 = 101; + CDS_DATA_2 = 102; + CDS_XA_2_1 = 103; + CDS_XA_2_2 = 104; + CDS_MIXED = 105; + +// User-configurable behavior options for the uniform CD-ROM driver + + CDO_AUTO_CLOSE = $1; // close tray on first open() + CDO_AUTO_EJECT = $2; // open tray on last release() + CDO_USE_FFLAGS = $4; // use O_NONBLOCK information on open + CDO_LOCK = $8; // lock tray on open files + CDO_CHECK_TYPE = $10; // check type on open for data + +// Special codes used when specifying changer slots. + + CDSL_NONE = $7FFFFFFE; + CDSL_CURRENT = $7FFFFFFF; + +(* For partition based multisession access. IDE can handle 64 partitions + per drive - SCSI CD-ROM's use minors to differentiate between the + various drives, so we can't do multisessions the same way there. + Use the -o session=x option to mount on them. *) + + CD_PART_MAX = 64; + CD_PART_MASK = (CD_PART_MAX - 1); + + + +implementation + +end. diff --git a/components/acs/Src/classes/windows/acs_cdrom.inc b/components/acs/Src/classes/windows/acs_cdrom.inc new file mode 100644 index 000000000..32ee17275 --- /dev/null +++ b/components/acs/Src/classes/windows/acs_cdrom.inc @@ -0,0 +1,336 @@ +{ +$Log: acs_cdrom.inc,v $ +Revision 1.12 2006/08/31 20:10:56 z0m3ie +*** empty log message *** + +Revision 1.11 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.3 2006/01/03 15:37:51 z0m3ie +*** empty log message *** + +Revision 1.2 2005/12/26 17:31:39 z0m3ie +fixed some problems in acs_dsfiles +fixed some problems in acs_vorbis +reworked all buffers + +Revision 1.1 2005/12/19 18:35:16 z0m3ie +*** empty log message *** + +Revision 1.4 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.3 2005/10/02 16:51:46 z0m3ie +*** empty log message *** + +Revision 1.2 2005/09/13 21:54:11 z0m3ie +acs is localizeable now (ACS_Strings) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.5 2005/09/09 21:33:43 z0m3ie +linux corrections + +Revision 1.4 2005/09/08 22:19:00 z0m3ie +completed akrip based CDIn + +Revision 1.3 2005/09/07 20:53:22 z0m3ie +begon to add MPEG and WMA support using DirectX + +Revision 1.2 2005/09/04 17:59:38 z0m3ie +moving CDIn support to AKRip mostly +begon to add mpegin support for Win with mpg123 + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +} + +type + MSFAddr = array[0..3] of Byte; + + function Toc2MSF(t : MSFAddr) : TACSCDMSF; + begin + Result.Minute := t[1]; + Result.Second := t[2]; + Result.Frame := t[3]; + end; + + procedure TACSCDIn.OpenCD; + var + GetCD: GETCDHAND; + begin + with GetCD do + begin + Size := SizeOf(GETCDHAND); + Ver := 1; + ha := 0; + tgt := FCurrentDrive; + lun := 0; + readType := CDR_ANY; + jitterCorr := false; + numJitter := 0; + numOverlap := 0; + end; + FCDHandle := GetCDHandle(GetCD); + end; + + procedure TACSCDIn.CloseCD; + begin + if FCDHandle <> 0 then + CloseCDHandle(FCDHandle); + FCDHandle := 0; + end; + + function TACSCDIn.GetInfo : TACSCDInfo; + var + i : Integer; + begin + OpenCD; + Result := cdiUnknown; + ModifyCDParms(FCDHandle, CDP_MSF, DWORD(true)); + FillChar(FToc, SizeOf(FToc),0); + if ReadTOC(FCDHandle, FTOC) <> 1 then + begin + Result := cdiNoDisc; + Exit; + end; + for i := 0 to FToc.lastTrack-1 do + begin + if (FToc.Tracks[i].adr and $04) = 0 then + begin + case Result of + cdiUnknown : Result := cdiDiscAudio; + cdiDiscData : Result := cdiDiscMixed; + end; + end else + begin + case Result of + cdiUnknown : Result := cdiDiscData; + cdiDiscAudio : Result := cdiDiscMixed; + end; + end; + end; + CloseCD; + end; + + function TACSCDIn.GetStatus : TACSCDStatus; + var + ms : Integer; + AP : LongBool; + begin + if FPlaying then + Result := cdsPlaying + else if (GetInfo <> cdiNoDisc) and (GetInfo <> cdiUnknown) then + Result := cdsReady + else + Result := cdsNotReady; + end; + + function TACSCDIn.GetNumTracks : Integer; + begin + OpenCD; + if FToc.lastTrack = 0 then + begin + ModifyCDParms(FCDHandle, CDP_MSF, DWORD(true)); + if ReadTOC(FCDHandle, FTOC) <> 1 then + begin + Result := -1; + Exit; + end; + end; + Result := FToc.lastTrack; + CloseCD; + end; + + FUNCTION TACSCDIn.GetTrackInfo(const vIndex : Integer) : TACSCDTrackInfo; + VAR + Frames: Integer; + tmpmsf : TACSCDMSF; + BEGIN + IF Busy THEN + RAISE EACSException.Create(strBusy); + IF (vIndex IN [0..GetNumTracks-1]) = False THEN + RAISE EACSException.Create(strTrackoutofrange); + IF (FToc.Tracks[vIndex].adr and $04) = 0 THEN + Result.TrackType := ttAudio + ELSE + Result.TrackType := ttData; + Result.TrackStart.Minute := FToc.Tracks[vIndex].addr[1]; + Result.TrackStart.Second := FToc.Tracks[vIndex].addr[2]; + Result.TrackStart.Frame := FToc.Tracks[vIndex].addr[3]; + Frames := MSF2Frames(Toc2MSF(MSFAddr(FToc.Tracks[vIndex+1].addr)))-MSF2Frames(Toc2MSF(MSFAddr(FToc.Tracks[vIndex].addr))); + Frames2MSF(Frames, Result.TrackLength); + end; + + procedure TACSCDIn.SetST; + begin + if Self.Busy then raise EACSException.Create(strBusy); + FStartTrack := Track; + FStartPos.Track := FStartTrack; + FillChar(FStartPos.MSF, SizeOf(FStartPos.MSF), 0); + end; + + procedure TACSCDIn.SetET; + begin + if Self.Busy then raise EACSException.Create(strBusy); + FEndTrack := Track; + FEndPos.Track := FEndTrack+1; + FillChar(FEndPos.MSF, SizeOf(FEndPos.MSF), 0); + end; + + procedure TACSCDIn.SetSP; + begin + if Self.Busy then raise EACSException.Create(strBusy); + FStartPos := Pos; + end; + + procedure TACSCDIn.SetEP; + begin + if Self.Busy then raise EACSException.Create(strBusy); + FEndPos := Pos; + if Pos.Track = EndOfDisc.Track then FEndPos.Track := TracksCount + 1; + end; + + function TACSCDIn.GetSize : Integer; + var + Sect1, Sect2 : Integer; + begin + if Busy then + begin + Result := FRipEnd-FRipStart*CD_FRAMESIZE_RAW; + Exit; + end; + Sect1 := MSF2Frames(Toc2MSF(MSFAddr(FToc.tracks[FStartPos.Track].addr))); + Sect1 := Sect1 + MSF2Frames(FStartPos.MSF); + Sect2 := MSF2Frames(Toc2MSF(MSFAddr(FToc.tracks[FEndPos.Track].addr))); + Sect2 := Sect2 + MSF2Frames(FEndPos.MSF); + Result := (Sect2 - Sect1)*CD_FRAMESIZE_RAW; + end; + + procedure TACSCDIn.Init; + var + Sect1, Sect2 : Integer; + begin + if Busy then raise EACSException.Create(strBusy); + if Status = cdsNotReady then + raise EACSException.Create(strDrivenotready); + if (FStartPos.Track in [0..GetNumTracks-1]) = False then + raise EACSException.Create(strTrackoutofRange); + if Tracks[FStartPos.Track].TrackType = ttData then + raise EACSException.Create(strnoAudioTreck); + OpenCD; + FSize := GetSize; + FBusy := True; + BufStart := 1; + BufEnd := 0; + FPosition := 0; + Sect1 := MSF2Frames(Toc2MSF(MSFAddr(FToc.tracks[FStartPos.Track].addr))); + Sect1 := Sect1 + MSF2Frames(FStartPos.MSF); + Sect2 := MSF2Frames(Toc2MSF(MSFAddr(FToc.tracks[FEndPos.Track].addr))); + Sect2 := Sect2 + MSF2Frames(FEndPos.MSF); + FRipEnd := Sect2; + FRipStart := Sect1; + SetLength(FBuffer,(BUF_SIZE * CD_FRAMESIZE_RAW)+TRACKBUFEXTRA); + end; + + procedure TACSCDIn.Flush; + begin + CloseCD; + FBusy := False; + Setlength(FBuffer,0); + FBuffer := nil; + FSize := 0; + end; + + function TACSCDIn.GetData(Buffer : Pointer; BufferSize : Integer): Integer; + var + Abort : LongBool; + fnum : Integer; + begin + if not Busy then raise EACSException.Create(strStreamnotOpen); + if BufStart > BufEnd then //Buffer clear try to fill it + begin + BufStart := 1; + Abort := False; + if FRipEnd-FRipStart > BUF_SIZE then + fNum := BUF_SIZE + else + fNum := FRipEnd-FRipStart; + FiBuffer^.startFrame := FRipStart; + FiBuffer^.numFrames := fNum; + FiBuffer^.maxLen := FiBuffer^.numFrames * CD_FRAMESIZE_RAW; + FiBuffer^.len := 0; + FiBuffer^.status := 0; + FiBuffer^.startOffset := 0; + if ReadCDAudioLBA(FCDHandle,FiBuffer) = 1 then + begin + Inc(FRipStart,FiBuffer^.numFrames); + BufEnd := FiBuffer^.len; + end; + end; + if BufferSize < (BufEnd - BufStart + 1) then + Result := BufferSize + else + Result := BufEnd - BufStart + 1; + Move(FiBuffer^.buf[BufStart-1],Buffer^, Result); + Inc(BufStart, Result); + Inc(FPosition, Result); + end; + + procedure TACSCDIn.SetCurrentDrive; + begin + if Value in [0..FCDList.num-1] then + FCurrentDrive := Value; + OpenCD; + FillChar(FToc, SizeOf(FToc),0); + ModifyCDParms(FCDHandle, CDP_MSF, DWORD(true)); + ReadTOC(FCDHandle, FTOC); + CloseCD; + end; + + function TACSCDIn.GetDrivesCount : Integer; + begin + Result := FCDList.num; + end; + + function TACSCDIn.GetDriveName : string; + begin + Result := FCDList.Cd[FCurrentDrive].id; + end; + + procedure TACSCDIn.Eject; + begin + if Busy then raise EACSException.Create(strBusy); + end; + + procedure TACSCDIn.CloseTray; + begin + end; + + constructor TACSCDIn.Create; + begin + inherited Create(AOwner); + AppPath := ExtractFilePath(ParamStr(0)); + if AppPath[length(AppPath)] <> '\' then AppPath := AppPath + '\'; + CDRIPInit(AppPath); + if not (csDesigning in ComponentState) then + if not CDRipLoaded then + raise EACSException.Create(akriplib + ' could not be loaded.'); + FillChar(FCDList, SizeOf(FCDList),0); + FCDList.max := MAXCDLIST; + GetCDList(FCDList); + end; + + destructor TACSCDIn.Destroy; + begin + if Busy then + Flush; + CloseCD; + inherited Destroy; + end; + diff --git a/components/acs/Src/classes/windows/acs_mixer.inc b/components/acs/Src/classes/windows/acs_mixer.inc new file mode 100644 index 000000000..586c857c7 --- /dev/null +++ b/components/acs/Src/classes/windows/acs_mixer.inc @@ -0,0 +1,407 @@ +{ +$Log: acs_mixer.inc,v $ +Revision 1.3 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.1 2005/12/19 18:35:16 z0m3ie +*** empty log message *** + +Revision 1.3 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.2 2005/09/13 21:54:11 z0m3ie +acs is localizeable now (ACS_Strings) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.10 2005/08/31 20:30:40 z0m3ie +Mixer Channelname work now +minior corrections for Converters + +Revision 1.9 2005/08/31 14:37:59 z0m3ie +*** empty log message *** + +Revision 1.8 2005/08/30 22:10:55 z0m3ie +Mixer mostly completed + +Revision 1.7 2005/08/29 22:50:33 z0m3ie +*** empty log message *** + +Revision 1.6 2005/08/29 21:46:43 z0m3ie +*** empty log message *** + +Revision 1.5 2005/08/28 20:33:10 z0m3ie +*** empty log message *** + +Revision 1.4 2005/08/28 18:35:53 z0m3ie +created Delphi package for 2.4 +more Mixer stuff +updated some things for Delphi + +Revision 1.3 2005/08/26 17:12:56 z0m3ie +*** empty log message *** + +Revision 1.2 2005/08/26 17:03:20 z0m3ie +begon to make acs resourcestring aware +more advanced tmixer for windows +restructured tmixer its better handleable now + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +} + +function mixerSetControlDetails(x1: HMIXEROBJ; x2: PMIXERCONTROLDETAILS; x3: DWORD): MMRESULT; stdcall; + external 'winmm.dll' name + 'mixerSetControlDetails'; + + function GetChannelfromMask(Mask : DWORD) : TACSMixerChannel; + begin + case Mask of + MIXERLINE_COMPONENTTYPE_DST_UNDEFINED : Result := mcUnknown; + MIXERLINE_COMPONENTTYPE_DST_DIGITAL : Result := mcDigital; + MIXERLINE_COMPONENTTYPE_DST_LINE : Result := mcLine; + MIXERLINE_COMPONENTTYPE_DST_MONITOR : Result := mcMonitor; + MIXERLINE_COMPONENTTYPE_DST_SPEAKERS : Result := mcVolume; + MIXERLINE_COMPONENTTYPE_DST_HEADPHONES : Result := mcHeadphone; + MIXERLINE_COMPONENTTYPE_DST_TELEPHONE : Result := mcTelephone; + MIXERLINE_COMPONENTTYPE_DST_WAVEIN : Result := mcPCM; + MIXERLINE_COMPONENTTYPE_DST_VOICEIN : Result := mcUnknown; + MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED : Result := mcUnknown; + MIXERLINE_COMPONENTTYPE_SRC_DIGITAL : Result := mcDigital; + MIXERLINE_COMPONENTTYPE_SRC_LINE : Result := mcLine; + MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE : Result := mcMic; + MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER: Result := mcSynth; + MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC: Result := mcCD; + MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE : Result := mcTelephone; + MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER : Result := mcVolume; + MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT : Result := mcPCM; + MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY : Result := mcAltPCM; + MIXERLINE_COMPONENTTYPE_SRC_ANALOG : Result := mcUnknown; + else + end; + end; + + procedure TACSMixer.SetDevNum(Num : Integer); + type + TData = array [0..3] of MIXERCONTROLDETAILS_UNSIGNED; + PData = ^TData; + var + destination, + connection : Integer; + data : PData; + pmxctrl : PMixerControl; + s : String; + aLineInfo, + aConnLineInfo : TMixerLine; + error : Integer; + + procedure GetLineControls(mixLineInfo : TMixerLine); + var + j, k, + datasize : Integer; + aLineControl : TMixerLineControls; + aControlDetails: TMixerControlDetails; + amixControl : PMixerControl; + aControl : PControlEntry; + begin + with aLineControl do + begin + cbStruct := SizeOf(TMixerLineControls); + dwLineID := mixLineInfo.dwLineID; + cControls := mixLineInfo.cControls; + cbmxctrl := SizeOf(TMixerControl); + GetMem(amixControl, SizeOf(TMixerControl) * mixLineInfo.cControls); + pamxctrl := amixControl; + end; + error := mixerGetLineControls(Num, @aLineControl, MIXER_GETLINECONTROLSF_ALL); + pmxctrl := amixControl; + for j := 0 TO aLineControl.cControls -1 do + begin + if (pmxctrl^.dwControlType <> MIXERCONTROL_CONTROLTYPE_VOLUME) + and (pmxctrl^.dwControlType <> MIXERCONTROL_CONTROLTYPE_MUTE) then + continue; + if (pmxctrl^.fdwControl and MIXERCONTROL_CONTROLF_UNIFORM) > 0 then + aControlDetails.cChannels := 1 + else + aControlDetails.cChannels := mixLineInfo.cChannels; + if (pmxctrl^.fdwControl AND MIXERCONTROL_CONTROLF_MULTIPLE) > 0 then + begin + aControlDetails.cMultipleItems := pmxctrl^.cMultipleItems; + Getmem(data,pmxctrl^.cMultipleItems * SizeOf(MIXERCONTROLDETAILS_UNSIGNED)); + datasize := pmxctrl^.cMultipleItems; + end + else + begin + aControlDetails.cMultipleItems := 0; + Getmem(data, aControlDetails.cChannels * SizeOf(MIXERCONTROLDETAILS_UNSIGNED)); + datasize := aControlDetails.cChannels; + end; + with aControlDetails do + begin + cbStruct := sizeOf(TmixerControlDetails); + dwControlID := pmxctrl^.dwControlID; + cbDetails := SizeOf(MIXERCONTROLDETAILS_UNSIGNED); + paDetails := data; + end; + error := mixerGetControlDetails(Num, @aControlDetails, MIXER_GETCONTROLDETAILSF_VALUE ); + if (pmxctrl^.dwControlType = MIXERCONTROL_CONTROLTYPE_MUTE) then + begin + setlength(FMuteControls,length(FControls)+1); + aControl := @FMuteControls[length(FControls)-1]; + end + else + begin + setlength(FControls,length(FControls)+1); + aControl := @FControls[length(FControls)-1]; + end; + setlength(FChannels,Max(length(FControls),length(FMuteControls))); + with aControl^, pmxctrl^, aControlDetails do + begin + IsInited := True; + CDestination := mixLineInfo.dwDestination; + CName := String(szShortname); + CComponentTyp := mixLineInfo.dwComponentType; + CKanal := cChannels; + CID := dwControlID; + CConnect := mixLineInfo.cConnections; + CCControls := mixLineInfo.cControls; + CControl := fdwControl; + CControlTyp := dwControlType; + CMultItems := cMultipleItems; + CMax := Bounds.lMaximum; + CMin := Bounds.lMinimum; + CcSteps := Metrics.cSteps; + for k := 0 to datasize -1 do + CDetails[k].dwValue := data^[k].dwvalue; + end; + FChannels[length(FControls)-1] := GetChannelfromMask(aControl.CComponentTyp); + Freemem(data); + inc(pmxctrl); + end; + Freemem(amixControl); + end; + + begin + if Num in [0..MixersCount - 1] then // check [0..0] [0..-1] + begin + setlength(FChannels,0); + setlength(FControls,0); + setlength(FMuteControls,0); + error := mixerGetDevCaps(Num, @FMixerCaps, sizeof(TMixerCaps)); + FMixer := Num; + FMixerName := StrPas(FMixerCaps.szPName); + error := mixerOpen(@Num, 0, 0, 0, MIXER_OBJECTF_MIXER); + if error = MMSYSERR_NOERROR then + begin + for destination := 0 to FMixerCaps.cDestinations - 1 do + begin + aLineInfo.cbStruct := SizeOf(TMixerLine); + aLineInfo.dwDestination := destination; + error := mixerGetLineInfo(Num, @aLineInfo, MIXER_GETLINEINFOF_DESTINATION); + if aLineInfo.dwComponentType <> MIXERLINE_COMPONENTTYPE_DST_SPEAKERS then + continue; + GetLineControls(aLineInfo); + for connection := 0 TO aLineInfo.cConnections-1 do + begin + with aConnLineInfo do + begin + cbStruct := SizeOf(TMixerLine); + dwDestination := destination; + dwSource := connection; + end; + error := mixerGetLineInfo(Num, @aConnLineInfo, MIXER_GETLINEINFOF_SOURCE); + GetLineControls(aConnLineInfo); + end; + end; + end; + end; + end; + + function TACSMixer.GetVolume(vChannel : Integer) : TACSMixerLevel; + type + TData = array [0..3] of MIXERCONTROLDETAILS_UNSIGNED; + PData = ^TData; + var + data : PData; + aControldetails : TMixerControlDetails; + datasize,k : Integer; + begin + if vChannel >= length(FControls) then + exit; + if FControls[vChannel].IsInited = False then + exit; + if (FControls[vChannel].CControl and MIXERCONTROL_CONTROLF_UNIFORM) > 0 then + aControlDetails.cChannels := 1 + else + aControlDetails.cChannels := FControls[vChannel].CKanal; + if (FControls[vChannel].CControl AND MIXERCONTROL_CONTROLF_MULTIPLE) > 0 then + begin + aControlDetails.cMultipleItems := FControls[vChannel].CMultItems; + Getmem(data, FControls[vChannel].CMultItems * SizeOf(MIXERCONTROLDETAILS_UNSIGNED)); + datasize := FControls[vChannel].CMultItems; + end + else + begin + aControlDetails.cMultipleItems := 0; + Getmem(data, aControlDetails.cChannels * SizeOf(MIXERCONTROLDETAILS_UNSIGNED)); + datasize := aControlDetails.cChannels; + end; + with aControlDetails do + begin + cbStruct := SizeOf(TMixerControlDetails); + dwControlID := FControls[vChannel].CID; + cChannels := FControls[vChannel].CKanal; + cMultipleItems := FControls[vChannel].CMultItems; + cbDetails := sizeof(MIXERCONTROLDETAILS_Signed); + padetails := data; + end; + mixerGetControlDetails(FMixer, @aControlDetails,MIXER_GETCONTROLDETAILSF_VALUE ); + with FControls[vChannel] do + begin + for k := 0 to datasize -1 do + CDetails[k].dwValue := data^[k].dwvalue; + end; + Freemem(data); + if IsStereo(vChannel) then + begin + Result.Left := round((FControls[vChannel].CDetails[0].dwValue*255)/FControls[vChannel].Cmax); + Result.Right := round((FControls[vChannel].CDetails[1].dwValue*255)/FControls[vChannel].Cmax); + end + else + Result.Main := round((FControls[vChannel].CDetails[0].dwValue*255)/FControls[vChannel].Cmax); + end; + + procedure TACSMixer.SetVolume(vChannel : Integer; vLevel : TACSMixerLevel); + var + aControlDetails : TMixerControlDetails; + begin + if vChannel >= length(FControls) then + exit; + if IsStereo(vChannel) then + begin + FControls[vChannel].CDetails[0].dwValue := round((vLevel.Left*FControls[vChannel].CMax)/255); + FControls[vChannel].CDetails[1].dwValue := round((vLevel.Right*FControls[vChannel].CMax)/255); + end + else + FControls[vChannel].CDetails[0].dwValue := round((vLevel.Main*FControls[vChannel].CMax)/255); + with aControlDetails do + begin + cbStruct := SizeOf(TMixerControlDetails); + dwControlID := FControls[vChannel].CID; + cChannels := FControls[vChannel].CKanal; + cMultipleItems := 0; + cbDetails := sizeof(MIXERCONTROLDETAILS_Signed); + padetails := @FControls[vChannel].CDetails; + end; + mixerSetControlDetails(FMixer, @aControlDetails,MIXER_SETCONTROLDETAILSF_Value); + end; + + function TACSMixer.IsStereo(vChannel : Integer) : Boolean; + begin + if vChannel >= length(FControls) then + exit; + Result := not (FControls[vChannel].CKanal = 1); + end; + + function TACSMixer.GetMute(vChannel : integer) : Boolean; + type + TData = array [0..3] of MIXERCONTROLDETAILS_UNSIGNED; + PData = ^TData; + var + data : PData; + aControldetails : TMixerControlDetails; + datasize,k : Integer; + begin + if vChannel >= length(FMuteControls) then + exit; + if FMuteControls[vChannel].IsInited = False then + exit; + if (FMuteControls[vChannel].CControl and MIXERCONTROL_CONTROLF_UNIFORM) > 0 then + aControlDetails.cChannels := 1 + else + aControlDetails.cChannels := FMuteControls[vChannel].CKanal; + if (FMuteControls[vChannel].CControl AND MIXERCONTROL_CONTROLF_MULTIPLE) > 0 then + begin + aControlDetails.cMultipleItems := FMuteControls[vChannel].CMultItems; + Getmem(data, FMuteControls[vChannel].CMultItems * SizeOf(MIXERCONTROLDETAILS_UNSIGNED)); + datasize := FMuteControls[vChannel].CMultItems; + end + else + begin + aControlDetails.cMultipleItems := 0; + Getmem(data, aControlDetails.cChannels * SizeOf(MIXERCONTROLDETAILS_UNSIGNED)); + datasize := aControlDetails.cChannels; + end; + with aControlDetails do + begin + cbStruct := SizeOf(TMixerControlDetails); + dwControlID := FMuteControls[vChannel].CID; + cChannels := FMuteControls[vChannel].CKanal; + cMultipleItems := FMuteControls[vChannel].CMultItems; + cbDetails := sizeof(MIXERCONTROLDETAILS_Signed); + padetails := data; + end; + mixerGetControlDetails(FMixer, @aControlDetails,MIXER_GETCONTROLDETAILSF_VALUE ); + with FMuteControls[vChannel] do + begin + for k := 0 to datasize -1 do + CDetails[k].dwValue := data^[k].dwvalue; + end; + Freemem(data); + Result := (FMuteControls[vChannel].CDetails[0].dwValue = 1); + end; + + procedure TACSMixer.SetMute(vChannel : integer; Mute : Boolean); + var + aControlDetails : TMixerControlDetails; + begin + if vChannel >= length(FMuteControls) then + exit; + if FMuteControls[vChannel].IsInited = False then + exit; + if Mute then + FMuteControls[vChannel].CDetails[0].dwValue := 1 + else + FMuteControls[vChannel].CDetails[0].dwValue := 0; + with aControlDetails do + begin + cbStruct := SizeOf(TMixerControlDetails); + dwControlID := FMuteControls[vChannel].CID; + cChannels := FMuteControls[vChannel].CKanal; + cMultipleItems := 0; + cbDetails := sizeof(MIXERCONTROLDETAILS_Signed); + padetails := @FMuteControls[vChannel].CDetails; + end; + mixerSetControlDetails(FMixer, @aControlDetails,MIXER_SETCONTROLDETAILSF_Value); + end; + + function TACSMixer.IsRecordable(vChannel : Integer) : Boolean; + begin + end; + + procedure TACSMixer.SetRecSource(vChannel : Integer); + begin + end; + + function TACSMixer.GetRecSource : Integer; + begin + end; + + destructor TACSMixer.Destroy; + begin + Setlength(FControls,0); + Setlength(FMuteControls,0); + Setlength(FChannels,0); + inherited Destroy; + end; + + function CountMixers : Byte; + begin + Result := mixerGetNumDevs; + end; + diff --git a/components/acs/Src/classes/windows/akrip32.pas b/components/acs/Src/classes/windows/akrip32.pas new file mode 100644 index 000000000..24492734c --- /dev/null +++ b/components/acs/Src/classes/windows/akrip32.pas @@ -0,0 +1,332 @@ +unit akrip32; +{* + * akrip32.h - copyright (c) 1999 jay a. key + * + * api for akrip32.dll (v0.93) + * + * modified for acs (dynamic loading ...) y christian ulrich (mail@z0m3ie.de) + * translated for borland delphi by holger dors (holger@dors.de) + * + * history of delphi version: + * + * 09. january 2000: first released version + * 05. February 2000: Updated for new function "CDDBGetServerList" + * in V.093 of akrip32.dll + * + ********************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + *} + +interface + +uses windows; + +const + + TRACK_AUDIO = $00; + TRACK_DATA = $01; + + MAXIDLEN = 64; + MAXCDLIST = 8; + + {* + * TRACKBUF + * + * This structure should not be allocated directly. If a buffer containing + * 27 * 2353 bytes is desired, a buffer should be allocated containing + * the desired amount + 24 bytes. The allocated memory can then be + * typecast to a LPTRACKBUF. It is the program's responsibility to guard + * against reading/writing past the end of allocated memory. + * + * The following must always apply: + * (len + startOffset) <= (numFrames * 2352) <= maxLen + *} + +type + PTRACKBUF = ^TRACKBUF; + TRACKBUF = record + startFrame: DWord; {* 00: starting frame number *} + numFrames: DWord; {* 04: number of frames read *} + maxLen: DWord; {* 08: length of buffer itself *} + len: DWord; {* 0C: length of data actually in buf *} + status: DWord; {* 10: status of last read operation *} + startOffset: Integer; {* 14: offset of valid data in buf *} + buf: array[0..1024 * 1024 - 1] of Byte; {* 18: the data itself *} + end; + + TRACKBUFDUMMY = record + startFrame: DWord; {* 00: starting frame number *} + numFrames: DWord; {* 04: number of frames read *} + maxLen: DWord; {* 08: length of buffer itself *} + len: DWord; {* 0C: length of data actually in buf *} + status: DWord; {* 10: status of last read operation *} + startOffset: Integer; {* 14: offset of valid data in buf *} + end; + +const + TRACKBUFEXTRA = SizeOf(TRACKBUFDUMMY); + +type + PCDINFO = ^CDINFO; + CDINFO = record + vendor: array[0..8] of Char; + prodId: array[0..16] of Char; + rev: array[0..4] of Char; + vendSpec: array[0..20] of Char; + end; + + PCDREC = ^CDREC; + CDREC = record + ha: Byte; + tgt: Byte; + lun: Byte; + pad: Byte; + id: array[0..MAXIDLEN] of Char; + info: CDINFO; + end; + + PCDLIST = ^CDLIST; + CDLIST = record + max: Byte; + num: Byte; + cd: array[0..MAXCDLIST - 1] of CDREC; + end; + + {* + * TOCTRACK and TOC must be byte-aligned. If you're not using Mingw32, + * CygWin, or some other compiler that understands the PACKED keyword, + * you need to ensure that these structures are byte aligned. Usually, + * this is done using a + * #pragma pack(1) + * See your compiler's documentation for details + *} + + TOCTRACK = packed record + rsvd: Byte; + ADR: Byte; + trackNumber: Byte; + rsvd2: Byte; + addr: array[0..3] of Byte; + end; + + PTOC = ^TOC; + TOC = packed record + tocLen: Word; + firstTrack: Byte; + lastTrack: Byte; + tracks: array[0..99] of TOCTRACK; + end; + + PTRACK = ^TRACK; + TRACK = packed record + trackNo: Integer; + startLBA: DWord; + trackLen: DWord; + _type: Byte; + pad: array[0..3] of Byte; + name: ShortString;//array[0..255] of Char; + end; + + PREADMSF = ^READMSF; + READMSF = record + sm: Byte; + ss: Byte; + sf: Byte; + em: Byte; + es: Byte; + ef: Byte; + end; + +const + {* + * Error codes set by functions in ASPILIB.C + *} + + ALERR_NOERROR = 0; + ALERR_NOWNASPI = 1; + ALERR_NOGETASPI32SUPP = 2; + ALERR_NOSENDASPICMD = 3; + ALERR_ASPI = 4; + ALERR_NOCDSELECTED = 5; + ALERR_BUFTOOSMALL = 6; + ALERR_INVHANDLE = 7; + ALERR_NOMOREHAND = 8; + ALERR_BUFPTR = 9; + ALERR_NOTACD = 10; + ALERR_LOCK = 11; + ALERR_DUPHAND = 12; + ALERR_INVPTR = 13; + ALERR_INVPARM = 14; + ALERR_JITTER = 15; + + {* + * constants used for queryCDParms() + *} + + CDP_READCDR = $0001; // can read CD-R + CDP_READCDE = $0002; // can read CD-E + CDP_METHOD2 = $0003; // can read CD-R wriiten via method 2 + CDP_WRITECDR = $0004; // can write CD-R + CDP_WRITECDE = $0005; // can write CD-E + CDP_AUDIOPLAY = $0006; // can play audio + CDP_COMPOSITE = $0007; // composite audio/video stream + CDP_DIGITAL1 = $0008; // digital output (IEC958) on port 1 + CDP_DIGITAL2 = $0009; // digital output (IEC958) on port 2 + CDP_M2FORM1 = $000A; // reads Mode 2 Form 1 (XA) format + CDP_M2FORM2 = $000B; // reads Mode 2 Form 2 format + CDP_MULTISES = $000C; // reads multi-session or Photo-CD + CDP_CDDA = $000D; // supports cd-da + CDP_STREAMACC = $000E; // supports "stream is accurate" + CDP_RW = $000F; // can return R-W info + CDP_RWCORR = $0010; // returns R-W de-interleaved and err. + // corrected + CDP_C2SUPP = $0011; // C2 error pointers + CDP_ISRC = $0012; // can return the ISRC info + CDP_UPC = $0013; // can return the Media Catalog Number + CDP_CANLOCK = $0014; // prevent/allow cmd. can lock the media + CDP_LOCKED = $0015; // current lock state (TRUE = LOCKED) + CDP_PREVJUMP = $0016; // prevent/allow jumper state + CDP_CANEJECT = $0017; // drive can eject disk + CDP_MECHTYPE = $0018; // type of disk loading supported + CDP_SEPVOL = $0019; // independent audio level for channels + CDP_SEPMUTE = $001A; // independent mute for channels + CDP_SDP = $001B; // supports disk present (SDP) + CDP_SSS = $001C; // Software Slot Selection + CDP_MAXSPEED = $001D; // maximum supported speed of drive + CDP_NUMVOL = $001E; // number of volume levels + CDP_BUFSIZE = $001F; // size of output buffer + CDP_CURRSPEED = $0020; // current speed of drive + CDP_SPM = $0021; // "S" units per "M" (MSF format) + CDP_FPS = $0022; // "F" units per "S" (MSF format) + CDP_INACTMULT = $0023; // inactivity multiplier ( x 125 ms) + CDP_MSF = $0024; // use MSF format for READ TOC cmd + CDP_OVERLAP = $0025; // number of overlap frames for jitter + CDP_JITTER = $0026; // number of frames to check for jitter + CDP_READMODE = $0027; // mode to attempt jitter corr. + + {* + * defines for GETCDHAND readType + * + *} + CDR_ANY = $00; // unknown + CDR_ATAPI1 = $01; // ATAPI per spec + CDR_ATAPI2 = $02; // alternate ATAPI + CDR_READ6 = $03; // using SCSI READ(6) + CDR_READ10 = $04; // using SCSI READ(10) + CDR_READ_D8 = $05; // using command 0xD8 (Plextor?) + CDR_READ_D4 = $06; // using command 0xD4 (NEC?) + CDR_READ_D4_1 = $07; // 0xD4 with a mode select + CDR_READ10_2 = $08; // different mode select w/ READ(10) + + {* + * defines for the read mode (CDP_READMODE) + *} + CDRM_NOJITTER = $00; // never jitter correct + CDRM_JITTER = $01; // always jitter correct + CDRM_JITTERONERR = $02; // jitter correct only after a read error + +type + HCDROM = THandle; + + PGETCDHAND = ^GETCDHAND; + GETCDHAND = packed record + size: Byte; {* set to sizeof(GETCDHAND) *} + ver: Byte; {* set to AKRIPVER *} + ha: Byte; {* host adapter *} + tgt: Byte; {* target id *} + lun: Byte; {* LUN *} + readType: Byte; {* read function to use *} + jitterCorr: Bool; {* use built-in jitter correction? *} + numJitter: Byte; {* number of frames to try to match *} + numOverlap: Byte; {* number of frames to overlap *} + end; + +const + akriplib = 'akrip32.dll'; + +var + LibHandle : Integer; + CDRipLoaded : Boolean; + +type + GetNumAdapters_t = function : Integer; cdecl; + GetCDList_t = function (var cd: CDLIST): Integer; cdecl; + GetAspiLibError_t = function : Integer; cdecl; + GetAspiLibAspiError_t = function : Byte; cdecl; + + GetCDId_t = function (hCD: HCDROM; buf: PChar; maxBuf: Integer): DWord; cdecl; + GetDriveInfo_t = function (ha, tgt, lun: byte; var cdrec: CDREC): DWord; cdecl; + ReadTOC_t = function (hCD: HCDROM; var MyToc: TOC): DWord; cdecl; + ReadCDAudioLBA_t = function (hCD: HCDROM; TrackBuf: PTRACKBUF): DWord; cdecl; + QueryCDParms_t = function (hCD: HCDROM; which: Integer; var Num: DWord): Bool; cdecl; + ModifyCDParms_t = function (hCD: HCDROM; which: Integer; val: DWord): Bool; cdecl; + GetCDHandle_t = function (var cd: GETCDHAND): HCDROM; cdecl; + CloseCDHandle_t = function (hCD: HCDROM): Bool; cdecl; + ReadCDAudioLBAEx_t = function (hCD: HCDROM; TrackBuf, Overlap: PTRACKBUF): DWord; cdecl; + +var + GetNumAdapters : GetNumAdapters_t; + GetCDList : GetCDList_t; + GetAspiLibError : GetAspiLibError_t; + GetAspiLibAspiError : GetAspiLibAspiError_t; + + GetCDId : GetCDId_t; + GetDriveInfo : GetDriveInfo_t; + ReadTOC : ReadTOC_t; + ReadCDAudioLBA : ReadCDAudioLBA_t; + QueryCDParms : QueryCDParms_t; + ModifyCDParms : ModifyCDParms_t; + GetCDHandle : GetCDHandle_t; + CloseCDHandle : CloseCDHandle_t; + ReadCDAudioLBAEx : ReadCDAudioLBAEx_t; + + procedure CDRIPInit(FilePath:String); + +implementation + + procedure CDRIPInit(FilePath:String); + begin + Libhandle := LoadLibraryEx(akriplib, 0, 0); + if Libhandle <> 0 then + begin + CDRipLoaded := True; + GetNumAdapters := GetProcAddress(Libhandle, 'GetNumAdapters'); + GetCDList := GetProcAddress(Libhandle, 'GetCDList'); + GetAspiLibError := GetProcAddress(Libhandle, 'GetAspiLibError'); + GetAspiLibAspiError := GetProcAddress(Libhandle, 'GetAspiLibAspiError'); + GetCDId := GetProcAddress(Libhandle, 'GetCDId'); + GetDriveInfo := GetProcAddress(Libhandle, 'GetCDDriveInfo'); + ReadTOC := GetProcAddress(Libhandle, 'ReadTOC'); + ReadCDAudioLBA := GetProcAddress(Libhandle, 'ReadCDAudioLBA'); + QueryCDParms := GetProcAddress(Libhandle, 'QueryCDParams'); + ModifyCDParms := GetProcAddress(Libhandle, 'ModifyCDParms'); + GetCDHandle := GetProcAddress(Libhandle, 'GetCDHandle'); + CloseCDHandle := GetProcAddress(Libhandle, 'CloseCDHandle'); + ReadCDAudioLBAEx := GetProcAddress(Libhandle, 'ReadCDAudioLBAEx'); + end; + end; + +initialization + +finalization + if Libhandle <> 0 then + begin + FreeLibrary(Libhandle); + end; + +end. + diff --git a/components/acs/Src/drivers/acs_alsaaudio.pas b/components/acs/Src/drivers/acs_alsaaudio.pas new file mode 100644 index 000000000..7126fd450 --- /dev/null +++ b/components/acs/Src/drivers/acs_alsaaudio.pas @@ -0,0 +1,481 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: acs_alsaaudio.pas,v $ +Revision 1.6 2006/08/30 18:59:51 z0m3ie +*** empty log message *** + +Revision 1.5 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.2 2006/01/01 18:46:40 z0m3ie +*** empty log message *** + +Revision 1.1 2005/12/19 18:36:05 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/13 21:53:45 z0m3ie +maked seperat driver (not complete jet) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.3 2005/08/28 20:31:17 z0m3ie +linux restructuring for 2.4 + +Revision 1.2 2005/08/26 17:03:20 z0m3ie +begon to make acs resourcestring aware +more advanced tmixer for windows +restructured tmixer its better handleable now + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + +{$ifdef mswindows}{$message error 'unit not supported'}{$endif} + +unit acs_alsaaudio; + +interface + +uses + Classes, SysUtils, ACS_Types, ACS_Classes, libc, alsa, ACS_Strings,ACS_Audio; + +const + BUF_SIZE = $4000; + ALSAStateIdle = $ffffffff; // additional DriverState value; + LATENCY = 60; + + +type + + EALSABufferUnderrun = class(EACSException); + EALSABufferOverrun = class(EACSException); + + { TALSAAudioIn } + + TALSAAudioIn = class(TACSBaseAudioIn) + private + FDevice : String; + FPeriodSize, FPeriodNum : Integer; + _audio_handle : Psnd_pcm_t; + _hw_params : Psnd_pcm_hw_params_t; + Busy : Boolean; + FBPS, FChan, FFreq : Integer; + BufStart, BufEnd : Integer; + FOpened : Integer; + FRecTime : Integer; + FRecBytes : Integer; + FLatency : Double; + FSilentOnOverrun : Boolean; + function GetDriverState: Integer; + procedure OpenAudio; + procedure CloseAudio; +// function GetDriverState : Integer; + protected + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + + procedure SetDevice(Ch : Integer);override; + function GetDeviceInfo : TACSDeviceInfo;override; + function GetTotalTime : real; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + property DriverState : Integer read GetDriverState; + published + property PeriodSize : Integer read FPeriodSize write FPeriodSize; + property PeriodNum : Integer read FPeriodNum write FPeriodNum; + property SilentOnOverrun : Boolean read FSilentOnOverrun write FSilentOnOverrun; + end; + + + + { TALSAAudioOut } + + TALSAAudioOut = class(TACSBaseAudioOut) + + private + FDevice : String; + FPeriodSize, FPeriodNum : Integer; + _audio_handle : Psnd_pcm_t; + _hw_params : Psnd_pcm_hw_params_t; + FBufferSize : Integer; + FVolume : Byte; + _audio_fd : Integer; + Buffer : array [0..BUF_SIZE-1] of Byte; + FLatency : Double; + FSilentOnUnderrun : Boolean; + function GetDriverState : Integer; + protected + procedure Done; override; + function DoOutput(Abort : Boolean):Boolean; override; + procedure Prepare; override; + procedure SetDevice(Ch : Integer);override; + function GetDeviceInfo : TACSDeviceInfo;override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + property DriverState : Integer read GetDriverState; + property Latency : Double read FLatency; + published + property BufferSize : Integer read FBufferSize write FBufferSize; + property Device : String read FDevice write FDevice stored True; + property PeriodSize : Integer read FPeriodSize write FPeriodSize; + property PeriodNum : Integer read FPeriodNum write FPeriodNum; + property SilentOnUnderrun : Boolean read FSilentOnUnderrun write FSilentOnUnderrun; + property Volume : Byte read FVolume write FVolume stored True; + end; + +implementation + + constructor TALSAAudioIn.Create; + begin + inherited Create(AOwner); + if not (csDesigning in ComponentState) then + if not AsoundlibLoaded then + raise EACSException.Create(Format(strcoudntloadLib,[asoundlib_path])); + FBPS := 8; + FChan := 1; + FFreq := 8000; + FSize := -1; + FRecTime := 600; + FDevice := 'default'; + BufferSize := 32768; + FSilentOnOverrun := True; + end; + + destructor TALSAAudioIn.Destroy; + begin + inherited Destroy; + CloseAudio; + end; + + procedure TALSAAudioIn.OpenAudio; + var + Res : Integer; + begin + if FOpened = 0 then + begin + Res := snd_pcm_open(_audio_handle, @FDevice[1], SND_PCM_STREAM_CAPTURE, 0); + if Res < 0 then + raise EACSException.Create(Format(strcoudntopendevice,[FDevice])); + // snd_pcm_reset(_audio_handle); + end; + Inc(FOpened); + end; + + procedure TALSAAudioIn.CloseAudio; + begin + if FOpened = 1 then + begin + snd_pcm_drop(_audio_handle); + snd_pcm_close(_audio_handle); + end; + if FOpened > 0 then Dec(FOpened); + end; + +(* Note on the following three methods. + These methods simply return the values passed by the user. + As the actual input process begins, ALSAAudioIn may return a bit different + value of the samplerate that is actually set by the ALSA drivers.*) + +function TALSAAudioIn.GetBPS : Integer; +begin + Result := FBPS; +end; + +function TALSAAudioIn.GetCh : Integer; +begin + Result := FChan; +end; + +function TALSAAudioIn.GetSR : Integer; +begin + Result := FFreq; +end; + +procedure TALSAAudioIn.SetDevice(Ch: Integer); +begin + FDevice := IntToStr(ch); +end; + +function TALSAAudioIn.GetDeviceInfo: TACSDeviceInfo; +begin +end; + +procedure TALSAAudioIn.Init; +var + aBufSize : Integer; +begin + if Busy then raise EACSException.Create(strBusy); + BufEnd := 0; + BufStart := 1; + FPosition := 0; + OpenAudio; + + snd_pcm_hw_params_malloc(_hw_params); + snd_pcm_hw_params_any(_audio_handle, _hw_params); + snd_pcm_hw_params_set_access(_audio_handle, _hw_params, SND_PCM_ACCESS_RW_INTERLEAVED); + if FBPS = 8 then snd_pcm_hw_params_set_format(_audio_handle, _hw_params, SND_PCM_FORMAT_U8) + else snd_pcm_hw_params_set_format(_audio_handle, _hw_params, SND_PCM_FORMAT_S16_LE); + Self.FFreq := snd_pcm_hw_params_set_rate_near(_audio_handle, _hw_params, FFreq, 0); + snd_pcm_hw_params_set_channels(_audio_handle, _hw_params, FChan); + if (FPeriodSize <> 0) and (FPeriodNum <> 0) then + begin + snd_pcm_hw_params_set_period_size_near(_audio_handle, _hw_params, FPeriodSize, 0); + snd_pcm_hw_params_set_periods_near(_audio_handle, _hw_params, FPeriodNum, 0); + aBufSize := (FPeriodSize * FPeriodNum) div (FChan * (FBPS shr 3)); + end + else aBufSize := Self.BufferSize div (FChan * (FBPS shr 3)); + snd_pcm_hw_params_set_buffer_size_near(_audio_handle, _hw_params, aBufSize); + snd_pcm_hw_params(_audio_handle, _hw_params); + snd_pcm_hw_params_free(_hw_params); + if snd_pcm_prepare(_audio_handle) < 0 then + begin + CloseAudio; + raise EACSException.Create(strInputstartfailed); + end; + try + FLatency := snd_pcm_hw_params_get_period_size(_audio_handle, 0) * + snd_pcm_hw_params_get_periods(_audio_handle, 0)/(FFreq * FChan * (FBPS shr 3)); + except + end; + FRecBytes := FRecTime * (GetBPS div 8) * GetCh * GetSR; + Busy := True; + FSize := FRecBytes; +end; + +procedure TALSAAudioIn.Flush; +begin + snd_pcm_drain(_audio_handle); + CloseAudio; + Busy := False; +end; + +function TALSAAudioIn.GetData(Buffer : Pointer; BufferSize : Integer): Integer; +var + l : Integer; +begin + if not Busy then raise EACSException.Create(strStreamnotopen); + if FPosition >= FRecBytes then + begin + Result := 0; + Exit; + end; + if BufStart > BufEnd then + begin + BufStart := 1; + l := snd_pcm_readi(_audio_handle, @FBuffer[1], (BUF_SIZE div FChan) div (FBPS shr 3)); + while l < 0 do + begin + snd_pcm_prepare(_audio_handle); + if not FSilentOnOverrun then + raise EALSABufferOverrun.Create(strBufferoverrun); + l := snd_pcm_readi(_audio_handle, @FBuffer[1], (BUF_SIZE div FChan) div (FBPS shr 3)); + end; + if l <> (BUF_SIZE div FChan) div (FBPS shr 3) then + begin + Result := 0; + Exit; + end + else BufEnd := l*FChan*(FBPS shr 3); + end; + if BufferSize < (BufEnd - BufStart + 1) + then Result := BufferSize + else Result := BufEnd - BufStart + 1; + Move(FBuffer[BufStart-1], Buffer^, Result); + Inc(BufStart, Result); + Inc(FPosition, Result); +end; + + +function TALSAAudioIn.GetTotalTime : real; +begin + Result := FRecTime; +end; + +function TALSAAudioIn.GetDriverState : Integer; + +begin + + if FOpened = 0 then Result := ALSAStateIdle + + else Result := snd_pcm_state(_audio_handle); + +end; + + +constructor TALSAAudioOut.Create; + +begin + inherited Create(AOwner); + if not (csDesigning in ComponentState) then + if not AsoundlibLoaded then + raise EACSException.Create(Format(strCoudntloadLib,[asoundlib_path])); + FVolume := 255; + FDevice := 'default'; + FBufferSize := 32768; + FSilentOnUnderrun := True; +end; + + +destructor TALSAAudioOut.Destroy; + +begin + if _audio_handle <> nil then snd_pcm_close(_audio_handle); + inherited Destroy; +end; + + +procedure TALSAAudioOut.Prepare; + +var + Res, aBufSize : Integer; +begin + FInput.Init; + Res := snd_pcm_open(_audio_handle, @FDevice[1], SND_PCM_STREAM_PLAYBACK, 0); + if Res < 0 then + raise EACSException.Create(Format(strCoudntopendeviceOut,[FDevice])); + //snd_pcm_reset(_audio_handle); + snd_pcm_hw_params_malloc(_hw_params); + snd_pcm_hw_params_any(_audio_handle, _hw_params); + snd_pcm_hw_params_set_access(_audio_handle, _hw_params, SND_PCM_ACCESS_RW_INTERLEAVED); + if FInput.BitsPerSample = 8 then + snd_pcm_hw_params_set_format(_audio_handle, _hw_params, SND_PCM_FORMAT_U8) + else + snd_pcm_hw_params_set_format(_audio_handle, _hw_params, SND_PCM_FORMAT_S16_LE); + snd_pcm_hw_params_set_rate_near(_audio_handle, _hw_params, FInput.SampleRate, 0); + snd_pcm_hw_params_set_channels(_audio_handle, _hw_params, FInput.Channels); + if (FPeriodSize <> 0) and (FPeriodNum <> 0) then + begin + snd_pcm_hw_params_set_period_size_near(_audio_handle, _hw_params, FPeriodSize, 0); + snd_pcm_hw_params_set_periods_near(_audio_handle, _hw_params, FPeriodNum, 0); + aBufSize := (FPeriodSize * FPeriodNum) div (Finput.Channels * (Finput.BitsPerSample shr 3)); + end + else aBufSize := Self.FBufferSize div (Finput.Channels * (Finput.BitsPerSample shr 3)); + snd_pcm_hw_params_set_buffer_size_near(_audio_handle, _hw_params, aBufSize); + snd_pcm_hw_params(_audio_handle, _hw_params); + snd_pcm_hw_params_free(_hw_params); + if snd_pcm_prepare(_audio_handle) < 0 then + begin + raise EACSException.Create(strFailedtostartoutput); + end; + try + FLatency := snd_pcm_hw_params_get_period_size(_audio_handle, 0) * + snd_pcm_hw_params_get_periods(_audio_handle, 0)/(Finput.Channels * (Finput.BitsPerSample shr 3)); + except + end; +end; + +procedure TALSAAudioOut.SetDevice(Ch: Integer); +begin +// FDevice := IntToStr(ch); +end; + +function TALSAAudioOut.GetDeviceInfo: TACSDeviceInfo; +begin +end; + +procedure TALSAAudioOut.Done; +begin + snd_pcm_drain(_audio_handle); + snd_pcm_close(_audio_handle); + _audio_handle := 0; + FInput.Flush; +end; + +function TALSAAudioOut.DoOutput(Abort : Boolean):Boolean; +var + Len, i, VCoef, l : Integer; + P : Pointer; + P1 : PACSBuffer8; + P2 : PACSBuffer16; +begin + // No exceptions Here + Result := True; + if not CanOutput then Exit; + Len := 0; + if Abort then + begin + snd_pcm_drain(_audio_handle); + snd_pcm_close(_audio_handle); + _audio_handle := 0; + Result := False; + Exit; + end; + try + P := @Buffer[0]; + while InputLock do; + InputLock := True; + Len := Finput.GetData(P, BUF_SIZE); + InputLock := False; + if Len = 0 then + begin + Result := False; + Exit; + end; + if FVolume < 255 then + begin + VCoef := Round(FVolume/255); + if FInput.BitsPerSample = 16 then + begin + P2 := @Buffer[0]; + for i := 0 to (Len shr 1) -1 do + P2[i] := P2[i]*VCoef; + end else + begin + P1 := @Buffer[0]; + for i := 0 to Len - 1 do + P1[i] := P1[i]*VCoef; + end; + end; + l := snd_pcm_writei(_audio_handle, P, (Len div Finput.Channels) div (FInput.BitsPerSample shr 3)); + while l < 0 do + begin + snd_pcm_prepare(_audio_handle); + if not FSilentOnUnderrun then + raise EALSABufferUnderrun.Create(strBufferunderrun); + l := snd_pcm_writei(_audio_handle, P, (Len div Finput.Channels) div (FInput.BitsPerSample shr 3)); + end; + if l = (Len div Finput.Channels) div (FInput.BitsPerSample shr 3) + then Result := True + else Result := False; + except + end; +end; + +function TALSAAudioOut.GetDriverState : Integer; +begin + + if not Busy then Result := ALSAStateIdle + + else Result := snd_pcm_state(_audio_handle); + +end; + +initialization + if AsoundlibLoaded then + begin + RegisterAudioOut('Alsa',TAlsaAudioOut,LATENCY); + RegisterAudioIn('Alsa',TAlsaAudioIn,LATENCY); + end; + +end. diff --git a/components/acs/Src/drivers/acs_aolive.pas b/components/acs/Src/drivers/acs_aolive.pas new file mode 100644 index 000000000..7c8a868b5 --- /dev/null +++ b/components/acs/Src/drivers/acs_aolive.pas @@ -0,0 +1,216 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{$Log: acs_aolive.pas,v $ +{Revision 1.2 2006/01/01 18:46:40 z0m3ie +{*** empty log message *** +{ +{Revision 1.1 2005/12/19 18:36:05 z0m3ie +{*** empty log message *** +{ +{Revision 1.2 2005/09/14 21:19:37 z0m3ie +{*** empty log message *** +{ +{Revision 1.1 2005/09/13 21:53:45 z0m3ie +{maked seperat driver (not complete jet) +{} + +unit acs_aolive; + +interface + +uses + Classes,ACS_Classes,ACS_Audio,libao,SysUtils,ACS_Strings,ACS_Types; + +const + LATENCY = 45;//how to measure ? + +type + + { TAOLiveAudioOut } + + TAOLiveAudioOut = class(TACSBaseAudioOut) + private + _device : PAODevice; + FVolume : Byte; + FDrivers : TStringList; + FCurrentDriver, + FDefaultDriver : String; + function IsDevicePlayable(const Dev : String) : Boolean; + protected + procedure Done; override; + function DoOutput(Abort : Boolean):Boolean; override; + procedure Prepare; override; + procedure SetDevice(Ch : Integer);override; + function GetDeviceInfo : TACSDeviceInfo;override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + end; + +implementation + + constructor TAOLiveAudioOut.Create; + var + DrList : PPAOInfo; + DrCount, i : Integer; + Info : PAOInfo; + begin + if not LibaoLoaded then + raise EACSException.Create(Format(strCoudntloadlib,[LibaoPath])); + inherited Create(AOwner); + if AOInitialized = 0 then + ao_initialize; + Inc(AOInitialized); + FDrivers := TStringList.Create; + DrList := ao_driver_info_list(DrCount); + for i := 0 to DrCount-1 do + begin + if DrList^._type = AO_TYPE_LIVE then + begin + FDrivers.Add(String(DrList^.short_name)); + end; + Inc(DrList); + end; + Info := ao_driver_info(ao_default_driver_id); + FDefaultDriver := Info.short_name; + FVolume := 255; + end; + + destructor TAOLiveAudioOut.Destroy; + begin + FDrivers.Free; + if AOInitialized = 1 then + ao_shutdown; + Dec(AOInitialized); + inherited Destroy; + end; + + procedure TAOLiveAudioOut.Prepare; + var + did : Integer; + sf : ao_sample_format; + opt : PAOOption; + Info : PAOInfo; + begin + FInput.Init; + if FCurrentDriver = '' then + begin + did := ao_default_driver_id; + Info := ao_driver_info(did); + FCurrentDriver := Info.short_name; + end + else did := ao_driver_id(@FCurrentDriver[1]); + opt := nil; + sf.bits := Finput.BitsPerSample; + sf.rate := Finput.SampleRate; + sf.channels := Finput.Channels; + sf.byte_format := AO_FMT_NATIVE; + _device := ao_open_live(did, @sf, opt); + FreeOptionsList(Opt); + if _device = nil then + raise EACSException.Create(Format(strDevnotplayable,['+FCurrentDriver+'])); + end; + +procedure TAOLiveAudioOut.SetDevice(Ch: Integer); +begin + if ch < FDrivers.Count-1 then + if IsDevicePlayable(FDrivers[ch]) then + FCurrentDriver := FDrivers[ch]; +end; + +function TAOLiveAudioOut.GetDeviceInfo: TACSDeviceInfo; +begin +end; + + procedure TAOLiveAudioOut.Done; + begin + Finput.Flush; + if _device <> nil then + ao_close(_device); + end; + +function TAOLiveAudioOut.DoOutput(Abort : Boolean):Boolean; +var + Len, i : Integer; + P : Pointer; + P1 : PACSBuffer8; + P2 : PACSBuffer16; +begin + // No exceptions Here + Result := True; + if not CanOutput then Exit; + Len := 0; + if Abort then + begin + ao_close(_device); + _device := nil; + Result := False; + Exit; + end; + try + P := @FBuffer[0]; + while InputLock do; + InputLock := True; + Len := Finput.GetData(P, FBufferSize); + InputLock := False; + if FVolume < 255 then + begin + if FInput.BitsPerSample = 16 then + begin + P2 := @FBuffer[0]; + for i := 0 to (Len shr 1) -1 do + P2[i] := Round(P2[i]*(FVolume/255)); + end else + begin + P1 := @FBuffer[0]; + for i := 0 to Len - 1 do + P1[i] := Round(P1[i]*(FVolume/255)); + end; + end; + ao_play(_device, P, Len); + except + end; + if Len > 0 then Result := True + else Result := False; +end; + + function TAOLiveAudioOut.IsDevicePlayable(const Dev : String) : Boolean; + var + i, did : Integer; + sf : ao_sample_format; + opt : PAOOption; + begin + Result := True; + if Dev = '' then Exit; + if Busy then + raise EACSException.Create(strBusy); + for i := 0 to FDrivers.Count-1 do + if FDrivers.Strings[i] = Dev then + begin + did := ao_driver_id(@Dev[1]); + sf.bits := 16; + sf.rate := 22050; + sf.channels := 2; + sf.byte_format := AO_FMT_NATIVE; + opt := nil; + _device := ao_open_live(did, @sf, opt); + if _device <> nil then + begin + ao_close(_device); + FreeOptionsList(Opt); + Exit; + end else Break; + end; + Result := False; + end; + +initialization + RegisterAudioOut('AOlive',TAOLiveAudioOut,LATENCY); + +end. + diff --git a/components/acs/Src/drivers/acs_dxaudio.pas b/components/acs/Src/drivers/acs_dxaudio.pas new file mode 100644 index 000000000..4a206e74a --- /dev/null +++ b/components/acs/Src/drivers/acs_dxaudio.pas @@ -0,0 +1,563 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: acs_dxaudio.pas,v $ +Revision 1.7 2006/08/31 20:10:56 z0m3ie +*** empty log message *** + +Revision 1.6 2006/07/09 16:40:35 z0m3ie +*** empty log message *** + +Revision 1.5 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.3 2006/01/01 18:46:40 z0m3ie +*** empty log message *** + +Revision 1.2 2005/12/26 17:31:39 z0m3ie +fixed some problems in acs_dsfiles +fixed some problems in acs_vorbis +reworked all buffers + +Revision 1.1 2005/12/19 18:36:05 z0m3ie +*** empty log message *** + +Revision 1.9 2005/12/18 17:01:54 z0m3ie +delphi compatibility + +Revision 1.8 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.7 2005/10/02 16:51:31 z0m3ie +*** empty log message *** + +Revision 1.6 2005/09/23 14:04:58 z0m3ie +*** empty log message *** + +Revision 1.5 2005/09/18 19:28:59 z0m3ie +more progress on driver handling + +Revision 1.4 2005/09/16 17:34:29 z0m3ie +*** empty log message *** + +Revision 1.3 2005/09/15 20:59:38 z0m3ie +start translate the documentation in the source for pasdoc + +Revision 1.2 2005/09/14 21:19:37 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/13 21:53:45 z0m3ie +maked seperat driver (not complete jet) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.3 2005/08/22 20:17:02 z0m3ie +changed Headers to log +changed mail adress + +} + +{$ifdef linux}{$message error 'unit not supported'}{$endif linux} + +unit acs_dxaudio; + +interface + +uses + ACS_Audio,SysUtils, Classes, Forms, ACS_Types, ACS_Classes, Windows,ACS_Strings; + +const + LATENCY = 25; + DS_POLLING_INTERVAL = 400; //milliseconds + +type + + TDSoundWrapper = record + dsw_pDirectSound : Pointer; + dsw_OutputBuffer : Pointer; + dsw_WriteOffset : LongWord; + dsw_OutputSize : Integer; + dsw_BytesPerFrame : Integer; + dsw_CounterTicksPerBuffer : Int64; + dsw_LastPlayTime : Int64; + dsw_LastPlayCursor : Int64; + dsw_OutputUnderflows : Int64; + dsw_OutputRunning : LongBool; + dsw_FramesWritten : Double; + dsw_FramesPlayed : Double; + dsw_pDirectSoundCapture : Pointer; + dsw_InputBuffer : Pointer; + dsw_ReadOffset : LongWord; + dsw_InputSize : LongWord; + end; + + PDSoundWrapper = ^TDSoundWrapper; + + TDSW_DeviceInfo = record + guid : TGUID; + name : array[0..127] of char; + end; + + TDSW_Devices = record + devcount : Integer; + dinfo : array [0..15] of TDSW_DeviceInfo; + end; + + PDSW_Devices = ^TDSW_Devices; + + { TDXAudioOut } + + TDXAudioOut = class(TACSBaseAudioOut) + private + DSW : TDSoundWrapper; + Devices : TDSW_Devices; + Chan, SR, BPS : Integer; + EndOfInput, StartInput : Boolean; + FDeviceNumber : Integer; + FDeviceCount : Integer; + procedure SetDevice(Ch : Integer);override; + function GetDeviceInfo : TACSDeviceInfo;override; + function GetDeviceCount : Integer;override; + protected + procedure Done; override; + function DoOutput(Abort : Boolean):Boolean; override; + procedure Prepare; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Pause;override; + procedure Resume;override; + end; + + TDXAudioIn = class(TACSBaseAudioIn) + private + DSW : TDSoundWrapper; + Devices : TDSW_Devices; + FDeviceNumber : Integer; + FDeviceCount : Integer; + FBPS, FChan, FFreq : Integer; + FOpened : Integer; + FBytesToRead : Integer; + FRecTime : Integer; + procedure SetDevice(i : Integer);override; + function GetDeviceName(Number : Integer) : String; + procedure OpenAudio; + procedure CloseAudio; + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + function GetTotalTime : real; override; + procedure SetRecTime(aRecTime : Integer); + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + property DeviceCount : Integer read FDeviceCount; + property DeviceName[Number : Integer] : String read GetDeviceName; + end; + +implementation + +type + + DSW_Init_t = function(dsw: PDSoundWrapper) : HRESULT; cdecl; + DSW_Term_t = procedure(dsw: PDSoundWrapper); cdecl; + DSW_InitOutputDevice_t = function (dsw: PDSoundWrapper; const guid : TGUID) : HRESULT; cdecl; + DSW_InitOutputBuffer_t = function (dsw: PDSoundWrapper; Wnd : HWND; bps, nFrameRate : LongWord; nChannels, bufSize : Integer): HRESULT; cdecl; + DSW_StartOutput_t = function (dsw: PDSoundWrapper) : HRESULT; cdecl; + DSW_StopOutput_t = function(dsw: PDSoundWrapper) : HRESULT; cdecl; + DSW_RestartOutput_t = function(dsw: PDSoundWrapper) : HRESULT; cdecl; + DSW_GetOutputStatus_t = function(dsw: PDSoundWrapper) : DWORD; cdecl; + DSW_WriteBlock_t = function(dsw: PDSoundWrapper; buf : PByte; numBytes : Integer) : HRESULT; cdecl; + DSW_ZeroEmptySpace_t = function(dsw: PDSoundWrapper) : HRESULT; cdecl; + DSW_QueryOutputSpace_t = function(dsw: PDSoundWrapper; var bytesEmpty ) : HRESULT; cdecl; + DSW_Enumerate_t = function(var devices : TDSW_Devices) : HRESULT; cdecl; + + DSW_InitInputBuffer_t = function(dsw: PDSoundWrapper; bps, nFrameRate, nChannels, bufSize : Integer) : HRESULT; cdecl; + DSW_InitInputDevice_t = function(dsw: PDSoundWrapper; const GUID : TGUID) : HRESULT; cdecl; + DSW_StartInput_t = function(dsw: PDSoundWrapper) : HRESULT; cdecl; + DSW_StopInput_t = function(dsw: PDSoundWrapper) : HRESULT; cdecl; + DSW_ReadBlock_t = function(dsw: PDSoundWrapper; buf : PByte; numBytes : Integer) : HRESULT; cdecl; + DSW_QueryInputFilled_t = function(dsw: PDSoundWrapper; var bytesFilled : Integer) : HRESULT; cdecl; + +var + + LibdswLoaded : Boolean = False; + + DSW_Init : DSW_Init_t; + DSW_Term : DSW_Term_t; + DSW_InitOutputDevice : DSW_InitOutputDevice_t; + DSW_InitOutputBuffer : DSW_InitOutputBuffer_t; + DSW_StartOutput : DSW_StartOutput_t; + DSW_StopOutput : DSW_StopOutput_t; + DSW_RestartOutput : DSW_RestartOutput_t; + DSW_GetOutputStatus : DSW_GetOutputStatus_t; + DSW_WriteBlock : DSW_WriteBlock_t; + DSW_ZeroEmptySpace : DSW_ZeroEmptySpace_t; + DSW_QueryOutputSpace : DSW_QueryOutputSpace_t; + DSW_Enumerate : DSW_Enumerate_t; + + DSW_InitInputBuffer : DSW_InitInputBuffer_t; + DSW_InitInputDevice : DSW_InitInputDevice_t; + DSW_StartInput : DSW_StartInput_t; + DSW_StopInput : DSW_StopInput_t; + DSW_ReadBlock : DSW_ReadBlock_t; + DSW_QueryInputFilled : DSW_QueryInputFilled_t; + + Libhandle : HMODULE; + + +procedure TDXAudioOut.Prepare; +var + Res : HResult; + Wnd : HWND; + Form : TForm; +begin + if (FDeviceNumber >= FDeviceCount) then raise EACSException.Create(Format(strChannelnotavailable,[FDeviceNumber])); + FInput.Init; + FBuffer := AllocMem(FBufferSize); + Chan := FInput.Channels; + SR := FInput.SampleRate; + BPS := FInput.BitsPerSample; + DSW_Init(@DSW); + Res := DSW_InitOutputDevice(@DSW, Devices.dinfo[FDeviceNumber].guid); + if Res <> 0 then raise EACSException.Create(strFailedtoCreateDSdev); +{ if Owner is TForm then + begin + Form := Owner as TForm; + Wnd := Form.Handle; + end else } + Wnd := 0; + Res := DSW_InitOutputBuffer(@DSW, Wnd, BPS, SR, Chan, FBufferSize); + if Res <> 0 then raise EACSException.Create(strFailedtoCreateDSbuf); + StartInput := True; + EndOfInput := False; +end; + +procedure TDXAudioOut.Done; +begin + Finput.Flush; + DSW_Term(@DSW); + FreeMem(FBuffer); +end; + +function TDXAudioOut.DoOutput(Abort : Boolean):Boolean; +var + Len, offs, lb : Integer; + Stat : LongWord; + Res : HRESULT; + PlayTime, CTime : LongWord; +begin + Result := True; + if not Busy then Exit; + if not CanOutput then + begin + Result := False; + Exit; + end; + if Abort then + begin + DSW_StopOutput(@DSW); + CanOutput := False; + Result := False; + Exit; + end; + if StartInput then + begin + Len := 0; + while Len < FBufferSize do + begin + offs := FInput.GetData(@FBuffer^[Len], FBufferSize-Len); + if offs = 0 then + begin + EndOfInput := True; + Break; + end; + Inc(Len, offs); + end; + DSW_WriteBlock(@DSW, @FBuffer^, Len); + DSW_StartOutput(@DSW); + StartInput := False; + end; + if EndOfInput then + begin + CanOutput := False; + PlayTime := Round(FBufferSize/(Chan*(BPS div 8)*SR))*1000; + CTime := 0; + while CTime < PlayTime do + begin + Sleep(100); + DSW_ZeroEmptySpace(@DSW); + Inc(CTime, 100); + end; + DSW_StopOutput(@DSW); + Result := False; + Exit; + end; + Sleep(DS_POLLING_INTERVAL); + DSW_QueryOutputSpace(@DSW, lb); + lb := lb - (lb mod 1024); + Len := 0; + while Len < lb do + begin + if FInput.Busy then + begin + try + offs := Finput.GetData(@FBuffer^[Len], lb-Len); + except + DSW_StopOutput(@DSW); + CanOutput := False; + Result := False; + Exit; + end; + end; + if offs = 0 then Break; + Inc(Len, offs); + end; + DSW_WriteBlock(@DSW, @Fbuffer^, Len); + if offs = 0 then + begin + DSW_ZeroEmptySpace(@DSW); + EndOfInput := True; + end; +end; + +constructor TDXAudioOut.Create; +begin + inherited Create(AOwner); + FBufferSize := $40000; + if not (csDesigning in ComponentState) then + begin + if not LibdswLoaded then + raise EACSException.Create(Format(strCoudntloadlib,['dswrapper.dll'])); + end; + if LibdswLoaded then DSW_Enumerate(Devices); + FDeviceCount := Devices.devcount; +end; + +destructor TDXAudioOut.Destroy; +begin + if LibdswLoaded then DSW_Term(@DSW); +end; + +procedure TDXAudioOut.Pause; +begin + if EndOfInput then Exit; + DSW_StopOutput(@DSW); +end; + +procedure TDXAudioOut.Resume; +begin + if EndOfInput then Exit; + DSW_RestartOutput(@DSW); +end; + +procedure TDXAudioOut.SetDevice(Ch: Integer); +begin + FBaseChannel := Ch; +end; + +function TDXAudioOut.GetDeviceInfo: TACSDeviceInfo; +begin + if (FBaseChannel >= FDeviceCount) then + exit; + Result.DeviceName := PChar(@(Devices.dinfo[FBaseChannel].Name[0])); +end; + +function TDXAudioOut.GetDeviceCount: Integer; +begin + Result := FDeviceCount; +end; + +constructor TDXAudioIn.Create; +begin + inherited Create(AOwner); + FBPS := 8; + FChan := 1; + FFreq := 8000; + FSize := -1; + BufferSize := $2000; + if not (csDesigning in ComponentState) then + begin + if not LibdswLoaded then + raise EACSException.Create(Format(strCoudntloadlib,['dswrapper.dll'])); + end; + if LibdswLoaded then DSW_Enumerate(Devices); + FDeviceCount := Devices.devcount; +end; + +destructor TDXAudioIn.Destroy; +begin + if LibdswLoaded then DSW_Term(@DSW); + inherited Destroy; +end; + +procedure TDXAudioIn.OpenAudio; +var + Res : HResult; + BufSize : Integer; +begin + BufSize := BufferSize; + if FOpened = 0 then + begin + DSW_Init(@DSW); + if not Assigned(DSW_InitInputDevice) then raise EACSException.Create(Format(strChannelNotAvailable,[FDeviceNumber])); + Res := DSW_InitInputDevice(@DSW, Devices.dinfo[FDeviceNumber].guid); + if Res <> 0 then raise EACSException.Create(strFailedtoCreateDSdev); + Res := DSW_InitInputBuffer(@DSW, FBPS, FFreq, FChan, BufSize); + if Res <> 0 then raise EACSException.Create(strFailedtoCreateDSbuf); + end; + Inc(FOpened); +end; + +procedure TDXAudioIn.CloseAudio; +begin + if FOpened = 1 then DSW_Term(@DSW); + if FOpened > 0 then Dec(FOpened); +end; + +function TDXAudioIn.GetBPS : Integer; +begin + Result := FBPS; +end; + +function TDXAudioIn.GetCh : Integer; +begin + Result := FChan; +end; + +function TDXAudioIn.GetSR : Integer; +begin + Result := FFreq; +end; + +procedure TDXAudioIn.Init; +begin + if Busy then raise EACSException.Create(strBusy); + if (FDeviceNumber >= FDeviceCount) then raise EACSException.Create(Format(strChannelnotavailable,[FDeviceNumber])); + if FRecTime > 0 then FBytesToRead := FRecTime*FFreq*FChan*(FBPS div 8); + BufEnd := 0; + BufStart := 1; + FPosition := 0; + FBusy := True; + FSize := FBytesToRead; + OpenAudio; + DSW_StartInput(@DSW); +end; + +procedure TDXAudioIn.Flush; +begin + DSW_StopInput(@DSW); + CloseAudio; + FBusy := False; +end; + +function TDXAudioIn.GetData(Buffer : Pointer; BufferSize : Integer): Integer; +var + l : Integer; +begin + if not Busy then raise EACSException.Create(strStreamnotopen); + if (FBytesToRead >=0) and (FPosition >= FBytesToRead) then + begin + Result := 0; + Exit; + end; + if BufStart >= BufEnd then + begin + BufStart := 0; + Sleep(DS_POLLING_INTERVAL); + DSW_QueryInputFilled(@DSW, l); + if l > BufferSize then + l := BufferSize; (* We have lost some data. + Generally this shouldn't happen. *) + l := l - (l mod 1024); + DSW_ReadBlock(@DSW, @FBuffer, l); + BufEnd := l; + end; + if BufferSize < (BufEnd - BufStart) + then Result := BufferSize + else Result := BufEnd - BufStart; + Move(FBuffer[BufStart], Buffer^, Result); + Inc(BufStart, Result); + Inc(FPosition, Result); +end; + +procedure TDXAudioIn.SetRecTime; +begin + FRecTime := aRecTime; + if FRecTime > 0 then + FBytesToRead := FRecTime*FFreq*FChan*(FBPS div 8) + else + FBytesToRead := -1; +end; + +procedure TDXAudioIn.SetDevice(i : Integer); +begin + FDeviceNumber := i +end; + +function TDXAudioIn.GetDeviceName(Number : Integer) : String; +begin + if (Number < FDeviceCount) then Result := PChar(@(Devices.dinfo[Number].Name[0])) + else Result := ''; +end; + +function TDXAudioIn.GetTotalTime : real; +var + BytesPerSec : Integer; +begin + BytesPerSec := FFreq*FChan*(FBPS div 8); + Result := FBytesToRead/BytesPerSec; +end; + +initialization + + Libhandle := LoadLibraryEx('dswrapper.dll', 0, 0); + + if Libhandle <> 0 then + begin + LibdswLoaded := True; + + DSW_Init := GetProcAddress(Libhandle, 'DSW_Init'); + DSW_Term := GetProcAddress(Libhandle, 'DSW_Term'); + DSW_InitOutputDevice := GetProcAddress(Libhandle, 'DSW_InitOutputDevice'); + DSW_InitOutputBuffer := GetProcAddress(Libhandle, 'DSW_InitOutputBuffer'); + DSW_StartOutput := GetProcAddress(Libhandle, 'DSW_StartOutput'); + DSW_StopOutput := GetProcAddress(Libhandle, 'DSW_StopOutput'); + DSW_RestartOutput := GetProcAddress(Libhandle, 'DSW_RestartOutput'); + DSW_GetOutputStatus := GetProcAddress(Libhandle, 'DSW_GetOutputStatus'); + DSW_WriteBlock := GetProcAddress(Libhandle, 'DSW_WriteBlock'); + DSW_ZeroEmptySpace := GetProcAddress(Libhandle, 'DSW_ZeroEmptySpace'); + DSW_QueryOutputSpace := GetProcAddress(Libhandle, 'DSW_QueryOutputSpace'); + DSW_Enumerate := GetProcAddress(Libhandle, 'DSW_Enumerate'); + DSW_InitInputDevice := GetProcAddress(Libhandle, 'DSW_InitInputDevice'); + DSW_InitInputBuffer := GetProcAddress(Libhandle, 'DSW_InitInputBuffer'); + DSW_StartInput := GetProcAddress(Libhandle, 'DSW_StartInput'); + DSW_StopInput := GetProcAddress(Libhandle, 'DSW_StopInput'); + DSW_ReadBlock := GetProcAddress(Libhandle, 'DSW_ReadBlock'); + DSW_QueryInputFilled := GetProcAddress(Libhandle, 'DSW_QueryInputFilled'); + + end; + + RegisterAudioOut('DirectSound',TDXAudioOut,LATENCY); + RegisterAudioIn('DirectSound',TDXAudioIn,LATENCY); + +finalization + + if Libhandle <> 0 then FreeLibrary(Libhandle); + +end. diff --git a/components/acs/Src/drivers/acs_stdaudio.pas b/components/acs/Src/drivers/acs_stdaudio.pas new file mode 100644 index 000000000..dc303862f --- /dev/null +++ b/components/acs/Src/drivers/acs_stdaudio.pas @@ -0,0 +1,228 @@ +(* + this file is a part of audio components suite v 2.3 (delphi version). + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at acs@compiler4.net + this is the acs for delphi (windows) version of the unit. +*) + +{ +$Log: acs_stdaudio.pas,v $ +Revision 1.6 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.4 2006/01/01 18:46:40 z0m3ie +*** empty log message *** + +Revision 1.3 2005/12/30 11:10:57 z0m3ie +some corrections to lazarus-linux depending things + +Revision 1.2 2005/12/26 17:31:39 z0m3ie +fixed some problems in acs_dsfiles +fixed some problems in acs_vorbis +reworked all buffers + +Revision 1.1 2005/12/19 18:36:05 z0m3ie +*** empty log message *** + +Revision 1.8 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.7 2005/11/27 16:50:33 z0m3ie +add ACS VolumeQuerry +make ACS_VolumeQuerry localizeable +some little errorfixes (buffersize for linuxdrivers was initially 0) +make TAudioIn workable + +Revision 1.6 2005/10/05 20:26:36 z0m3ie +Linux changes + +Revision 1.5 2005/10/02 16:51:31 z0m3ie +*** empty log message *** + +Revision 1.4 2005/09/23 14:04:58 z0m3ie +*** empty log message *** + +Revision 1.3 2005/09/18 19:28:59 z0m3ie +more progress on driver handling + +Revision 1.2 2005/09/14 21:19:37 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/13 21:53:45 z0m3ie +maked seperat driver (not complete jet) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.3 2005/09/02 16:27:49 z0m3ie +*** empty log message *** + +Revision 1.2 2005/08/28 20:31:17 z0m3ie +linux restructuring for 2.4 + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.4 2005/08/22 20:17:02 z0m3ie +changed Headers to log +changed mail adress + +} + +unit acs_stdaudio; + +interface + +uses + Classes, SysUtils, ACS_Types, ACS_Classes,ACS_Audio,ACS_Strings + {$IFDEF MSWINDOWS} + , Windows, MMSystem + {$ELSE} + , Soundcard + {$ENDIF} + ; + +const + LATENCY = 110; + +type + {$IFDEF MSWINDOWS} + {$IFDEF FPC} + TWaveInCapsA = WAVEINCAPSA; + TWaveInCaps = TWaveInCapsA; + + TWaveHdr = WAVEHDR; + {$ENDIF} + + PPWaveHdr = ^PWaveHdr; + {$ENDIF} + + { TStdAudioOut } + + TStdAudioOut = class(TACSBaseAudioOut) + private + {$IFDEF MSWINDOWS} + BlockChain : PWaveHdr; + aBlock : Integer; + EOC : PPWaveHdr; + FReadChunks : Integer; + {$ENDIF} + _audio_fd : Integer; + procedure SetDevice(Ch : Integer);override; + function GetDeviceInfo : TACSDeviceInfo;override; + {$IFDEF MSWINDOWS} + procedure WriteBlock(P : Pointer; Len : Integer); + procedure AddBlockToChain(WH : PWaveHdr); + {$ENDIF} + function GetDeviceCount : Integer;override; + protected + procedure Done; override; + function DoOutput(Abort : Boolean):Boolean; override; + procedure Prepare; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + end; + + TStdAudioIn = class(TACSBaseAudioIn) + private + {$IFDEF MSWINDOWS} + BlockChain : PWaveHdr; + FBlocksCount : Integer; + aBlock : Integer; + EOC : PPWaveHdr; + {$ENDIF} + _audio_fd : Integer; + FOpened : Integer; + FRecBytes : Integer; + procedure OpenAudio; + procedure CloseAudio; + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + procedure SetDevice(Ch : Integer);override; + function GetDeviceInfo : TACSDeviceInfo;override; + function GetTotalTime : real; override; + {$IFDEF MSWINDOWS} + procedure NewBlock; + procedure AddBlockToChain(WH : PWaveHdr); + {$ENDIF} + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; oBufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + end; + +var + InputChannelsCount : Integer; + OutputChannelsCount : Integer; + +function GetAudioDeviceInfo(DevID : Integer; OutputDev : Boolean) : TACSDeviceInfo; + +implementation + +var + CrSecI, CrSecO : TRTLCriticalSection; + +{$IFDEF MSWINDOWS} +{$I windows\acs_audio.inc} +{$ELSE} +{$I linux\acs_audio.inc} +{$ENDIF} + +function TStdAudioOut.GetDeviceInfo : TACSDeviceInfo; +begin + Result := GetAudioDeviceInfo(FBaseChannel, True); +end; + +function TStdAudioIn.GetDeviceInfo : TACSDeviceInfo; +begin + Result := GetAudioDeviceInfo(FBaseChannel, False); +end; + +function TStdAudioIn.GetTotalTime : real; +begin + Result := RecTime; +end; + +constructor TStdAudioIn.Create; +begin + inherited Create(AOwner); + FBPS := 8; + FChan := 1; + FFreq := 8000; + FSize := -1; + FRecTime := 600; + BufferSize := $1000; + {$IFDEF MSWINDOWS} + FBlocksCount := 4; + {$ENDIF} +end; + +function TStdAudioOut.GetDeviceCount : Integer; +begin + Result := OutputChannelsCount; +end; + +initialization + {$IFDEF MSWINDOWS} + InitializeCriticalSection(CrSecI); + InitializeCriticalSection(CrSecO); + {$ENDIF} + CountChannels; + RegisterAudioOut('Wavemapper',TStdAudioOut,LATENCY); + RegisterAudioIn('Wavemapper',TStdAudioIn,LATENCY); + +finalization + {$IFDEF MSWINDOWS} + DeleteCriticalSection(CrSecI); + DeleteCriticalSection(CrSecO); + {$ENDIF} + +end. diff --git a/components/acs/Src/drivers/linux/acs_audio.inc b/components/acs/Src/drivers/linux/acs_audio.inc new file mode 100644 index 000000000..a77b7566c --- /dev/null +++ b/components/acs/Src/drivers/linux/acs_audio.inc @@ -0,0 +1,266 @@ +{ +$Log +} + +const + MAX_CHANNELS = 16; // Maximum number of audio channels/devices + O_RDONLY = 0; + O_WRONLY = 1; + libname = 'libc.so.6'; + +var + AudioChannels : array[0..MAX_CHANNELS-1] of String; + +(* We import libc functions directly to avoid Kylix + Libc unit limitations *) + +function __write(fd : Integer; data : Pointer; size : Integer): Integer; cdecl; external libname; +function __read(Handle: Integer; var Buffer; Count: Integer): Integer; cdecl; external libname; +function ioctl(fd : Integer; command : Integer): Integer; varargs; cdecl; external libname; +function open(PathName: PChar; Flags: Integer): Integer; varargs; cdecl; external libname; +function __close(Handle: Integer): Integer; cdecl; external libname; + + +function GetAudioDeviceInfo(DevID : Integer; OutputDev : Boolean) : TACSDeviceInfo; +begin + Result.DeviceName := '/dev/dsp'+IntToStr(DevID); + Result.DrvVersion := 0; + Result.Formats := []; + Result.Stereo := True; +end; + +procedure TStdAudioOut.SetDevice; +begin + if Busy then raise EACSException.Create(strBusy); + if Ch < OutputChannelsCount then FBaseChannel := Ch + else raise EACSException.Create(Format(strChannelnotavailable,[ch])); +end; + +procedure TStdAudioOut.Prepare; +var + parm : Integer; +begin + GetMem(FBuffer,FBufferSize); + // No exceptions here! + FInput.Init; + case FInput.BitsPerSample of + 8 : parm := AFMT_U8; + 16 : parm := AFMT_S16_LE; + end; + _audio_fd := open(PChar(AudioChannels[FBaseChannel]), O_WRONLY); + ioctl(_audio_fd, SNDCTL_DSP_SETFMT, @parm); + parm := FInput.Channels; + ioctl(_audio_fd, SNDCTL_DSP_CHANNELS, @parm); + parm := FInput.SampleRate; + ioctl(_audio_fd, SNDCTL_DSP_SPEED, @parm); +end; + +procedure TStdAudioOut.Done; +begin +//TODO:why this raises an exception ?? FreeMem(FBuffer); + __close(_audio_fd); + _audio_fd := -1; + FInput.Flush; +end; + +function TStdAudioOut.DoOutput; +var + Len, i, VCoef : Integer; + P : Pointer; + P1 : PACSBuffer8; + P2 : PACSBuffer16; +begin + // No exceptions Here + Result := True; + if not CanOutput then Exit; + Len := 0; + if Abort then + begin + __close(_audio_fd); + Result := False; + Exit; + end; + try + P := @FBuffer[0]; + while InputLock do; + InputLock := True; + Len := Finput.GetData(P, FBufferSize); + InputLock := False; + if FVolume < 255 then + begin + VCoef := Round(FVolume/255); + if FInput.BitsPerSample = 16 then + begin + P2 := @FBuffer[0]; + for i := 0 to (Len shr 1) -1 do + P2[i] := P2[i]*VCoef; + end else + begin + P1 := @FBuffer[0]; + for i := 0 to Len - 1 do + P1[i] := P1[i]*VCoef; + end; + end; + __write(_audio_fd, P, Len); + except + end; + if Len > 0 then Result := True + else Result := False; +end; + +constructor TStdAudioOut.Create; +begin + inherited Create(AOwner); + FVolume := 255; + FBufferSize := $8000; + _audio_fd := -1; +end; + +destructor TStdAudioOut.Destroy; +begin + if _audio_fd > 0 then __close(_audio_fd); + inherited Destroy; +end; + +destructor TStdAudioIn.Destroy; +begin + inherited Destroy; + __close(_audio_fd); +end; + +procedure TStdAudioIn.OpenAudio; +begin + if FOpened = 0 then + _audio_fd := open(PChar(AudioChannels[FBaseChannel]), O_RDONLY); + Inc(FOpened); +end; + +procedure TStdAudioIn.CloseAudio; +begin + if FOpened = 1 then __close(_audio_fd); + if FOpened > 0 then Dec(FOpened); +end; + +function TStdAudioIn.GetBPS; +var + BPS : Integer; +begin + OpenAudio; + BPS := FBPS; + if (BPS in [8, 16]) = False then BPS := 16; + ioctl(_audio_fd, SNDCTL_DSP_SETFMT, @BPS); + FBPS := BPS; + Result := BPS; + CloseAudio; +end; + +function TStdAudioIn.GetCh; +var + Ch : Integer; +begin + OpenAudio; + Ch := FChan; + ioctl(_audio_fd, SNDCTL_DSP_CHANNELS, @Ch); + FChan := Ch; + Result := Ch; + CloseAudio; +end; + +function TStdAudioIn.GetSR; +var + SR : Integer; +begin + OpenAudio; + SR := FFreq; + ioctl(_audio_fd, SNDCTL_DSP_SPEED, @SR); + FFreq := SR; + Result := SR; + CloseAudio; +end; + +procedure TStdAudioIn.Init; +begin + if Busy then raise EACSException.Create(strBusy); + BufEnd := 0; + BufStart := 1; + FPosition := 0; + BufferSize := $8000; + OpenAudio; + FRecBytes := FRecTime * (GetBPS div 8) * GetCh * GetSR; + FBusy := True; + FSize := FRecBytes; +end; + +procedure TStdAudioIn.Flush; +begin + CloseAudio; + FBusy := False; +end; + +procedure TStdAudioIn.SetDevice; +begin + if Ch > (OutputChannelsCount - 1) then + if not (csDesigning in ComponentState) then + raise EACSException.Create(Format(strChannelnotavailable,[Ch])); + FBaseChannel := Ch; +end; + +function TStdAudioIn.GetData; +var + l : Integer; +begin + if not Busy then raise EACSException.Create(strStreamnotOpen); + if FRecBytes >= 0 then + if FPosition >= FRecBytes then + begin + Result := 0; + Exit; + end; + if BufStart > BufEnd then + begin + BufStart := 1; + l := __read(_audio_fd, FBuffer[BufStart], BufferSize); + if l < 1 then + begin + Result := 0; + Exit; + end + else BufEnd := l; + end; + if BufferSize < (BufEnd - BufStart + 1) + then Result := BufferSize + else Result := BufEnd - BufStart + 1; + Move(FBuffer[BufStart], Buffer^, Result); + Inc(BufStart, Result); + Inc(FPosition, Result); +end; + +procedure CountChannels; +var + i, fd : Integer; + fname : String; +begin + OutputChannelsCount := 0; + fname := '/dev/dsp0'; + fd := open(PChar(fname), O_RDONLY); + if fd < 0 then + begin + // Under ALSA there is no /dev/dsp0 device + fname := '/dev/dsp'; + fd := open(PChar(fname), O_RDONLY); + if fd < 0 then Exit; + end; + AudioChannels[OutputChannelsCount] := fname; + __close(fd); + Inc(OutputChannelsCount); + for i := 1 to MAX_CHANNELS - 2 do + begin + fname := '/dev/dsp' + IntToStr(i); + fd := open(PChar(fname), O_RDONLY); + if fd < 0 then Break; + __close(fd); + AudioChannels[OutputChannelsCount] := fname; + Inc(OutputChannelsCount); + end; +end; + diff --git a/components/acs/Src/drivers/linux/alsa.pas b/components/acs/Src/drivers/linux/alsa.pas new file mode 100644 index 000000000..7fa34f955 --- /dev/null +++ b/components/acs/Src/drivers/linux/alsa.pas @@ -0,0 +1,907 @@ +(* + application interface library for the alsa driver + free pascal / kylix import unit + converted from file + + ALSA library is copyrighted by its authors: + Jaroslav Kysela + Abramo Bagnara + Takashi Iwai + + Pascal translation: + Copyright (C) 2002, Pedro Lopez-Cabanillas + + Modified by Andrei Borovsky, 01-06-2003 + Note by A.B.: currently only translation is included in this file. + + This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + +*) + +(* attention! in this unit asoundlib is linked dynamically. + In order to decrease loading time, only the symbols needed by ACS + are actually resolved. *) + +{ +$Log: alsa.pas,v $ +Revision 1.6 2006/08/30 18:59:51 z0m3ie +*** empty log message *** + +Revision 1.5 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.3 2005/12/19 18:36:16 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/14 21:19:37 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + + +unit alsa; + +interface + +uses + Libc,ACS_Procs; + +const + asoundlib_path = 'libasound.so*'; + +var + AsoundlibLoaded : Boolean = False; + +type + Pint16_t = ^int16_t; + + { PCM generic info container } + Psnd_pcm_info_t = pointer; + { PCM hardware configuration space container } + Psnd_pcm_hw_params_t = pointer; + { PCM software configuration container } + Psnd_pcm_sw_params_t = pointer; + { PCM status container } + Psnd_pcm_status_t = pointer; + { PCM access types mask } + Psnd_pcm_access_mask_t = pointer; + { PCM formats mask } + Psnd_pcm_format_mask_t = pointer; + { PCM subformats mask } + Psnd_pcm_subformat_mask_t = pointer; + + Psnd_config_t = pointer; + + Psnd_async_handler_t = pointer; + + Psnd_output_t = Pointer; + + { PCM class } + _snd_pcm_class = Longint; + snd_pcm_class_t = _snd_pcm_class; +const + SND_PCM_CLASS_GENERIC = 0; { standard device } + SND_PCM_CLASS_MULTI = 1; { multichannel device } + SND_PCM_CLASS_MODEM = 2; { software modem device } + SND_PCM_CLASS_DIGITIZER = 3; { digitizer device } + SND_PCM_CLASS_LAST = SND_PCM_CLASS_DIGITIZER; + +type + { PCM subclass } + _snd_pcm_subclass = Longint; + snd_pcm_subclass_t = _snd_pcm_subclass; +const + SND_PCM_SUBCLASS_GENERIC_MIX = 0; { subdevices are mixed together } + SND_PCM_SUBCLASS_MULTI_MIX = 1; { multichannel subdevices are mixed together } + SND_PCM_SUBCLASS_LAST = SND_PCM_SUBCLASS_MULTI_MIX; + +type + { PCM stream (direction) } + _snd_pcm_stream = Longint; + snd_pcm_stream_t = _snd_pcm_stream; +const + SND_PCM_STREAM_PLAYBACK = 0; { Playback stream } + SND_PCM_STREAM_CAPTURE = 1; { Capture stream } + SND_PCM_STREAM_LAST = SND_PCM_STREAM_CAPTURE; + +type + { PCM access type } + _snd_pcm_access = Longint; + snd_pcm_access_t = _snd_pcm_access; +const + SND_PCM_ACCESS_MMAP_INTERLEAVED = 0; { mmap access with simple interleaved channels } + SND_PCM_ACCESS_MMAP_NONINTERLEAVED = 1; { mmap access with simple non interleaved channels } + SND_PCM_ACCESS_MMAP_COMPLEX = 2; { mmap access with complex placement } + SND_PCM_ACCESS_RW_INTERLEAVED = 3; { snd_pcm_readi/snd_pcm_writei access } + SND_PCM_ACCESS_RW_NONINTERLEAVED = 4; { snd_pcm_readn/snd_pcm_writen access } + SND_PCM_ACCESS_LAST = SND_PCM_ACCESS_RW_NONINTERLEAVED; + +type + { PCM sample format } + _snd_pcm_format = Longint; + snd_pcm_format_t = _snd_pcm_format; +const + { Unknown } + SND_PCM_FORMAT_UNKNOWN = -1; + { Signed 8 bit } + SND_PCM_FORMAT_S8 = 0; + { Unsigned 8 bit } + SND_PCM_FORMAT_U8 = 1; + { Signed 16 bit Little Endian } + SND_PCM_FORMAT_S16_LE = 2; + { Signed 16 bit Big Endian } + SND_PCM_FORMAT_S16_BE = 3; + { Unsigned 16 bit Little Endian } + SND_PCM_FORMAT_U16_LE = 4; + { Unsigned 16 bit Big Endian } + SND_PCM_FORMAT_U16_BE = 5; + { Signed 24 bit Little Endian } + SND_PCM_FORMAT_S24_LE = 6; + { Signed 24 bit Big Endian } + SND_PCM_FORMAT_S24_BE = 7; + { Unsigned 24 bit Little Endian } + SND_PCM_FORMAT_U24_LE = 8; + { Unsigned 24 bit Big Endian } + SND_PCM_FORMAT_U24_BE = 9; + { Signed 32 bit Little Endian } + SND_PCM_FORMAT_S32_LE = 10; + { Signed 32 bit Big Endian } + SND_PCM_FORMAT_S32_BE = 11; + { Unsigned 32 bit Little Endian } + SND_PCM_FORMAT_U32_LE = 12; + { Unsigned 32 bit Big Endian } + SND_PCM_FORMAT_U32_BE = 13; + { Float 32 bit Little Endian, Range -1.0 to 1.0 } + SND_PCM_FORMAT_FLOAT_LE = 14; + { Float 32 bit Big Endian, Range -1.0 to 1.0 } + SND_PCM_FORMAT_FLOAT_BE = 15; + { Float 64 bit Little Endian, Range -1.0 to 1.0 } + SND_PCM_FORMAT_FLOAT64_LE = 16; + { Float 64 bit Big Endian, Range -1.0 to 1.0 } + SND_PCM_FORMAT_FLOAT64_BE = 17; + { IEC-958 Little Endian } + SND_PCM_FORMAT_IEC958_SUBFRAME_LE = 18; + { IEC-958 Big Endian } + SND_PCM_FORMAT_IEC958_SUBFRAME_BE = 19; + { Mu-Law } + SND_PCM_FORMAT_MU_LAW = 20; + { A-Law } + SND_PCM_FORMAT_A_LAW = 21; + { Ima-ADPCM } + SND_PCM_FORMAT_IMA_ADPCM = 22; + { MPEG } + SND_PCM_FORMAT_MPEG = 23; + { GSM } + SND_PCM_FORMAT_GSM = 24; + { Special } + SND_PCM_FORMAT_SPECIAL = 31; + { Signed 24bit Little Endian in 3bytes format } + SND_PCM_FORMAT_S24_3LE = 32; + { Signed 24bit Big Endian in 3bytes format } + SND_PCM_FORMAT_S24_3BE = 33; + { Unsigned 24bit Little Endian in 3bytes format } + SND_PCM_FORMAT_U24_3LE = 34; + { Unsigned 24bit Big Endian in 3bytes format } + SND_PCM_FORMAT_U24_3BE = 35; + { Signed 20bit Little Endian in 3bytes format } + SND_PCM_FORMAT_S20_3LE = 36; + { Signed 20bit Big Endian in 3bytes format } + SND_PCM_FORMAT_S20_3BE = 37; + { Unsigned 20bit Little Endian in 3bytes format } + SND_PCM_FORMAT_U20_3LE = 38; + { Unsigned 20bit Big Endian in 3bytes format } + SND_PCM_FORMAT_U20_3BE = 39; + { Signed 18bit Little Endian in 3bytes format } + SND_PCM_FORMAT_S18_3LE = 40; + { Signed 18bit Big Endian in 3bytes format } + SND_PCM_FORMAT_S18_3BE = 41; + { Unsigned 18bit Little Endian in 3bytes format } + SND_PCM_FORMAT_U18_3LE = 42; + { Unsigned 18bit Big Endian in 3bytes format } + SND_PCM_FORMAT_U18_3BE = 43; + SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_U18_3BE; + +{$IFDEF ENDIAN_LITTLE} + { Signed 16 bit CPU endian } + SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_LE; + { Unsigned 16 bit CPU endian } + SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_LE; + { Signed 24 bit CPU endian } + SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_LE; + { Unsigned 24 bit CPU endian } + SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_LE; + { Signed 32 bit CPU endian } + SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_LE; + { Unsigned 32 bit CPU endian } + SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_LE; + { Float 32 bit CPU endian } + SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_LE; + { Float 64 bit CPU endian } + SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_LE; + { IEC-958 CPU Endian } + SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_LE; +{$ENDIF} + +{$IFDEF ENDIAN_BIG} + { Signed 16 bit CPU endian } + SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_BE; + { Unsigned 16 bit CPU endian } + SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_BE; + { Signed 24 bit CPU endian } + SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_BE; + { Unsigned 24 bit CPU endian } + SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_BE; + { Signed 32 bit CPU endian } + SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_BE; + { Unsigned 32 bit CPU endian } + SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_BE; + { Float 32 bit CPU endian } + SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_BE; + { Float 64 bit CPU endian } + SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_BE; + { IEC-958 CPU Endian } + SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_BE; +{$ENDIF} + +type + { PCM sample subformat } + _snd_pcm_subformat = Longint; + snd_pcm_subformat_t = _snd_pcm_subformat; + +const + SND_PCM_SUBFORMAT_STD = 0; { Standard } + SND_PCM_SUBFORMAT_LAST = SND_PCM_SUBFORMAT_STD; + +type + { PCM state } + _snd_pcm_state = Longint; + snd_pcm_state_t = _snd_pcm_state; +const + SND_PCM_STATE_OPEN = 0; { Open } + SND_PCM_STATE_SETUP = 1; { Setup installed } + SND_PCM_STATE_PREPARED = 2; { Ready to start } + SND_PCM_STATE_RUNNING = 3; { Running } + SND_PCM_STATE_XRUN = 4; { Stopped: underrun (playback) or overrun (capture) detected } + SND_PCM_STATE_DRAINING = 5; { Draining: running (playback) or stopped (capture) } + SND_PCM_STATE_PAUSED = 6; { Paused } + SND_PCM_STATE_SUSPENDED = 7; { Hardware is suspended } + SND_PCM_STATE_LAST = SND_PCM_STATE_SUSPENDED; + +type + { PCM start mode } + _snd_pcm_start = Longint; + snd_pcm_start_t = _snd_pcm_start; +const + SND_PCM_START_DATA = 0; { Automatic start on data read/write } + SND_PCM_START_EXPLICIT = 1; { Explicit start } + SND_PCM_START_LAST = SND_PCM_START_EXPLICIT; + +type + { PCM xrun mode } + _snd_pcm_xrun = Longint; + snd_pcm_xrun_t = _snd_pcm_xrun; +const + SND_PCM_XRUN_NONE = 0; { Xrun detection disabled } + SND_PCM_XRUN_STOP = 1; { Stop on xrun detection } + SND_PCM_XRUN_LAST = SND_PCM_XRUN_STOP; + +type + { PCM timestamp mode } + _snd_pcm_tstamp = Longint; + snd_pcm_tstamp_t = _snd_pcm_tstamp; +const + SND_PCM_TSTAMP_NONE = 0; { No timestamp } + SND_PCM_TSTAMP_MMAP = 1; { Update mmap'ed timestamp } + SND_PCM_TSTAMP_LAST = SND_PCM_TSTAMP_MMAP; + +type + { Unsigned frames quantity } + snd_pcm_uframes_t = LongWord; + Psnd_pcm_uframes_t = ^snd_pcm_uframes_t; + { Signed frames quantity } + snd_pcm_sframes_t = longint; + Psnd_pcm_sframes_t = ^snd_pcm_sframes_t; + { Timestamp } + snd_timestamp_t = timeval; + Psnd_timestamp_t = ^snd_timestamp_t; + +const + { Non blocking mode (flag for open mode) \hideinitializer } + SND_PCM_NONBLOCK = $0001; + { Async notification (flag for open mode) \hideinitializer } + SND_PCM_ASYNC = $0002; + +type + { PCM handle } + Psnd_pcm_t = pointer; + + { PCM type } + _snd_pcm_type = Longint; + snd_pcm_type_t = _snd_pcm_type; +const + { PCM type } + SND_PCM_TYPE_HW = 0; { Kernel level PCM } + SND_PCM_TYPE_HOOKS = 1; { Hooked PCM } + SND_PCM_TYPE_MULTI = 2; { One ore more linked PCM with exclusive access to selected channels } + SND_PCM_TYPE_FILE = 3; { File writing plugin } + SND_PCM_TYPE_NULL = 4; { Null endpoint PCM } + SND_PCM_TYPE_SHM = 5; { Shared memory client PCM } + SND_PCM_TYPE_INET = 6; { INET client PCM (not yet implemented) } + SND_PCM_TYPE_COPY = 7; { Copying plugin } + SND_PCM_TYPE_LINEAR = 8; { Linear format conversion PCM } + SND_PCM_TYPE_ALAW = 9; { A-Law format conversion PCM } + SND_PCM_TYPE_MULAW = 10; { Mu-Law format conversion PCM } + SND_PCM_TYPE_ADPCM = 11; { IMA-ADPCM format conversion PCM } + SND_PCM_TYPE_RATE = 12; { Rate conversion PCM } + SND_PCM_TYPE_ROUTE = 13; { Attenuated static route PCM } + SND_PCM_TYPE_PLUG = 14; { Format adjusted PCM } + SND_PCM_TYPE_SHARE = 15; { Sharing PCM } + SND_PCM_TYPE_METER = 16; { Meter plugin } + SND_PCM_TYPE_MIX = 17; { Mixing PCM } + SND_PCM_TYPE_DROUTE = 18; { Attenuated dynamic route PCM (not yet implemented) } + SND_PCM_TYPE_LBSERVER = 19; { Loopback server plugin (not yet implemented) } + SND_PCM_TYPE_LINEAR_FLOAT = 20; { Linear Integer <-> Linear Float format conversion PCM } + SND_PCM_TYPE_LADSPA = 21; { LADSPA integration plugin } + + + type + + { PCM area specification } + _snd_pcm_channel_area = record + addr : pointer; { base address of channel samples } + first : LongWord; { offset to first sample in bits } + step : LongWord; { samples distance in bits } + end; + snd_pcm_channel_area_t = _snd_pcm_channel_area; + Psnd_pcm_channel_area_t = ^snd_pcm_channel_area_t; + + { PCM synchronization ID } + _snd_pcm_sync_id = record + case longint of + 0 : ( id : array[0..15] of byte ); { 8-bit ID } + 1 : ( id16 : array[0..7] of word ); { 16-bit ID } + 2 : ( id32 : array[0..3] of LongWord ); { 32-bit ID } + end; + snd_pcm_sync_id_t = _snd_pcm_sync_id; + + { #SND_PCM_TYPE_METER scope handle } + Psnd_pcm_scope_t = pointer; + +type + snd_pcm_open_t = function(var pcm:Psnd_pcm_t; name:Pchar; stream:snd_pcm_stream_t; mode:longint):longint;cdecl; + snd_pcm_open_lconf_t = function(var pcm:Psnd_pcm_t; name:Pchar; stream:snd_pcm_stream_t; mode:longint; lconf:Psnd_config_t):longint;cdecl; + snd_pcm_close_t = function(pcm:Psnd_pcm_t):longint;cdecl; + snd_pcm_name_t = function(pcm:Psnd_pcm_t):Pchar;cdecl; + snd_pcm_type_t_t = function(pcm:Psnd_pcm_t):snd_pcm_type_t;cdecl; + snd_pcm_stream_t_t = function(pcm:Psnd_pcm_t):snd_pcm_stream_t;cdecl; + snd_pcm_poll_descriptors_count_t = function(pcm:Psnd_pcm_t):longint;cdecl; + snd_pcm_poll_descriptors_t = function(pcm:Psnd_pcm_t; var pfds:pollfd; space:LongWord):longint;cdecl; + snd_pcm_poll_descriptors_revents_t = function(pcm:Psnd_pcm_t; var pfds:pollfd; nfds:LongWord; revents:Pword):longint;cdecl; + snd_pcm_set_nonblock_t = function(pcm:Psnd_pcm_t; nonblock:longint):longint;cdecl; +// snd_async_add_pcm_handler_t = function(var handler:Psnd_async_handler_t; pcm:Psnd_pcm_t; callback:snd_async_callback_t; private_data:pointer):longint;cdecl; + snd_async_handler_get_pcm_t = function(handler:Psnd_async_handler_t):Psnd_pcm_t;cdecl; + snd_pcm_info_t = function(pcm:Psnd_pcm_t; info:Psnd_pcm_info_t):longint;cdecl; + snd_pcm_hw_params_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_current_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_free_t = function(pcm:Psnd_pcm_t):longint;cdecl; + snd_pcm_sw_params_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_sw_params_t):longint;cdecl; + snd_pcm_sw_params_current_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_sw_params_t):longint;cdecl; + snd_pcm_prepare_t = function(pcm:Psnd_pcm_t):longint;cdecl; + snd_pcm_reset_t = function(pcm:Psnd_pcm_t):longint;cdecl; + snd_pcm_status_t = function(pcm:Psnd_pcm_t; status:Psnd_pcm_status_t):longint;cdecl; + snd_pcm_start_t_t = function(pcm:Psnd_pcm_t):longint;cdecl; + snd_pcm_drop_t = function(pcm:Psnd_pcm_t):longint;cdecl; + snd_pcm_drain_t = function(pcm:Psnd_pcm_t):longint;cdecl; + snd_pcm_pause_t = function(pcm:Psnd_pcm_t; enable:longint):longint;cdecl; + snd_pcm_state_t_t = function(pcm:Psnd_pcm_t):snd_pcm_state_t;cdecl; + snd_pcm_hwsync_t = function(pcm: Psnd_pcm_t):longint;cdecl; + snd_pcm_delay_t = function(pcm:Psnd_pcm_t; delayp:Psnd_pcm_sframes_t):longint;cdecl; + snd_pcm_resume_t = function(pcm:Psnd_pcm_t):longint;cdecl; + snd_pcm_avail_update_t = function(pcm:Psnd_pcm_t):snd_pcm_sframes_t;cdecl; + snd_pcm_rewind_t = function(pcm:Psnd_pcm_t; frames:snd_pcm_uframes_t):snd_pcm_sframes_t;cdecl; + snd_pcm_writei_t = function(pcm:Psnd_pcm_t; buffer:pointer; size:snd_pcm_uframes_t):snd_pcm_sframes_t;cdecl; + snd_pcm_readi_t = function(pcm:Psnd_pcm_t; buffer:pointer; size:snd_pcm_uframes_t):snd_pcm_sframes_t;cdecl; + snd_pcm_writen_t = function(pcm:Psnd_pcm_t; bufs:Ppointer; size:snd_pcm_uframes_t):snd_pcm_sframes_t;cdecl; + snd_pcm_readn_t = function(pcm:Psnd_pcm_t; bufs:Ppointer; size:snd_pcm_uframes_t):snd_pcm_sframes_t;cdecl; + snd_pcm_wait_t = function(pcm:Psnd_pcm_t; timeout:longint):longint;cdecl; + snd_pcm_link_t = function(pcm1:Psnd_pcm_t; pcm2:Psnd_pcm_t):longint;cdecl; + snd_pcm_unlink_t = function(pcm:Psnd_pcm_t):longint;cdecl; + + snd_pcm_info_sizeof_t = function:size_t;cdecl; + snd_pcm_info_malloc_t = function(var obj:Psnd_pcm_info_t):LongInt;cdecl; + snd_pcm_info_free_t = procedure(obj:Psnd_pcm_info_t);cdecl; + snd_pcm_info_copy_t = procedure(dst:Psnd_pcm_info_t; src:Psnd_pcm_info_t);cdecl; + snd_pcm_info_get_device_t = function(obj:Psnd_pcm_info_t):LongWord;cdecl; + snd_pcm_info_get_subdevice_t = function(obj:Psnd_pcm_info_t):LongWord;cdecl; + snd_pcm_info_get_stream_t = function(obj:Psnd_pcm_info_t):snd_pcm_stream_t;cdecl; + snd_pcm_info_get_card_t = function(obj:Psnd_pcm_info_t):longint;cdecl; + snd_pcm_info_get_id_t = function(obj:Psnd_pcm_info_t):Pchar;cdecl; + snd_pcm_info_get_name_t = function(obj:Psnd_pcm_info_t):Pchar;cdecl; + snd_pcm_info_get_subdevice_name_t = function(obj:Psnd_pcm_info_t):Pchar;cdecl; + snd_pcm_info_get_class_t = function(obj:Psnd_pcm_info_t):snd_pcm_class_t;cdecl; + snd_pcm_info_get_subclass_t = function(obj:Psnd_pcm_info_t):snd_pcm_subclass_t;cdecl; + snd_pcm_info_get_subdevices_count_t = function(obj:Psnd_pcm_info_t):LongWord;cdecl; + snd_pcm_info_get_subdevices_avail_t = function(obj:Psnd_pcm_info_t):LongWord;cdecl; + snd_pcm_info_get_sync_t = function(obj:Psnd_pcm_info_t):snd_pcm_sync_id_t;cdecl; + snd_pcm_info_set_device_t = procedure(obj:Psnd_pcm_info_t; val:LongWord);cdecl; + snd_pcm_info_set_subdevice_t = procedure(obj:Psnd_pcm_info_t; val:LongWord);cdecl; + snd_pcm_info_set_stream_t = procedure(obj:Psnd_pcm_info_t; val:snd_pcm_stream_t);cdecl; + { + Hardware Parameters + See the \ref pcm page for more details. + } + snd_pcm_hw_params_any_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_can_mmap_sample_resolution_t = function(params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_is_double_t = function(params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_is_batch_t = function(params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_is_block_transfer_t = function(params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_can_overrange_t = function(params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_can_pause_t = function(params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_can_resume_t = function(params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_is_half_duplex_t = function(params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_is_joint_duplex_t = function(params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_can_sync_start_t = function(params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_get_rate_numden_t = function(params:Psnd_pcm_hw_params_t; rate_num:PLongWord; rate_den:PLongWord):longint;cdecl; + snd_pcm_hw_params_get_sbits_t = function(params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_get_fifo_size_t = function(params:Psnd_pcm_hw_params_t):longint;cdecl; + + snd_pcm_hw_params_sizeof_t = function:size_t;cdecl; + snd_pcm_hw_params_malloc_t = function(var obj:Psnd_pcm_hw_params_t):LongInt;cdecl; + snd_pcm_hw_params_free_t = procedure(obj:Psnd_pcm_hw_params_t);cdecl; + snd_pcm_hw_params_copy_t = procedure(dst:Psnd_pcm_hw_params_t; src:Psnd_pcm_hw_params_t);cdecl; + snd_pcm_hw_params_get_access_t = function(params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_test_access_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:snd_pcm_access_t):longint;cdecl; + snd_pcm_hw_params_set_access_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:snd_pcm_access_t):longint;cdecl; + snd_pcm_hw_params_set_access_first_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t):snd_pcm_access_t;cdecl; + snd_pcm_hw_params_set_access_last_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t):snd_pcm_access_t;cdecl; + snd_pcm_hw_params_set_access_mask_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; mask:Psnd_pcm_access_mask_t):longint;cdecl; + snd_pcm_hw_params_get_access_mask_t = procedure(params:Psnd_pcm_hw_params_t; mask:Psnd_pcm_access_mask_t);cdecl; + snd_pcm_hw_params_get_format_t = function(params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_test_format_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:snd_pcm_format_t):longint;cdecl; + snd_pcm_hw_params_set_format_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:snd_pcm_format_t):longint;cdecl; + snd_pcm_hw_params_set_format_first_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t):snd_pcm_format_t;cdecl; + snd_pcm_hw_params_set_format_last_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t):snd_pcm_format_t;cdecl; + snd_pcm_hw_params_set_format_mask_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; mask:Psnd_pcm_format_mask_t):longint;cdecl; + snd_pcm_hw_params_get_format_mask_t = procedure(params:Psnd_pcm_hw_params_t; mask:Psnd_pcm_format_mask_t);cdecl; + snd_pcm_hw_params_test_subformat_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:snd_pcm_subformat_t):longint;cdecl; + snd_pcm_hw_params_get_subformat_t = function(params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_set_subformat_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:snd_pcm_subformat_t):longint;cdecl; + snd_pcm_hw_params_set_subformat_first_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t):snd_pcm_subformat_t;cdecl; + snd_pcm_hw_params_set_subformat_last_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t):snd_pcm_subformat_t;cdecl; + snd_pcm_hw_params_set_subformat_mask_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; mask:Psnd_pcm_subformat_mask_t):longint;cdecl; + snd_pcm_hw_params_get_subformat_mask_t = procedure(params:Psnd_pcm_hw_params_t; mask:Psnd_pcm_subformat_mask_t);cdecl; + snd_pcm_hw_params_get_channels_t = function(params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_get_channels_min_t = function(params:Psnd_pcm_hw_params_t):LongWord;cdecl; + snd_pcm_hw_params_get_channels_max_t = function(params:Psnd_pcm_hw_params_t):LongWord;cdecl; + snd_pcm_hw_params_test_channels_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord):longint;cdecl; + snd_pcm_hw_params_set_channels_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord):longint;cdecl; + snd_pcm_hw_params_set_channels_min_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:PLongWord):longint;cdecl; + snd_pcm_hw_params_set_channels_max_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:PLongWord):longint;cdecl; + snd_pcm_hw_params_set_channels_minmax_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; min:PLongWord; max:PLongWord):longint;cdecl; + snd_pcm_hw_params_set_channels_near_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord):LongWord;cdecl; + snd_pcm_hw_params_set_channels_first_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t):LongWord;cdecl; + snd_pcm_hw_params_set_channels_last_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t):LongWord;cdecl; + snd_pcm_hw_params_get_rate_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_get_rate_min_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_get_rate_max_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_test_rate_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord; dir:longint):longint;cdecl; + snd_pcm_hw_params_set_rate_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord; dir:longint):longint;cdecl; + snd_pcm_hw_params_set_rate_min_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:PLongWord; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_rate_max_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:PLongWord; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_rate_minmax_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; min:PLongWord; mindir:Plongint; max:PLongWord; + maxdir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_rate_near_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_set_rate_first_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_set_rate_last_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_get_period_time_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_get_period_time_min_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_get_period_time_max_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_test_period_time_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord; dir:longint):longint;cdecl; + snd_pcm_hw_params_set_period_time_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord; dir:longint):longint;cdecl; + snd_pcm_hw_params_set_period_time_min_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:PLongWord; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_period_time_max_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:PLongWord; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_period_time_minmax_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; min:PLongWord; mindir:Plongint; max:PLongWord; + maxdir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_period_time_near_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_set_period_time_first_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_set_period_time_last_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_get_period_size_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):snd_pcm_sframes_t;cdecl; + snd_pcm_hw_params_get_period_size_min_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):snd_pcm_uframes_t;cdecl; + snd_pcm_hw_params_get_period_size_max_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):snd_pcm_uframes_t;cdecl; + snd_pcm_hw_params_test_period_size_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:snd_pcm_uframes_t; dir:longint):longint;cdecl; + snd_pcm_hw_params_set_period_size_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:snd_pcm_uframes_t; dir:longint):longint;cdecl; + snd_pcm_hw_params_set_period_size_min_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:Psnd_pcm_uframes_t; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_period_size_max_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:Psnd_pcm_uframes_t; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_period_size_minmax_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; min:Psnd_pcm_uframes_t; mindir:Plongint; max:Psnd_pcm_uframes_t; + maxdir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_period_size_near_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:snd_pcm_uframes_t; dir:Plongint):snd_pcm_uframes_t;cdecl; + snd_pcm_hw_params_set_period_size_first_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; dir:Plongint):snd_pcm_uframes_t;cdecl; + snd_pcm_hw_params_set_period_size_last_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; dir:Plongint):snd_pcm_uframes_t;cdecl; + snd_pcm_hw_params_set_period_size_integer_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_get_periods_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_get_periods_min_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_get_periods_max_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_test_periods_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord; dir:longint):longint;cdecl; + snd_pcm_hw_params_set_periods_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord; dir:longint):longint;cdecl; + snd_pcm_hw_params_set_periods_min_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:PLongWord; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_periods_max_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:PLongWord; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_periods_minmax_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; min:PLongWord; mindir:Plongint; max:PLongWord; + maxdir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_periods_near_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_set_periods_first_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_set_periods_last_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_set_periods_integer_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t):longint;cdecl; + snd_pcm_hw_params_get_buffer_time_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_get_buffer_time_min_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_get_buffer_time_max_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_test_buffer_time_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord; dir:longint):longint;cdecl; + snd_pcm_hw_params_set_buffer_time_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord; dir:longint):longint;cdecl; + snd_pcm_hw_params_set_buffer_time_min_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:PLongWord; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_buffer_time_max_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:PLongWord; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_buffer_time_minmax_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; min:PLongWord; mindir:Plongint; max:PLongWord; + maxdir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_buffer_time_near_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_set_buffer_time_first_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_set_buffer_time_last_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_get_buffer_size_t = function(params:Psnd_pcm_hw_params_t):snd_pcm_sframes_t;cdecl; + snd_pcm_hw_params_get_buffer_size_min_t = function(params:Psnd_pcm_hw_params_t):snd_pcm_uframes_t;cdecl; + snd_pcm_hw_params_get_buffer_size_max_t = function(params:Psnd_pcm_hw_params_t):snd_pcm_uframes_t;cdecl; + snd_pcm_hw_params_test_buffer_size_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:snd_pcm_uframes_t):longint;cdecl; + snd_pcm_hw_params_set_buffer_size_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:snd_pcm_uframes_t):longint;cdecl; + snd_pcm_hw_params_set_buffer_size_min_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:Psnd_pcm_uframes_t):longint;cdecl; + snd_pcm_hw_params_set_buffer_size_max_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:Psnd_pcm_uframes_t):longint;cdecl; + snd_pcm_hw_params_set_buffer_size_minmax_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; min:Psnd_pcm_uframes_t; max:Psnd_pcm_uframes_t):longint;cdecl; + snd_pcm_hw_params_set_buffer_size_near_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:snd_pcm_uframes_t):snd_pcm_uframes_t;cdecl; + snd_pcm_hw_params_set_buffer_size_first_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t):snd_pcm_uframes_t;cdecl; + snd_pcm_hw_params_set_buffer_size_last_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t):snd_pcm_uframes_t;cdecl; + snd_pcm_hw_params_get_tick_time_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_get_tick_time_min_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_get_tick_time_max_t = function(params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_test_tick_time_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord; dir:longint):longint;cdecl; + snd_pcm_hw_params_set_tick_time_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord; dir:longint):longint;cdecl; + snd_pcm_hw_params_set_tick_time_min_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:PLongWord; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_tick_time_max_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:PLongWord; dir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_tick_time_minmax_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; min:PLongWord; mindir:Plongint; max:PLongWord; + maxdir:Plongint):longint;cdecl; + snd_pcm_hw_params_set_tick_time_near_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; val:LongWord; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_set_tick_time_first_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + snd_pcm_hw_params_set_tick_time_last_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_hw_params_t; dir:Plongint):LongWord;cdecl; + { New function added in alsa-lib-0.9.0-rc5 } + snd_pcm_hw_params_get_min_align_t = function(params: Psnd_pcm_hw_params_t; var val: snd_pcm_uframes_t):longint;cdecl; + + { + Software Parameters + } + // function snd_pcm_sw_params_current(pcm:Psnd_pcm_t; params:Psnd_pcm_sw_params_t):longint;cdecl;external asoundlib_name; + snd_pcm_sw_params_sizeof_t = function:size_t;cdecl; + snd_pcm_sw_params_malloc_t = function(var obj:Psnd_pcm_sw_params_t):LongInt;cdecl; + snd_pcm_sw_params_free_t = procedure(obj:Psnd_pcm_sw_params_t);cdecl; + snd_pcm_sw_params_copy_t = procedure(dst:Psnd_pcm_sw_params_t; src:Psnd_pcm_sw_params_t);cdecl; + snd_pcm_sw_params_set_tstamp_mode_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_sw_params_t; val:snd_pcm_tstamp_t):longint;cdecl; + snd_pcm_sw_params_get_tstamp_mode_t = function(params:Psnd_pcm_sw_params_t):snd_pcm_tstamp_t;cdecl; + + snd_pcm_sw_params_set_sleep_min_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_sw_params_t; val:LongWord):longint;cdecl; + snd_pcm_sw_params_get_sleep_min_t = function(params:Psnd_pcm_sw_params_t):LongWord;cdecl; + snd_pcm_sw_params_set_avail_min_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_sw_params_t; val:snd_pcm_uframes_t):longint;cdecl; + snd_pcm_sw_params_get_avail_min_t = function(params:Psnd_pcm_sw_params_t):snd_pcm_uframes_t;cdecl; + snd_pcm_sw_params_set_xfer_align_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_sw_params_t; val:snd_pcm_uframes_t):longint;cdecl; + snd_pcm_sw_params_get_xfer_align_t = function(params:Psnd_pcm_sw_params_t):snd_pcm_uframes_t;cdecl; + snd_pcm_sw_params_set_start_threshold_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_sw_params_t; val:snd_pcm_uframes_t):longint;cdecl; + snd_pcm_sw_params_get_start_threshold_t = function(params:Psnd_pcm_sw_params_t):snd_pcm_uframes_t;cdecl; + snd_pcm_sw_params_set_stop_threshold_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_sw_params_t; val:snd_pcm_uframes_t):longint;cdecl; + snd_pcm_sw_params_get_stop_threshold_t = function(params:Psnd_pcm_sw_params_t):snd_pcm_uframes_t;cdecl; + + snd_pcm_sw_params_set_silence_threshold_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_sw_params_t; val:snd_pcm_uframes_t):longint;cdecl; + snd_pcm_sw_params_get_silence_threshold_t = function(params:Psnd_pcm_sw_params_t):snd_pcm_uframes_t;cdecl; + snd_pcm_sw_params_set_silence_size_t = function(pcm:Psnd_pcm_t; params:Psnd_pcm_sw_params_t; val:snd_pcm_uframes_t):longint;cdecl; + snd_pcm_sw_params_get_silence_size_t = function(params:Psnd_pcm_sw_params_t):snd_pcm_uframes_t;cdecl; + + { + Access Mask Functions + } + snd_pcm_access_mask_sizeof_t = function:size_t;cdecl; + snd_pcm_access_mask_malloc_t = function(var obj:Psnd_pcm_access_mask_t):LongInt;cdecl; + snd_pcm_access_mask_free_t = procedure(obj:Psnd_pcm_access_mask_t);cdecl; + snd_pcm_access_mask_copy_t = procedure(dst:Psnd_pcm_access_mask_t; src:Psnd_pcm_access_mask_t);cdecl; + snd_pcm_access_mask_none_t = procedure(mask:Psnd_pcm_access_mask_t);cdecl; + snd_pcm_access_mask_any_t = procedure(mask:Psnd_pcm_access_mask_t);cdecl; + snd_pcm_access_mask_test_t = function(mask:Psnd_pcm_access_mask_t; val:snd_pcm_access_t):longint;cdecl; + snd_pcm_access_mask_empty_t = function(mask:Psnd_pcm_access_mask_t):longint;cdecl; + snd_pcm_access_mask_set_t = procedure(mask:Psnd_pcm_access_mask_t; val:snd_pcm_access_t);cdecl; + snd_pcm_access_mask_reset_t = procedure(mask:Psnd_pcm_access_mask_t; val:snd_pcm_access_t);cdecl; + { + Format Mask Functions + } + snd_pcm_format_mask_sizeof_t = function:size_t;cdecl; + snd_pcm_format_mask_malloc_t = function(var obj:Psnd_pcm_format_mask_t):LongInt;cdecl; + snd_pcm_format_mask_free_t = procedure(obj:Psnd_pcm_format_mask_t);cdecl; + snd_pcm_format_mask_copy_t = procedure(dst:Psnd_pcm_format_mask_t; src:Psnd_pcm_format_mask_t);cdecl; + snd_pcm_format_mask_none_t = procedure(mask:Psnd_pcm_format_mask_t);cdecl; + snd_pcm_format_mask_any_t = procedure(mask:Psnd_pcm_format_mask_t);cdecl; + snd_pcm_format_mask_test_t = function(mask:Psnd_pcm_format_mask_t; val:snd_pcm_format_t):longint;cdecl; + snd_pcm_format_mask_empty_t = function(mask:Psnd_pcm_format_mask_t):longint;cdecl; + snd_pcm_format_mask_set_t = procedure(mask:Psnd_pcm_format_mask_t; val:snd_pcm_format_t);cdecl; + snd_pcm_format_mask_reset_t = procedure(mask:Psnd_pcm_format_mask_t; val:snd_pcm_format_t);cdecl; + { + Subformat Mask Functions + } + snd_pcm_subformat_mask_sizeof_t = function:size_t;cdecl; + snd_pcm_subformat_mask_malloc_t = function(var obj:Psnd_pcm_subformat_mask_t):LongInt;cdecl; + snd_pcm_subformat_mask_free_t = procedure(obj:Psnd_pcm_subformat_mask_t);cdecl; + snd_pcm_subformat_mask_copy_t = procedure(dst:Psnd_pcm_subformat_mask_t; src:Psnd_pcm_subformat_mask_t);cdecl; + snd_pcm_subformat_mask_none_t = procedure(mask:Psnd_pcm_subformat_mask_t);cdecl; + snd_pcm_subformat_mask_any_t = procedure(mask:Psnd_pcm_subformat_mask_t);cdecl; + snd_pcm_subformat_mask_test_t = function(mask:Psnd_pcm_subformat_mask_t; val:snd_pcm_subformat_t):longint;cdecl; + snd_pcm_subformat_mask_empty_t = function(mask:Psnd_pcm_subformat_mask_t):longint;cdecl; + snd_pcm_subformat_mask_set_t = procedure(mask:Psnd_pcm_subformat_mask_t; val:snd_pcm_subformat_t);cdecl; + snd_pcm_subformat_mask_reset_t = procedure(mask:Psnd_pcm_subformat_mask_t; val:snd_pcm_subformat_t);cdecl; + { + Status Functions + } + snd_pcm_status_sizeof_t = function:size_t;cdecl; + snd_pcm_status_malloc_t = function(var obj:Psnd_pcm_status_t):LongInt;cdecl; + snd_pcm_status_free_t = procedure(obj:Psnd_pcm_status_t);cdecl; + snd_pcm_status_copy_t = procedure(dst:Psnd_pcm_status_t; src:Psnd_pcm_status_t);cdecl; + snd_pcm_status_get_state_t = function(obj:Psnd_pcm_status_t):snd_pcm_state_t;cdecl; + snd_pcm_status_get_trigger_tstamp_t = procedure(obj:Psnd_pcm_status_t; ptr:Psnd_timestamp_t);cdecl; + snd_pcm_status_get_tstamp_t = procedure(obj:Psnd_pcm_status_t; ptr:Psnd_timestamp_t);cdecl; + snd_pcm_status_get_delay_t = function(obj:Psnd_pcm_status_t):snd_pcm_sframes_t;cdecl; + snd_pcm_status_get_avail_t = function(obj:Psnd_pcm_status_t):snd_pcm_uframes_t;cdecl; + snd_pcm_status_get_avail_max_t = function(obj:Psnd_pcm_status_t):snd_pcm_uframes_t;cdecl; + snd_pcm_status_get_overrange_t = function(obj:Psnd_pcm_status_t):snd_pcm_uframes_t;cdecl; + { + Description Functions + } + snd_pcm_stream_name_t = function(stream:snd_pcm_stream_t):Pchar;cdecl; + snd_pcm_access_name_t = function(_access:snd_pcm_access_t):Pchar;cdecl; + snd_pcm_format_name_t = function(format:snd_pcm_format_t):Pchar;cdecl; + snd_pcm_format_description_t = function(format:snd_pcm_format_t):Pchar;cdecl; + snd_pcm_subformat_name_t = function(subformat:snd_pcm_subformat_t):Pchar;cdecl; + snd_pcm_subformat_description_t = function(subformat:snd_pcm_subformat_t):Pchar;cdecl; + snd_pcm_format_value_t = function(name:Pchar):snd_pcm_format_t;cdecl; + snd_pcm_tstamp_mode_name_t = function(mode:snd_pcm_tstamp_t):Pchar;cdecl; + snd_pcm_state_name_t = function(state:snd_pcm_state_t):Pchar;cdecl; + { + Debug Functions + } + snd_pcm_dump_t = function(pcm:Psnd_pcm_t; mout:Psnd_output_t):longint;cdecl; + snd_pcm_dump_hw_setup_t = function(pcm:Psnd_pcm_t; mout:Psnd_output_t):longint;cdecl; + snd_pcm_dump_sw_setup_t = function(pcm:Psnd_pcm_t; mout:Psnd_output_t):longint;cdecl; + snd_pcm_dump_setup_t = function(pcm:Psnd_pcm_t; mout:Psnd_output_t):longint;cdecl; + snd_pcm_hw_params_dump_t = function(params:Psnd_pcm_hw_params_t; mout:Psnd_output_t):longint;cdecl; + snd_pcm_sw_params_dump_t = function(params:Psnd_pcm_sw_params_t; mout:Psnd_output_t):longint;cdecl; + snd_pcm_status_dump_t = function(status:Psnd_pcm_status_t; mout:Psnd_output_t):longint;cdecl; + { + Direct Access (MMAP) Functions + } + snd_pcm_mmap_begin_t = function(pcm:Psnd_pcm_t; var areas:Psnd_pcm_channel_area_t; offset:Psnd_pcm_uframes_t; frames:Psnd_pcm_uframes_t):longint;cdecl; + snd_pcm_mmap_commit_t = function(pcm:Psnd_pcm_t; offset:snd_pcm_uframes_t; frames:snd_pcm_uframes_t):snd_pcm_sframes_t;cdecl; + snd_pcm_mmap_writei_t = function(pcm:Psnd_pcm_t; buffer:pointer; size:snd_pcm_uframes_t):snd_pcm_sframes_t;cdecl; + snd_pcm_mmap_readi_t = function(pcm:Psnd_pcm_t; buffer:pointer; size:snd_pcm_uframes_t):snd_pcm_sframes_t;cdecl; + snd_pcm_mmap_writen_t = function(pcm:Psnd_pcm_t; bufs:Ppointer; size:snd_pcm_uframes_t):snd_pcm_sframes_t;cdecl; + snd_pcm_mmap_readn_t = function(pcm:Psnd_pcm_t; bufs:Ppointer; size:snd_pcm_uframes_t):snd_pcm_sframes_t;cdecl; + { + Helper Functions + } + snd_pcm_format_signed_t = function(format:snd_pcm_format_t):longint;cdecl; + snd_pcm_format_unsigned_t = function(format:snd_pcm_format_t):longint;cdecl; + snd_pcm_format_linear_t = function(format:snd_pcm_format_t):longint;cdecl; + snd_pcm_format_is_float_t = function(format:snd_pcm_format_t):longint;cdecl; + snd_pcm_format_little_endian_t = function(format:snd_pcm_format_t):longint;cdecl; + snd_pcm_format_big_endian_t = function(format:snd_pcm_format_t):longint;cdecl; + snd_pcm_format_cpu_endian_t = function(format:snd_pcm_format_t):longint;cdecl; + snd_pcm_format_width_t = function(format:snd_pcm_format_t):longint;cdecl; + { in bits } + snd_pcm_format_physical_width_t = function(format:snd_pcm_format_t):longint;cdecl; + { in bits } + snd_pcm_build_linear_format_t = function(width:longint; pwidth:longint; unsignd:longint; big_endian:longint):snd_pcm_format_t;cdecl; + snd_pcm_format_size_t = function(format:snd_pcm_format_t; samples:size_t):ssize_t;cdecl; + snd_pcm_format_silence_t = function(format:snd_pcm_format_t):u_int8_t;cdecl; + snd_pcm_format_silence_16_t = function(format:snd_pcm_format_t):u_int16_t;cdecl; + snd_pcm_format_silence_32_t = function(format:snd_pcm_format_t):u_int32_t;cdecl; +// snd_pcm_format_silence_64_t = function(format:snd_pcm_format_t):u_int64_t;cdecl; + snd_pcm_format_set_silence_t = function(format:snd_pcm_format_t; buf:pointer; samples:LongWord):longint;cdecl; + snd_pcm_bytes_to_frames_t = function(pcm:Psnd_pcm_t; bytes:ssize_t):snd_pcm_sframes_t;cdecl; + snd_pcm_frames_to_bytes_t = function(pcm:Psnd_pcm_t; frames:snd_pcm_sframes_t):ssize_t;cdecl; + snd_pcm_bytes_to_samples_t = function(pcm:Psnd_pcm_t; bytes:ssize_t):longint;cdecl; + snd_pcm_samples_to_bytes_t = function(pcm:Psnd_pcm_t; samples:longint):ssize_t;cdecl; + snd_pcm_area_silence_t = function(dst_channel:Psnd_pcm_channel_area_t; dst_offset:snd_pcm_uframes_t; samples:LongWord; format:snd_pcm_format_t):longint;cdecl; + snd_pcm_areas_silence_t = function(dst_channels:Psnd_pcm_channel_area_t; dst_offset:snd_pcm_uframes_t; channels:LongWord; frames:snd_pcm_uframes_t; format:snd_pcm_format_t):longint;cdecl; + snd_pcm_area_copy_t = function(dst_channel:Psnd_pcm_channel_area_t; dst_offset:snd_pcm_uframes_t; src_channel:Psnd_pcm_channel_area_t; src_offset:snd_pcm_uframes_t; samples:LongWord; + format:snd_pcm_format_t):longint;cdecl; + snd_pcm_areas_copy_t = function(dst_channels:Psnd_pcm_channel_area_t; dst_offset:snd_pcm_uframes_t; src_channels:Psnd_pcm_channel_area_t; src_offset:snd_pcm_uframes_t; channels:LongWord; + frames:snd_pcm_uframes_t; format:snd_pcm_format_t):longint;cdecl; + { + Hook Extension + } +type + { type of pcm hook } + _snd_pcm_hook_type = Longint; + snd_pcm_hook_type_t = _snd_pcm_hook_type; +const + SND_PCM_HOOK_TYPE_HW_PARAMS = 0; + SND_PCM_HOOK_TYPE_HW_FREE = 1; + SND_PCM_HOOK_TYPE_CLOSE = 2; + SND_PCM_HOOK_TYPE_LAST = SND_PCM_HOOK_TYPE_CLOSE; + +type + { PCM hook container } + Psnd_pcm_hook_t = pointer; + { PCM hook callback function } + snd_pcm_hook_func_t = function (hook:Psnd_pcm_hook_t):longint;cdecl; +type + + snd_pcm_hook_get_pcm_t = function(hook:Psnd_pcm_hook_t):Psnd_pcm_t;cdecl; + snd_pcm_hook_get_private_t = function(hook:Psnd_pcm_hook_t):pointer;cdecl; + snd_pcm_hook_set_private_t = procedure(hook:Psnd_pcm_hook_t; private_data:pointer);cdecl; + snd_pcm_hook_add_t = function(var hookp:Psnd_pcm_hook_t; pcm:Psnd_pcm_t; _type:snd_pcm_hook_type_t; func:snd_pcm_hook_func_t; private_data:pointer):longint;cdecl; + snd_pcm_hook_remove_t = function(hook:Psnd_pcm_hook_t):longint;cdecl; + { + Scope Plugin Extension + } +type + { #SND_PCM_TYPE_METER scope functions } + _snd_pcm_scope_ops = record + enable : function (scope:Psnd_pcm_scope_t):longint;cdecl; { Enable and prepare it using current params } + disable : procedure (scope:Psnd_pcm_scope_t); { Disable } + start : procedure (scope:Psnd_pcm_scope_t); { PCM has been started } + stop : procedure (scope:Psnd_pcm_scope_t); { PCM has been stopped } + update : procedure (scope:Psnd_pcm_scope_t); { New frames are present } + reset : procedure (scope:Psnd_pcm_scope_t); { Reset status } + close : procedure (scope:Psnd_pcm_scope_t); { PCM is closing } + end; + snd_pcm_scope_ops_t = _snd_pcm_scope_ops; + Psnd_pcm_scope_ops_t = ^snd_pcm_scope_ops_t; + + snd_pcm_meter_get_bufsize_t = function(pcm:Psnd_pcm_t):snd_pcm_uframes_t;cdecl; + snd_pcm_meter_get_channels_t = function(pcm:Psnd_pcm_t):LongWord;cdecl; + snd_pcm_meter_get_rate_t = function(pcm:Psnd_pcm_t):LongWord;cdecl; + snd_pcm_meter_get_now_t = function(pcm:Psnd_pcm_t):snd_pcm_uframes_t;cdecl; + snd_pcm_meter_get_boundary_t = function(pcm:Psnd_pcm_t):snd_pcm_uframes_t;cdecl; + snd_pcm_meter_add_scope_t = function(pcm:Psnd_pcm_t; scope:Psnd_pcm_scope_t):longint;cdecl; + snd_pcm_meter_search_scope_t = function(pcm:Psnd_pcm_t; name:Pchar):Psnd_pcm_scope_t;cdecl; + snd_pcm_scope_malloc_t = function(var ptr:Psnd_pcm_scope_t):longint;cdecl; + snd_pcm_scope_set_ops_t = procedure(scope:Psnd_pcm_scope_t; val:Psnd_pcm_scope_ops_t);cdecl; + snd_pcm_scope_set_name_t = procedure(scope:Psnd_pcm_scope_t; val:Pchar);cdecl; + snd_pcm_scope_get_name_t = function(scope:Psnd_pcm_scope_t):Pchar;cdecl; + snd_pcm_scope_get_callback_private_t = function(scope:Psnd_pcm_scope_t):pointer;cdecl; + snd_pcm_scope_set_callback_private_t = procedure(scope:Psnd_pcm_scope_t; val:pointer);cdecl; + snd_pcm_scope_s16_open_t = function(pcm:Psnd_pcm_t; name:Pchar; var scopep:Psnd_pcm_scope_t):longint;cdecl; + snd_pcm_scope_s16_get_channel_buffer_t = function(scope:Psnd_pcm_scope_t; channel:LongWord):Pint16_t;cdecl; + +var + + snd_pcm_close : snd_pcm_close_t; + snd_pcm_drop : snd_pcm_drop_t; + snd_pcm_drain : snd_pcm_drain_t; + snd_pcm_hw_params_malloc : snd_pcm_hw_params_malloc_t; + snd_pcm_hw_params_any : snd_pcm_hw_params_any_t; + snd_pcm_hw_params_get_periods : snd_pcm_hw_params_get_periods_t; + snd_pcm_hw_params_get_period_size : snd_pcm_hw_params_get_period_size_t; + snd_pcm_hw_params_get_rate : snd_pcm_hw_params_get_rate_t; + snd_pcm_hw_params_set_access : snd_pcm_hw_params_set_access_t; + snd_pcm_hw_params_set_buffer_size : snd_pcm_hw_params_set_buffer_size_t; + snd_pcm_hw_params_set_buffer_size_near : snd_pcm_hw_params_set_buffer_size_near_t; + snd_pcm_hw_params_set_channels : snd_pcm_hw_params_set_channels_t; + snd_pcm_hw_params_set_format : snd_pcm_hw_params_set_format_t; + snd_pcm_hw_params_set_period_size_near : snd_pcm_hw_params_set_period_size_near_t; + snd_pcm_hw_params_set_periods_near : snd_pcm_hw_params_set_periods_near_t; + snd_pcm_hw_params_set_rate_near : snd_pcm_hw_params_set_rate_near_t; + snd_pcm_hw_params : snd_pcm_hw_params_t; + snd_pcm_hw_params_free : snd_pcm_hw_params_free_t; + snd_pcm_info_get_device : snd_pcm_info_get_device_t; + snd_pcm_info_get_name : snd_pcm_info_get_name_t; + snd_pcm_info_set_device : snd_pcm_info_set_device_t; + snd_pcm_mmap_readi : snd_pcm_mmap_readi_t; + snd_pcm_mmap_writei : snd_pcm_mmap_writei_t; + snd_pcm_open : snd_pcm_open_t; + snd_pcm_pause : snd_pcm_pause_t; + snd_pcm_prepare : snd_pcm_prepare_t; + snd_pcm_readi : snd_pcm_readi_t; + snd_pcm_reset : snd_pcm_reset_t; + snd_pcm_resume : snd_pcm_resume_t; + snd_pcm_state : snd_pcm_state_t_t; + snd_pcm_stream : snd_pcm_stream_t_t; + snd_pcm_writei : snd_pcm_writei_t; + +// Mixer types + +type + + psnd_ctl_card_info_t = Pointer; + ppsnd_ctl_card_info_t = ^psnd_ctl_card_info_t; + psnd_ctl_t = Pointer; + ppsnd_ctl_t = ^psnd_ctl_t; + + +type + + snd_ctl_card_info_sizeof_t = function : Integer; cdecl; + snd_ctl_card_info_malloc_t = function(ptr : ppsnd_ctl_card_info_t) : Integer; cdecl; + snd_ctl_card_info_free_t = procedure(obj : psnd_ctl_card_info_t); cdecl; + snd_ctl_card_info_clear_t = procedure(obj : psnd_ctl_card_info_t); cdecl; + snd_ctl_card_info_copy_t = procedure(dst, src : psnd_ctl_card_info_t); cdecl; + snd_ctl_card_info_get_card_t = function(obj : psnd_ctl_card_info_t) : Integer; cdecl; + snd_ctl_card_info_get_id_t = function(obj : psnd_ctl_card_info_t) : PChar; cdecl; + snd_ctl_card_info_get_driver_t = function(obj : psnd_ctl_card_info_t) : PChar; cdecl; + snd_ctl_card_info_get_name_t = function(obj : psnd_ctl_card_info_t) : PChar; cdecl; + snd_ctl_card_info_get_longname_t = function(obj : psnd_ctl_card_info_t) : PChar; cdecl; + snd_ctl_card_info_get_mixername_t = function(obj : psnd_ctl_card_info_t) : PChar; cdecl; + snd_ctl_card_info_get_components_t = function(obj : psnd_ctl_card_info_t) : PChar; cdecl; + + + +implementation + +var + Path : string; + Libhandle : Pointer; + +initialization + + Path := FindLibs(asoundlib_path); + if Path <> '' then Libhandle := dlopen(@Path[1], RTLD_NOW or RTLD_GLOBAL); + if Libhandle <> nil then + begin + AsoundlibLoaded := True; + snd_pcm_close := dlsym(Libhandle, 'snd_pcm_close'); + snd_pcm_drop := dlsym(Libhandle, 'snd_pcm_drop'); + snd_pcm_drain := dlsym(Libhandle, 'snd_pcm_drain'); + snd_pcm_hw_params_malloc := dlsym(Libhandle, 'snd_pcm_hw_params_malloc'); + snd_pcm_hw_params_any := dlsym(Libhandle, 'snd_pcm_hw_params_any'); + snd_pcm_hw_params_get_periods := dlsym(Libhandle, 'snd_pcm_hw_params_get_periods'); + snd_pcm_hw_params_get_period_size := dlsym(Libhandle, 'snd_pcm_hw_params_get_period_size'); + snd_pcm_hw_params_get_rate := dlsym(Libhandle, 'snd_pcm_hw_params_get_rate'); + snd_pcm_hw_params_set_access := dlsym(Libhandle, 'snd_pcm_hw_params_set_access'); + snd_pcm_hw_params_set_buffer_size := dlsym(Libhandle, 'snd_pcm_hw_params_set_buffer_size'); + snd_pcm_hw_params_set_buffer_size_near := dlsym(Libhandle, 'snd_pcm_hw_params_set_buffer_size_near'); + snd_pcm_hw_params_set_channels := dlsym(Libhandle, 'snd_pcm_hw_params_set_channels'); + snd_pcm_hw_params_set_format := dlsym(Libhandle, 'snd_pcm_hw_params_set_format'); + snd_pcm_hw_params_set_period_size_near := dlsym(Libhandle, 'snd_pcm_hw_params_set_period_size_near'); + snd_pcm_hw_params_set_periods_near := dlsym(Libhandle, 'snd_pcm_hw_params_set_periods_near'); + snd_pcm_hw_params_set_rate_near := dlsym(Libhandle, 'snd_pcm_hw_params_set_rate_near'); + snd_pcm_hw_params := dlsym(Libhandle, 'snd_pcm_hw_params'); + snd_pcm_hw_params_free := dlsym(Libhandle, 'snd_pcm_hw_params_free'); + snd_pcm_info_get_device := dlsym(Libhandle, 'snd_pcm_info_get_device'); + snd_pcm_info_get_name := dlsym(Libhandle, 'snd_pcm_info_get_name'); + snd_pcm_info_set_device := dlsym(Libhandle, 'snd_pcm_info_set_device'); + snd_pcm_mmap_readi := dlsym(Libhandle, 'snd_pcm_mmap_readi'); + snd_pcm_mmap_writei := dlsym(Libhandle, 'snd_pcm_mmap_writei'); + snd_pcm_open := dlsym(Libhandle, 'snd_pcm_open'); + snd_pcm_pause := dlsym(Libhandle, 'snd_pcm_pause'); + snd_pcm_prepare := dlsym(Libhandle, 'snd_pcm_prepare'); + snd_pcm_readi := dlsym(Libhandle, 'snd_pcm_readi'); + snd_pcm_reset := dlsym(Libhandle, 'snd_pcm_reset'); + snd_pcm_resume := dlsym(Libhandle, 'snd_pcm_resume'); + snd_pcm_state := dlsym(Libhandle, 'snd_pcm_state'); + snd_pcm_stream := dlsym(Libhandle, 'snd_pcm_stream'); + snd_pcm_writei := dlsym(Libhandle, 'snd_pcm_writei'); + end; + +finalization + + if Libhandle <> nil then dlclose(Libhandle); + + +end. diff --git a/components/acs/Src/drivers/linux/libao.pas b/components/acs/Src/drivers/linux/libao.pas new file mode 100644 index 000000000..b09c7d923 --- /dev/null +++ b/components/acs/Src/drivers/linux/libao.pas @@ -0,0 +1,252 @@ +(* + kylix header for libao library. + translated from ao.h header file + by andrei borovsky, aborovsky@mtu-net.ru + the original header is + original copyright (c) aaron holtzman - may 1999 + modifications copyright (c) stan seibert - july 2000, july 2001 + more modifications copyright (c) jack moffitt - october 2000 +*) + +{ +$Log: libao.pas,v $ +Revision 1.2 2006/01/01 18:46:40 z0m3ie +*** empty log message *** + +Revision 1.1 2005/12/19 18:36:16 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/14 21:19:37 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + + +unit libao; + +interface + +uses + Libc, ACS_Procs; + +var + LibaoLoaded : Boolean = False; + +const + + LibaoPath = 'libao.so*'; // '/usr/lib/libao.so'; + {$DEFINE SEARCH_LIBS} + + AO_TYPE_LIVE = 1; + AO_TYPE_FILE = 2; + AO_ENODRIVER = 1; + AO_ENOTFILE = 2; + AO_ENOTLIVE = 3; + AO_EBADOPTION = 4; + AO_EOPENDEVICE = 5; + AO_EOPENFILE = 6; + AO_EFILEEXISTS = 7; + + AO_EFAIL = 100; + + AO_FMT_LITTLE = 1; + AO_FMT_BIG = 2; + AO_FMT_NATIVE = 4; + +type + + PPChar = array[0..0] of PChar; + + PAOInfo = ^ao_info; + PPAOInfo = ^PAOInfo; + ao_info = record + _type : Integer; // live output or file output? + name : PChar; // full name of driver + short_name : PChar; // short name of driver */ + author : PChar; // driver author + comment : PChar; // driver comment + preferred_byte_format : Integer; + priority : Integer; + options : PPChar; + option_count : Integer; + end; + + PAOFunctions = ^ao_functions; + + PAODevice = ^ao_device; + ao_device = packed record + _type : Integer; // live output or file output? + driver_id : Integer; + funcs : PAOFunctions; + _file : PIOFile; // File for output if this is a file driver + client_byte_format : Integer; + machine_byte_format : Integer; + driver_byte_format : Integer; + swap_buffer : PChar; + swap_buffer_size : Integer; // Bytes allocated to swap_buffer + internal : Pointer; // Pointer to driver-specific data + end; + + PAOSampleFormat = ^ao_sample_format; + ao_sample_format = record + bits : Integer; // bits per sample + rate : Integer; // samples per second (in a single channel) + channels : Integer; // number of audio channels + byte_format : Integer; // Byte ordering in sample, see constants below + end; + + f_test = function : Integer; cdecl; + f_driver_info = function : PAOInfo; cdecl; + f_device_init = function(device : PAODevice) : Integer; cdecl; + f_set_option = function(device : PAODevice; const key, value : PChar) : Integer; cdecl; + f_open = function(device : PAODevice) : Integer; cdecl; + f_play = function(device : PAODevice; const output_samples : PChar; num_bytes : LongWord) : Integer; cdecl; + f_close = function(device : PAODevice) : Integer; cdecl; + f_device_clear = procedure(device : PAODevice); cdecl; + f_file_extension = function : PChar; cdecl; + + ao_functions = packed record + test : f_test; + driver_info : f_driver_info; + device_init : f_device_init; + set_option : f_set_option; + open : f_open; + play : f_play; + close : f_close; + device_clear : f_device_clear; + file_extension : f_file_extension; + end; + + PPAOOption = ^PAOOption; + PAOOption = ^ao_option; + ao_option = record + key : PChar; + value : PChar; + next : PAOOption; + end; + + (* --- Functions --- *) + + (* library setup/teardown *) + + ao_initialize_t = procedure; cdecl; + ao_shutdown_t = procedure; cdecl; + + (* device setup/playback/teardown *) + ao_append_option_t = function(options : PPAOOption; const key, value : PChar) : Integer; cdecl; + ao_free_options_t = procedure(options : PAOOption); cdecl; + ao_open_live_t = function(driver_id : Integer; format : PAOSampleFormat; option : PAOOption) : PAODevice; cdecl; + ao_open_file_t = function(driver_id : Integer; const filename : PChar; overwrite : Integer; format : PAOSampleFormat; option : PAOOption) : PAODevice; cdecl; + + ao_play_t = function(device : PAODevice; output_samples : PChar; num_bytes : LongWord) : Integer; cdecl; + ao_close_t = function(device : PAODevice) : Integer; cdecl; + + (* driver information *) + ao_driver_id_t = function(const short_name : PChar) : Integer; cdecl; + ao_default_driver_id_t = function : Integer; cdecl; + ao_driver_info_t = function(driver_id : Integer) : PAOInfo; cdecl; + ao_driver_info_list_t = function(var driver_count : Integer) : PPAOInfo; cdecl; + // The following function is declared in ao.h but not exported by libao. + //ao_file_extension_t = function(driver_id : Integer) : PChar; cdecl; + + (* miscellaneous *) + ao_is_big_endian_t = function : Integer; cdecl; + +var + + ao_initialize : ao_initialize_t; + ao_shutdown : ao_shutdown_t; + ao_append_option : ao_append_option_t; + ao_free_options : ao_free_options_t; + ao_open_live : ao_open_live_t; + ao_open_file : ao_open_file_t; + ao_play : ao_play_t; + ao_close : ao_close_t; + ao_driver_id : ao_driver_id_t; + ao_default_driver_id : ao_default_driver_id_t; + ao_driver_info : ao_driver_info_t; + ao_driver_info_list : ao_driver_info_list_t; + //ao_file_extension : ao_file_extension_t; + ao_is_big_endian : ao_is_big_endian_t; + + AOInitialized : Integer = 0; + + procedure FreeOptionsList(var OL : PAOOption); + +implementation + +var + Libhandle : Pointer; + +{$IFDEF SEARCH_LIBS} + Path : String; +{$ENDIF} + + +procedure FreeOptionsList(var OL : PAOOption); +var + NextOpt, tmp : PAOOption; +begin + if OL = nil then Exit; + NextOpt := OL; + repeat + tmp := NextOpt; + NextOpt := NextOpt.next; + FreeMem(tmp); + until NextOpt = nil; +end; + +initialization + +{$IFDEF SEARCH_LIBS} + + Libhandle := nil; + Path := FindLibs(LibaoPath); + if Path <> '' then Libhandle := dlopen(@Path[1], RTLD_NOW or RTLD_GLOBAL); + +{$ELSE} + + Libhandle := dlopen(LibaoPath, RTLD_NOW or RTLD_GLOBAL); + +{$ENDIF} + + if Libhandle <> nil then + begin + LibaoLoaded := True; + ao_initialize := dlsym(Libhandle, 'ao_initialize'); + ao_shutdown := dlsym(Libhandle, 'ao_shutdown'); + ao_append_option := dlsym(Libhandle, 'ao_append_option'); + ao_free_options := dlsym(Libhandle, 'ao_free_options'); + ao_open_live := dlsym(Libhandle, 'ao_open_live'); + ao_open_file := dlsym(Libhandle, 'ao_open_file'); + ao_play := dlsym(Libhandle, 'ao_play'); + ao_close := dlsym(Libhandle, 'ao_close'); + ao_driver_id := dlsym(Libhandle, 'ao_driver_id'); + ao_default_driver_id := dlsym(Libhandle, 'ao_default_driver_id'); + ao_driver_info := dlsym(Libhandle, 'ao_driver_info'); + ao_driver_info_list := dlsym(Libhandle, 'ao_driver_info_list'); + //ao_file_extension := dlsym(Libhandle, 'ao_file_extension'); + ao_is_big_endian := dlsym(Libhandle, 'ao_is_big_endian'); + end; + +finalization + + if Libhandle <> nil then + begin + dlclose(Libhandle); + end; + +end. diff --git a/components/acs/Src/drivers/linux/soundcard.pas b/components/acs/Src/drivers/linux/soundcard.pas new file mode 100644 index 000000000..b4189e6a6 --- /dev/null +++ b/components/acs/Src/drivers/linux/soundcard.pas @@ -0,0 +1,515 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: soundcard.pas,v $ +Revision 1.1 2005/12/19 18:36:16 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/14 21:19:37 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + +unit soundcard; + +interface + + + // Supported card ID numbers (OBSOLETE. NOT USED ANY MORE) + +const + + SNDCARD_ADLIB = 1; + SNDCARD_SB = 2; + SNDCARD_PAS = 3; + SNDCARD_GUS = 4; + SNDCARD_MPU401 = 5; + SNDCARD_SB16 = 6; + SNDCARD_SB16MIDI = 7; + SNDCARD_UART6850 = 8; + SNDCARD_GUS16 = 9; + SNDCARD_MSS = 10; + SNDCARD_PSS = 11; + SNDCARD_SSCAPE = 12; + SNDCARD_PSS_MPU = 13; + SNDCARD_PSS_MSS = 14; + SNDCARD_SSCAPE_MSS = 15; + SNDCARD_TRXPRO = 16; + SNDCARD_TRXPRO_SB = 17; + SNDCARD_TRXPRO_MPU = 18; + SNDCARD_MAD16 = 19; + SNDCARD_MAD16_MPU = 20; + SNDCARD_CS4232 = 21; + SNDCARD_CS4232_MPU = 22; + SNDCARD_MAUI = 23; + SNDCARD_PSEUDO_MSS = 24; + SNDCARD_GUSPNP = 25; + SNDCARD_UART401 = 26; + + // Sound card numbers 27 to N are reserved. Don't add more numbers here + + //********************************** + + // IOCTL commands for /dev/dsp and /dev/audio + +const + + SNDCTL_DSP_RESET = $5000; + SNDCTL_DSP_SPEED = $c0045002; + SNDCTL_DSP_STEREO = $c0045003; + SNDCTL_DSP_GETBLKSIZE = $c0045004; + SNDCTL_DSP_SAMPLESIZE = $c0045005; + SNDCTL_DSP_CHANNELS = $c0045006; + SOUND_PCM_WRITE_CHANNELS = $c0045006; + SOUND_PCM_WRITE_FILTER = $c0045007; + SNDCTL_DSP_POST = $5008; + SNDCTL_DSP_SUBDIVIDE = $c0045009; + SNDCTL_DSP_SETFRAGMENT = $c004500a; + +// Audio data formats (Note! U8=8 and S16_LE=16 for compatibility)*/ } + + SNDCTL_DSP_GETFMTS = $8004500b; + SNDCTL_DSP_SETFMT = $c0045005; + + AFMT_QUERY = 0; + AFMT_MU_LAW = 1; + AFMT_A_LAW = 2; + AFMT_IMA_ADPCM = 4; + AFMT_U8 = 8; + AFMT_S16_LE = $10; + AFMT_S16_BE = $20; + AFMT_S8 = $40; + AFMT_U16_LE = $80; + AFMT_U16_BE = $100; + AFMT_MPEG = $200; + + // 32 bit formats (MSB aligned) formats + + AFMT_S32_LE = $1000; + AFMT_S32_BE = $2000; + + // AC3 _compressed_ bitstreams (See Programmer's Guide for details). + + AFMT_AC3 = $4000; + + // 24 bit formats (LSB aligned in 32 bit word) formats*/ } + AFMT_S24_LE = $8000; + AFMT_S24_BE = $10000; + +(* S/PDIF raw format. In this format the S/PDIF frames (including all + control and user bits) are included in the data stream. Each sample + is stored in a 32 bit frame (see IEC-958 for more info). This format + is supported by very few devices and it's only usable for purposes + where full access to the control/user bits is required (real time control). +*) + + AFMT_SPDIF_RAW = $20000; + +type + audio_buf_info = record + fragments: Integer; // of available fragments (partially usend ones not counted) + fragstotal: Integer; // Total # of fragments allocated + fragsize: Integer; // Size of a fragment in bytes + bytes: Integer; // Available space in bytes (includes partially used fragments) + // Note! 'bytes' could be more than fragments*fragsize*/ + end; + +const + + SNDCTL_DSP_GETOSPACE = $8010500c; + SNDCTL_DSP_GETISPACE = $8010500d; + SNDCTL_DSP_NONBLOCK = $500e; + SNDCTL_DSP_GETCAPS = $8004500f; + + DSP_CAP_REVISION = $ff; // Bits for revision level (0 to 255) + DSP_CAP_DUPLEX = $100; // Full duplex record/playback + DSP_CAP_REALTIME = $200; // Not in use + DSP_CAP_BATCH = $400; (* Device has some kind of + internal buffers which may + cause some delays and + decrease precision of timing *) + + DSP_CAP_COPROC = $800; // Has a coprocessor + (* Sometimes it's a DSP + but usually not *) + + DSP_CAP_TRIGGER = $1000; // Supports SETTRIGGER + DSP_CAP_MMAP = $2000; // Supports mmap() + DSP_CAP_MULTI = $4000; // Supports multiple open + DSP_CAP_BIND = $8000; // Supports binding to front/rear/center/lfe + DSP_CAP_INPUT = $10000; // Supports recording + DSP_CAP_OUTPUT = $20000; // Supports playback + DSP_CAP_VIRTUAL = $40000; // Virtuial device + // Analog/digital control capabilities + DSP_CAP_ANALOGOUT = $100000; + DSP_CAP_ANALOGIN = $200000; + DSP_CAP_DIGITALOUT = $400000; + DSP_CAP_DIGITALIN = $800000; + DSP_CAP_ADMASK = $f00000; +(* NOTE! (capabilities & DSP_CAP_ADMASK)==0 means just that the + digital/analog interface control features are not supported by the + device/driver. However the device still supports analog, digital or + both inputs/outputs (depending on the device). See the OSS Programmer's + Guide for full details. *) + + SNDCTL_DSP_GETTRIGGER = $80045010; + SNDCTL_DSP_SETTRIGGER = $40045010; + + PCM_ENABLE_INPUT = 1; + PCM_ENABLE_OUTPUT = 2; + +type + count_info = record + bytes: Integer; // Total # of bytes processed + blocks : Integer; // # of fragment transitions since last time + ptr: Integer; // Current DMA pointer value } + end; + +const + SNDCTL_DSP_GETIPTR = $800c5011; + SNDCTL_DSP_GETOPTR = $800c5012; + +type + buffmem_desc = record + buffer: PWord; + size: Integer; + end; + +const + SNDCTL_DSP_MAPINBUF = $80085013; + SNDCTL_DSP_MAPOUTBUF = $80085014; + SNDCTL_DSP_SETSYNCRO = $5015; + SNDCTL_DSP_SETDUPLEX = $5016; + +// Application's profile defines the way how playback underrun situations should be handled. + +(* APF_NORMAL (the default) and APF_NETWORK make the driver to cleanup the + playback buffer whenever an underrun occurs. This consumes some time + prevents looping the existing buffer. + APF_CPUINTENS is intended to be set by CPU intensive applications which + are likely to run out of time occasionally. In this mode the buffer cleanup is + disabled which saves CPU time but also let's the previous buffer content to + be played during the "pause" after the underrun. *) + +const + SNDCTL_DSP_PROFILE = $40045017; + + APF_NORMAL = 0; // Normal applications + APF_NETWORK = 1; // Underruns probably caused by an 'external' delay + APF_CPUINTENS = 2; // Underruns probably caused by 'overheating' the CPU + + SNDCTL_DSP_GETODELAY = $80045017; + + +type + audio_errinfo = record + play_underruns: Integer; + rec_overruns: Integer; + play_ptradjust: Word; + rec_ptradjust: Word; + play_errorcount: Integer; + rec_errorcount: Integer; + play_lasterror: Integer; + rec_lasterror: Integer; + play_errorparm: LongInt; + rec_errorparm: LongInt; + filler: array[0..15] of Integer; + end; + + +type + oss_digital_control = record + caps: LongWord; // To be defined } + valid : LongWord; + cbitin: array[0..23] of Byte; + ubitin: array[0..23] of Byte; + cbitout: array[0..23] of Byte; + ubitout: array[0..23] of Byte; + outsel: LongWord; + in_data: Integer; // Audio/data if autodetectable by the receiver + in_locked: Integer; // Receiver locked + in_quality: Integer; // Input signal quality + in_vbit, out_vbit: Integer; // V bits + in_errors: LongWord; // Various input errro conditions + end; + +const + + DIG_CBITIN_LIMITED = $00000001; + DIG_CBITIN_DATA = $00000002; + DIG_CBITIN_BYTE0 = $00000004; + DIG_CBITIN_FULL = $00000008; + DIG_CBITIN_MASK = $0000000; + DIG_CBITOUT_LIMITED = $00000010; + DIG_CBITOUT_BYTE0 = $00000020; + DIG_CBITOUT_FULL = $00000040; + DIG_CBITOUT_DATA = $00000080; + DIG_CBITOUT_MASK = $000000f0; + DIG_UBITIN = $00000100; + DIG_UBITOUT = $00000200; + + VAL_CBITIN = $01; + VAL_UBITIN = $02; + VAL_CBITOUT = $04; + VAL_UBITOUT = $08; + VAL_ISTATUS = $10; + + OUTSEL_DIGITAL = 1; + OUTSEL_ANALOG = 2; + OUTSEL_BOTH = (OUTSEL_DIGITAL or OUTSEL_ANALOG); + + IND_UNKNOWN = 0; + IND_AUDIO = 1; + IND_DATA = 2; + + LOCK_NOT_INDICATED = 0; + LOCK_UNLOCKED = 1; + LOCK_LOCKED = 2; + IN_QUAL_NOT_INDICATED = 0; + IN_QUAL_POOR = 1; + IN_QUAL_GOOD = 2; + + VBIT_NOT_INDICATED = 0; + VBIT_OFF = 1; + VBIT_ON = 2; + + INERR_CRC = $0001; + INERR_QCODE_CRC = $0002; + INERR_PARITY = $0004; + INERR_BIPHASE = $0008; + +type + oss_syncgroup = record + id: Integer; + mode: Integer; + end; + +const + + SNDCTL_DSP_GETCHANNELMASK = $c0045040; + SNDCTL_DSP_BIND_CHANNEL = $c0045041; + + DSP_BIND_QUERY = 0; + DSP_BIND_FRONT = 1; + DSP_BIND_SURR = 2; + DSP_BIND_CENTER_LFE = 4; + DSP_BIND_HANDSET = 8; + DSP_BIND_MIC = $10; + DSP_BIND_MODEM1 = $20; + DSP_BIND_MODEM2 = $40; + DSP_BIND_I2S = $80; + DSP_BIND_SPDIF = $100; + +// Mixer devices + +(* There can be up to 20 different analog mixer channels. The } + SOUND_MIXER_NRDEVICES gives the currently supported maximum. + The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells + the devices supported by the particular mixer. +*) + +const + + SOUND_MIXER_NRDEVICES = 28; + SOUND_MIXER_VOLUME = 0; + SOUND_MIXER_BASS = 1; + SOUND_MIXER_TREBLE = 2; + SOUND_MIXER_SYNTH = 3; + SOUND_MIXER_PCM = 4; + SOUND_MIXER_SPEAKER = 5; + SOUND_MIXER_LINE = 6; + SOUND_MIXER_MIC = 7; + SOUND_MIXER_CD = 8; + SOUND_MIXER_IMIX = 9; // Recording monitor + SOUND_MIXER_ALTPCM = 10; + SOUND_MIXER_RECLEV = 11; // Recording level + SOUND_MIXER_IGAIN = 12; // Input gain + SOUND_MIXER_OGAIN = 13; // Output gain + +(* The AD1848 codec and compatibles have three line level inputs + (line, aux1 and aux2). Since each card manufacturer have assigned + different meanings to these inputs, it's inpractical to assign + specific meanings (line, cd, synth etc.) to them. *) + + SOUND_MIXER_LINE1 = 14; // Input source 1 (aux1) + SOUND_MIXER_LINE2 = 15; // Input source 2 (aux2) + SOUND_MIXER_LINE3 = 16; // Input source 3 (line) + SOUND_MIXER_DIGITAL1 = 17; // Digital (input) + SOUND_MIXER_DIGITAL2 = 18; // Digital (input) 2 + SOUND_MIXER_DIGITAL3 = 19; // Digital (input) 3 + SOUND_MIXER_PHONEIN = 20; // Phone input + SOUND_MIXER_PHONEOUT = 21; // Phone output + SOUND_MIXER_VIDEO = 22; // Video/TV (audio) in + SOUND_MIXER_RADIO = 23; // Radio in + SOUND_MIXER_MONITOR = 24; // Monitor (usually mic) volume + SOUND_MIXER_DEPTH = 25; // 3D 'depth'/'space' parameter + SOUND_MIXER_CENTER = 26; // 3D 'center' parameter + SOUND_MIXER_MIDI = 27; // Alternative for 'synth' + +(* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) + Not counted to SOUND_MIXER_NRDEVICES, but use the same number space *) + + SOUND_ONOFF_MIN = 28; + SOUND_ONOFF_MAX = 30; + +// Note! Number 31 cannot be used since the sign bit is reserved + + SOUND_MIXER_NONE = 31; + +(* The following unsupported macros are no longer functional. + Use SOUND_MIXER_PRIVATE# macros in future. *) + + SOUND_MIXER_ENHANCE = SOUND_MIXER_NONE; + SOUND_MIXER_MUTE = SOUND_MIXER_NONE; + SOUND_MIXER_LOUD = SOUND_MIXER_NONE; + + + + SOUND_DEVICE_LABELS : array[0..27] of PChar = ('Vol ', 'Bass ', 'Trebl', 'Synth', 'Pcm ', 'Spkr ', 'Line ', + 'Mic ', 'CD ', 'Mix ', 'Pcm2 ', 'Rec ', 'IGain', 'OGain', + 'Line1', 'Line2', 'Line3', 'Digital1', 'Digital2', 'Digital3', + 'PhoneIn', 'PhoneOut', 'Video', 'Radio', 'Monitor', + 'Depth', 'Center', 'MIDI'); + + + SOUND_DEVICE_NAMES : array[0..27] of PChar = ('vol', 'bass', 'treble', 'synth', 'pcm', 'speaker', 'line', + 'mic', 'cd', 'mix', 'pcm2', 'rec', 'igain', 'ogain', + 'line1', 'line2', 'line3', 'dig1', 'dig2', 'dig3', + 'phin', 'phout', 'video', 'radio', 'monitor', + 'depth', 'center', 'midi'); + +// Device bitmask identifiers + + SOUND_MIXER_RECSRC = $ff; // Arg contains a bit for each recording source + SOUND_MIXER_DEVMASK = $fe; // Arg contains a bit for each supported device + SOUND_MIXER_RECMASK = $fd; // Arg contains a bit for each supported recording source + SOUND_MIXER_CAPS = $fc; + SOUND_CAP_EXCL_INPUT = $1; // Only one recording source at a time + + SOUND_MIXER_STEREODEVS = $fb; // Mixer channels supporting stereo + +// OSS/Free ONLY + SOUND_MIXER_OUTSRC = $fa; // Arg contains a bit for each input source to output + SOUND_MIXER_OUTMASK = $f9; // Arg contains a bit for each supported input source to output +// OSS/Free ONLY + +// Device mask bits + + SOUND_MASK_VOLUME = 1 shl SOUND_MIXER_VOLUME; + SOUND_MASK_BASS = 1 shl SOUND_MIXER_BASS; + SOUND_MASK_TREBLE = 1 shl SOUND_MIXER_TREBLE; + SOUND_MASK_SYNTH = 1 shl SOUND_MIXER_SYNTH; + SOUND_MASK_PCM = 1 shl SOUND_MIXER_PCM; + SOUND_MASK_SPEAKER = 1 shl SOUND_MIXER_SPEAKER; + SOUND_MASK_LINE = 1 shl SOUND_MIXER_LINE; + SOUND_MASK_MIC = 1 shl SOUND_MIXER_MIC; + SOUND_MASK_CD = 1 shl SOUND_MIXER_CD; + SOUND_MASK_IMIX = 1 shl SOUND_MIXER_IMIX; + SOUND_MASK_ALTPCM = 1 shl SOUND_MIXER_ALTPCM; + SOUND_MASK_RECLEV = 1 shl SOUND_MIXER_RECLEV; + SOUND_MASK_IGAIN = 1 shl SOUND_MIXER_IGAIN; + SOUND_MASK_OGAIN = 1 shl SOUND_MIXER_OGAIN; + SOUND_MASK_LINE1 = 1 shl SOUND_MIXER_LINE1; + SOUND_MASK_LINE2 = 1 shl SOUND_MIXER_LINE2; + SOUND_MASK_LINE3 = 1 shl SOUND_MIXER_LINE3; + SOUND_MASK_DIGITAL1 = 1 shl SOUND_MIXER_DIGITAL1; + SOUND_MASK_DIGITAL2 = 1 shl SOUND_MIXER_DIGITAL2; + SOUND_MASK_DIGITAL3 = 1 shl SOUND_MIXER_DIGITAL3; + SOUND_MASK_PHONEIN = 1 shl SOUND_MIXER_PHONEIN; + SOUND_MASK_PHONEOUT = 1 shl SOUND_MIXER_PHONEOUT; + SOUND_MASK_RADIO = 1 shl SOUND_MIXER_RADIO; + SOUND_MASK_VIDEO = 1 shl SOUND_MIXER_VIDEO; + SOUND_MASK_MONITOR = 1 shl SOUND_MIXER_MONITOR; + SOUND_MASK_DEPTH = 1 shl SOUND_MIXER_DEPTH; + SOUND_MASK_CENTER = 1 shl SOUND_MIXER_CENTER; + SOUND_MASK_MIDI = 1 shl SOUND_MIXER_MIDI; + + SOUND_MIXER_READ_VOLUME = $80044d00; + SOUND_MIXER_READ_BASS = $80044d01; + SOUND_MIXER_READ_TREBLE = $80044d02; + SOUND_MIXER_READ_SYNTH = $80044d03; + SOUND_MIXER_READ_PCM = $80044d04; + SOUND_MIXER_READ_SPEAKER = $80044d05; + SOUND_MIXER_READ_LINE = $80044d06; + SOUND_MIXER_READ_MIC = $80044d07; + SOUND_MIXER_READ_CD = $80044d08; + SOUND_MIXER_READ_IMIX = $80044d09; + SOUND_MIXER_READ_ALTPCM = $80044d0a; + SOUND_MIXER_READ_RECLEV = $80044d0b; + SOUND_MIXER_READ_IGAIN = $80044d0c; + SOUND_MIXER_READ_OGAIN = $80044d0d; + SOUND_MIXER_READ_LINE1 = $80044d0e; + SOUND_MIXER_READ_LINE2 = $80044d0f; + SOUND_MIXER_READ_LINE3 = $80044d10; + SOUND_MIXER_READ_RECSRC = $80044dff; + SOUND_MIXER_READ_RECMASK = $80044dfd; + SOUND_MIXER_READ_DEVMASK = $80044dfe; + SOUND_MIXER_READ_STEREODEVS = $80044dfb; + SOUND_MIXER_READ_CAPS = $80044dfc; + + SOUND_MIXER_WRITE_VOLUME = $c0044d00; + SOUND_MIXER_WRITE_BASS = $c0044d01; + SOUND_MIXER_WRITE_TREBLE = $c0044d02; + SOUND_MIXER_WRITE_SYNTH = $c0044d03; + SOUND_MIXER_WRITE_PCM = $c0044d04; + SOUND_MIXER_WRITE_SPEAKER = $c0044d05; + SOUND_MIXER_WRITE_LINE = $c0044d06; + SOUND_MIXER_WRITE_MIC = $c0044d07; + SOUND_MIXER_WRITE_CD = $c0044d08; + SOUND_MIXER_WRITE_IMIX = $c0044d09; + SOUND_MIXER_WRITE_ALTPCM = $c0044d0a; + SOUND_MIXER_WRITE_RECLEV = $c0044d0b; + SOUND_MIXER_WRITE_IGAIN = $c0044d0c; + SOUND_MIXER_WRITE_OGAIN = $c0044d0d; + SOUND_MIXER_WRITE_LINE1 = $c0044d0e; + SOUND_MIXER_WRITE_LINE2 = $c0044d0f; + SOUND_MIXER_WRITE_LINE3 = $c0044d10; + SOUND_MIXER_WRITE_RECSRC = $c0044dff; + SOUND_MIXER_INFO = $805c4d65; + +type + mixer_info = record + id: array[0..15] of Char; + name: array[0..31] of Char; + modify_counter: Integer; + fillers: array[0..9] of Integer; + end; + +const + SOUND_MIXER_ACCESS = $c0804d66; + SOUND_MIXER_GETLEVELS = $c0a44d74; + SOUND_MIXER_SETLEVELS = $c0a44d75; + +(* SOUND_MIXER_GETLEVELS and SOUND_MIXER_SETLEVELS calls can be used + for querying current mixer settings from the driver and for loading + default volume settings _prior_ activating the mixer (loading + doesn't affect current state of the mixer hardware). These calls + are for internal use only. *) + +type + mixer_vol_table = record + num: Integer; // Index to volume table + name: array[0..31] of Char; + levels: array[0..31] of Integer; + end; + +implementation +end. diff --git a/components/acs/Src/drivers/windows/acs_audio.inc b/components/acs/Src/drivers/windows/acs_audio.inc new file mode 100644 index 000000000..c539dba7b --- /dev/null +++ b/components/acs/Src/drivers/windows/acs_audio.inc @@ -0,0 +1,408 @@ +{ +$Log: acs_audio.inc,v $ +Revision 1.7 2006/08/31 20:10:56 z0m3ie +*** empty log message *** + +Revision 1.6 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.3 2006/01/01 18:46:40 z0m3ie +*** empty log message *** + +Revision 1.2 2005/12/26 17:31:39 z0m3ie +fixed some problems in acs_dsfiles +fixed some problems in acs_vorbis +reworked all buffers + +Revision 1.1 2005/12/19 18:36:26 z0m3ie +*** empty log message *** + +Revision 1.6 2005/12/18 17:01:54 z0m3ie +delphi compatibility + +Revision 1.5 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.4 2005/11/27 16:50:34 z0m3ie +add ACS VolumeQuerry +make ACS_VolumeQuerry localizeable +some little errorfixes (buffersize for linuxdrivers was initially 0) +make TAudioIn workable + +Revision 1.3 2005/10/02 16:51:31 z0m3ie +*** empty log message *** + +Revision 1.2 2005/09/18 19:29:00 z0m3ie +more progress on driver handling + +} + + +function GetAudioDeviceInfo(DevID : Integer; OutputDev : Boolean) : TACSDeviceInfo; +var + WIC : TWaveInCaps; + i : Integer; +begin + if OutputDev then + begin + if DevID >= OutputChannelsCount then + raise EACSException.Create(Format(strChannelnotavailable,[DevId])); + end else + begin + if DevID >= InputChannelsCount then + raise EACSException.Create(Format(strChannelnotavailable,[DevId])); + end; + if OutputDev then waveOutGetDevCaps(DevID, @WIC, SizeOf(WIC)) + else waveInGetDevCaps(DevID, @WIC, SizeOf(WIC)); + i := 0; + while WIC.szPname[i] <> #0 do Inc(i); + SetLength(Result.DeviceName, i); + Move(WIC.szPname[0], Result.DeviceName[1], i); + Result.Formats := []; + if (WIC.dwFormats and WAVE_FORMAT_1M08) <> 0 then Result.Formats := Result.Formats + [af1M08]; + if (WIC.dwFormats and WAVE_FORMAT_1M16) <> 0 then Result.Formats := Result.Formats + [af1M16]; + if (WIC.dwFormats and WAVE_FORMAT_1S08) <> 0 then Result.Formats := Result.Formats + [af1S08]; + if (WIC.dwFormats and WAVE_FORMAT_1S16) <> 0 then Result.Formats := Result.Formats + [af1S16]; + if (WIC.dwFormats and WAVE_FORMAT_2M08) <> 0 then Result.Formats := Result.Formats + [af2M08]; + if (WIC.dwFormats and WAVE_FORMAT_2M16) <> 0 then Result.Formats := Result.Formats + [af2M16]; + if (WIC.dwFormats and WAVE_FORMAT_2S08) <> 0 then Result.Formats := Result.Formats + [af2S08]; + if (WIC.dwFormats and WAVE_FORMAT_2S16) <> 0 then Result.Formats := Result.Formats + [af2S16]; + if (WIC.dwFormats and WAVE_FORMAT_4M08) <> 0 then Result.Formats := Result.Formats + [af4M08]; + if (WIC.dwFormats and WAVE_FORMAT_4M16) <> 0 then Result.Formats := Result.Formats + [af4M16]; + if (WIC.dwFormats and WAVE_FORMAT_4S08) <> 0 then Result.Formats := Result.Formats + [af4S08]; + if (WIC.dwFormats and WAVE_FORMAT_4S16) <> 0 then Result.Formats := Result.Formats + [af4S16]; + Result.DrvVersion := WIC.vDriverVersion; + if WIC.wChannels = 1 then Result.Stereo := False else Result.Stereo := True; +end; + +procedure WaveOutProc(hwo, Msg : LongWord; Instance : Pointer; Param1, Param2 : LongWord); stdcall; +var + Audio : TStdAudioOut; +begin + EnterCriticalSection(CrSecO); + if Msg = WOM_DONE then + begin + Audio := TStdAudioOut(Instance); + Audio.AddBlockToChain(PWaveHdr(Param1)); + end; + LeaveCriticalSection(CrSecO); +end; + +procedure WaveInProc(hwi, Msg : LongWord; Instance : Pointer; Param1, Param2 : LongWord); stdcall; +var + Audio : TStdAudioIn; +begin + EnterCriticalSection(CrSecI); + if Msg = WIM_DATA then + begin + Audio := TStdAudioIn(Instance); + Audio.AddBlockToChain(PWaveHdr(Param1)); + end; + LeaveCriticalSection(CrSecI); +end; + +procedure TStdAudioOut.AddBlockToChain(WH : PWaveHdr); +begin + WH.lpNext := nil; + EOC^ := WH; + EOC := @WH.lpNext; + Dec(aBlock); +end; + +procedure TStdAudioOut.SetDevice; +begin + if Busy then raise EACSException.Create(strBusy); + if OutputChannelsCount = 0 then FBaseChannel := 0 else + if Ch < OutputChannelsCount then FBaseChannel := Ch + else raise EACSException.Create(Format(strChannelnotavailable,[Ch])); +end; + +procedure TStdAudioOut.Prepare; +var + WF : TPCMWaveFormat; +begin + // No exceptions here! + FInput.Init; + WF.wf.wFormatTag := WAVE_FORMAT_PCM; + WF.wf.nChannels := FInput.Channels; + WF.wf.nSamplesPerSec := FInput.SampleRate; + WF.wBitsPerSample := FInput.BitsPerSample; + WF.wf.nAvgBytesPerSec := WF.wf.nSamplesPerSec*WF.wBitsPerSample div 8; + WF.wf.nBlockAlign := WF.wf.nChannels * WF.wBitsPerSample div 8; + waveOutOpen(@_audio_fd, FBaseChannel, @WF, DWORD(@WaveOutProc), DWORD(Self), CALLBACK_FUNCTION or WAVE_MAPPED); + aBlock := 0; + FBuffer := AllocMem(FBufferSize); + EOC := @BlockChain; +end; + +procedure TStdAudioOut.Done; +var + Tmp : PWaveHdr; +begin + if _audio_fd <> -1 then + begin + while aBlock > 0 do; + Tmp := BlockChain; + while Tmp <> nil do + begin + BlockChain := Tmp.lpNext; + waveOutUnprepareHeader(_audio_fd, Tmp, SizeOf(TWaveHdr)); + FreeMem(Tmp.lpData); + Dispose(Tmp); + Tmp := BlockChain; + end; + EOC := @BlockChain; + waveOutClose(_audio_fd); + FreeMem(FBuffer); + _audio_fd := -1; + end; + FInput.Flush; +end; + +function TStdAudioOut.DoOutput(Abort : Boolean):Boolean; +var + Len, i, k, vCoef : Integer; + P : Pointer; + P1 : PACSBuffer8; + P2 : PACSBuffer16; + Tmp : PWaveHdr; +begin + // No exceptions Here + Result := True; + if not Busy then Exit; + if Abort or (not CanOutput) then + begin + Result := False; + Exit; + end; + Tmp := BlockChain; // clear pending data blocks + while Tmp <> nil do + begin + BlockChain := Tmp.lpNext; + waveOutUnprepareHeader(_audio_fd, Tmp, SizeOf(TWaveHdr)); + FreeMem(Tmp.lpData); + Dispose(Tmp); + Tmp := BlockChain; + end; + EOC := @BlockChain; + (* Write more than one block. This is needed for audio sources like + Vorbis codec that return data in small chunks. *) + for k := aBlock to FReadChunks do + begin + GetMem(P, FBufferSize div FReadChunks); + while InputLock do; + InputLock := True; + Len := Finput.GetData(P, FBufferSize div FReadChunks); + InputLock := False; + if Len > 0 then Result := True + else + begin + Result := False; + FreeMem(P); + Exit; + end; + if FVolume < 255 then + begin + vCoef := Round(FVolume/255); + if FInput.BitsPerSample = 16 then + begin + P2 := P; + for i := 0 to (Len shr 1) -1 do + P2[i] := P2[i]*vCoef; + end else + begin + P1 := P; + for i := 0 to Len - 1 do + P1[i] := P1[i]*vCoef; + end; + end; + WriteBlock(P, Len); + end; +end; + +constructor TStdAudioOut.Create; +begin + inherited Create(AOwner); + FBaseChannel := 0; + FVolume := 255; + _audio_fd := -1; + Delay := 6; + FReadChunks := 8; + FBufferSize := $8000; +end; + +destructor TStdAudioOut.Destroy; +begin + if _audio_fd <> -1 then WaveOutClose(_audio_fd); + inherited Destroy; +end; + +destructor TStdAudioIn.Destroy; +begin + waveInClose(_audio_fd); + inherited Destroy; +end; + +procedure TStdAudioIn.OpenAudio; +var + WF : TPCMWaveFormat; +begin + WF.wf.wFormatTag := WAVE_FORMAT_PCM; + WF.wf.nChannels := FChan; + WF.wf.nSamplesPerSec := FFreq; + WF.wBitsPerSample := FBPS; + WF.wf.nAvgBytesPerSec := WF.wf.nSamplesPerSec*WF.wBitsPerSample div 8; + WF.wf.nBlockAlign := WF.wf.nChannels * WF.wBitsPerSample div 8; + if FOpened = 0 then + begin + waveInOpen(@_audio_fd, FBaseChannel, @WF, DWORD(@WaveInProc), DWORD(Self), CALLBACK_FUNCTION or WAVE_MAPPED); + end; + Inc(FOpened); +end; + +procedure TStdAudioIn.CloseAudio; +begin + if FOpened = 1 then + begin + waveInClose(_audio_fd); + FreeMem(FBuffer); + end; + if FOpened > 0 then Dec(FOpened); +end; + +function TStdAudioIn.GetBPS : Integer; +begin + Result := FBPS; +end; + +function TStdAudioIn.GetCh : Integer; +begin + Result := FChan; +end; + +function TStdAudioIn.GetSR : Integer; +begin + Result := FFreq; +end; + +procedure TStdAudioIn.Init; +begin + if Busy then raise EACSException.Create(strBusy); + BufEnd := 0; + BufStart := 1; + FPosition := 0; + FRecBytes := FRecTime * (GetBPS div 8) * GetCh * GetSR; + FBusy := True; + OpenAudio; + waveInStart(_audio_fd); + BlockChain := nil; + FSize := FRecBytes; + aBlock := 0; + EOC := @BlockChain; +end; + +procedure TStdAudioIn.Flush; +var + Tmp : PWaveHdr; +begin + while aBlock > 0 do; // wait until pending data blocks are put to the chain + waveInReset(_audio_fd); // return all pending data blocks + sleep(10); + Tmp := BlockChain; // clear pending data blocks + while Tmp <> nil do + begin + BlockChain := Tmp.lpNext; + waveInUnprepareHeader(_audio_fd, Tmp, SizeOf(TWaveHdr)); + FreeMem(Tmp.lpData); + Dispose(Tmp); + Tmp := BlockChain; + end; + CloseAudio; + FBusy := False; +end; + +procedure TStdAudioIn.SetDevice; +begin + if Busy then raise EACSException.Create(strBusy); + if Ch < InputChannelsCount then FBaseChannel := Ch + else raise EACSException.Create(Format(strChannelnotavailable,[Ch])); +end; + +function TStdAudioIn.GetData(Buffer : Pointer; oBufferSize : Integer): Integer; +var + Tmp : PWaveHdr; +begin + if not Busy then raise EACSException.Create(strStreamnotopen); + if FRecBytes >= 0 then + if (FPosition >= FRecBytes) then + begin + Result := 0; + Exit; + end; + while aBlock < FBlocksCount do + NewBlock; + if BufStart > BufEnd then + begin + BufStart := 1; + while BlockChain = nil do + sleep(10); + TMP := BlockChain; + BlockChain := BlockChain.lpNext; + if BlockChain = nil then + EOC := @BlockChain; + Move(Tmp.lpData[0], FBuffer[1], Tmp.dwBytesRecorded); + BufEnd := Tmp.dwBytesRecorded; + waveInUnprepareHeader(_audio_fd, Tmp, SizeOf(TWaveHdr)); + FreeMem(Tmp.lpData); + Dispose(Tmp); + end; + if BufferSize < (BufEnd - BufStart + 1) then + Result := BufferSize + else + Result := BufEnd - BufStart + 1; + Move(FBuffer[BufStart], Buffer^, Result); + Inc(BufStart, Result); + Inc(FPosition, Result); +end; + +procedure TStdAudioOut.WriteBlock; +var + WH : PWaveHdr; +begin + Inc(aBlock); + New(WH); + WH.lpData := P; + WH.dwBufferLength := Len; + WH.dwLoops := 0; + WH.dwFlags := 0; + waveOutPrepareHeader(_audio_fd, WH, SizeOf(TWaveHdr)); + waveOutWrite(_audio_fd, WH, SizeOf(TWaveHdr)); +end; + +procedure TStdAudioIn.NewBlock; +var + WH : PWaveHdr; +begin + New(WH); + GetMem(WH.lpData, BufferSize div FBlocksCount); + WH.dwBufferLength := BufferSize div FBlocksCount; + WH.dwFlags := 0; + waveInPrepareHeader(_audio_fd, WH, SizeOf(TWaveHdr)); + waveInAddBuffer(_audio_fd, WH, SizeOf(TWaveHdr)); + Inc(aBlock); +end; + +function CountChannels : Integer; +begin + OutputChannelsCount := waveOutGetNumDevs; + InputChannelsCount := waveInGetNumDevs; +end; + +procedure TStdAudioIn.AddBlockToChain(WH : PWaveHdr); +begin + WH.lpNext := nil; + EOC^ := WH; + EOC := @WH.lpNext; + Dec(aBlock); +end; + diff --git a/components/acs/Src/fileformats/acs_allformats.pas b/components/acs/Src/fileformats/acs_allformats.pas new file mode 100644 index 000000000..c95fea23c --- /dev/null +++ b/components/acs/Src/fileformats/acs_allformats.pas @@ -0,0 +1,20 @@ +unit acs_allformats; + +interface + +uses + ACS_Vorbis, + {$IFDEF MSWINDOWS} + ACS_DSFiles, + ACS_MAC, + {$ELSE} + acs_mpeg, + {$ENDIF} + ACS_FLAC, + ACS_LAME, + ACS_Wave; + +implementation + +end. + diff --git a/components/acs/Src/fileformats/acs_dsaudio.pas b/components/acs/Src/fileformats/acs_dsaudio.pas new file mode 100644 index 000000000..7811fe599 --- /dev/null +++ b/components/acs/Src/fileformats/acs_dsaudio.pas @@ -0,0 +1,336 @@ +(* + this file is a part of audio components suite v 2.4. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: acs_dsaudio.pas,v $ +Revision 1.1 2005/12/19 18:36:38 z0m3ie +*** empty log message *** + +Revision 1.3 2005/11/28 21:57:24 z0m3ie +mostly FileOut fixes +moved PBuffer to PBuffer8 +set all to dynamically Buffering + +Revision 1.2 2005/09/13 04:04:50 z0m3ie +First release without Components for Fileformats +only TFileIn and TFileOut are Visible + +Revision 1.1 2005/09/13 03:13:57 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.4 2005/09/11 18:06:26 z0m3ie +first working Version + +Revision 1.3 2005/09/10 08:25:40 z0m3ie +*** empty log message *** + +Revision 1.2 2005/09/07 21:13:24 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/07 20:53:22 z0m3ie +begon to add MPEG and WMA support using DirectX + +} +unit acs_dsaudio; + +{$ifdef linux}{$message error 'unit not supported'}{$endif linux} + +{$DEFINE DYNAMIC_LINK_ALL} + +interface + +uses + ACS_File,ACS_Classes,DirectShow9,Classes,ActiveX,MMSystem,Windows; + +const + BUF_SIZE = $8000; // 32k + +type + { TDSIn } + + TDSIn = class(TACSFileIn) + private + buf : PBuffer8; // ring buffer + FxFormat: TWaveFormatEx; + FxAMMultiMediaStream: IAMMultiMediaStream; + FxGraphBuilder: IGraphBuilder; + FxMediaSeeking: IMediaSeeking; + FxMediaControl: IMediaControl; + FxAudioMediaStream: IAudioMediaStream; + FxMediaStream: IMediaStream; + FxAudioStreamSample: IAudioStreamSample; + FxAudioData: IAudioData; + FxBuffer: Pointer; + FxBufferSize: DWord; + FDuration, + FxPosition, + FxSelStart, + FxSelLength, + FxLastReadingStartTime, + FxLastReadingEndTime : Stream_Time; + FSeekScale : Integer; + function Read(const Buffer; xSize: DWord): DWord; + procedure SetPosition( Value: STREAM_TIME ); + protected + procedure OpenFile; override; + procedure CloseFile; override; + + procedure Init; override; + procedure Flush; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + function Seek(SampleNum : Integer) : Boolean; override; + end; + +const + DSUSER_HRESULT = HResult($08000000); + DSUSER_INVALIDSIZE = DSUSER_HRESULT + 1; + +function ErrorCheck( Value: HRESULT ): HRESULT; { Check the result of a COM operation } + +implementation + +procedure TDSIn.OpenFile; +var + v : WideString; +begin + FValid := True; + if FOpened = 0 then + begin + ErrorCheck( CoCreateInstance( CLSID_AMMultiMediaStream, nil, CLSCTX_INPROC_SERVER,IID_IAMMultiMediaStream, FxAMMultiMediaStream ) ); + ErrorCheck( FxAMMultiMediaStream.Initialize(STREAMTYPE_READ, AMMSF_NOGRAPHTHREAD, nil) ); + ErrorCheck( FxAMMultiMediaStream.AddMediaStream(nil, @MSPID_PrimaryAudio, 0, FxMediaStream) ); + ErrorCheck( FxAMMultiMediaStream.GetMediaStream(MSPID_PrimaryAudio, FxMediaStream) ); + v := FFileName; + ErrorCheck( FxAMMultiMediaStream.OpenFile(PWideChar(v), 0) ); + ErrorCheck( FxAMMultiMediaStream.GetFilterGraph(FxGraphBuilder) ); + ErrorCheck( FxGraphBuilder.QueryInterface(IID_IMediaControl, FxMediaControl) ); + ErrorCheck( FxGraphBuilder.QueryInterface(IID_IMediaSeeking, FxMediaSeeking) ); + ErrorCheck( FxMediaStream.QueryInterface(IID_IAudioMediaStream, FxAudioMediaStream) ); + ErrorCheck( FxAudioMediaStream.GetFormat(FxFormat) ); + ErrorCheck( CoCreateInstance(CLSID_AMAudioData, nil, CLSCTX_INPROC_SERVER,IID_IAudioData, FxAudioData) ); + ErrorCheck( FxAudioData.SetFormat(FxFormat) ); + ErrorCheck( FxAudioMediaStream.CreateSample(FxAudioData, 0, FxAudioStreamSample) ); + ErrorCheck( FxAMMultiMediaStream.GetDuration(FDuration) ); + ErrorCheck( FxAMMultiMediaStream.SetState( STREAMSTATE_RUN ) ); + FxSelLength := 0; + FSR := FxFormat.nSamplesPerSec; + FBPS := FxFormat.wBitsPerSample; + FChan := FxFormat.nChannels; + FTotalSamples := FSize; + FSeekable := TRUE; + FSize := (FDuration div 10000000) * + FxFormat.nSamplesPerSec * + FxFormat.nChannels * + FxFormat.wBitsPerSample div 8; + FSeekScale := FDuration div FSize; + end; + Inc(FOpened); +end; + +procedure TDSIn.CloseFile; +begin + if FOpened = 1 then + begin + if Assigned(FxAMMultiMediaStream) then + ErrorCheck( FxAMMultiMediaStream.SetState( STREAMSTATE_STOP ) ); + FxAudioStreamSample := nil; + FxAudioData := nil; + FxAudioMediaStream := nil; + FxMediaStream := nil; + FxMediaSeeking := nil; + FxMediaControl := nil; + FxGraphBuilder := nil; + FxAMMultiMediaStream := nil; + end; + if FOpened > 0 then Dec(FOpened); +end; + +function TDSIn.GetData(Buffer: Pointer; BufferSize: Integer): Integer; +var + nDone : Integer; + nOffs : Integer; +begin + if not Busy then raise EACSException.Create('The Stream is not opened'); + if BufStart > BufEnd then + begin + if FOffset <> 0 then + begin + FPosition := FOffset; + if FPosition < 0 then + FPosition := 0 + else if FPosition > FSize then + FPosition := FSize; + SetPosition(Int64(FPosition) * FSeekScale); + FOffset := 0; + end; + BufStart := 1; + nDone := Read(Buf^, BUF_SIZE); + if nDone = 0 then + begin + if FLoop then + begin + SetPosition(0); // just rewind + nDone := Read(Buf^, BUF_SIZE); + end else + begin + Result := 0; + Exit; + end; + end; + BufEnd := nDone; + end; + + if BufferSize < (BufEnd - BufStart + 1) then + Result := BufferSize + else + Result := BufEnd - BufStart + 1; + + Move(Buf^[BufStart], Buffer^, Result); + Inc(BufStart, Result); + Inc(FPosition, Result); +end; + +constructor TDSIn.Create(AOwner: TComponent); +var + AMovie: IGraphBuilder; +begin + QzInitialize(nil); + ErrorCheck(CoCreateInstance( CLSID_FilterGraph, nil, CLSCTX_INPROC_SERVER,IID_IGraphBuilder, AMovie)); + inherited Create(AOwner); +end; + +destructor TDSIn.Destroy; +begin + inherited Destroy; +end; + +procedure TDSIn.Init; +begin + inherited Init; + GetMem(Buf, BUF_SIZE); +end; + +procedure TDSIn.Flush; +begin + FreeMem(Buf); + inherited Flush; +end; + +function TDSIn.Seek(SampleNum: Integer): Boolean; +begin + FOffset := SampleNum; +end; + +function TDSIn.Read(const Buffer; xSize: DWord): DWord; +var + hr : DWord; + Tmp: STREAM_TIME; +begin + Result := 0; + if (xSize <= 0) then ErrorCheck(DSUSER_INVALIDSIZE); + if (FxSelLength <> 0) and (FxPosition >= FxSelStart + FxSelLength) then exit; + if (@Buffer <> FxBuffer) or (xSize <> FxBufferSize) then + begin + FxBuffer := @Buffer; + FxBufferSize := xSize; + ErrorCheck( FxAudioData.SetBuffer( FxBufferSize, FxBuffer, 0 ) ); + end; + hr := FxAudioStreamSample.Update(0, 0, nil, 0); + if (hr = MS_S_ENDOFSTREAM) or (hr = MS_E_NOSTREAM) then exit; + ErrorCheck(hr); + ErrorCheck( FxAudioData.GetInfo(FxBufferSize, FxBuffer, Result) ); + ErrorCheck( FxAudioStreamSample.GetSampleTimes( FxLastReadingStartTime,FxLastReadingEndTime, Tmp ) ); + if FxLastReadingStartTime > FxLastReadingEndTime then + FxLastReadingStartTime := FxLastReadingEndTime; + if (FxSelLength <> 0) and (FxLastReadingEndTime > FxLastReadingStartTime) and + (FxSelStart + FxSelLength < FxLastReadingEndTime) then + begin + Result := DWord(Trunc(((Result * + (FxSelStart + FxSelLength - FxLastReadingStartTime)) / + (FxLastReadingEndTime - FxLastReadingStartTime)))) and + (not(FxFormat.nBlockAlign-1)); + FxLastReadingEndTime := FxSelStart + FxSelLength; + end; + FxPosition := FxLastReadingEndTime; +end; + +procedure TDSIn.SetPosition( Value: STREAM_TIME ); +var pfs: TFilterState; +begin + if (Value <> FxPosition) then + begin + if (Value < FxSelStart) then + Value := FxSelStart + else + if (Value > FDuration) then + Value := FDuration + else + if (FxSelLength <> 0) and (Value > FxSelStart + FxSelLength) then + Value := FxSelStart + FxSelLength; + ErrorCheck(FxMediaControl.StopWhenReady ); + ErrorCheck(FxMediaSeeking.SetPositions(Value,AM_SEEKING_AbsolutePositioning, Value, AM_SEEKING_NoPositioning)); + ErrorCheck(FxMediaControl.Run ); + ErrorCheck(FxMediaControl.GetState(INFINITE, pfs) ); + FxPosition := Value; + end; +end; + +function ErrorCheck( Value: HRESULT ): HRESULT; { Check the result of a COM operation } +var + S: String; + S2: array [0..300] of Char; +begin + Result := Value; + if (Value <> S_OK) then + begin + Case DWord(Value) of + DSUSER_INVALIDSIZE: S:='Invalid buffer size.'; + DWord(REGDB_E_CLASSNOTREG): S:='A specified class is not registered in the registration database.'; + DWord(CLASS_E_NOAGGREGATION): S:='This class cannot be created as part of an aggregate.'; + DWord(E_ABORT): S:='The update aborted.'; + DWOrd(E_INVALIDARG): S:='One of the parameters is invalid.'; + DWord(E_POINTER): S:='This method tried to access an invalid pointer.'; + DWord(E_NOINTERFACE): S:='No interface.'; + MS_S_PENDING: S:='The asynchronous update is pending.'; + MS_S_NOUPDATE: S:='Sample was not updated after forced completion.'; + MS_S_ENDOFSTREAM: S:='Reached the end of the stream; the sample wasn''t updated.'; + MS_E_SAMPLEALLOC: S:='An IMediaStream object could not be removed from an IMultiMediaStream object because it still contains at least one allocated sample.'; + MS_E_PURPOSEID: S:='The specified purpose ID can''t be used for the call.'; + MS_E_NOSTREAM: S:='No stream can be found with the specified attributes.'; + MS_E_NOSEEKING: S:='One or more media streams don''t support seeking.'; + MS_E_INCOMPATIBLE: S:='The stream formats are not compatible.'; + MS_E_BUSY: S:='This sample already has a pending update.'; + MS_E_NOTINIT: S:='The object can''t accept the call because its initialize function or equivalent has not been called.'; + MS_E_SOURCEALREADYDEFINED: S:='Source already defined.'; + MS_E_INVALIDSTREAMTYPE: S:='The stream type is not valid for this operation.'; + MS_E_NOTRUNNING: S:='The IMultiMediaStream object is not in running state.'; + Else + begin + if AMGetErrorText( Value, s2, High(s2) ) = 0 then + S:='Unrecognized error value.' + else + S:=String( s2 ); + end; + end; + raise EACSException.Create(S); + end; +end ; + +initialization + FileFormats.Add('mp3','Mpeg Audio Layer III',TDSIn); + FileFormats.Add('mp2','Mpeg Audio Layer II',TDSIn); + FileFormats.Add('mpeg','Mpeg Audio',TDSIn); + FileFormats.Add('wma','Windows Media Audio',TDSIn); + +end. + diff --git a/components/acs/Src/fileformats/acs_dsfiles.pas b/components/acs/Src/fileformats/acs_dsfiles.pas new file mode 100644 index 000000000..0dc215e31 --- /dev/null +++ b/components/acs/Src/fileformats/acs_dsfiles.pas @@ -0,0 +1,358 @@ +(* + this file is a part of audio components suite v 2.4. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: acs_dsfiles.pas,v $ +Revision 1.17 2006/09/04 14:40:16 z0m3ie +*** empty log message *** + +Revision 1.16 2006/08/31 20:10:56 z0m3ie +*** empty log message *** + +Revision 1.15 2006/08/03 17:31:35 z0m3ie +*** empty log message *** + +Revision 1.14 2006/07/09 16:40:35 z0m3ie +*** empty log message *** + +Revision 1.13 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.9 2006/01/01 18:46:40 z0m3ie +*** empty log message *** + +Revision 1.8 2005/12/26 17:31:39 z0m3ie +fixed some problems in acs_dsfiles +fixed some problems in acs_vorbis +reworked all buffers + +Revision 1.7 2005/12/19 18:36:38 z0m3ie +*** empty log message *** + +Revision 1.5 2005/12/18 17:01:54 z0m3ie +delphi compatibility + +Revision 1.4 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.3 2005/11/29 18:32:51 z0m3ie +bugfixes for win32 version + +Revision 1.2 2005/11/28 21:57:24 z0m3ie +mostly FileOut fixes +moved PBuffer to PBuffer8 +set all to dynamically Buffering + +Revision 1.1 2005/09/23 14:04:58 z0m3ie +*** empty log message *** + +Revision 1.2 2005/09/13 04:04:50 z0m3ie +First release without Components for Fileformats +only TFileIn and TFileOut are Visible + +Revision 1.1 2005/09/13 03:13:57 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.4 2005/09/11 18:06:26 z0m3ie +first working Version + +Revision 1.3 2005/09/10 08:25:40 z0m3ie +*** empty log message *** + +Revision 1.2 2005/09/07 21:13:24 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/07 20:53:22 z0m3ie +begon to add MPEG and WMA support using DirectX + +} +unit acs_dsfiles; + +{$ifdef linux}{$message error 'unit not supported'}{$endif linux} + +{$DEFINE DYNAMIC_LINK_ALL} + +interface + +uses + ACS_File,ACS_Classes,DirectShow9,Classes,ActiveX,MMSystem,Windows,ACS_Types; + +type + { TDSIn } + + TDSIn = class(TACSCustomFileIn) + private + FxFormat: TWaveFormatEx; + FxAMMultiMediaStream: IAMMultiMediaStream; + FxGraphBuilder: IGraphBuilder; + FxMediaSeeking: IMediaSeeking; + FxMediaControl: IMediaControl; + FxAudioMediaStream: IAudioMediaStream; + FxMediaStream: IMediaStream; + FxAudioStreamSample: IAudioStreamSample; + FxAudioData: IAudioData; + FxBuffer: Pointer; + FxBufferSize: DWord; + FDuration, + FxPosition, + FxSelStart, + FxSelLength, + FxLastReadingStartTime, + FxLastReadingEndTime : Stream_Time; + FSeekScale : Integer; + function Read(Buffer : Pointer; xSize: DWord): DWord; + procedure SetPosition( Value: STREAM_TIME ); + protected + procedure OpenFile; override; + procedure CloseFile; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + function Seek(SampleNum : Integer) : Boolean; override; + end; + +const + DSUSER_HRESULT = HResult($08000000); + DSUSER_INVALIDSIZE = DSUSER_HRESULT + 1; + +function ErrorCheck( Value: HRESULT ): HRESULT; { Check the result of a COM operation } + +implementation + +procedure TDSIn.OpenFile; +var + v : WideString; +begin + FValid := True; + if FOpened = 0 then + begin + QzInitialize(nil); + ErrorCheck( CoCreateInstance( CLSID_AMMultiMediaStream, nil, CLSCTX_INPROC_SERVER,IID_IAMMultiMediaStream, FxAMMultiMediaStream ) ); + ErrorCheck( FxAMMultiMediaStream.Initialize(STREAMTYPE_READ, AMMSF_NOGRAPHTHREAD, nil) ); + ErrorCheck( FxAMMultiMediaStream.AddMediaStream(nil, @MSPID_PrimaryAudio, 0, FxMediaStream) ); + ErrorCheck( FxAMMultiMediaStream.GetMediaStream(MSPID_PrimaryAudio, FxMediaStream) ); + v := FFileName; + ErrorCheck( FxAMMultiMediaStream.OpenFile(PWideChar(v), 0) ); + ErrorCheck( FxAMMultiMediaStream.GetFilterGraph(FxGraphBuilder) ); + ErrorCheck( FxGraphBuilder.QueryInterface(IID_IMediaControl, FxMediaControl) ); + ErrorCheck( FxGraphBuilder.QueryInterface(IID_IMediaSeeking, FxMediaSeeking) ); + ErrorCheck( FxMediaStream.QueryInterface(IID_IAudioMediaStream, FxAudioMediaStream) ); + ErrorCheck( FxAudioMediaStream.GetFormat(FxFormat) ); + ErrorCheck( CoCreateInstance(CLSID_AMAudioData, nil, CLSCTX_INPROC_SERVER,IID_IAudioData, FxAudioData) ); + ErrorCheck( FxAudioData.SetFormat(FxFormat) ); + ErrorCheck( FxAudioMediaStream.CreateSample(FxAudioData, 0, FxAudioStreamSample) ); + ErrorCheck( FxAMMultiMediaStream.GetDuration(FDuration) ); + ErrorCheck( FxAMMultiMediaStream.SetState( STREAMSTATE_RUN ) ); + FxSelLength := 0; + FSR := FxFormat.nSamplesPerSec; + FBPS := FxFormat.wBitsPerSample; + FChan := FxFormat.nChannels; + FTotalSamples := FSize; + FSeekable := TRUE; + if fDuration = 0 then exit; + FSize :=(FDuration div 10000000) * + FSR * + FChan * + FBPS div 8; + FSeekScale := FDuration div FSize; + end; + Inc(FOpened); +end; + +procedure TDSIn.CloseFile; +begin + if FOpened = 1 then + begin + if Assigned(FxAMMultiMediaStream) then + ErrorCheck( FxAMMultiMediaStream.SetState( STREAMSTATE_STOP ) ); + FxAudioStreamSample := nil; + FxAudioData := nil; + FxAudioMediaStream := nil; + FxMediaStream := nil; + FxMediaSeeking := nil; + FxMediaControl := nil; + FxGraphBuilder := nil; + FxAMMultiMediaStream := nil; + end; + if FOpened > 0 then Dec(FOpened); +end; + +function TDSIn.GetData(Buffer: Pointer; BufferSize: Integer): Integer; +var + nDone : Integer; + nOffs : Integer; +begin + if not Busy then raise EACSException.Create('The Stream is not opened'); + if BufStart > BufEnd then + begin + if FOffset <> 0 then + begin + FPosition := FPosition+Round((FOffset/100)*FSize); + if FPosition < 0 then + FPosition := 0 + else if FPosition > FSize then + FPosition := FSize; + SetPosition(Int64(FPosition) * FSeekScale); + FOffset := 0; + end; + BufStart := 1; + nDone := Read(FBuffer, BufferSize); + if nDone = 0 then + begin + if FLoop then + begin + SetPosition(0); // just rewind + nDone := Read(FBuffer, BufferSize); + end else + begin + Result := 0; + Exit; + end; + end; + BufEnd := nDone; + end; + + if BufferSize < (BufEnd - BufStart + 1) then + Result := BufferSize + else + Result := BufEnd - BufStart + 1; + + Move(FBuffer[BufStart-1], Buffer^, Result); + Inc(BufStart, Result); + Inc(FPosition, Result); +end; + +constructor TDSIn.Create(AOwner: TComponent); +var + AMovie: IGraphBuilder; +begin + inherited Create(AOwner); + BufferSize := $8000; + QzInitialize(nil); + ErrorCheck(CoCreateInstance( CLSID_FilterGraph, nil, CLSCTX_INPROC_SERVER,IID_IGraphBuilder, AMovie)); +end; + +destructor TDSIn.Destroy; +begin + QzUninitialize; + inherited Destroy; +end; + +function TDSIn.Seek(SampleNum : Integer): Boolean; +begin + FPosition := SampleNum; +end; + +function TDSIn.Read(Buffer : Pointer; xSize: DWord): DWord; +var + hr : DWord; + Tmp: STREAM_TIME; +begin + Result := 0; + if (xSize <= 0) then + ErrorCheck(DSUSER_INVALIDSIZE); + if (FxSelLength <> 0) and (FxPosition >= FxSelStart + FxSelLength) then + exit; + if (Buffer <> FxBuffer) or (xSize <> FxBufferSize) then + begin + FxBuffer := Buffer; + FxBufferSize := xSize; + ErrorCheck( FxAudioData.SetBuffer( FxBufferSize, FxBuffer, 0 ) ); + end; + hr := FxAudioStreamSample.Update(0, 0, nil, 0); + if (hr = MS_S_ENDOFSTREAM) or (hr = MS_E_NOSTREAM) then exit; + ErrorCheck(hr); + ErrorCheck( FxAudioData.GetInfo(FxBufferSize, FxBuffer, Result) ); + ErrorCheck( FxAudioStreamSample.GetSampleTimes( FxLastReadingStartTime,FxLastReadingEndTime, Tmp ) ); + if FxLastReadingStartTime > FxLastReadingEndTime then + FxLastReadingStartTime := FxLastReadingEndTime; + if (FxSelLength <> 0) and (FxLastReadingEndTime > FxLastReadingStartTime) and + (FxSelStart + FxSelLength < FxLastReadingEndTime) then + begin + Result := DWord(Trunc(((Result * + (FxSelStart + FxSelLength - FxLastReadingStartTime)) / + (FxLastReadingEndTime - FxLastReadingStartTime)))) and + (not(FxFormat.nBlockAlign-1)); + FxLastReadingEndTime := FxSelStart + FxSelLength; + end; + FxPosition := FxLastReadingEndTime; +end; + +procedure TDSIn.SetPosition( Value: STREAM_TIME ); +var pfs: TFilterState; +begin + if (Value <> FxPosition) then + begin + if (Value < FxSelStart) then + Value := FxSelStart + else + if (Value > FDuration) then + Value := FDuration + else + if (FxSelLength <> 0) and (Value > FxSelStart + FxSelLength) then + Value := FxSelStart + FxSelLength; + ErrorCheck(FxMediaControl.StopWhenReady ); + ErrorCheck(FxMediaSeeking.SetPositions(Value,AM_SEEKING_AbsolutePositioning, Value, AM_SEEKING_NoPositioning)); + ErrorCheck(FxMediaControl.Run ); + ErrorCheck(FxMediaControl.GetState(INFINITE, pfs) ); + FxPosition := Value; + end; +end; + +function ErrorCheck( Value: HRESULT ): HRESULT; { Check the result of a COM operation } +var + S: String; + S2: array [0..300] of Char; +begin + Result := Value; + if (Value <> S_OK) then + begin + Case DWord(Value) of + DSUSER_INVALIDSIZE: S:='Invalid buffer size.'; + DWord(REGDB_E_CLASSNOTREG): S:='A specified class is not registered in the registration database.'; + DWord(CLASS_E_NOAGGREGATION): S:='This class cannot be created as part of an aggregate.'; + DWord(E_ABORT): S:='The update aborted.'; + DWOrd(E_INVALIDARG): S:='One of the parameters is invalid.'; + DWord(E_POINTER): S:='This method tried to access an invalid pointer.'; + DWord(E_NOINTERFACE): S:='No interface.'; + MS_S_PENDING: S:='The asynchronous update is pending.'; + MS_S_NOUPDATE: S:='Sample was not updated after forced completion.'; + MS_S_ENDOFSTREAM: S:='Reached the end of the stream; the sample wasn''t updated.'; + MS_E_SAMPLEALLOC: S:='An IMediaStream object could not be removed from an IMultiMediaStream object because it still contains at least one allocated sample.'; + MS_E_PURPOSEID: S:='The specified purpose ID can''t be used for the call.'; + MS_E_NOSTREAM: S:='No stream can be found with the specified attributes.'; + MS_E_NOSEEKING: S:='One or more media streams don''t support seeking.'; + MS_E_INCOMPATIBLE: S:='The stream formats are not compatible.'; + MS_E_BUSY: S:='This sample already has a pending update.'; + MS_E_NOTINIT: S:='The object can''t accept the call because its initialize function or equivalent has not been called.'; + MS_E_SOURCEALREADYDEFINED: S:='Source already defined.'; + MS_E_INVALIDSTREAMTYPE: S:='The stream type is not valid for this operation.'; + MS_E_NOTRUNNING: S:='The IMultiMediaStream object is not in running state.'; + Else + begin + if AMGetErrorText( Value, s2, High(s2) ) = 0 then + S:='Unrecognized error value.' + else + S:=String( s2 ); + end; + end; +// raise EACSException.Create(S); + end; +end ; + +initialization + FileFormats.Add('mp3','Mpeg Audio Layer III',TDSIn); + FileFormats.Add('mp2','Mpeg Audio Layer II',TDSIn); + FileFormats.Add('mpeg','Mpeg Audio',TDSIn); + FileFormats.Add('wma','Windows Media Audio',TDSIn); + +end. + diff --git a/components/acs/Src/fileformats/acs_flac.pas b/components/acs/Src/fileformats/acs_flac.pas new file mode 100644 index 000000000..d2c8585dc --- /dev/null +++ b/components/acs/Src/fileformats/acs_flac.pas @@ -0,0 +1,591 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: acs_flac.pas,v $ +Revision 1.7 2006/07/09 16:40:35 z0m3ie +*** empty log message *** + +Revision 1.6 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.2 2005/12/30 11:10:57 z0m3ie +some corrections to lazarus-linux depending things + +Revision 1.1 2005/12/19 18:36:38 z0m3ie +*** empty log message *** + +Revision 1.4 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.3 2005/11/28 21:57:24 z0m3ie +mostly FileOut fixes +moved PBuffer to PBuffer8 +set all to dynamically Buffering + +Revision 1.2 2005/09/13 04:04:50 z0m3ie +First release without Components for Fileformats +only TFileIn and TFileOut are Visible + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + +unit acs_flac; + +interface + +uses + + ACS_File,Classes, SysUtils, ACS_Types, ACS_Classes, FLAC, +{$IFDEF LINUX} + libc; +{$ENDIF} + +{$IFDEF WIN32} + Windows; +{$ENDIF} + +type + + TFLACOut = class(TACSCustomFileOut) + private + _encoder : PFLAC__SeekableStreamEncoder; + FBufSize : Integer; + FVerify : Boolean; + FBlockSize : Word; + FBestModelSearch : Boolean; + FEnableMidSideStereo : Boolean; + FMaxLPCOrder : Word; + EndOfInput : Boolean; + FEnableLooseMidSideStereo : Boolean; + FQLPCoeffPrecision : Word; + FQLPCoeffPrecisionSearch : Boolean; + FMaxResidualPartitionOrder : Word; + FMinResidualPartitionOrder : Word; + procedure SetEnableLooseMidSideStereo(val : Boolean); + procedure SetBestModelSearch(val : Boolean); + protected + procedure Done; override; + function DoOutput(Abort : Boolean):Boolean; override; + procedure Prepare; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + property BestModelSearch : Boolean read FBestModelSearch write SetBestModelSearch; + property BlockSize : Word read FBlockSize write FBlockSize; + property EnableMidSideStereo : Boolean read FEnableMidSideStereo write FEnableMidSideStereo; + property EnableLooseMidSideStereo : Boolean read FEnableLooseMidSideStereo write SetEnableLooseMidSideStereo; + property MaxLPCOrder : Word read FMaxLPCOrder write FMaxLPCOrder; + property MaxResidualPartitionOrder : Word read FMaxResidualPartitionOrder write FMaxResidualPartitionOrder; + property MinResidualPartitionOrder : Word read FMinResidualPartitionOrder write FMinResidualPartitionOrder; + property QLPCoeffPrecision : Word read FQLPCoeffPrecision write FQLPCoeffPrecision; + property QLPCoeffPrecisionSearch : Boolean read FQLPCoeffPrecisionSearch write FQLPCoeffPrecisionSearch; + property Verify : Boolean read FVerify write FVerify; + end; + + TFLACIn = class(TACSCustomFileIn) + private + Buff : PACSBuffer8; + _decoder : PFLAC__SeekableStreamDecoder; + FBlockSize: Integer; + BytesPerBlock : Integer; + EndOfStream : Boolean; + MinFrameSize : Integer; + protected + procedure OpenFile; override; + procedure CloseFile; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + function Seek(SampleNum : Integer) : Boolean; override; + end; + + +implementation + +type + + FLACBuf = array[0..0] of FLAC__int32; + PFLACBuf = ^FLACBuf; + + function EncWriteCBFunc(encoder : PFLAC__SeekableStreamEncoder; + buffer : PFLAC__byte; + bytes, samples, current_frame : LongWord; + client_data : Pointer) : Integer; cdecl; + var + FLACOut : TFLACOut; + begin + FLACOut := TFLACOut(client_data); + Result := FLAC__SEEKABLE_STREAM_ENCODER_OK; + try + FLACOut.FStream.Write(buffer^, bytes); + except + Result := FLAC__SEEKABLE_STREAM_ENCODER_WRITE_ERROR; + end; + end; + + function EncSeekCBFunc(encoder : PFLAC__SeekableStreamEncoder; + absolute_byte_offset : FLAC__uint64; + client_data : Pointer) : Integer; cdecl; + var + FLACOut : TFLACOut; + begin + FLACOut := TFLACOut(client_data); + Result := FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK; + try + FLACOut.FStream.Seek(absolute_byte_offset, soFromBeginning); + except + Result := FLAC__SEEKABLE_STREAM_ENCODER_SEEK_ERROR; + end; + end; + + function DecReadCBFunc(decoder : PFLAC__SeekableStreamDecoder; + buffer : PFLAC__byte; + var bytes : LongWord; + client_data : Pointer) : Integer; cdecl; + var + FLACIn : TFLACIn; + begin + FLACIn := TFLACIn(client_data); + Result := FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK; + if FLACIn.FStream.Position >= FLACIn.FStream.Size then + begin + Result := FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM; + Exit; + end; + try + bytes := FLACIn.FStream.Read(buffer^, bytes); + except + Result := FLAC__SEEKABLE_STREAM_DECODER_READ_ERROR; + end; + end; + + function DecSeekCBFunc(decoder : PFLAC__SeekableStreamDecoder; + absolute_byte_offset : FLAC__uint64; + client_data : Pointer) : Integer; cdecl; + var + FLACIn : TFLACIn; + begin + FLACIn := TFLACIn(client_data); + Result := FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK; + try + FLACIn.FStream.Seek(absolute_byte_offset, soFromBeginning); + except + Result := FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR; + end; + end; + + function DecTellCBFunc(decoder : PFLAC__SeekableStreamDecoder; + var absolute_byte_offset : FLAC__uint64; + client_data : Pointer) : Integer; cdecl; + var + FLACIn : TFLACIn; + begin + FLACIn := TFLACIn(client_data); + Result := FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK; + try + absolute_byte_offset := FLACIn.FStream.Position; + except + Result := FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR; + end; + end; + + function DecLengthCBFunc(decoder : PFLAC__SeekableStreamDecoder; + var stream_length : FLAC__uint64; + client_data : Pointer) : Integer; cdecl; + var + FLACIn : TFLACIn; + begin + FLACIn := TFLACIn(client_data); + Result := FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK; + try + stream_length := FLACIn.FStream.Size; + except + Result := FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR; + end; + end; + + function DecEOFCBFunc(decoder : PFLAC__SeekableStreamDecoder; + client_data : Pointer) : Boolean; cdecl; + var + FLACIn : TFLACIn; + begin + FLACIn := TFLACIn(client_data); + if FLACIn.FStream.Position >= FLACIn.FStream.Size then Result := True + else Result := False; + end; + + function DecWriteCBFunc(decoder : PFLAC__SeekableStreamDecoder; + frame : PFLAC__Frame; + buffer : PFLACChannels; + client_data : Pointer) : Integer; cdecl; + var + FLACIn : TFLACIn; + Header : PFLAC__FrameHeader; + buffer1 : PFLACIntBuf; + buffer2 : PFLACIntBuf; + B16 : PACSBuffer16; + i : Integer; + begin + FLACIn := TFLACIn(client_data); + Header := PFLAC__FrameHeader(frame); + FLACIn.FBlockSize := Header.blocksize; + FLACIn.BytesPerBlock := FLACIn.FBlockSize*(FLACIn.FBPS shr 3)*FLACIn.FChan; + GetMem(FLACIn.Buff, FLACIn.BytesPerBlock); +// FillChar(FLACIn.Buff[0], FLACIn.BytesPerBlock, 255); + if FLACIn.FBPS = 16 then + begin + B16 := PACSBuffer16(FLACIn.Buff); + if FLACIn.FChan = 1 then + begin + buffer1 := buffer[0]; + for i := 0 to FLACIn.FBlockSize-1 do B16[i] := buffer1[i] + end else + begin + buffer1 := buffer[0]; + buffer2 := buffer[1]; + for i := 0 to FLACIn.FBlockSize-1 do + begin + B16[i shl 1] := buffer1[i]; + B16[(i shl 1)+1] := buffer2[i]; + end; + end; + end else + begin + if FLACIn.FChan = 1 then + begin + buffer1 := buffer[0]; + for i := 0 to FLACIn.FBlockSize-1 do FLACIn.Buff[i] := buffer1[i]; + end else + begin + buffer1 := buffer[0]; + buffer2 := buffer[1]; + for i := 0 to FLACIn.FBlockSize-1 do + begin + FLACIn.Buff[i shl 1] := buffer1[i]; + FLACIn.Buff[(i shl 1)+1] := buffer2[i]; + end; + end; + end; + Result := FLAC__SEEKABLE_STREAM_ENCODER_OK; + end; + + procedure DecMetadataCBProc(decoder : PFLAC__SeekableStreamDecoder; + metadata : PFLAC__StreamMetadata; + client_data : Pointer); cdecl; + var + FLACIn : TFLACIn; + P : Pointer; + FI : PFLACInfo; + begin + if LongWord(metadata^) <> 0 then Exit; + P := metadata; + (* + STREAMINFO block format differs in different + FLAC codec versions, so we are trying to be flexible here. + *) + while LongWord(P^) = 0 do Inc(Integer(P), 4); + Inc(Integer(P), 4); + if LongWord(P^) = 0 then Inc(Integer(P), 4); + FI := PFLACInfo(P); + FLACIn := TFLACIn(client_data); + FLACIn.FSR := FI.sample_rate; + FLACIn.FChan := FI.channels; + if FLACIn.FChan > 2 then FLACIn.FValid := False; + FLACIn.FBPS := FI.bits_per_sample; + if FLACIn.FChan > 16 then FLACIn.FValid := False; + FLACIn.FTotalSamples := FI.total_samples1; + if FLACIn.FTotalSamples = 0 then + FLACIn.FTotalSamples := FI.total_samples2; + FLACIn.FSize := FLACIn.FTotalSamples*(FLACIn.FBPS shr 3)*FLACIn.FChan; + FLACIn.MinFrameSize := FI.min_framesize; + end; + + procedure DecErrorCBProc(decoder : PFLAC__SeekableStreamDecoder; + status : Integer; + client_data : Pointer); cdecl; + var + FLACIn : TFLACIn; + begin + FLACIn := TFLACIn(client_data); + FLACIn.FValid := False; + end; + + constructor TFLACOut.Create; + begin + inherited Create(AOwner); + FVerify := False; + FBufferSize := $6000; + FBlockSize := 4608; + FBestModelSearch := False; + FEnableMidSideStereo := True; + if not (csDesigning in ComponentState) then + if not LibFLACLoaded then + raise EACSException.Create(LibFLACPath + ' library could not be loaded.'); + end; + + destructor TFLACOut.Destroy; + begin + inherited Destroy; + end; + + procedure TFLACOut.Prepare; + begin + if not FStreamAssigned then + begin + if FFileName = '' then raise EACSException.Create('File name is not assigned.'); + if (not FileExists(FFileName)) or (FFileMode = foRewrite) then + FStream := TFileStream.Create(FFileName, fmCreate or fmShareExclusive, FAccessMask) + else FStream := TFileStream.Create(FFileName, fmOpenReadWrite or fmShareExclusive, FAccessMask); + end; + EndOfInput := False; + _encoder := FLAC__seekable_stream_encoder_new; + if _encoder = nil then + raise EACSException.Create('Failed to initialize FLAC encoder.'); + FInput.Init; + FLAC__seekable_stream_encoder_set_verify(_encoder, FVerify); + FLAC__seekable_stream_encoder_set_channels(_encoder, FInput.Channels); + FLAC__seekable_stream_encoder_set_bits_per_sample(_encoder, FInput.BitsPerSample); + FLAC__seekable_stream_encoder_set_sample_rate(_encoder, FInput.SampleRate); + if FInput.Channels = 2 then + begin + FLAC__seekable_stream_encoder_set_do_mid_side_stereo(_encoder, FEnableMidSideStereo); + FLAC__seekable_stream_encoder_set_loose_mid_side_stereo(_encoder, FEnableLooseMidSideStereo); + end; + FLAC__seekable_stream_encoder_set_blocksize(_encoder, FBlockSize); + FLAC__seekable_stream_encoder_set_max_lpc_order(_encoder, FMaxLPCOrder); + if FQLPCoeffPrecision + FInput.BitsPerSample > 31 then FQLPCoeffPrecision := 31 - FInput.BitsPerSample; + FLAC__seekable_stream_encoder_set_qlp_coeff_precision(_encoder, FQLPCoeffPrecision); + FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search(_encoder, FQLPCoeffPrecisionSearch); + FLAC__seekable_stream_encoder_set_min_residual_partition_order(_encoder, FMinResidualPartitionOrder); + FLAC__seekable_stream_encoder_set_max_residual_partition_order(_encoder, FMaxResidualPartitionOrder); + FLAC__seekable_stream_encoder_set_do_exhaustive_model_search(_encoder, FBestModelSearch); + if FInput.Size > 0 then + FLAC__seekable_stream_encoder_set_total_samples_estimate(_encoder, Round(FInput.Size/(FInput.BitsPerSample shr 3)/FInput.Channels)); + FLAC__seekable_stream_encoder_set_seek_callback(_encoder, EncSeekCBFunc); + FLAC__seekable_stream_encoder_set_write_callback(_encoder, EncWriteCBFunc); + FLAC__seekable_stream_encoder_set_client_data(_encoder, Self); + if FLAC__seekable_stream_encoder_init(_encoder) <> + FLAC__SEEKABLE_STREAM_ENCODER_OK then + begin + FInput.Flush; + raise EACSException.Create('Failed to initialize FLAC encoder.'); + end; + //TODO: Recreate this stuff with uffersize more equal to FBufferSize + FBufSize := FBufferSize div FBlockSize; + FBufSize := FBufSize * (FInput.BitsPerSample shr 3) * FInput.Channels; + GetMem(FBuffer, FBufSize); + end; + + procedure TFLACOut.Done; + begin + if not FStreamAssigned then + FLAC__seekable_stream_encoder_finish(_encoder); + FLAC__seekable_stream_encoder_delete(_encoder); + if FBuffer <> nil then + FreeMem(FBuffer); + FBuffer := nil; + FStream.Free; + FInput.Flush; + end; + + function TFLACOut.DoOutput(Abort : Boolean):Boolean; + var + Len, i, l, samples : Integer; + FB : PFLACBuf; + B16 : PACSBuffer16; + begin + Result := True; + if not CanOutput then Exit; + if Abort or EndOfInput then + begin + Result := False; + Exit; + end; + while InputLock do; + InputLock := True; + Len := 0; + while Len < FBufSize do + begin + l := Finput.GetData(@FBuffer[Len], FBufSize-Len); + Inc(Len, l); + if l = 0 then + begin + EndOfInput := True; + Break; + end; + end; + InputLock := False; + if Len = 0 then + begin + Result := False; + Exit; + end; + samples := (Len shl 3) div Finput.BitsPerSample; + GetMem(FB, samples*SizeOF(FLAC__int32)); + if FInput.BitsPerSample = 16 then + begin + B16 := @FBuffer[0]; + for i := 0 to samples - 1 do FB[i] := B16[i]; + end else + for i := 0 to samples - 1 do FB[i] := FBuffer[i]; + if not FLAC__seekable_stream_encoder_process_interleaved(_encoder, @FB[0], samples div FInput.Channels) then + raise EACSException.Create('Failed to encode data.'); + FreeMem(FB); + end; + + procedure TFLACOut.SetEnableLooseMidSideStereo; + begin + if Val then FEnableMidSideStereo := True; + FEnableLooseMidSideStereo := Val; + end; + + procedure TFLACOut.SetBestModelSearch; + begin + if Val then + begin + FEnableMidSideStereo := True; + FEnableLooseMidSideStereo := False; + end; + FBestModelSearch := Val; + end; + + constructor TFLACIn.Create; + begin + inherited Create(AOwner); + if not (csDesigning in ComponentState) then + if not LibFLACLoaded then + raise EACSException.Create(LibFLACPath + ' library could not be loaded.'); + end; + + destructor TFLACIn.Destroy; + begin + CloseFile; + inherited Destroy; + end; + + procedure TFLACIn.OpenFile; + begin + Inc(FOpened); + if FOpened = 1 then + begin + if (not FStreamAssigned) and (FFileName = '') then + raise EACSException.Create('File name is not assigned'); + if not FStreamAssigned then FStream := TFileStream.Create(FFileName, fmOpenRead, fmShareDenyNone); + FValid := True; + _decoder := FLAC__seekable_stream_decoder_new; + if _decoder = nil then + raise EACSException.Create('Failed to initialize FLAC decoder.'); +// FLAC__seekable_stream_decoder_set_metadata_ignore_all(_decoder); + FLAC__seekable_stream_decoder_set_read_callback(_decoder, DecReadCBFunc); + FLAC__seekable_stream_decoder_set_seek_callback(_decoder, DecSeekCBFunc); + FLAC__seekable_stream_decoder_set_tell_callback(_decoder, DecTellCBFunc); + FLAC__seekable_stream_decoder_set_length_callback(_decoder, DecLengthCBFunc); + FLAC__seekable_stream_decoder_set_eof_callback(_decoder, DecEOFCBFunc); + FLAC__seekable_stream_decoder_set_write_callback(_decoder, DecWriteCBFunc); + FLAC__seekable_stream_decoder_set_metadata_callback(_decoder, DecMetadataCBProc); + FLAC__seekable_stream_decoder_set_error_callback(_decoder, DecErrorCBProc); + FLAC__seekable_stream_decoder_set_client_data(_decoder, Self); + if FLAC__seekable_stream_decoder_init(_decoder) <> FLAC__SEEKABLE_STREAM_DECODER_OK then + raise EACSException.Create('Failed to initialize FLAC decoder.'); + if not FLAC__seekable_stream_decoder_process_until_end_of_metadata(_decoder) then + FValid := False; + EndOfStream := False; + end; + end; + + procedure TFlacIn.CloseFile; + begin + if FOpened = 1 then + begin + if _decoder <> nil then + begin + FLAC__seekable_stream_decoder_flush(_decoder); + FLAC__seekable_stream_decoder_finish(_decoder); + FLAC__seekable_stream_decoder_delete(_decoder); + _decoder := nil; + end; + if Buff <> nil then FreeMem(Buff); + Buff := nil; + if not FStreamAssigned then FStream.Free + else FStream.Seek(0, soFromBeginning); + end; + if FOpened > 0 then Dec(FOpened); + end; + + function TFLACIn.GetData(Buffer : Pointer; BufferSize : Integer): Integer; + var + dec_state, offs : Integer; + begin + if not Busy then raise EACSException.Create('The Stream is not opened'); + if BufStart >= BufEnd then + begin + if FOffset <> 0 then + begin + offs := Round((FOffset/100)*Self.FTotalSamples); + FPosition := FPosition + offs*(FBPS shr 3)*FChan; + if FPosition < 0 then FPosition := 0 + else if FPosition > FSize then FPosition := FSize; + Seek((FPosition div (FBPS shr 3)) div FChan); + FOffset := 0; + end; + BufStart := 0; + BufEnd := 0; + if FPosition+MinFrameSize > FSize then EndOfStream := True; + if EndOfStream then + begin + if FLoop then + begin + Flush; + Init; + end else + begin + Result := 0; + Exit; + end; + end; + if Buff <> nil then FreeMem(Buff); + Buff := nil; + if not FLAC__seekable_stream_decoder_process_single(_decoder) then + begin + dec_state := FLAC__seekable_stream_decoder_get_state(_decoder); + if dec_state = FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM then + begin + EndOfStream := True; + Result := 0; + Exit; + end + else raise EACSException.Create('Error reading FLAC file'); + end else BufEnd := Self.BytesPerBlock; + end; + if BufferSize < (BufEnd - BufStart) + then Result := BufferSize + else Result := BufEnd - BufStart; + Move(Buff[BufStart], Buffer^, Result); + Inc(BufStart, Result); + Inc(FPosition, Result); + end; + + function TFLACIn.Seek(SampleNum : Integer) : Boolean; + begin + Result := FLAC__seekable_stream_decoder_seek_absolute(_decoder, Samplenum); + end; + +initialization + FileFormats.Add('flac','Free Lossless Audio Codec',TFLACIn); + FileFormats.Add('flac','Free Lossless Audio Codec',TFLACOut); + +end. diff --git a/components/acs/Src/fileformats/acs_lame.pas b/components/acs/Src/fileformats/acs_lame.pas new file mode 100644 index 000000000..b82033cb0 --- /dev/null +++ b/components/acs/Src/fileformats/acs_lame.pas @@ -0,0 +1,346 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: acs_lame.pas,v $ +Revision 1.5 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.2 2006/01/01 18:46:40 z0m3ie +*** empty log message *** + +Revision 1.1 2005/12/19 18:36:38 z0m3ie +*** empty log message *** + +Revision 1.6 2005/12/18 17:01:54 z0m3ie +delphi compatibility + +Revision 1.5 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.4 2005/11/28 21:57:24 z0m3ie +mostly FileOut fixes +moved PBuffer to PBuffer8 +set all to dynamically Buffering + +Revision 1.3 2005/11/28 19:10:14 z0m3ie +*** empty log message *** + +Revision 1.2 2005/09/13 04:04:50 z0m3ie +First release without Components for Fileformats +only TFileIn and TFileOut are Visible + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + +unit acs_lame; + +interface + +uses + ACS_File,Classes, SysUtils, ACS_Classes, lame, +{$IFDEF LINUX} + libc; +{$ENDIF} + +{$IFDEF WIN32} + Windows; +{$ENDIF} + +type + + TMP3Quality = (ql0, ql1, ql2, ql3, ql4, ql5, + ql6, ql7, ql8, ql9); + + TMP3Mode = (STEREO = 0, + JOINT_STEREO, + DUAL_CHANNEL, // LAME doesn't supports this! + MONO); + + TMP3SampleRate = (srDefault, sr32kHz, sr41kHz, sr48kHz); + + TMP3BitRate = (br8, br16, br24, br32, br40, br48, br56, br64, br80, br96, + br112, br128, br144, br160, br192, br224, br256, br320); + + BOOL = Boolean; + + TMP3Out = class(TACSCustomFileOut) + private + FBitRate : TMP3BitRate; + _plgf : PLame_global_flags; + mp3buf : PByte; + mp3buf_size : Integer; + FTitle : String; + FArtist : String; + FAlbum : String; + FYear : String; + FTrack : String; + FComment : String; + FGenre : String; + FCopyright: BOOL; + FOriginal: BOOL; + FEnableVBR: BOOL; + FWriteVBRHeader: BOOL; + FCRC: BOOL; + FVBRQuality: TMP3Quality; + FVBRMinBitrate: integer; + FVBRMaxBitrate: integer; + FQuality: TMP3Quality; + FMode: TMP3Mode; + FSampleRate: TMP3SampleRate; + protected + procedure Done; override; + function DoOutput(Abort : Boolean):Boolean; override; + procedure Prepare; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + property BitRate : TMP3BitRate read FBitRate write FBitRate stored True; + property Id3TagTitle : String read FTitle write FTitle; + property Id3TagArtist : String read FArtist write FArtist; + property Id3TagAlbum : String read FAlbum write FAlbum; + property Id3TagYear : String read FYear write FYear; + property Id3TagTrack : String read FTrack write FTrack; + property Id3TagComment : String read FComment write FComment; + property Id3TagGenre : String read FGenre write FGenre; + property Quality : TMP3Quality read FQuality write FQuality default ql5; + + property SampleRate : TMP3SampleRate read FSampleRate write FSampleRate default srDefault; + property Mode : TMP3Mode read FMode write FMode default STEREO; + + //Extras + property CRC : BOOL read FCRC write FCRC default false; + property Copyright : BOOL read FCopyright write FCopyright default false; + property Original : BOOL read FOriginal write FOriginal default true; + + //VBR encoding + property WriteVBRHeader : BOOL read FWriteVBRHeader write FWriteVBRHeader default false; + property EnableVBR : BOOL read FEnableVBR write FEnableVBR default false; + property VBRQuality : TMP3Quality read FVBRQuality write FVBRQuality default ql5; + property VBRMinBitrate : integer read FVBRMinBitrate write FVBRMinBitrate default 128; + property VBRMaxBitrate : integer read FVBRMaxBitrate write FVBRMaxBitrate default 192; + end; + +implementation + + constructor TMP3Out.Create(AOwner: TComponent); + begin + inherited Create(AOwner); + LoadLAME; + FBitRate := br128; + + FBufferSize := $4000; + FQuality := ql5; + FSampleRate := srDefault; + FMode := STEREO; + FCRC := false; + FCopyright := false; + FOriginal := true; + + FWriteVBRHeader := false; + FEnableVBR := false; + FVBRQuality := ql5; + FVBRMinBitrate := 128; + FVBRMaxBitrate := 192; + + if not (csDesigning in ComponentState) then + if not LameLoaded then + raise EACSException.Create(LAME_PATH + ' library could not be loaded.'); + end; + + destructor TMP3Out.Destroy; + begin + UnloadLAME; + inherited Destroy; + end; + + procedure TMP3Out.Prepare; + var + samples, br, tbr, sr, ql : Integer; + begin + GetMem(FBuffer,FBufferSize); + if not FStreamAssigned then + begin + if FFileName = '' then raise EACSException.Create('File name is not assigned.'); + FStream := TFileStream.Create(FFileName, fmCreate or fmShareExclusive, FAccessMask); + end; + FInput.Init; + _plgf := lame_init; + if FInput.Size > 0 then + samples := FInput.Size div ((Finput.BitsPerSample shr 3)*Finput.Channels); + lame_set_num_samples(_plgf, samples); + lame_set_in_samplerate(_plgf, Finput.SampleRate); + lame_set_num_channels(_plgf, 2); // not Finput.Channels see the note below + case FBitRate of + br8 : br := 8; + br16 : br := 16; + br24 : br := 24; + br32 : br := 32; + br40 : br := 40; + br48 : br := 48; + br56 : br := 56; + br64 : br := 64; + br80 : br := 80; + br96 : br := 96; + br112 : br := 112; + br128 : br := 128; + br144 : br := 144; + br160 : br := 160; + br192 : br := 192; + br224 : br := 224; + br256 : br := 256; + br320 : br := 320; + end; + case FSampleRate of + srDefault: sr := 0; + sr32kHz: sr := 32000; + sr41kHz: sr := 41000; + sr48kHz: sr := 48000; + end; + lame_set_out_samplerate(_plgf,sr); +{ lame_set_mode(_plgf, Integer(FMode)); + if FCopyright then + lame_set_copyright(_plgf,1) + else + lame_set_copyright(_plgf,0); + if FOriginal then + lame_set_original(_plgf,1) + else + lame_set_original(_plgf,0); + if FCRC then + lame_set_error_protection(_plgf,1) + else + lame_set_error_protection(_plgf,0); + + if not EnableVBR then + begin + lame_set_brate(_plgf, br); + case FQuality of + ql0: ql:=0; + ql1: ql:=1; + ql2: ql:=2; + ql3: ql:=3; + ql4: ql:=4; + ql5: ql:=5; + ql6: ql:=6; + ql7: ql:=7; + ql8: ql:=8; + ql9: ql:=9; + end; + lame_set_quality(_plgf,ql); + end + else + begin + if FWriteVBRHeader then + lame_set_bWriteVbrTag(_plgf,1); + lame_set_VBR(_plgf,2); + case FVBRQuality of + ql0: ql:=0; + ql1: ql:=1; + ql2: ql:=2; + ql3: ql:=3; + ql4: ql:=4; + ql5: ql:=5; + ql6: ql:=6; + ql7: ql:=7; + ql8: ql:=8; + ql9: ql:=9; + end; + lame_set_VBR_q(_plgf,ql); + if FVBRMinBitrate > FVBRMaxBitrate then + begin + tbr := FVBRMinBitrate; + FVBRMinBitrate := FVBRMaxBitrate; + FVBRMinBitrate := tbr; + end; + lame_set_VBR_min_bitrate_kbps(_plgf,FVBRMinBitrate); + lame_set_VBR_max_bitrate_kbps(_plgf,FVBRMaxBitrate); + end; +} + lame_init_params(_plgf); + mp3buf_size := (FBufferSize shr 1) + (FBufferSize shr 3) + 7200; + GetMem(mp3buf, mp3buf_size); + end; + + procedure TMP3Out.Done; + var + res : Integer; + begin + id3tag_init(_plgf); + id3tag_set_title(_plgf, PChar(FTitle)); + id3tag_set_artist(_plgf, PChar(FArtist)); + id3tag_set_album(_plgf, PChar(FAlbum)); + id3tag_set_year(_plgf, PChar(FYear)); + id3tag_set_track(_plgf, PChar(FTrack)); + id3tag_set_comment(_plgf, PChar(FComment)); + id3tag_set_genre(_plgf, PChar(FGenre)); + res := lame_encode_flush(_plgf, mp3buf, mp3buf_size); + FStream.Write(mp3buf^, res); + if not FStreamAssigned then FStream.Free; + lame_close(_plgf); + FreeMem(mp3buf); + FInput.Flush; + FreeMem(FBuffer); + end; + + function TMP3Out.DoOutput(Abort : Boolean):Boolean; + var + Len, res, ns : Integer; + begin + // No exceptions Here + Result := True; + if not CanOutput then Exit; + if Abort then + begin + Result := False; + Exit; + end; + while InputLock do; + InputLock := True; + Len := Finput.GetData(@FBuffer, FBufferSize); + InputLock := False; + if Len <> 0 then + begin + if FInput.Channels = 2 then + begin + ns := Len shr 2; + res := lame_encode_buffer_interleaved(_plgf, @FBuffer, ns, mp3buf, mp3buf_size); + end else + begin + (* If the input stream is mono we turn it into stereo here. + This is the way to bypass some pour performance on mono streams, + maybe not the best way, but for a while ...*) + ns := Len shr 1; + res := lame_encode_buffer(_plgf, @FBuffer, @FBuffer, ns, mp3buf, mp3buf_size); + end; + if res < 0 then + begin + Result := False; + Exit; + end; + FStream.Write(mp3buf^, res); + end else + begin + Result := False; + Exit; + end; + end; + +initialization + + FileFormats.Add('mp3','Mpeg Layer III',TMP3Out); + + +end. diff --git a/components/acs/Src/fileformats/acs_mac.pas b/components/acs/Src/fileformats/acs_mac.pas new file mode 100644 index 000000000..1a96947f4 --- /dev/null +++ b/components/acs/Src/fileformats/acs_mac.pas @@ -0,0 +1,475 @@ +(* + the original version of this file is written by thomas la cour, + http://www.top-house.dk/~nr161/delphi/ + + This file is a part of Audio Components Suite v 2.4 + Copyright (c) 2002, 2003 Andrei Borovsky. All rights reserved. + See the LICENSE file for more details. + You can contact me at acs@compiler4.net +*) + +{ +$Log: acs_mac.pas,v $ +Revision 1.7 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.3 2005/12/30 11:10:57 z0m3ie +some corrections to lazarus-linux depending things + +Revision 1.2 2005/12/26 17:31:39 z0m3ie +fixed some problems in acs_dsfiles +fixed some problems in acs_vorbis +reworked all buffers + +Revision 1.1 2005/12/19 18:36:38 z0m3ie +*** empty log message *** + +Revision 1.6 2005/12/18 17:01:54 z0m3ie +delphi compatibility + +Revision 1.5 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.4 2005/11/29 18:32:51 z0m3ie +bugfixes for win32 version + +Revision 1.3 2005/11/28 21:57:24 z0m3ie +mostly FileOut fixes +moved PBuffer to PBuffer8 +set all to dynamically Buffering + +Revision 1.2 2005/09/13 04:04:50 z0m3ie +First release without Components for Fileformats +only TFileIn and TFileOut are Visible + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +} + +unit acs_mac; + +{$ifdef linux}{$message error 'unit not supported'}{$endif linux} + +interface + +uses + ACS_File,Classes, SysUtils, Windows, ACS_Classes, MACDll; + +type + + // Note by A.B.: It seems that APE compressor supports file output only. + + TMACOut = class(TACSCustomFileOut) + private + APECompress: TAPECompress; + WaveFormatEx: TWaveFormatEx; + EndOfStream: Boolean; + FCompressionLevel: Integer; + FMaxAudioBytes: Integer; + procedure SetCompressionLevel(Value: Integer); + protected + procedure Done; override; + function DoOutput(Abort: Boolean): Boolean; override; + procedure Prepare; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + property CompressionLevel: LongInt read FCompressionLevel write SetCompressionLevel stored True; + property MaxAudioBytes: Integer read FMaxAudioBytes write FMaxAudioBytes; + end; + + (* Note by A.B.: Due to the reasons described above this component + ignores streamed input *) + + TMACIn = class(TACSCustomFileIn) + private + APEDecompress: TAPEDecompress; + EndOfStream: Boolean; + function GetAverageBitrate: Integer; + function GetCurrentBitrate: Integer; + function GetCurrentBlock: Integer; + function GetCurrentMS: Integer; + function GetLengthMS: Integer; + function GetTotalBlocks: Integer; + protected + function GetBPS: Integer; override; + function GetCh: Integer; override; + function GetSR: Integer; override; + function GetTotalTime: real; override; + procedure OpenFile; override; + procedure CloseFile; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer: Pointer; BufferSize: Integer): Integer; override; + + function Seek(Sample : Integer) : Boolean; override; + + procedure Flush; override; + procedure Init; override; + + property AverageBitrate: Integer read GetAverageBitrate; + property CurrentBitrate: Integer read GetCurrentBitrate; + property CurrentBlock: Integer read GetCurrentBlock; + property CurrentMS: Integer read GetCurrentMS; + property LengthMS: Integer read GetLengthMS; + property TotalBlocks: Integer read GetTotalBlocks; + end; + +implementation + +constructor TMACOut.Create; +begin + inherited Create(AOwner); + FBufferSize := $10000; + FCompressionLevel := COMPRESSION_LEVEL_NORMAL; + FMaxAudioBytes := MAX_AUDIO_BYTES_UNKNOWN; + if not (csDesigning in ComponentState) then + begin + if not MACLoaded then + raise EACSException.Create(MACPath + ' library could not be loaded.'); + end; +end; + +destructor TMACOut.Destroy; +begin + if Assigned(APECompress) then + APECompress.Free; + inherited Destroy; +end; + +procedure TMACOut.Prepare; +var + r: Integer; +begin + GetMem(FBuffer,FBufferSize); + if FFileName = '' then raise EACSException.Create('File name is not assigned.'); + FInput.Init; + EndOfStream := False; + + APECompress := TAPECompress.Create; + + macFillWaveFormatEx(WaveFormatEx, FInput.SampleRate, FInput.BitsPerSample, FInput.Channels); + + r := APECompress.Start( + PChar(FFileName), + @WaveFormatEx, + FMaxAudioBytes, + FCompressionLevel, + nil, + CREATE_WAV_HEADER_ON_DECOMPRESSION); + + CanOutput := (r = 0); + + if r <> 0 then + raise EACSException.Create('Error starting APECompress.' + #13#10 + + macErrorExplanation(r)); +end; + +procedure TMACOut.Done; +begin + APECompress.Finish(nil, 0, 0); + APECompress.Free; + APECompress := nil; + FInput.Flush; + FreeMem(FBuffer); +end; + +function TMACOut.DoOutput(Abort: Boolean): Boolean; +var + Len, i, x, z: Integer; + pBuffer: PByteArray; + nAudioBytesLeft, nBufferBytesAvailable, nNoiseBytes, nRetVal: Integer; +begin + // No exceptions Here + Result := True; + if not CanOutput then Exit; + if Abort or EndOfStream then + begin + (* We don't close file here to avoide exceptions + if output componenet's Stop method is called *) + Result := False; + Exit; + end; + Len := Finput.GetData(@FBuffer[0], FBufferSize); + x := 0; + if Len <> 0 then + begin + nAudioBytesLeft := Len; + while (nAudioBytesLeft > 0) do + begin + nBufferBytesAvailable := 0; + pBuffer := APECompress.LockBuffer(nBufferBytesAvailable); + + nNoiseBytes := nBufferBytesAvailable; + if nNoiseBytes > nAudioBytesLeft then + nNoiseBytes := nAudioBytesLeft; + + //whats this ? schoult System.Move not be faster ? + for z := 0 to nNoiseBytes - 1 do + begin + pBuffer[z] := FBuffer[x]; + inc(x); + end; + + nRetVal := APECompress.UnlockBuffer(nNoiseBytes, TRUE); + if (nRetVal <> 0) then + raise EACSException.Create('APECompress.UnlockBuffer Error: ' + inttostr(nRetVal)); + + dec(nAudioBytesLeft, nNoiseBytes); + end + end + else + EndOfStream := True; +end; + + +constructor TMACIn.Create; +begin + inherited Create(AOwner); + BufferSize := $2000; + if not (csDesigning in ComponentState) then + begin + if not MACLoaded then + raise EACSException.Create(MACPath + ' library could not be loaded.'); + end; +end; + +destructor TMACIn.Destroy; +begin + if Assigned(APEDecompress) then + APEDecompress.Free; + inherited Destroy; +end; + +procedure TMACIn.OpenFile; +begin + FValid := True; + if FOpened = 0 then + begin + EndOfStream := False; + + APEDecompress := TAPEDecompress.Create(FileName); + if APEDecompress.Handle <> 0 then + begin + FSize := APEDecompress.InfoWavTotalBytes; + FSR := APEDecompress.InfoSampleRate; + FBPS := APEDecompress.InfoBitsPerSample; + FChan := APEDecompress.InfoChannels; + FTime := APEDecompress.InfoLengthMS div 1000; // Round(ov_time_total(VFile, 0)); + FTotalSamples := (FSize div (FBPS shr 3)) div FChan; + end + else + begin + FValid := False; + FOpened := -1; + end; + end; + Inc(FOpened); +end; + +procedure TMACIn.CloseFile; +begin + if FOpened = 1 then + begin + if Assigned(APEDecompress) then + APEDecompress.Free; + APEDecompress := nil; + end; + if FOpened > 0 then Dec(FOpened); +end; + +function TMACIn.GetData(Buffer: Pointer; BufferSize: Integer): Integer; +var + l, csize, offs: Integer; + blocks: Integer; + tmp: Double; +begin + if not Busy then raise EACSException.Create('The Stream is not opened'); + if BufStart > BufEnd then + begin + if FOffset <> 0 then + begin + offs := Round((FOffset / 100) * FSize); + FPosition := FPosition + offs; + if FPosition < 0 then FPosition := 0 + else if FPosition > FSize then FPosition := FSize; + APEDecompress.Seek(FPosition shr 2); + FOffset := 0; + end; + BufStart := 1; + BufEnd := 0; + if not EndOfStream then + begin + while BufEnd < BufferSize do + begin + //l := ov_read(VFile, @buf[BufEnd + 1], BUF_SIZE - BufEnd, 0, 2, 1, @cursec); + blocks := (BufferSize - BufEnd) div 4; + APEDecompress.GetData(@FBuffer[BufEnd], blocks, l); + l := l * 4; + if l <= 0 then + begin + EndOfStream := True; + Break; + end; + Inc(BufEnd, l); + if (FEndSample <> -1) then + begin + csize := (FEndSample-FStartSample)*(FBPS shr 3)*FChan; + if (csize - FPosition) <= 0 then + begin + EndOfStream := True; + Break; + end; + if (csize - FPosition) < BufEnd then + begin + BufEnd := csize - FPosition; + Break; + end; + end; + end; + end; + if EndOfStream and FLoop then + begin + Flush; + Init; + EndOfStream := False; + while BufEnd < BufferSize do + begin + //l := ov_read(VFile, @buf[BufEnd + 1], BUF_SIZE - BufEnd, 0, 2, 1, @cursec); + blocks := (BufferSize - BufEnd) div 4; + APEDecompress.GetData(@FBuffer[BufEnd], blocks, l); + l := l * 4; + if l <= 0 then + begin + EndOfStream := True; + Break; + end; + Inc(BufEnd, l); + end; + end; + end; + if BufferSize < (BufEnd - BufStart + 1) then + Result := BufferSize + else + Result := BufEnd - BufStart + 1; + Move(FBuffer[BufStart - 1], Buffer^, Result); + Inc(BufStart, Result); + Inc(FPosition, Result); +end; + +function TMACIn.GetTotalTime: real; +begin + OpenFile; + if Assigned(APEDecompress) then + Result := APEDecompress.LengthMS / 1000; + CloseFile; +end; + +function TMACIn.GetAverageBitrate: Integer; +begin + if Assigned(APEDecompress) then + Result := APEDecompress.AverageBitrate; +end; + +function TMACIn.GetCurrentBitrate: Integer; +begin + if Assigned(APEDecompress) then + Result := APEDecompress.CurrentBitrate; +end; + +function TMACIn.GetCurrentBlock: Integer; +begin + if Assigned(APEDecompress) then + Result := APEDecompress.CurrentBlock; +end; + +function TMACIn.GetCurrentMS: Integer; +begin + if Assigned(APEDecompress) then + Result := APEDecompress.CurrentMS; +end; + +function TMACIn.GetLengthMS: Integer; +begin + if Assigned(APEDecompress) then + Result := APEDecompress.LengthMS; +end; + +function TMACIn.GetTotalBlocks: Integer; +begin + if Assigned(APEDecompress) then + Result := APEDecompress.TotalBlocks; +end; + +function TMACIn.GetBPS: Integer; +begin + OpenFile; + Result := FBPS; + CloseFile; +end; + +function TMACIn.GetCh: Integer; +begin + OpenFile; + Result := FChan; + CloseFile; +end; + +function TMACIn.GetSR: Integer; +begin + OpenFile; + Result := FSR; + CloseFile; +end; + +procedure TMACOut.SetCompressionLevel(Value: Integer); +begin + case Value of + COMPRESSION_LEVEL_FAST, + COMPRESSION_LEVEL_NORMAL, + COMPRESSION_LEVEL_HIGH, + COMPRESSION_LEVEL_EXTRA_HIGH: FCompressionLevel := Value; + else + FCompressionLevel := COMPRESSION_LEVEL_NORMAL; + end; +end; + +procedure TMACIn.Flush; +begin + inherited Flush; +end; + +procedure TMACIn.Init; +begin + inherited Init; + BufStart := 1; + BufEnd := 0; +end; + +function TMACIn.Seek(Sample : Integer) : Boolean; +begin + Result := False; + if not FSeekable then Exit; + Result := True; + OpenFile; + APEDecompress.Seek(Sample); + CloseFile; +end; + +initialization + + FileFormats.Add('mac','Monkey Audio',TMACOut); + FileFormats.Add('mac','Monkey Audio',TMACIn); + + +end. + diff --git a/components/acs/Src/fileformats/acs_mad.pas b/components/acs/Src/fileformats/acs_mad.pas new file mode 100644 index 000000000..59dbce0a7 --- /dev/null +++ b/components/acs/Src/fileformats/acs_mad.pas @@ -0,0 +1,242 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: acs_mad.pas,v $ +Revision 1.1 2005/12/19 18:36:38 z0m3ie +*** empty log message *** + +Revision 1.2 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.3 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + +unit acs_mad; + +interface + +uses + + ACS_Types, Classes, SysUtils, Math, MAD; + +type + + TRawPCMWaveHeader = record + RIFF: array [0..3] of Char; + FileSize: Integer; + RIFFType: array [0..3] of Char; + FmtChunkId: array [0..3] of Char; + FmtChunkSize: Integer; + FormatTag: Word; + Channels: Word; + SampleRate: Integer; + BytesPerSecond: Integer; + BlockAlign: Word; + BitsPerSample: Word; + DataChunkId: array [0..3] of Char; + DataSize: Integer; + end; + + TMADProgressEvent = procedure(Sender : TComponent) of object; + TMADDoneEvent = procedure(Sender : TComponent; Success : Boolean) of object; + + TMADThread = class(TThread) + private + _Free : Boolean; + Progr : Integer; + Owner : TComponent; + FDecoder : mad_decoder; + FInputStream : TStream; + FOutputStream : TStream; + HasFirstFrame : Boolean; + FSR : Integer; + FChan : Integer; + FBitrate : Integer; + FValid : Boolean; + Data : PACSBuffer8; + InputDone : Boolean; + WaveHdr : TRawPCMWaveHeader; + FSize : Integer; + FMADProgress : TMADProgressEvent; + FMADDone : TMADDoneEvent; + WhenDone : procedure of object; + protected + procedure Execute; override; + public + constructor Create(AOwner : TComponent; InputStream, OutputStream : TStream); + destructor Destroy; override; + end; + +implementation + + function InputFunc(CData : Pointer; Stream : p_mad_stream) : Integer; cdecl; + var + MT : TMADThread; + Len : Integer; + begin + + MT := TMADThread(CData); + + if MT.InputDone then + begin + Result := MAD_FLOW_STOP; + Exit; + end; + MT.InputDone := True; +// Len := MT.FInputStream.Read(Data^, MT.FInputStream.Size); + Len := MT.FInputStream.Size; + mad_stream_buffer(Stream, MT.Data, Len); + if not MT.Terminated then Result := MAD_FLOW_CONTINUE + else Result := MAD_FLOW_STOP; + end; + + function OutputFunc(CData : Pointer; Header : p_mad_header; pcm : p_mad_pcm) : Integer; cdecl; + var + MT : TMADThread; + i, framesize : Integer; + outsamples : array[0..2303] of SmallInt; + text : array[0..4] of Char; + CProgr : Integer; + begin + MT := TMADThread(CData); + if not MT.HasFirstFrame then + begin + MT.FSR := pcm.samplerate; + MT.FChan := pcm.channels; + MT.FBitrate := Header.bitrate; + framesize := Ceil(144*MT.FBitrate/MT.FSR); + MT.FSize := Round(MT.FInputStream.Size/framesize*1152)*MT.FChan*2; + MT.FValid := True; + text := 'RIFF'; + Move(text[0], MT.WaveHdr.RIFF[0], 4); + MT.WaveHdr.FileSize := MT.FSize + 44; + text := 'WAVE'; + Move(text[0], MT.WaveHdr.RIFFType[0], 4); + text := 'fmt '; + Move(text[0], MT.WaveHdr.FmtChunkId[0], 4); + MT.WaveHdr.FmtChunkSize := 16; + MT.WaveHdr.FormatTag := 1; + MT.WaveHdr.Channels := MT.FChan; + MT.WaveHdr.SampleRate := MT.FSR; + MT.WaveHdr.BitsPerSample := 16; + MT.WaveHdr.BlockAlign := 2*MT.FChan; + MT.WaveHdr.BytesPerSecond := MT.FSR * MT.WaveHdr.BlockAlign; + text := 'data'; + Move(text[0], MT.WaveHdr.DataChunkId[0], 4); + MT.WaveHdr.DataSize := MT.FSize; + if MT.FOutputStream is TMemoryStream then + begin + MT.FOutputStream.Size :=MT.FSize + 44; + MT.FOutputStream.Seek(0, soFromBeginning); + end; + MT.FOutputStream.Write(MT.WaveHdr, 44); + MT.HasFirstFrame := True; + end; + if pcm.channels = 2 then + begin + for i := 0 to pcm.length -1 do + begin + if pcm.samples[0][i] >= MAD_F_ONE then + pcm.samples[0][i] := MAD_F_ONE - 1; + if pcm.samples[0][i] < -MAD_F_ONE then + pcm.samples[0][i] := -MAD_F_ONE; + pcm.samples[0][i] := pcm.samples[0][i] shr (MAD_F_FRACBITS + 1 - 16); + outsamples[i shl 1] := pcm.samples[0][i]; + if pcm.samples[1][i] >= MAD_F_ONE then + pcm.samples[1][i] := MAD_F_ONE - 1; + if pcm.samples[1][i] < -MAD_F_ONE then + pcm.samples[1][i] := -MAD_F_ONE; + pcm.samples[1][i] := pcm.samples[1][i] shr (MAD_F_FRACBITS + 1 - 16); + outsamples[(i shl 1)+1] := pcm.samples[1][i]; + end; + MT.FOutputStream.Write(outsamples[0], pcm.length*4); + end else + begin + for i := 0 to pcm.length -1 do + begin + if pcm.samples[0][i] >= MAD_F_ONE then + pcm.samples[0][i] := MAD_F_ONE - 1; + if pcm.samples[0][i] < -MAD_F_ONE then + pcm.samples[0][i] := -MAD_F_ONE; + pcm.samples[0][i] := pcm.samples[0][i] shr (MAD_F_FRACBITS + 1 - 16); + outsamples[i] := pcm.samples[0][i]; + end; + MT.FOutputStream.Write(outsamples[0], pcm.length*2); + end; + if MT.FSize <> 0 then + begin + CProgr := Round(MT.FOutputStream.Position/MT.FSize*100); + if MT.Progr <> CProgr then + begin + MT.Progr := CProgr; + if Assigned(MT.FMADProgress) then + MT.FMADProgress(MT.Owner); + end; + end; + if not MT.Terminated then Result := MAD_FLOW_CONTINUE + else Result := MAD_FLOW_STOP; + end; + + function ErrorFunc(CData : Pointer; Stream : p_mad_stream; Frame : p_mad_frame) : Integer; cdecl; + begin + Result := MAD_FLOW_CONTINUE; + end; + + constructor TMADThread.Create; + begin + inherited Create(True); + Owner := AOwner; + FInputStream := InputStream; + FOutputStream := OutputStream; + FreeOnTerminate := False; + end; + + destructor TMADThread.Destroy; + begin + if not _Free then + begin + Terminate; + {$IFDEF WIN32} + while not _Free do; + {$ENDIF} + end; + inherited Destroy; + end; + + procedure TMADThread.Execute; + begin + try + GetMem(Data, FInputStream.Size); + FInputStream.Read(Data[0], FInputStream.Size); + mad_decoder_init(@FDecoder, Self, InputFunc, nil, nil, OutputFunc, ErrorFunc, nil); + mad_decoder_run(@FDecoder, MAD_DECODER_MODE_SYNC); + mad_decoder_finish(@FDecoder); + FreeMem(Data); + WhenDone; + if Assigned(FMADDone) then FMADDone(Owner, FValid); + _Free := True; + except + FreeMem(Data); + WhenDone; + _Free := True; + end; + end; + +end. diff --git a/components/acs/Src/fileformats/acs_mpeg.pas b/components/acs/Src/fileformats/acs_mpeg.pas new file mode 100644 index 000000000..9b4e219ed --- /dev/null +++ b/components/acs/Src/fileformats/acs_mpeg.pas @@ -0,0 +1,149 @@ +unit acs_mpeg; + +interface + +uses + Classes, SysUtils,ACS_file,ACS_classes, smpeg; + +type + TMPEGIn = class(TACSCustomFileIn) + private + _M : Pointer; + protected + procedure OpenFile; override; + procedure CloseFile; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + end; + + +implementation + + constructor TMPEGIn.Create; + begin + inherited Create(AOwner); + BufferSize := $2000; + end; + + destructor TMPEGIn.Destroy; + begin + inherited Destroy; + end; + + procedure TMPEGIn.Init; + begin + inherited Init; + SMPEG_play(_M); + end; + + procedure TMPEGIn.OpenFile; + var + info : SMPEG_info; + spec : SDL_AudioSpec; + begin + if FOpened = 0 then + begin + (* the next call is needed just to make sure + the SDL library is loaded *) + _M := SMPEG_new(PChar(FFileName), info, 1); + SMPEG_delete(_M); + FValid := True; + _M := SMPEG_new(PChar(FFileName), info, 0); + if info.has_audio <> 1 then + begin + FValid := False; + Exit; + end; + FTime := Round(info.total_time); + SMPEG_wantedSpec(_M, spec); + FSR := spec.freq; + FBPS := 16; + FChan := spec.channels; + FSize := FTime*2*FChan*FSR; + end; + Inc(FOpened); + end; + + procedure TMPEGIn.CloseFile; + begin + if FOpened = 1 then + begin + if SMPEG_status(_M) = SMPEG_PLAYING then + SMPEG_stop(_M); + SMPEG_delete(_M); + end; + if FOpened > 0 then Dec(FOpened); + end; + + function TMPEGIn.GetData(Buffer : Pointer; BufferSize : Integer): Integer; + var + l, offs : Integer; + tmp : Single; + begin + if not Busy then raise EACSException.Create('The Stream is not opened'); + if BufStart > BufEnd then + begin + if FOffset <> 0 then + begin + offs := Round((FOffset/100)*FSize); + FPosition := FPosition + offs; + if FPosition < 0 then FPosition := 0 + else if FPosition > FSize then FPosition := FSize; + if FOffset < 0 then + begin + SMPEG_rewind(_M); + SMPEG_play(_M); + tmp := (FPosition/FSize)*FTime; + SMPEG_skip(_M, tmp); + end; + tmp := (FOffset/100)*FTime; + SMPEG_skip(_M, tmp); + FOffset := 0; + end; + BufStart := 1; + FillChar(FBuffer, BufferSize, 0); + l := Buffersize; + l := SMPEG_playAudio(_M, @FBuffer[BufEnd + 1], BufferSize - BufEnd); + if l = 0 then + begin + if FLoop then + begin + Flush; + Init; + SMPEG_rewind(_M); + SMPEG_play(_M); + FPosition := 0; + l := SMPEG_playAudio(_M, @FBuffer[BufEnd + 1], BufferSize - BufEnd); + end else + begin + Result := 0; + Exit; + end; + end; + BufEnd := l; + end; + if BufferSize < (BufEnd - BufStart + 1) + then Result := BufferSize + else Result := BufEnd - BufStart + 1; + Move(FBuffer[BufStart], Buffer^, Result); + Inc(BufStart, Result); + Inc(FPosition, Result); + end; + +initialization + LoadMPEGLibrary; + if LibsmpegLoaded then + begin + FileFormats.Add('mp3','Mpeg Audio Layer III',TMPEGIn); + FileFormats.Add('mp2','Mpeg Audio Layer II',TMPEGIn); + FileFormats.Add('mpeg','Mpeg Audio',TMPEGIn); + end; + +finalization + UnLoadMPEGLibrary; + +end. + diff --git a/components/acs/Src/fileformats/acs_vorbis.pas b/components/acs/Src/fileformats/acs_vorbis.pas new file mode 100644 index 000000000..1a447c3eb --- /dev/null +++ b/components/acs/Src/fileformats/acs_vorbis.pas @@ -0,0 +1,669 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: acs_vorbis.pas,v $ +Revision 1.8 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.4 2006/01/01 18:46:40 z0m3ie +*** empty log message *** + +Revision 1.3 2005/12/29 20:45:59 z0m3ie +fixed some problems with vorbis in lazarus + +Revision 1.2 2005/12/26 17:31:39 z0m3ie +fixed some problems in acs_dsfiles +fixed some problems in acs_vorbis +reworked all buffers + +Revision 1.1 2005/12/19 18:36:38 z0m3ie +*** empty log message *** + +Revision 1.5 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.4 2005/11/28 21:57:24 z0m3ie +mostly FileOut fixes +moved PBuffer to PBuffer8 +set all to dynamically Buffering + +Revision 1.3 2005/10/02 16:51:01 z0m3ie +*** empty log message *** + +Revision 1.2 2005/09/13 04:04:50 z0m3ie +First release without Components for Fileformats +only TFileIn and TFileOut are Visible + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.3 2005/09/10 08:25:40 z0m3ie +*** empty log message *** + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + +unit acs_vorbis; + +{$DEFINE USE_VORBIS_11} + +interface + +uses + ACS_File,Classes, SysUtils, ACS_Classes, ogg, vorbiscodec, VorbisFile, VorbisEnc,ACS_Strings +{$IFDEF LINUX} + ,libc; +{$ENDIF} + +{$IFDEF WIN32} + ,Windows,Dialogs; +{$ENDIF} + +type + + TVorbisBitRate = (brAutoSelect, br45, br48, br56, br64, br80, br96, + br112, br128, br144, br160, br192, br224, br256, br320, br499); + + TVorbisOut = class(TACSCustomFileOut) + private + FComments : TStringList; + FSerial : Integer; + FDesiredNominalBitrate : TVorbisBitRate; + FDesiredMaximumBitrate : TVorbisBitRate; + FMinimumBitrate : TVorbisBitRate; + OggSS : ogg_stream_state; + OggPg : ogg_page; + OggPk : ogg_packet; + VInfo : vorbis_info; + VComm : vorbis_comment; + Vdsp : vorbis_dsp_state; + VBlock : vorbis_block; + header, header_comm, header_code : ogg_packet; + FCompression : Single; + EndOfStream : Boolean; + procedure SetComments(vComments : TStringList); + procedure SetDesiredNominalBitrate(Value : TVorbisBitRate); + procedure SetDesiredMaximumBitrate(Value : TVorbisBitRate); + procedure SetMinimumBitrate(Value : TVorbisBitRate); + protected + procedure Done; override; + function DoOutput(Abort : Boolean):Boolean; override; + procedure Prepare; override; + procedure SetFileMode(aMode : TACSFileOutputMode); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + property Compression : Single read FCompression write FCompression stored True; + property Comments : TStringList read FComments write SetComments stored True; + property DesiredMaximumBitrate : TVorbisBitRate read FDesiredMaximumBitrate write SetDesiredMaximumBitrate; + property DesiredNominalBitrate : TVorbisBitRate read FDesiredNominalBitrate write SetDesiredNominalBitrate; + property MinimumBitrate : TVorbisBitRate read FMinimumBitrate write SetMinimumBitrate; + property Serial : Integer read FSerial write FSerial; + //property Vendor : String read FVendor write FVendor; + end; + + TVorbisIn = class(TACSCustomFileIn) + private + FComments : TStringList; +// FVendor : String; + VFile : OggVorbis_File; + cursec : Integer; + FMaxBitrate: Integer; + FNominalBitrate: Integer; + FMinBitrate : Integer; + EndOfStream : Boolean; + function GetMaxBitrate: Integer; + function GetNominalBitrate: Integer; + function GetMinBitrate : Integer; + function GetComments : TStringList; + function GetBitStreams : Integer; + function GetInstantBitRate : Integer; + function GetCurrentBitStream : Integer; + procedure SetCurrentBitStream(BS : Integer); + protected + procedure OpenFile; override; + procedure CloseFile; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + function Seek(SampleNum : Integer) : Boolean; override; + property BitStreams : Integer read GetBitStreams; + property Comments : TStringList read GetComments; + property CurrentBitStream : Integer read GetCurrentBitStream write SetCurrentBitStream; + property InstantBitRate : Integer read GetInstantBitRate; + //property Vendor : String read FVendor; + property MaxBitrate: Integer read GetMaxBitrate; + property MinBitrate: Integer read GetMinBitrate; + property NominalBitrate: Integer read GetNominalBitrate; + end; + +implementation + + function cbRead(ptr : Pointer; size, nmemb : Cardinal;const datasource : Pointer) : Cardinal; cdecl; + var + VI : TVorbisIn; + Buffer : array of Byte; + begin + VI := TVorbisIn(datasource); + SetLength(Buffer, size*nmemb); + Result := VI.FStream.Read(Buffer[0], size*nmemb); + Move(Buffer[0], ptr^, Result); + Setlength(Buffer,0); + Buffer := nil; + end; + + function cbSeek(const datasource : Pointer; offset : ogg_int64_t; whence : Integer) : Integer; cdecl; + var + VI : TVorbisIn; + Origin : TSeekOrigin; + begin + VI := TVorbisIn(datasource); + if not VI.Seekable then + begin + Result := -1; + Exit; + end; + case whence of + SEEK_SET : Origin := TSeekOrigin(soFromBeginning); + SEEK_CUR : Origin := TSeekOrigin(soFromCurrent); + SEEK_END : Origin := TSeekOrigin(soFromEnd); + end; + Result := VI.FStream.Seek(offset, Origin); + end; + + function cbClose(const datasource : Pointer) : Integer; cdecl; + var + VI : TVorbisIn; + begin + VI := TVorbisIn(datasource); + if not VI.FStreamAssigned then VI.FStream.Free + else VI.FStream.Seek(0, soFromBeginning); + Result := 0; + end; + + function cbTell(const datasource : Pointer) : Integer; cdecl; + var + VI : TVorbisIn; + begin + VI := TVorbisIn(datasource); + Result := VI.FStream.Position + end; + + function VorbisBitrateToInt(Bitrate : TVorbisBitrate) : Integer; + begin + case Bitrate of + br45 : Result := 45000; + br48 : Result := 48000; + br56 : Result := 46000; + br64 : Result := 64000; + br80 : Result := 80000; + br96 : Result := 96000; + br112 : Result := 112000; + br128 : Result := 128000; + br144 : Result := 144000; + br160 : Result := 160000; + br192 : Result := 192000; + br224 : Result := 224000; + br256 : Result := 256000; + br320 : Result := 320000; + br499 : Result := 499000; + else Result := -1; + end; + end; + + constructor TVorbisOut.Create; + begin + inherited Create(AOwner); + FBufferSize := $10000; + VORBISLoadLibrary; + FCompression := 0.2; + FComments := TStringList.Create; + FDesiredNominalBitrate := br64; + FDesiredMaximumBitrate := br112; + FMinimumBitrate := br48; + if not (csDesigning in ComponentState) then + begin + VORBISLoadLibrary; + if not LiboggLoaded then + raise EACSException.Create(Format(strCoudntloadLib,[Liboggpath])); + if not LibvorbisLoaded then + raise EACSException.Create(Format(strCoudntloadLib,[LibvorbisPath])); + if not LibvorbisfileLoaded then + raise EACSException.Create(Format(strCoudntloadLib,[LibvorbisfilePath])); + if not LibvorbisencLoaded then + raise EACSException.Create(Format(strCoudntloadLib,[LibvorbisencPath])); + end; + end; + + destructor TVorbisOut.Destroy; + begin + FComments.Free; + inherited Destroy; + end; + + procedure TVorbisOut.SetComments; + begin + FComments.Assign(vComments); + end; + + procedure TVorbisOut.Prepare; + var + i, maxbr, minbr, nombr : Integer; + Name, Value : String; + rm : ovectl_ratemanage2_arg; + begin + GetMem(FBuffer,FBufferSize); + if not FStreamAssigned then + begin + if not Assigned(FInput) then + raise EACSException.Create(strInputNotAssigned); + if FFileName = '' then raise EACSException.Create(strNoFileOpened); + if (not FileExists(FFileName)) or (FFileMode = foRewrite) then + FStream := TFileStream.Create(FFileName, fmCreate or fmShareExclusive, FAccessMask) + else FStream := TFileStream.Create(FFileName, fmOpenReadWrite or fmShareExclusive, FAccessMask); + end; + FInput.Init; + if FFileMode = foAppend then + FStream.Seek(0, soFromEnd); + EndOfStream := False; + vorbis_info_init(VInfo); + if DesiredNominalBitrate = brAutoSelect then + begin + {$IFNDEF USE_VORBIS_11} + vorbis_encode_init_vbr(VInfo, FInput.Channels, FInput.SampleRate, FCompression); + {$ENDIF} + {$IFDEF USE_VORBIS_11} + vorbis_encode_setup_vbr(VInfo, FInput.Channels, FInput.SampleRate, FCompression); + vorbis_encode_setup_init(VInfo); + {$ENDIF} + end else + begin + nombr := VorbisBitrateToInt(FDesiredNominalBitrate); + maxbr := VorbisBitrateToInt(FDesiredMaximumBitrate); + if maxbr < nombr then maxbr := nombr; + minbr := VorbisBitrateToInt(Self.FMinimumBitrate); + if minbr < 0 then minbr := nombr; + vorbis_encode_init(VInfo, FInput.Channels, FInput.SampleRate, maxbr, nombr, minbr); + end; + vorbis_comment_init(VComm); + for i := 0 to FComments.Count - 1 do + begin + Name := FComments.Names[i]; + Value := FComments.Values[Name]; + vorbis_comment_add_tag(VComm, PChar(Name), PChar(Value)); + end; + vorbis_analysis_init(Vdsp, VInfo); + vorbis_block_init(Vdsp, VBlock); + ogg_stream_init(OggSS, FSerial); + vorbis_analysis_headerout(Vdsp, VComm, header, header_comm, header_code); + ogg_stream_packetin(OggSS, header); + ogg_stream_packetin(OggSS, header_comm); + ogg_stream_packetin(OggSS, header_code); + while ogg_stream_flush(OggSS, OggPg) <> 0 do + begin + FStream.Write(OggPg.header^, OggPg.header_len); + FStream.Write(OggPg.body^, OggPg.body_len); + end; + end; + + procedure TVorbisOut.Done; + begin + if not FStreamAssigned then + FStream.Free; + FInput.Flush; + FComments.Clear; + ogg_stream_clear(OggSS); + vorbis_block_clear(VBlock); + vorbis_dsp_clear(Vdsp); + vorbis_comment_clear(VComm); + vorbis_info_clear(VInfo); + FreeMem(FBuffer); + end; + + function TVorbisOut.DoOutput(Abort : Boolean):Boolean; + var + Len, i,chc : Integer; + out_buf : PPFloat; + tmpBuf1, tmpBuf2 : PFloat; + begin + // No exceptions Here + Result := True; + if not CanOutput then Exit; + if Abort or EndOfStream then + begin + (* We don't close file here to avoide exceptions + if output componenet's Stop method is called *) + Result := False; + Exit; + end; + while InputLock do; + InputLock := True; + chc := Finput.Channels; + Len := Finput.GetData(@FBuffer[0], FBufferSize); + InputLock := False; + if Len <> 0 then + begin + if chc = 2 then + begin + out_buf := vorbis_analysis_buffer(Vdsp, FBufferSize shr 2); + (* A bit of pointer arithmetics. What is easy in C + is not so easy in Pascal. *) + tmpBuf1 := out_buf^; + Inc(out_buf); + tmpBuf2 := out_buf^; + for i:=0 to (Len shr 2)-1 do + begin + tmpBuf1[i] := FBuffer[i*2]/$8000; + tmpBuf2[i] := FBuffer[i*2+1]/$8000; + end; + vorbis_analysis_wrote(Vdsp, Len shr 2); + end else + begin + out_buf := vorbis_analysis_buffer(Vdsp, FBufferSize shr 1); + for i:=0 to (Len shr 1)-1 do + out_buf^[i] := FBuffer[i]/$8000; + vorbis_analysis_wrote(Vdsp, Len shr 1); + end; + end else + vorbis_analysis_wrote(Vdsp, 0); + while vorbis_analysis_blockout(Vdsp, VBlock) = 1 do + begin + vorbis_analysis(VBlock, nil); + vorbis_bitrate_addblock(VBlock); + while vorbis_bitrate_flushpacket(Vdsp, OggPk) = 1 do + begin + ogg_stream_packetin(OggSS, OggPk); + while not EndOfStream do + begin + if ogg_stream_pageout(OggSS, OggPg) = 0 then Break; + FStream.Write(OggPg.header^, OggPg.header_len); + FStream.Write(OggPg.body^, OggPg.body_len); + if ogg_page_eos(OggPg) <> 0 then EndOfStream := True; + end; + end; + end; + end; + + constructor TVorbisIn.Create; + begin + inherited Create(AOwner); + BufferSize := $2000; + FComments := TStringList.Create; + if not (csDesigning in ComponentState) then + begin + VORBISLoadLibrary; + if not LiboggLoaded then + raise EACSException.Create(Format(strCoudntloadLib,[LiboggPath])); + if not LibvorbisLoaded then + raise EACSException.Create(Format(strCoudntloadLib,[LibvorbisPath])); + if not LibvorbisfileLoaded then + raise EACSException.Create(Format(strCoudntloadLib,[LibvorbisfilePath])); + if not LibvorbisencLoaded then + raise EACSException.Create(Format(strCoudntloadLib,[LibvorbisencPath])); + end; + end; + + destructor TVorbisIn.Destroy; + begin + FComments.Free; + inherited Destroy; + end; + + procedure TVorbisIn.OpenFile; + var + PVComm : PVORBIS_COMMENT; + PVInfo : PVORBIS_INFO; + PComment : PPChar; + Comment : PChar; + Callbacks : OV_CALLBACKS; + begin + if FOpened = 0 then + begin + FValid := True; + EndOfStream := False; + if not FStreamAssigned then + try + Stream := TFileStream.Create(FileName, fmOpenRead) as TFileStream; + except + FValid := False; + Exit; + end; + Callbacks.read_func := cbRead; + Callbacks.close_func := cbClose; + Callbacks.seek_func := cbSeek; + Callbacks.tell_func := cbTell; + ov_open_callbacks(Self, VFile, nil, 0, Callbacks); + FComments.Clear; +{ PVComm := ov_comment(VFile, -1); + PComment := PVComm.user_comments; + Comment := PComment^; + while Comment <> nil do + begin + FComments.Add(String(Comment)); + Inc(LongWord(PComment), 4); + Comment := PComment^; + end;} +// FVendor := PVComm.vendor; + PVInfo := ov_info(VFile, -1); + FChan := PVInfo.channels; + FSR := PVInfo.rate; + FBPS := 16; + FMaxBitrate := PVInfo.bitrate_upper; + FNominalBitrate := PVInfo.bitrate_nominal; + FMinBitrate := PVInfo.bitrate_lower; + FTotalSamples := ov_pcm_total(VFile, -1); + FSize := (FTotalSamples shl 1) * PVInfo.channels; + cursec := -1; + FTime := Round(ov_time_total(VFile, -1)); + // ov_pcm_seek(VFile, FOffset); + end; + Inc(FOpened); + end; + + procedure TVorbisIn.CloseFile; + begin + if FOpened = 1 then + begin + if ov_seekable(VFile) <> 0 then + ov_pcm_seek(VFile, 0); + ov_clear(VFile); + end; + if FOpened > 0 then Dec(FOpened); + end; + + function TVorbisIn.GetData(Buffer : Pointer; BufferSize : Integer): Integer; + var + l, offs : Integer; + begin + if not Busy then raise EACSException.Create('The Stream is not opened'); + if BufStart > BufEnd then + begin + if FOffset <> 0 then + begin + offs := Round((FOffset/100)*FSize); + FPosition := FPosition + offs; + if FPosition < 0 then FPosition := 0 + else if FPosition > FSize then FPosition := FSize; +// tmp := (FPosition/FSize)*FTime; + if ov_seekable(VFile) <> 0 then + ov_pcm_seek(VFile, (FPosition shr 1) div FChan); + FOffset := 0; + end; + BufStart := 1; + BufEnd := 0; + if not EndOfStream then + begin + (* The ov_read function can return data in quite small chunks + (of about 512 bytes). We keep reading data until the buffer is filled + or there is no more data to read. *) + while BufEnd < BufferSize do + begin + l := ov_read(VFile, @FBuffer[BufEnd + 1], BufferSize - BufEnd, 0, 2, 1, @cursec); + if l <= 0 then + begin + EndOfStream := True; + Break; + end; + Inc(BufEnd, l); + if (FPosition + BufEnd) >= FSize then + begin + BufEnd := FSize - FPosition; + if BufEnd <= 0 then EndOfStream := True; + Break; + end; + end; + end; + if EndOfStream and FLoop then + begin + Flush; + Init; + EndOfStream := False; + while BufEnd < BufferSize do + begin + l := ov_read(VFile, @FBuffer[BufEnd + 1], BufferSize - BufEnd, 0, 2, 1, @cursec); + if l <= 0 then + begin + EndOfStream := True; + Break; + end; + Inc(BufEnd, l); + end; + end; + end; + if BufferSize < (BufEnd - BufStart + 1) + then Result := BufferSize + else Result := BufEnd - BufStart + 1; + Move(FBuffer[BufStart], Buffer^, Result); + Inc(BufStart, Result); + Inc(FPosition, Result); + end; + + function TVorbisIn.GetMaxBitrate : Integer; + begin + OpenFile; + Result := FMaxBitrate; + CloseFile; + end; + + function TVorbisIn.GetNominalBitrate : Integer; + begin + OpenFile; + Result := FNominalBitrate; + CloseFile; + end; + + function TVorbisIn.GetComments : TStringList; + begin + OpenFile; + Result := FComments; + CloseFile; + end; + + function TVorbisIn.GetMinBitrate : Integer; + begin + OpenFile; + Result := FMinBitrate; + CloseFile; + end; + + procedure TVorbisOut.SetFileMode; + begin + FFileMode := aMode; + end; + + function TVorbisIn.GetBitStreams : Integer; + begin + Result := 0; + if Busy then + begin + if ov_seekable(VFile)<>0 then + Result := ov_streams(VFile); + end; + end; + + function TVorbisIn.GetInstantBitRate : Integer; + begin + Result := 0; + if Busy then + begin + Result := ov_bitrate_instant(VFile); + end; + end; + + function TVorbisIn.GetCurrentBitStream : Integer; + begin + Result := -1; + if Busy then + begin + if ov_seekable(VFile)<>0 then + Result := VFile.current_link; + end; + end; + + procedure TVorbisIn.SetCurrentBitStream; + var + Offset : POGG_INT64_T; + begin + if Busy then + begin + if ov_seekable(VFile)<>0 then + if (BS >= 0) and (BS < ov_streams(VFile)) then + begin + Offset := VFile.offsets; + Inc(Offset, BS); + FStream.Seek(Offset^, soFromBeginning); + end; + end; + end; + + procedure TVorbisOut.SetDesiredNominalBitrate; + begin + FDesiredNominalBitrate := Value; + if FMinimumBitrate > FDesiredNominalBitrate then + FMinimumBitrate := FDesiredNominalBitrate; + if FDesiredMaximumBitrate < FDesiredNominalBitrate then + FDesiredMaximumBitrate := FDesiredNominalBitrate; + if FDesiredNominalBitrate = brAutoSelect then + FDesiredMaximumBitrate := brAutoSelect; + end; + + procedure TVorbisOut.SetDesiredMaximumBitrate; + begin + if FDesiredNominalBitrate = brAutoSelect then Exit; + if (Value = brAutoSelect) or (Value >= FDesiredNominalBitrate) then + FDesiredMaximumBitrate := Value; + end; + + procedure TVorbisOut.SetMinimumBitrate; + begin + if Value <= FDesiredNominalBitrate then + FMinimumBitrate := Value; + end; + + function TVorbisIn.Seek(SampleNum : Integer) : Boolean; + begin + Result := False; + if not FSeekable then Exit; + Result := True; + OpenFile; + ov_pcm_seek(VFile, SampleNum); + CloseFile; + end; + +initialization + + FileFormats.Add('ogg','Ogg Vorbis',TVorbisOut); + FileFormats.Add('ogg','Ogg Vorbis',TVorbisIn); + +end. diff --git a/components/acs/Src/fileformats/acs_wave.pas b/components/acs/Src/fileformats/acs_wave.pas new file mode 100644 index 000000000..9f9faadfc --- /dev/null +++ b/components/acs/Src/fileformats/acs_wave.pas @@ -0,0 +1,1839 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: acs_wave.pas,v $ +Revision 1.11 2006/08/03 17:31:09 z0m3ie +*** empty log message *** + +Revision 1.10 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.5 2005/12/30 13:24:28 z0m3ie +waveformat corrections, localizing + +Revision 1.4 2005/12/30 11:10:57 z0m3ie +some corrections to lazarus-linux depending things + +Revision 1.3 2005/12/29 20:45:59 z0m3ie +fixed some problems with vorbis in lazarus + +Revision 1.2 2005/12/26 17:31:39 z0m3ie +fixed some problems in acs_dsfiles +fixed some problems in acs_vorbis +reworked all buffers + +Revision 1.1 2005/12/19 18:36:38 z0m3ie +*** empty log message *** + +Revision 1.6 2005/12/18 17:01:54 z0m3ie +delphi compatibility + +Revision 1.5 2005/12/04 16:54:34 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.4 2005/11/28 21:57:24 z0m3ie +mostly FileOut fixes +moved PBuffer to PBuffer8 +set all to dynamically Buffering + +Revision 1.3 2005/10/02 16:51:01 z0m3ie +*** empty log message *** + +Revision 1.2 2005/09/13 04:04:50 z0m3ie +First release without Components for Fileformats +only TFileIn and TFileOut are Visible + +Revision 1.1 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + +unit acs_wave; + +interface + +uses + +// This is required to enable TWaveIn read MS ACM (MP3-encoded) files. + {$IFDEF WIN32} + MMSYSTEM, MSAcm, waveconverter, + {$ENDIF} + + {$IFDEF LINUX} + Math, MAD, + {$ENDIF} + ACS_File, Classes, SysUtils, ACS_Types, ACS_Classes,ACS_Strings; + +type + + TWavType = (wtUnsupported, wtPCM, wtDVIADPCM, wtMSADPCM, wtACM); + + TWaveHeader = record + // RIFF file header + RIFF: array [0..3] of Char; // = 'RIFF' + FileSize: Integer; // = FileSize - 8 + RIFFType: array [0..3] of Char; // = 'WAVE' + // Format chunk + FmtChunkId: array [0..3] of Char; // = 'fmt' + FmtChunkSize: Integer; // = 16 + FormatTag: Word; // One of WAVE_FORMAT_XXX constants + Channels: Word; // = 1 - mono = 2 - stereo + SampleRate: Integer; + BytesPerSecond: Integer; + BlockAlign: Word; + BitsPerSample: Word; // = 8, 16 or 32 Bits/sample + // Data Chunk + DataChunkId: array [0..3] of Char; // = 'data' + DataSize: Integer; // Data size in bytes + end; + + TDVIADPCMHeader = record + // RIFF file header + RIFF: array [0..3] of Char; // = 'RIFF' + FileSize: Integer; // = FileSize - 8 + RIFFType: array [0..3] of Char; // = 'WAVE' + // Format chunk + FmtChunkId: array [0..3] of Char; // = 'fmt' + FmtChunkSize: Integer; // = 20 + FormatTag: Word; // WAVE_FORMAT_DVI_ADPCM + Channels: Word; // = 1 - mono = 2 - stereo + SampleRate: Integer; + BytesPerSecond: Integer; + BlockAlign: Word; + BitsPerSample: Word; // = 3, 4 Bits/sample + cbSize : Word; // The size in bytes of the extra information + SamplesPerBlock : Word; // number of samples per channel per Block + // Fact Chunk + FactChunkId: array [0..3] of Char; // = 'fact' + FactChunkSize : Integer; // = 4 + DataLength : Integer; + // Data Chunk + DataChunkId: array [0..3] of Char; // = 'data' + DataSize: Integer; // Data size in bytes + end; + + + TDVI_ADPCM_INFO = record + BlockLength : Word; + SamplesPerBlock : Word; + DataSize : Integer; + end; + + TDVI_ADPCM_STATE_STEREO = packed record + valprev_l : SmallInt; // Previous output value + index_l : Byte; // Index into stepsize table + valprev_r : SmallInt; // Previous output value + index_r : Byte; // Index into stepsize table + end; + + TDVI_ADPCM_ENCODE_STATE_STEREO = packed record + PredSamp_l : SmallInt; + Index_l : Byte; + PredSamp_r : SmallInt; + Index_r : Byte; + end; + + TMS_ADPCM_COEF_SET = packed record + Coef1, Coef2 : SmallInt; + end; + + TMS_ADPCM_INFO = record + BlockLength : Word; + SamplesPerBlock : Word; + DataSize : Integer; + NumCoeff : Word; + CoefSets : array[0..31] of TMS_ADPCM_COEF_SET; // Is that enough? + end; + + TMSADPCMBlockHeaderMono = packed record + predictor : Byte; + Delta : SmallInt; + Samp1 : SmallInt; + Samp2 : SmallInt; + end; + + TMSADPCMBlockHeaderStereo = packed record + predictor : array[0..1] of Byte; + Delta : array[0..1] of SmallInt; + Samp1 : array[0..1] of SmallInt; + Samp2 : array[0..1] of SmallInt; + end; + +const + //Hack : Wave is the only format where i must use an const buffer + //all dynamic buffers crash on Move in GetData no matter why + BUFFER_SIZE = $8000; + +type + + { TWaveIn } + + TWaveIn = class(TACSCustomFileIn) + private + buf : array[0..BUFFER_SIZE] of byte; + _WavType : TWavType; + DVI_ADPCM_INFO : TDVI_ADPCM_INFO; + DVI_ADPCM_STATE : TDVI_ADPCM_STATE_STEREO; + MS_ADPCM_INFO : TMS_ADPCM_INFO; + MS_ADPCM_STATE : TMSADPCMBlockHeaderStereo; + HeaderSize : Word; + _MS : TMemoryStream; + OldStream : TStream; + OldStreamAssigned : Boolean; + {$IFDEF LINUX} + // MS ACM stuff + HasFirstFrame : Boolean; + InputDone : Boolean; + Data : Pointer; + DataLen : Integer; + {$ENDIF} + procedure SetBufferSize(S : Integer);override; + function ReadDVIADPCMBlock(aData : Pointer) : Boolean; + function ReadMSADPCMBlock(bData : Pointer) : Boolean; + function GetWavType : TWavType; + procedure ReadRIFFHeader; + procedure DecodeDVIADPCMMono(InData : PACSBuffer8; OutData : PACSBuffer16; var Len : Integer); + procedure DecodeDVIADPCMStereo(InData : PACSBuffer8; OutData : PACSBuffer16; var Len : Integer); + procedure DecodeMSADPCMMono(InData : PACSBuffer8; OutData : PACSBuffer16; var Len : Integer); + procedure DecodeMSADPCMStereo(InData : PACSBuffer8; OutData : PACSBuffer16; var Len : Integer); + protected + procedure OpenFile; override; + procedure CloseFile; override; + public + property WavType : TWavType read GetWavType; + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; aBufferSize : Integer): Integer; override; + function Seek(SampleNum : Integer) : Boolean; override; + end; + + TWaveOut = class(TACSCustomFileOut) + private + EndOfInput : Boolean; + FWavType : TWavType; + FEncodeState : TDVI_ADPCM_ENCODE_STATE_STEREO; + FPrevSR : Integer; + FPrevCh : Word; + FPrevBPS : Word; + FPrevLen : Integer; + FLenOffs : Integer; + FPrevDataSize : Integer; + FDataSizeOffs : Integer; + FPrevWavType : TWavType; + HeaderSize : Integer; + FBlockAlign : Word; + procedure SetWavType(WT : TWavType); + procedure ReadRIFFHeader; + procedure FillHeaderPCM(var Header : TWaveHeader); + procedure FillHeaderDVIADPCM(var Header : TDVIADPCMHeader); + procedure SetBlockSize(BS : Word); + procedure EncodeDVIADPCMMono(InData : PACSBuffer16; OutData : PACSBuffer8); + procedure EncodeDVIADPCMStereo(InData : PACSBuffer16; OutData : PACSBuffer8); + protected + procedure Done; override; + function DoOutput(Abort : Boolean):Boolean; override; + procedure Prepare; override; + procedure SetFileMode(aMode : TACSFileOutputMode); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + property WavType : TWavType read FWavType write SetWavType; + property BlockSize : Word read FBlockAlign write SetBlockSize; + end; + +implementation + +const + + WaveHeaderOffs = 44; + DataSizeOffs = 40; + WAVE_FORMAT_PCM = 1; + WAVE_FORMAT_ADPCM = 2; + WAVE_FORMAT_ALAW = 6; + WAVE_FORMAT_MULAW = 7; + WAVE_FORMAT_DVI_IMA_ADPCM = 17; + WAVE_FORMAT_IMA_ADPCM = 17; + WAVE_FORMAT_MP3 = 85; + +type + + TDVIADPCMBlockHeader = packed record + Samp0 : SmallInt; + StepTableIndex : Byte; + Reserved : Byte; + end; + +const + + // DVI IMA ADPCM stuff + + StepTab : array[0..88] of Integer = ( + 7, 8, 9, 10, 11, 12, 13, 14, + 16, 17, 19, 21, 23, 25, 28, 31, + 34, 37, 41, 45, 50, 55, 60, 66, + 73, 80, 88, 97, 107, 118, 130, 143, + 157, 173, 190, 209, 230, 253, 279, 307, + 337, 371, 408, 449, 494, 544, 598, 658, + 724, 796, 876, 963, 1060, 1166, 1282, 1411, + 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, + 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484, + 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, + 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, + 32767 ); + + IndexTab : array[0..15] of Integer = ( -1, -1, -1, -1, 2, 4, 6, 8, + -1, -1, -1, -1, 2, 4, 6, 8 ); + + // MS ADPCM Stuff + + adaptive : array[0..15] of SmallInt = + ( + 230, 230, 230, 230, 307, 409, 512, 614, + 768, 614, 512, 409, 307, 230, 230, 230 + ); + + + + procedure TWaveIn.DecodeDVIADPCMMono(InData : PACSBuffer8; OutData : PACSBuffer16; var Len : Integer); + var + i, j, SP : Integer; + Diff, PSample : Integer; + Code : Byte; + Index : Integer; + begin + OutData^[0] := DVI_ADPCM_STATE.valprev_l; + SP := 0; + PSample := DVI_ADPCM_STATE.valprev_l; + Index := DVI_ADPCM_STATE.index_l; + for i := 0 to (Len shl 1) -1 do + begin + j := i shr 1; + Code := InData^[j]; + if (i and 1) = 0 then + Code := Code and 15 + else Code := Code shr 4; + Diff := (StepTab[Index] shr 3 ); + if (Code and 4) <> 0 then + Diff := Diff + StepTab[Index]; + if (Code and 2) <> 0 then + Diff := Diff + (StepTab[Index] shr 1); + if (Code and 1) <> 0 then + Diff := Diff + (StepTab[Index] shr 2); + if (Code and 8) <> 0 then Diff := -Diff; + PSample := PSample + Diff; + if PSample > 32767 then PSample := 32767; + if PSample < -32767 then PSample := -32767; + SP:=SP+1; + OutData^[SP] := PSample; + Index := Index + IndexTab[Code]; + if Index > 88 then Index := 88; + if Index < 0 then Index := 0; + end; + Len := SP+1; + end; + + procedure TWaveIn.DecodeDVIADPCMStereo(InData : PACSBuffer8; OutData : PACSBuffer16; var Len : Integer); + var + i, j, SP : Integer; + Diff, PSample : Integer; + Code : Byte; + Index : Integer; + begin + OutData^[0] := DVI_ADPCM_STATE.valprev_l; + SP := 0; + PSample := DVI_ADPCM_STATE.valprev_l; + Index := DVI_ADPCM_STATE.index_l; + for i := 0 to (Len -1) do + begin + j := i shr 1; + Code := InData^[(j div 4)*8 + (j mod 4)]; + if (i and 1) = 0 then + Code := Code and 15 + else Code := Code shr 4; + Diff := (StepTab[Index] shr 3 ); + if (Code and 4) <> 0 then + Diff := Diff + StepTab[Index]; + if (Code and 2) <> 0 then + Diff := Diff + (StepTab[Index] shr 1); + if (Code and 1) <> 0 then + Diff := Diff + (StepTab[Index] shr 2); + if (Code and 8) <> 0 then Diff := -Diff; + PSample := PSample + Diff; + if PSample > 32767 then PSample := 32767; + if PSample < -32767 then PSample := -32767; + SP:=SP+2; + OutData^[SP] := PSample; + Index := Index + IndexTab[Code]; + if Index > 88 then Index := 88; + if Index < 0 then Index := 0; + end; + i := 1; + OutData^[i] := DVI_ADPCM_STATE.valprev_r; + SP := 1; + PSample := DVI_ADPCM_STATE.valprev_r; + Index := DVI_ADPCM_STATE.index_r; + for i := 0 to (Len -1) do + begin + j := i shr 1; + Code := InData^[(j div 4)*8 + (j mod 4) + 4]; + if (i and 1) = 0 then + Code := Code and 15 + else Code := Code shr 4; + Diff := (StepTab[Index] shr 3 ); + if (Code and 4) <> 0 then + Diff := Diff + StepTab[Index]; + if (Code and 2) <> 0 then + Diff := Diff + (StepTab[Index] shr 1); + if (Code and 1) <> 0 then + Diff := Diff + (StepTab[Index] shr 2); + if (Code and 8) <> 0 then Diff := -Diff; + PSample := PSample + Diff; + if PSample > 32767 then PSample := 32767; + if PSample < -32767 then PSample := -32767; + SP:=SP+2; + OutData^[SP] := PSample; + Index := Index + IndexTab[Code]; + if Index > 88 then Index := 88; + if Index < 0 then Index := 0; + end; + Len := (SP div 2)+1; + end; + + procedure TWaveIn.DecodeMSADPCMMono(InData : PACSBuffer8; OutData : PACSBuffer16; var Len : Integer); + var + pos, i, PredSamp, ErrorDelta : Integer; + begin + pos := 0; + OutData^[pos] := MS_ADPCM_STATE.Samp2[0]; + Inc(pos); + OutData^[pos] := MS_ADPCM_STATE.Samp1[0]; + Inc(pos); + for i := 0 to (Len shr 1) - 1 do + begin + PredSamp := (MS_ADPCM_STATE.Samp1[0]*MS_ADPCM_INFO.CoefSets[MS_ADPCM_STATE.predictor[0]].Coef1 + + MS_ADPCM_STATE.Samp2[0]*MS_ADPCM_INFO.CoefSets[MS_ADPCM_STATE.predictor[0]].Coef2) div 256; + ErrorDelta := InData^[i] shr 4; + if (ErrorDelta and 8) <> 0 then + PredSamp := PredSamp + MS_ADPCM_STATE.Delta[0]*(ErrorDelta - 16) + else + PredSamp := PredSamp + MS_ADPCM_STATE.Delta[0]*(ErrorDelta); + if PredSamp > 32767 then PredSamp := 32767; + if PredSamp < -32768 then PredSamp := -32768; + OutData^[pos] := PredSamp; + Inc(pos); + MS_ADPCM_STATE.Delta[0] := (MS_ADPCM_STATE.Delta[0]*adaptive[ErrorDelta]) div 256; + if MS_ADPCM_STATE.Delta[0] < 16 then MS_ADPCM_STATE.Delta[0] := 16; + MS_ADPCM_STATE.Samp2[0] := MS_ADPCM_STATE.Samp1[0]; + MS_ADPCM_STATE.Samp1[0] := PredSamp; + + PredSamp := (MS_ADPCM_STATE.Samp1[0]*MS_ADPCM_INFO.CoefSets[MS_ADPCM_STATE.predictor[0]].Coef1 + + MS_ADPCM_STATE.Samp2[0]*MS_ADPCM_INFO.CoefSets[MS_ADPCM_STATE.predictor[0]].Coef2) div 256; + ErrorDelta := InData^[i] and 15; + if (ErrorDelta and 8) <> 0 then + PredSamp := PredSamp + MS_ADPCM_STATE.Delta[0]*(ErrorDelta - 16) + else + PredSamp := PredSamp + MS_ADPCM_STATE.Delta[0]*(ErrorDelta); + if PredSamp > 32767 then PredSamp := 32767; + if PredSamp < -32768 then PredSamp := -32768; + OutData^[pos] := PredSamp; + Inc(pos); + MS_ADPCM_STATE.Delta[0] := (MS_ADPCM_STATE.Delta[0]*adaptive[ErrorDelta]) div 256; + if MS_ADPCM_STATE.Delta[0] < 16 then MS_ADPCM_STATE.Delta[0] := 16; + MS_ADPCM_STATE.Samp2[0] := MS_ADPCM_STATE.Samp1[0]; + MS_ADPCM_STATE.Samp1[0] := PredSamp; + end; + Len := pos*2; + end; + + procedure TWaveIn.DecodeMSADPCMStereo(InData : PACSBuffer8; OutData : PACSBuffer16; var Len : Integer); + var + pos, i, PredSamp, ErrorDelta : Integer; + begin + pos := 0; + OutData^[pos] := MS_ADPCM_STATE.Samp2[0]; + Inc(pos); + OutData^[pos] := MS_ADPCM_STATE.Samp2[1]; + Inc(pos); + OutData^[pos] := MS_ADPCM_STATE.Samp1[0]; + Inc(pos); + OutData^[pos] := MS_ADPCM_STATE.Samp1[1]; + Inc(pos); + for i := 0 to Len - 1 do + begin + PredSamp := (MS_ADPCM_STATE.Samp1[0]*MS_ADPCM_INFO.CoefSets[MS_ADPCM_STATE.predictor[0]].Coef1 + + MS_ADPCM_STATE.Samp2[0]*MS_ADPCM_INFO.CoefSets[MS_ADPCM_STATE.predictor[0]].Coef2) div 256; + ErrorDelta := InData^[i] shr 4; + if (ErrorDelta and 8) <> 0 then + PredSamp := PredSamp + MS_ADPCM_STATE.Delta[0]*(ErrorDelta - 16) + else + PredSamp := PredSamp + MS_ADPCM_STATE.Delta[0]*(ErrorDelta); + if PredSamp > 32767 then PredSamp := 32767; + if PredSamp < -32768 then PredSamp := -32768; + OutData^[pos] := PredSamp; + Inc(pos); + MS_ADPCM_STATE.Delta[0] := (MS_ADPCM_STATE.Delta[0]*adaptive[ErrorDelta]) div 256; + if MS_ADPCM_STATE.Delta[0] < 16 then MS_ADPCM_STATE.Delta[0] := 16; + MS_ADPCM_STATE.Samp2[0] := MS_ADPCM_STATE.Samp1[0]; + MS_ADPCM_STATE.Samp1[0] := PredSamp; + + PredSamp := (MS_ADPCM_STATE.Samp1[1]*MS_ADPCM_INFO.CoefSets[MS_ADPCM_STATE.predictor[1]].Coef1 + + MS_ADPCM_STATE.Samp2[1]*MS_ADPCM_INFO.CoefSets[MS_ADPCM_STATE.predictor[1]].Coef2) div 256; + ErrorDelta := InData^[i] and 15; + if (ErrorDelta and 8) <> 0 then + PredSamp := PredSamp + MS_ADPCM_STATE.Delta[1]*(ErrorDelta - 16) + else + PredSamp := PredSamp + MS_ADPCM_STATE.Delta[1]*(ErrorDelta); + if PredSamp > 32767 then PredSamp := 32767; + if PredSamp < -32768 then PredSamp := -32768; + OutData^[pos] := PredSamp; + Inc(pos); + MS_ADPCM_STATE.Delta[1] := (MS_ADPCM_STATE.Delta[1]*adaptive[ErrorDelta]) div 256; + if MS_ADPCM_STATE.Delta[1] < 16 then MS_ADPCM_STATE.Delta[1] := 16; + MS_ADPCM_STATE.Samp2[1] := MS_ADPCM_STATE.Samp1[1]; + MS_ADPCM_STATE.Samp1[1] := PredSamp; + end; + Len := pos*2; + end; + + function Compare4(S1, S2 : PChar) : Boolean; + var + i, Diff : Byte; + begin + Result := False; + for i := 0 to 3 do + begin + Diff := Byte(S1[i]) - Byte(S2[i]); + if not (Diff in [0, 32, 224]) then Exit; + end; + Result := True; + end; + +{$IFDEF LINUX} + + function InputFunc(CData : Pointer; Stream : p_mad_stream) : Integer; cdecl; + var + WI : TWaveIn; + begin + WI := TWaveIn(CData); + if WI.InputDone then + begin + Result := MAD_FLOW_STOP; + Exit; + end; + WI.InputDone := True; + mad_stream_buffer(Stream, WI.Data, WI.DataLen); + Result := MAD_FLOW_CONTINUE; + end; + + function OutputFunc(CData : Pointer; Header : p_mad_header; pcm : p_mad_pcm) : Integer; cdecl; + var + WI : TWaveIn; + WH : TWaveHeader; + i, framesize : Integer; + outsamples : array[0..2303] of SmallInt; + text : array[0..4] of Char; + begin + WI := TWaveIn(CData); + if not WI.HasFirstFrame then + begin + WI.FSR := pcm^.samplerate; + WI.FChan := pcm^.channels; + WI.FBPS := 16; + framesize := Ceil(144*Header^.bitrate/Header^.samplerate); + WI.FSize := Round(WI.DataLen/framesize*1152)*WI.FChan*2; + WI.FValid := True; + text := 'RIFF'; + Move(text[0], WH.RIFF[0], 4); + WH.FileSize := WI.FSize + 44; + text := 'WAVE'; + Move(text[0], WH.RIFFType[0], 4); + text := 'fmt '; + Move(text[0], WH.FmtChunkId[0], 4); + WH.FmtChunkSize := 16; + WH.FormatTag := 1; + WH.Channels := WI.FChan; + WH.SampleRate := WI.FSR; + WH.BitsPerSample := 16; + WH.BlockAlign := 2*WI.FChan; + WH.BytesPerSecond := WI.FSR * WH.BlockAlign; + text := 'data'; + Move(text[0], WH.DataChunkId[0], 4); + WH.DataSize := WI.FSize; + WI.FStream.Size :=WI.FSize + 44; + WI.FStream.Seek(0, soFromBeginning); + WI.FStream.Write(WH, 44); + WI.HasFirstFrame := True; + end; + if pcm^.channels = 2 then + begin + for i := 0 to pcm^.length -1 do + begin + if pcm^.samples[0][i] >= MAD_F_ONE then + pcm^.samples[0][i] := MAD_F_ONE - 1; + if pcm^.samples[0][i] < -MAD_F_ONE then + pcm^.samples[0][i] := -MAD_F_ONE; + pcm^.samples[0][i] := pcm^.samples[0][i] shr (MAD_F_FRACBITS + 1 - 16); + outsamples[i shl 1] := pcm^.samples[0][i]; + if pcm^.samples[1][i] >= MAD_F_ONE then + pcm^.samples[1][i] := MAD_F_ONE - 1; + if pcm^.samples[1][i] < -MAD_F_ONE then + pcm^.samples[1][i] := -MAD_F_ONE; + pcm^.samples[1][i] := pcm^.samples[1][i] shr (MAD_F_FRACBITS + 1 - 16); + outsamples[(i shl 1)+1] := pcm^.samples[1][i]; + end; + WI.FStream.Write(outsamples[0], pcm^.length*4); + end else + begin + for i := 0 to pcm^.length -1 do + begin + if pcm^.samples[0][i] >= MAD_F_ONE then + pcm^.samples[0][i] := MAD_F_ONE - 1; + if pcm^.samples[0][i] < -MAD_F_ONE then + pcm^.samples[0][i] := -MAD_F_ONE; + pcm^.samples[0][i] := pcm^.samples[0][i] shr (MAD_F_FRACBITS + 1 - 16); + outsamples[i] := pcm^.samples[0][i]; + end; + WI.FStream.Write(outsamples[0], pcm^.length*2); + end; + Result := MAD_FLOW_CONTINUE; + end; + + function ErrorFunc(CData : Pointer; Stream : p_mad_stream; Frame : p_mad_frame) : Integer; cdecl; + begin + Result := MAD_FLOW_CONTINUE; + end; + +{$ENDIF} + +const + LookingForRIFF = 0; + LookingForWave = 1; + LookingForFMT = 2; + LookingForFACT = 3; + LookingForDATA = 4; + + constructor TWaveIn.Create(AOwner: TComponent); + begin + inherited Create(AOwner); + BufferSize := $8000; + _WavType := wtUnsupported; + end; + + destructor TWaveIn.Destroy; + begin + inherited Destroy; + end; + + procedure TWaveIn.OpenFile; + var + {$IFDEF WIN32} + WaveConverter: TWaveConverter; + ValidItems: LongWord; + Res: MMResult; + {$ENDIF} + {$IFDEF LINUX} + _decoder : mad_decoder; + {$ENDIF} + begin + FValid := True; + if FOpened = 0 then + begin + _WavType := wtUnsupported; + if not FStreamAssigned then + FStream := TFileStream.Create(FFileName, fmOpenRead) as TFileStream; + ReadRIFFHeader; + case Self._WavType of + wtUnsupported : + begin + FValid := False; + Inc(FOpened); + Exit; + end; + wtPCM: + begin + FSize := FStream.Size; + FTotalSamples := FSize div ((FBPS shr 3) * FChan); + end; + wtDVIADPCM : + begin + if FBPS <> 4 then + FValid := False; + FBPS := 16; + FTotalSamples := DVI_ADPCM_INFO.DataSize; + FSize := FTotalSamples*2*FChan; + end; + wtMSADPCM : + begin + FBPS := 16; + FSize := MS_ADPCM_INFO.DataSize*2*FChan; + FTotalSamples := MS_ADPCM_INFO.DataSize; + end; + wtACM : + begin + +{$IFDEF WIN32} + + (* Checking if the file is ACM encoded and if it is, decoding it. + Thanks to Jan Henrik Ejme, for the + provided converter units. *) + try + WaveConverter := TWaveConverter.Create; + FStream.Position := 0; + WaveConverter.LoadStream(FStream); + with WaveConverter.NewFormat.Format do + begin + wFormatTag := WAVE_FORMAT_PCM; + ValidItems := ACM_FORMATSUGGESTF_WFORMATTAG; + Res := acmFormatSuggest(nil, WaveConverter.CurrentFormat.format, + WaveConverter.NewFormat.Format, SizeOf(TACMWaveFormat), ValidItems); + end; + if Res <> 0 then + begin + FValid := False; + WaveConverter.Free; + Exit; + end; + if WaveConverter.Convert <> 0 then + begin + FValid := False; + WaveConverter.Free; + Exit; + end else + begin + _MS := TMemoryStream.Create; + OldStream := FStream; + OldStreamAssigned := FStreamAssigned; + FStream := _MS; + _MS.Position := 0; + WaveConverter.SaveWavToStream(_MS); + FSize := _MS.Size; + _MS.Seek(0, soFromBeginning); + ReadRIFFHeader; + //WaveConverter.CurrentFormat.Format.wFormatTag; + WaveConverter.Free; + _wavType := wtACM; + end; + except + WaveConverter.Free; + end; +{$ENDIF} +{$IFDEF LINUX} + if not MADLibLoaded then + raise EACSException.Create(Format(strCoudntloadLib,['madlib'])); + DataLen := FStream.Size; + GetMem(Data, DataLen); + FStream.Read(Data^, DataLen); + _MS := TMemoryStream.Create; + OldStream := FStream; + OldStreamAssigned := FStreamAssigned; + FStream := _MS; + HasFirstFrame := False; + InputDone := False; + mad_decoder_init(@_decoder, Self, InputFunc, nil, nil, OutputFunc, ErrorFunc, nil); + mad_decoder_run(@_decoder, MAD_DECODER_MODE_SYNC); + mad_decoder_finish(@_decoder); + FreeMem(Data); + FStream.Seek(0, soFromBeginning); + ReadRIFFHeader; + _wavType := wtACM; +{$ENDIF} + end; + end; + end; + Inc(FOpened); + end; + + procedure TWaveIn.CloseFile; + begin + if FOpened = 1 then + begin + if not FStreamAssigned then FStream.Free + else if FSeekable then FStream.Seek(0, soFromBeginning); + if _WavType = wtACM then + begin + if Assigned(_MS) then + begin + if OldStreamAssigned then + FStream := OldStream + else + begin + FStream := nil; + OldStream.Free; + end; +// _MS.Free; + _MS := nil; + end; + end; + end; + if FOpened > 0 then Dec(FOpened); + end; + + function TWaveIn.GetData(Buffer : Pointer; aBufferSize : Integer): Integer; + var + l, csize : Integer; + offs : Integer; + Data : Pointer; + begin + if not Busy then raise EACSException.Create(strStreamnotopen); + if BufStart > BufEnd then + begin + case _WavType of + wtDVIADPCM : + begin + if FOffset <> 0 then + begin + offs := (FStream.Position div DVI_ADPCM_INFO.BlockLength) + * DVI_ADPCM_INFO.SamplesPerBlock + Round((FOffset/100)*FTotalSamples); + if offs < 0 then offs := 0; + Seek(offs); + FPosition := (FStream.Position div DVI_ADPCM_INFO.BlockLength) + * DVI_ADPCM_INFO.SamplesPerBlock; + FPosition := FPosition*2*FChan; + FOffset := 0; + end; + if FSeekable then + begin + if FPosition >= FSize then + begin + if FLoop then + begin + Flush; + Init; + end else + begin + Result := 0; + Exit; + end; + end; + end; + BufStart := 1; + csize := DVI_ADPCM_INFO.BlockLength - FChan*4; + GetMem(Data, csize); + if ReadDVIADPCMBlock(Data) then + begin + if FChan = 2 then + begin + DecodeDVIADPCMStereo(Data, @buf[1], csize); + BufEnd := (csize)*4; + end else + begin + DecodeDVIADPCMMono(Data, @buf[1], csize); + BufEnd := (csize)*2; + FreeMem(Data); + end; + end else + begin + FreeMem(Data); + if not Seekable then + begin + Result := 0; + Exit; + end + else BufEnd := 0; + end; + end; + wtMSADPCM : + begin + if FOffset <> 0 then + begin + offs := (FStream.Position div MS_ADPCM_INFO.BlockLength) + * MS_ADPCM_INFO.SamplesPerBlock + Round((FOffset/100)*FTotalSamples); + if offs < 0 then offs := 0; + Seek(offs); + FPosition := (FStream.Position div MS_ADPCM_INFO.BlockLength) + * MS_ADPCM_INFO.SamplesPerBlock; + FPosition := FPosition*2*FChan; + FOffset := 0; + end; + if FPosition >= FSize then + begin + if FLoop then + begin + Flush; + Init; + end else + begin + Result := 0; + Exit; + end; + end; + BufStart := 1; + if FChan = 2 then + begin + csize := MS_ADPCM_INFO.BlockLength-SizeOf(TMSADPCMBlockHeaderStereo); + GetMem(Data, csize); + if ReadMSADPCMBlock(Data) then + begin + csize := MS_ADPCM_INFO.SamplesPerBlock-2; + DecodeMSADPCMStereo(Data, @buf, csize); + BufEnd := csize; + FreeMem(Data); + end else BufEnd := 0; + end else + begin + csize := MS_ADPCM_INFO.BlockLength-SizeOf(TMSADPCMBlockHeaderMono); + GetMem(Data, csize); + if ReadMSADPCMBlock(Data) then + begin + csize := MS_ADPCM_INFO.SamplesPerBlock-2; + DecodeMSADPCMMono(Data, @buf, csize); + BufEnd := csize; + FreeMem(Data); + end else BufEnd := 0; + end; + end; + wtPCM: + begin + if FOffset <> 0 then + begin + offs := Round((FOffset/100)*FSize); + FPosition := FPosition + offs; + if FPosition < 0 then FPosition := 0 + else if FPosition > FSize then FPosition := FSize; + FStream.Seek((FPosition shr 2) shl 2, soFromBeginning); // align to 4-byte frame + FOffset := 0; + end; + BufStart := 1; + l := FStream.Read(buf, aBufferSize); + if FPosition+l >= FSize then + l := FSize - FPosition; + if l <=0 then + begin + if FLoop then + begin + Flush; + Init; + end else + begin + Result := 0; + Exit; + end; + end; + if l = 0 then + begin + if FLoop then + begin + Flush; + Init; + l := FStream.Read(buf, aBufferSize); + end else + begin + Result := 0; + Exit; + end; + end; + BufEnd := l; + end; + wtACM: + begin + if FOffset <> 0 then + begin + offs := Round((FOffset/100)*FSize); + FPosition := FPosition + offs; + if FPosition < 0 then FPosition := 0 + else if FPosition > FSize then FPosition := FSize; + FStream.Seek((FPosition shr 2) shl 2, soFromBeginning); // align to 4-byte frame + FOffset := 0; + end; + BufStart := 1; + l := FStream.Read(buf, aBufferSize); + if FPosition+l >= FSize then + l := FSize - FPosition; + if l <=0 then + begin + if FLoop then + begin + Flush; + Init; + end else + begin + Result := 0; + Exit; + end; + end; + BufEnd := l; + end; + end; + end; + if aBufferSize < (BufEnd - BufStart + 1) then + Result := aBufferSize + else + Result := BufEnd - BufStart + 1; + + Move(buf[BufStart-1], Buffer^, Result); + Inc(BufStart, Result); + Inc(FPosition, Result); + end; + + function TWaveIn.Seek(SampleNum : Integer) : Boolean; + begin + Result := False; + if not FSeekable then Exit; + Result := True; + OpenFile; + case _WavType of + wtPCM : + begin + Stream.Seek(SampleNum*(Self.FBPS shr 3)*FChan+HeaderSize, soFromBeginning); + end; + wtDVIADPCM: + begin + Stream.Seek((SampleNum div DVI_ADPCM_INFO.SamplesPerBlock)*DVI_ADPCM_INFO.BlockLength + HeaderSize, soFromBeginning); + end; + wtMSADPCM: + begin + Stream.Seek((SampleNum div MS_ADPCM_INFO.SamplesPerBlock)*MS_ADPCM_INFO.BlockLength + HeaderSize, soFromBeginning); + end; + else + begin + Result := False; + end; + end; + CloseFile; + end; + +procedure TWaveOut.FillHeaderPCM(var Header : TWaveHeader); +var + text : array[0..4] of Char; +begin + text := 'RIFF'; + Move(text[0], Header.RIFF[0], 4); + Header.FileSize := FInput.Size + WaveHeaderOffs; + text := 'WAVE'; + Move(text[0], Header.RIFFType[0], 4); + text := 'fmt '; + Move(text[0], Header.FmtChunkId[0], 4); + Header.FmtChunkSize := 16; + Header.FormatTag := WAVE_FORMAT_PCM; + Header.Channels := FInput.Channels; + Header.SampleRate := FInput.SampleRate; + Header.BitsPerSample := FInput.BitsPerSample; + Header.BlockAlign := (Header.BitsPerSample * Header.Channels) shr 3; + Header.BytesPerSecond := Header.SampleRate * Header.BlockAlign; + text := 'data'; + Move(text[0], Header.DataChunkId[0], 4); + Header.DataSize := FInput.Size; +end; + +procedure TWaveOut.FillHeaderDVIADPCM(var Header : TDVIADPCMHeader); +var + text : array[0..4] of Char; + samples : Integer; +begin + text := 'RIFF'; + Move(text[0], Header.RIFF[0], 4); + text := 'WAVE'; + Move(text[0], Header.RIFFType[0], 4); + text := 'fmt '; + Move(text[0], Header.FmtChunkId[0], 4); + Header.FmtChunkSize := 20; + Header.FormatTag := WAVE_FORMAT_DVI_IMA_ADPCM; + Header.Channels := FInput.Channels; + Header.SampleRate := FInput.SampleRate; + Header.BitsPerSample := 4; + Header.BlockAlign := FBlockAlign; + Header.SamplesPerBlock := (Header.BlockAlign- 4*FInput.Channels) * (2 div FInput.Channels) + 1; + Header.cbSize := 2; + Header.BytesPerSecond := (FInput.SampleRate div Header.SamplesPerBlock)*Header.BlockAlign; + samples := (FInput.Size div (FInput.BitsPerSample shr 3)) div FInput.Channels; + Header.DataSize := Round(samples/Header.SamplesPerBlock)*Header.BlockAlign; + Header.FileSize := Header.DataSize + SizeOf(TDVIADPCMHeader); + text := 'data'; + Move(text[0], Header.DataChunkId[0], 4); + text := 'fact'; + Move(text[0], Header.FactChunkId[0], 4); + Header.FactChunkSize := 4; + Header.DataLength := samples; +end; + +procedure TWaveOut.EncodeDVIADPCMMono(InData : PACSBuffer16; OutData : PACSBuffer8); +var + i, j, Diff, PredSamp, Index : Integer; + Code : Byte; + Header : TDVIADPCMBlockHeader; +begin + FillChar(OutData[0], FBlockAlign, 0); + Header.Samp0 := FEncodeState.PredSamp_l; + Header.StepTableIndex := FEncodeState.Index_l; + Move(Header, OutData[0], SizeOf(Header)); + PredSamp := FEncodeState.PredSamp_l; + Index := FEncodeState.Index_l; + for i := 0 to (FBlockAlign-4)*2 - 1 do + begin + Diff := InData[i] - PredSamp; + if Diff < 0 then + begin + Code := 8; + Diff := -Diff; + end else Code := 0; + if Diff >= StepTab[Index] then + begin + Code := Code or 4; + Diff := Diff-StepTab[Index]; + end; + if Diff >= (StepTab[Index] shr 1) then + begin + Code := Code or 2; + Diff := Diff - (StepTab[Index] shr 1); + end; + if Diff >= (StepTab[Index] shr 2) then + Code := Code or 1; + j := (i shr 1)+4; + if (i and 1) = 0 then + OutData[j] := Code + else + OutData[j] := OutData[j] or (Code shl 4); + Diff := (StepTab[Index] shr 3); + if (Code and 4) <> 0 then Diff := Diff + StepTab[Index]; + if (Code and 2) <> 0 then Diff := Diff + (StepTab[Index] shr 1); + if (Code and 1) <> 0 then Diff := Diff + (StepTab[Index] shr 2); + if (Code and 8) <> 0 then Diff := -Diff; + PredSamp := PredSamp + Diff; + if PredSamp > 32767 then PredSamp := 32767; + if PredSamp < -32767 then PredSamp := -32767; + Index := Index + IndexTab[Code]; + if Index > 88 then Index := 88; + if Index < 0 then Index := 0; + end; + FEncodeState.Index_l := Index; +// State.PredSamp_l := PredSamp; +end; + +procedure TWaveOut.EncodeDVIADPCMStereo(InData : PACSBuffer16; OutData : PACSBuffer8); +var + i, j, Diff, bPos, PredSamp, Index : Integer; + Code : Byte; + Header : TDVIADPCMBlockHeader; +begin + FillChar(OutData[0], FBlockAlign, 0); + Header.Samp0 := FEncodeState.PredSamp_l; + Header.StepTableIndex := FEncodeState.Index_l; + Move(Header, OutData[0], SizeOf(Header)); + Header.Samp0 := FEncodeState.PredSamp_r; + Header.StepTableIndex := FEncodeState.Index_r; + i := 4; + Move(Header, OutData[i], SizeOf(Header)); + PredSamp := FEncodeState.PredSamp_l; + Index := FEncodeState.Index_l; + for i := 0 to FBlockAlign - 9 do + begin + Diff := InData[i shl 1] - PredSamp; + if Diff < 0 then + begin + Code := 8; + Diff := -Diff; + end else Code := 0; + if Diff >= StepTab[Index] then + begin + Code := Code or 4; + Diff := Diff-StepTab[Index]; + end; + if Diff >= (StepTab[Index] shr 1) then + begin + Code := Code or 2; + Diff := Diff - (StepTab[Index] shr 1); + end; + if Diff >= (StepTab[Index] shr 2) then + Code := Code or 1; + j := i shr 1; + bPos := (j div 4)*8 + (j mod 4) + 8; + if (i and 1) = 0 then + OutData[bPos] := Code + else + OutData[bPos] := OutData[bPos] or (Code shl 4); + Diff := (StepTab[Index] shr 3); + if (Code and 4) <> 0 then Diff := Diff + StepTab[Index]; + if (Code and 2) <> 0 then Diff := Diff + (StepTab[Index] shr 1); + if (Code and 1) <> 0 then Diff := Diff + (StepTab[Index] shr 2); + if (Code and 8) <> 0 then Diff := -Diff; + PredSamp := PredSamp + Diff; + if PredSamp > 32767 then PredSamp := 32767; + if PredSamp < -32767 then PredSamp := -32767; + Index := Index + IndexTab[Code]; + if Index > 88 then Index := 88; + if Index < 0 then Index := 0; + end; + FEncodeState.Index_l := Index; + FEncodeState.PredSamp_l := PredSamp; + PredSamp := FEncodeState.PredSamp_r; + Index := FEncodeState.Index_r; + for i := 0 to FBlockAlign - 9 do + begin + Diff := InData[(i shl 1)+1] - PredSamp; + if Diff < 0 then + begin + Code := 8; + Diff := -Diff; + end else Code := 0; + if Diff >= StepTab[Index] then + begin + Code := Code or 4; + Diff := Diff-StepTab[Index]; + end; + if Diff >= (StepTab[Index] shr 1) then + begin + Code := Code or 2; + Diff := Diff - (StepTab[Index] shr 1); + end; + if Diff >= (StepTab[Index] shr 2) then + Code := Code or 1; + j := i shr 1; + bPos := (j div 4)*8 + (j mod 4) + 12; + if i and 1 = 0 then + OutData[bPos] := Code + else + OutData[bPos] := OutData[bPos] or (Code shl 4); + Diff := (StepTab[Index] shr 3); + if (Code and 4) <> 0 then Diff := Diff + StepTab[Index]; + if (Code and 2) <> 0 then Diff := Diff + (StepTab[Index] shr 1); + if (Code and 1) <> 0 then Diff := Diff + (StepTab[Index] shr 2); + if (Code and 8) <> 0 then Diff := -Diff; + PredSamp := PredSamp + Diff; + if PredSamp > 32767 then PredSamp := 32767; + if PredSamp < -32767 then PredSamp := -32767; + Index := Index + IndexTab[Code]; + if Index > 88 then Index := 88; + if Index < 0 then Index := 0; + end; + FEncodeState.Index_r := Index; + FEncodeState.PredSamp_r := PredSamp; +end; + +constructor TWaveOut.Create; +begin + inherited Create(AOwner); + FBufferSize := $4000; + FWavType := wtPCM; + FBlockAlign := 512; +end; + +destructor TWaveOut.Destroy; +begin + inherited Destroy; +end; + +procedure TWaveOut.SetWavType; +begin + if Busy then Exit; + if (WT = wtPCM) or (WT = wtDVIADPCM) then + FWavType := WT; +end; + + procedure TWaveOut.Prepare; + var + Header : TWaveHeader; + DVIADPCMHeader : TDVIADPCMHeader; + begin + GetMem(FBuffer,FBufferSize); + EndOfInput := False; + if not FStreamAssigned then + begin + if FFileName = '' then raise EACSException.Create(strFilenamenotassigned); + if (not FileExists(FFileName)) or (FFileMode = foRewrite) then + FStream := TFileStream.Create(FFileName, fmCreate or fmShareExclusive, FAccessMask) + else FStream := TFileStream.Create(FFileName, fmOpenReadWrite or fmShareExclusive, FAccessMask); + end; + FInput.Init; + if (FFileMode = foAppend) and (FStream.Size <> 0) then + begin + ReadRIFFHeader; + if not (FPrevWavType in [wtPCM, wtDVIADPCM]) then + begin + FInput.Flush; + if not FStreamAssigned then + begin + FStream.Free; + FStream := nil; + end; + raise EACSException.Create('Cannot append data to this .wav file.'); + end; + FWavType := FPrevWavType; + end; + case FWavType of + wtPCM : + begin + if (FFileMode = foAppend) and (FStream.Size <> 0) then + begin + if (FPrevSR <> FInput.SampleRate) or + (FPrevBPS <> FInput.BitsPerSample) or + (FPrevCh <> FInput.Channels) then + begin + FInput.Flush; + if not FStreamAssigned then + begin + FStream.Free; + FStream := nil; + end; + raise EACSException.Create('Cannot append data in different audio format.'); + end; + FStream.Seek(0, soFromEnd); + end else + begin + FillHeaderPCM(Header); + FStream.Write(Header, WaveHeaderOffs); + end; + end; + wtDVIADPCM : + begin + if FInput.BitsPerSample <> 16 then + begin + FInput.Flush; + if not FStreamAssigned then + begin + FStream.Free; + FStream := nil; + end; + raise EACSException.Create('Cannot encode 8 bit sound into ADPCM.'); + end; +// FBlockAlign := 512; + if (FFileMode = foAppend) and (FStream.Size <> 0) then + begin + if (FPrevSR <> FInput.SampleRate) or + (FPrevCh <> FInput.Channels) then + begin + FInput.Flush; + if not FStreamAssigned then + begin + FStream.Free; + FStream := nil; + end; + raise EACSException.Create('Cannot append data in different audio format.'); + end; + FStream.Seek(0, soFromEnd); + end else + begin + FillHeaderDVIADPCM(DVIADPCMHeader); + FStream.Write(DVIADPCMHeader, SizeOf(DVIADPCMHeader)); + FEncodeState.Index_l := 0; + FEncodeState.Index_r := 0; + end; + end; + end; + end; + + procedure TWaveOut.Done; + var + Size : Integer; + Hdr : TDVIADPCMHeader; + begin + if ((FInput.Size < 0) or (FFileMode = foAppend)) and (FStream <> nil) then + begin + case FWavType of + wtPCM: + begin + if FFileMode = foAppend then + begin + FStream.Seek(FDataSizeOffs, soFromBeginning); + Size := FStream.Size - HeaderSize; + FStream.Write(Size, 4); + end else + begin + Size := FStream.Size - 44; + FStream.Seek(DataSizeOffs, soFromBeginning); + FStream.Write(Size, 4); + end; + end; + wtDVIADPCM: + begin + if FFileMode = foAppend then + begin + FStream.Seek(FDataSizeOffs, soFromBeginning); + Size := FStream.Size - HeaderSize; + FStream.Write(Size, 4); + FStream.Seek(FLenOffs, soFromBeginning); + Size := (Size div FBlockAlign)*((FBlockAlign-FPrevCh*4)*(2 div FPrevCh) + 1); + FStream.Write(Size, 4); + end else + begin + Size := FStream.Size - SizeOf(TDVIADPCMHeader); + FStream.Seek(0, soFromBeginning); + Fstream.Read(Hdr, SizeOf(Hdr)); + Hdr.DataSize := Size; + Hdr.DataLength := (Hdr.DataSize div Hdr.BlockAlign) * Hdr.SamplesPerBlock; + FStream.Seek(0, soFromBeginning); + FStream.Write(Hdr, SizeOf(Hdr)); + end; + end; + end; + Size := FStream.Size; + FStream.Seek(4, soFromBeginning); + FStream.Write(Size, 4); + end; + if (not FStreamAssigned) and (FStream <> nil) then FStream.Free; + FInput.Flush; + FreeMem(FBuffer); + end; + + function TWaveOut.DoOutput(Abort : Boolean):Boolean; + var + Len, l, m : Integer; + DVIInBuf : PACSBuffer16; + DVIOutBuf : PACSBuffer8; + P : PACSBuffer8; + BlockDataSize : Integer; + begin + // No exceptions Here + Result := True; + if not CanOutput then Exit; + Len := 0; + if Abort then + begin + (* We don't close file here to avoide exceptions + if output componenet's Stop method is called *) + Result := False; + Exit; + end; + if EndOfInput then + begin + Result := False; + Exit; + end; + case FWavType of + wtPCM : + begin + try + while InputLock do; + InputLock := True; + Len := Finput.GetData(@FBuffer[0], FBufferSize); + InputLock := False; + FStream.Write(FBuffer[0], Len); + except + end; + if Len > 0 then Result := True + else Result := False; + end; + wtDVIADPCM : + begin + BlockDataSize := (FBlockAlign - 4*FInput.Channels)*4 +2*FInput.Channels; + GetMem(DVIInBuf, BlockDataSize); + GetMem(DVIOutBuf, FBlockAlign); + P := PACSBuffer8(DVIInBuf); + try + if FInput.Channels = 2 then + begin + l := 0; + FillChar (DVIInBuf[0], BlockDataSize, 0); + while InputLock do; + InputLock := True; + while l <> BlockDataSize do + begin + m := Finput.GetData(@P[l], BlockDataSize-l); + if m = 0 then + begin + EndOfInput := True; + Break; + end; + Inc(l, m); + end; + Len := FBlockAlign; + InputLock := False; + FEncodeState.PredSamp_l := DVIInBuf[0]; + m := 1; + FEncodeState.PredSamp_r := DVIInBuf[m]; + m := 2; + EncodeDVIADPCMStereo(@DVIInBuf[m], @DVIOutBuf[0]); + FStream.Write(DVIOutBuf[0], FBlockAlign); + end else + begin + l := 0; + FillChar (DVIInBuf[0], BlockDataSize, 0); + while InputLock do; + InputLock := True; + while l <> BlockDataSize do + begin + m := Finput.GetData(@P[l], BlockDataSize-l); + if m = 0 then + begin + EndOfInput := True; + Break; + end; + Inc(l, m); + end; + Len := FBlockAlign; + InputLock := False; + FEncodeState.PredSamp_l := DVIInBuf[0]; + m := 1; + EncodeDVIADPCMMono(@DVIInBuf[m], @DVIOutBuf[0]); + FStream.Write(DVIOutBuf[0], FBlockAlign); + end; + except + end; + FreeMem(DVIInBuf); + FreeMem(DVIOutBuf); + if Len > 0 then Result := True + else Result := False; + end; + end; + end; + + function TWaveIn.GetWavType : TWavType; + begin + OpenFile; + Result := _WavType; + CloseFile; + end; + + procedure TWaveOut.SetFileMode; + begin + FFileMode := aMode; + end; + + procedure TWaveIn.SetBufferSize(S: Integer); + begin + end; + + function TWaveIn.ReadDVIADPCMBlock(aData : Pointer) : Boolean; + var + block : array of Byte; + BH : TDVIADPCMBlockHeader; + begin + Result := False; + if Seekable then + if FStream.Position >= FStream.Size then Exit; + SetLength(Block, DVI_ADPCM_INFO.BlockLength); + if FStream.Read(Block[0], Length(Block))= 0 then Exit; + Result := True; + Move(Block[0], BH, SizeOf(BH)); + DVI_ADPCM_STATE.valprev_l := BH.Samp0; + DVI_ADPCM_STATE.index_l := BH.StepTableIndex; + if FChan = 2 then + begin + Move(Block[4], BH, SizeOf(BH)); + DVI_ADPCM_STATE.valprev_r := BH.Samp0; + DVI_ADPCM_STATE.index_r := BH.StepTableIndex; + Move(Block[8], aData^, DVI_ADPCM_INFO.BlockLength-8); + end else + Move(Block[4], aData^, DVI_ADPCM_INFO.BlockLength-4); + end; + + function TWaveIn.ReadMSADPCMBlock(bData : Pointer) : Boolean; + var + block : array of Byte; + BHM : TMSADPCMBlockHeaderMono; + BHS : TMSADPCMBlockHeaderStereo; + begin + Result := False; + if FStream.Position >= FStream.Size then Exit; + Result := True; + SetLength(Block, MS_ADPCM_INFO.BlockLength); + FStream.Read(Block[0], Length(Block)); + if FChan = 1 then + begin + Move(Block[0], BHM, SizeOf(BHM)); + MS_ADPCM_STATE.predictor[0] := BHM.predictor; + MS_ADPCM_STATE.Delta[0] := BHM.Delta; + MS_ADPCM_STATE.Samp1[0] := BHM.Samp1; + MS_ADPCM_STATE.Samp2[0] := BHM.Samp2; + Move(Block[SizeOf(BHM)], bData^, MS_ADPCM_INFO.BlockLength-SizeOf(BHM)); + end else + begin + Move(Block[0], BHS, SizeOf(BHS)); + MS_ADPCM_STATE := BHS; + Move(Block[SizeOf(BHS)], bData^, MS_ADPCM_INFO.BlockLength-SizeOf(BHS)); + end; + end; + + procedure TWaveIn.ReadRIFFHeader; + var + i : Integer; + WordVal : Word; + IntVal : Integer; + Buff : array[0..$fff] of Char; + State : Integer; + ChunkSize : Integer; + begin + _WavType := wtUnsupported; + State := LookingForRIFF; + i := 4; + FStream.Read(Buff[0], 4); + while i < $2000 do + begin + case State of + LookingForRIFF : + begin + if not Compare4(@Buff[i-4], 'RIFF') then + begin + FStream.Read(Buff[i], 1); + Inc(i); + end else + begin + FStream.Read(Buff[i], 4); + Inc(i, 4); + State := LookingForWAVE; + end; + end; + LookingForWAVE : + begin + if not Compare4(@Buff[i-4], 'WAVE') then + begin + FStream.Read(Buff[i], 1); + Inc(i); + end else + begin + FStream.Read(Buff[i], 4); + Inc(i, 4); + State := LookingForFMT; + end; + end; + LookingForFMT : + begin + if not Compare4(@Buff[i-4], 'fmt ') then + begin + FStream.Read(Buff[i], 4); + Inc(i, 4); + Move(Buff[i-4], ChunkSize, 4); + FStream.Read(Buff[i], ChunkSize); + Inc(i, ChunkSize); + FStream.Read(Buff[i], 4); + Inc(i, 4); + end else + begin + Stream.Read(Buff[i], 4); + Inc(i, 4); + Move(Buff[i-4], ChunkSize, 4); + FStream.Read(Buff[i], ChunkSize); + Inc(i, ChunkSize); + Move(Buff[i-ChunkSize], WordVal, 2); + case WordVal of + WAVE_FORMAT_PCM : _WavType := wtPCM; + WAVE_FORMAT_IMA_ADPCM : _WavType := wtDVIADPCM; + WAVE_FORMAT_ADPCM : _WavType := wtMSADPCM; + WAVE_FORMAT_MP3 : _WavType := wtACM; + else Exit; + end; + Move(Buff[i+2-ChunkSize], WordVal, 2); + FChan := WordVal; + Move(Buff[i+4-ChunkSize], IntVal, 4); + FSR := IntVal; + Move(Buff[i+12-ChunkSize], WordVal, 2); + if _WavType = wtDVIADPCM then + DVI_ADPCM_INFO.BlockLength := WordVal else + MS_ADPCM_INFO.BlockLength := WordVal; + Move(Buff[i+14-ChunkSize], WordVal, 2); + FBPS := WordVal; + if _WavType in [wtDVIADPCM, wtMSADPCM, wtACM] then + begin + Move(Buff[i+18-ChunkSize], WordVal, 2); + if _WavType = wtDVIADPCM then + DVI_ADPCM_INFO.SamplesPerBlock := WordVal + else MS_ADPCM_INFO.SamplesPerBlock := WordVal; + if _WavType = wtMSADPCM then + begin + Move(Buff[i+20-ChunkSize], WordVal, 2); + MS_ADPCM_INFO.NumCoeff := WordVal; + Move(Buff[i+22-ChunkSize], MS_ADPCM_INFO.CoefSets[0], MS_ADPCM_INFO.NumCoeff*SizeOf(TMS_ADPCM_COEF_SET)); + end; + State := LookingForFACT; + end else State := LookingForDATA; + FStream.Read(Buff[i], 4); + Inc(i, 4); + end; + end; + LookingForFACT : + begin + if not Compare4(@Buff[i-4], 'fact') then + begin + FStream.Read(Buff[i], 4); + Inc(i, 4); + Move(Buff[i-4], ChunkSize, 4); + FStream.Read(Buff[i], ChunkSize); + Inc(i, ChunkSize); + FStream.Read(Buff[i], 4); + Inc(i, 4); + end else + begin + FStream.Read(Buff[i], 4); + Inc(i, 4); + Move(Buff[i-4], ChunkSize, 4); + FStream.Read(Buff[i], ChunkSize); + Inc(i, ChunkSize); + Move(Buff[i-ChunkSize], IntVal, 4); + if _WavType = wtDVIADPCM then + DVI_ADPCM_INFO.DataSize := IntVal + else + MS_ADPCM_INFO.DataSize := IntVal; + FStream.Read(Buff[i], 4); + Inc(i, 4); + State := LookingForDATA; + end; + end; + LookingForDATA : + begin + if not Compare4(@Buff[i-4], 'data') then + begin + FStream.Read(Buff[i], 4); + Inc(i, 4); + Move(Buff[i-4], ChunkSize, 4); + FStream.Read(Buff[i], ChunkSize); + Inc(i, ChunkSize); + FStream.Read(Buff[i], 4); + Inc(i, 4); + end else + begin + FStream.Read(Buff[i], 4); + Inc(i, 4); + if _WavType = wtPCM then + Move(Buff[i-4], FSize, 4); + HeaderSize := i; + Exit; + end; + end; + end; + if Seekable then + if FStream.Position >= FStream.Size then Break; + end; + _WavType := wtUnsupported + end; + + procedure TWaveOut.ReadRIFFHeader; + var + i : Integer; + WordVal : Word; + Buff : array[0..$fff] of Char; + State : Integer; + ChunkSize : Integer; + begin + FPrevWavType := wtUnsupported; + State := LookingForRIFF; + i := 4; + FStream.Read(Buff[0], 4); + while i < $2000 do + begin + case State of + LookingForRIFF : + begin + if not Compare4(@Buff[i-4], 'RIFF') then + begin + FStream.Read(Buff[i], 1); + Inc(i); + end else + begin + FStream.Read(Buff[i], 4); + Inc(i, 4); + State := LookingForWAVE; + end; + end; + LookingForWAVE : + begin + if not Compare4(@Buff[i-4], 'WAVE') then + begin + FStream.Read(Buff[i], 1); + Inc(i); + end else + begin + FStream.Read(Buff[i], 4); + Inc(i, 4); + State := LookingForFMT; + end; + end; + LookingForFMT : + begin + if not Compare4(@Buff[i-4], 'fmt ') then + begin + FStream.Read(Buff[i], 4); + Inc(i, 4); + Move(Buff[i-4], ChunkSize, 4); + FStream.Read(Buff[i], ChunkSize); + Inc(i, ChunkSize); + FStream.Read(Buff[i], 4); + Inc(i, 4); + end else + begin + FStream.Read(Buff[i], 4); + Inc(i, 4); + Move(Buff[i-4], ChunkSize, 4); + FStream.Read(Buff[i], ChunkSize); + Inc(i, ChunkSize); + Move(Buff[i-ChunkSize], WordVal, 2); + case WordVal of + WAVE_FORMAT_PCM : FPrevWavType := wtPCM; + WAVE_FORMAT_IMA_ADPCM : FPrevWavType := wtDVIADPCM; + else Exit; + end; + Move(Buff[i+2-ChunkSize], FPrevCh, 2); + Move(Buff[i+4-ChunkSize], FPrevSR, 4); + Move(Buff[i+12-ChunkSize], FBlockAlign, 2); + Move(Buff[i+14-ChunkSize], FPrevBPS, 2); + if FPrevWavType = wtDVIADPCM then + State := LookingForFACT + else State := LookingForDATA; + FStream.Read(Buff[i], 4); + Inc(i, 4); + end; + end; + LookingForFACT : + begin + if not Compare4(@Buff[i-4], 'fact') then + begin + FStream.Read(Buff[i], 4); + Inc(i, 4); + Move(Buff[i-4], ChunkSize, 4); + FStream.Read(Buff[i], ChunkSize); + Inc(i, ChunkSize); + FStream.Read(Buff[i], 4); + Inc(i, 4); + end else + begin + FStream.Read(Buff[i], 4); + Inc(i, 4); + Move(Buff[i-4], ChunkSize, 4); + FLenOffs := i; + FStream.Read(Buff[i], ChunkSize); + Inc(i, ChunkSize); + Move(Buff[i-ChunkSize], FPrevLen, 4); + FStream.Read(Buff[i], 4); + Inc(i, 4); + State := LookingForDATA; + end; + end; + LookingForDATA : + begin + if not Compare4(@Buff[i-4], 'data') then + begin + FStream.Read(Buff[i], 4); + Inc(i, 4); + Move(Buff[i-4], ChunkSize, 4); + FStream.Read(Buff[i], ChunkSize); + Inc(i, ChunkSize); + FStream.Read(Buff[i], 4); + Inc(i, 4); + end else + begin + FStream.Read(Buff[i], 4); + Inc(i, 4); + FDataSizeOffs := i-4; + Move(Buff[i-4], FPrevDataSize, 4); + HeaderSize := i; + Exit; + end; + end; + end; + if FStream.Position >= FStream.Size then Break; + end; + FPrevWavType := wtUnsupported + end; + + procedure TWaveOut.SetBlockSize; + begin + if not Busy then + if BS <> 0 then + if (BS mod 4) = 0 then FBlockAlign := BS; + end; + +initialization + + FileFormats.Add('wav','Waveform Audio',TWaveOut); + FileFormats.Add('wav','Waveform Audio',TWaveIn); + +end. diff --git a/components/acs/Src/fileformats/general/flac.pas b/components/acs/Src/fileformats/general/flac.pas new file mode 100644 index 000000000..d5e463b12 --- /dev/null +++ b/components/acs/Src/fileformats/general/flac.pas @@ -0,0 +1,602 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: flac.pas,v $ +Revision 1.1 2005/12/19 18:36:56 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:53 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + +unit flac; + +interface + +uses + {$IFDEF WIN32} + Windows; + {$ENDIF} + + {$IFDEF LINUX} + Libc, ACS_Procs; + {$ENDIF} + +var + + LibFLACLoaded : Boolean = False; + +const + + {$IFDEF WIN32} + LibFLACPath = 'libFLAC.dll'; + {$ENDIF} + + {$IFDEF LINUX} + LibFLACPath = 'libFLAC.so*'; // libFLAC.so + {$DEFINE SEARCH_LIBS} + {$ENDIF} + + FLAC__SEEKABLE_STREAM_ENCODER_OK = 0; + FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR = 1; + FLAC__SEEKABLE_STREAM_ENCODER_MEMORY_ALLOCATION_ERROR = 2; + FLAC__SEEKABLE_STREAM_ENCODER_WRITE_ERROR = 3; + FLAC__SEEKABLE_STREAM_ENCODER_READ_ERROR = 4; + FLAC__SEEKABLE_STREAM_ENCODER_SEEK_ERROR = 5; + FLAC__SEEKABLE_STREAM_ENCODER_ALREADY_INITIALIZED = 6; + FLAC__SEEKABLE_STREAM_ENCODER_INVALID_CALLBACK = 7; + FLAC__SEEKABLE_STREAM_ENCODER_INVALID_SEEKTABLE = 8; + FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED = 9; + + FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK = 0; + FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_ERROR = 1; + + FLAC__SEEKABLE_STREAM_DECODER_OK = 0; + FLAC__SEEKABLE_STREAM_DECODER_SEEKING = 1; + FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM = 2; + FLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR = 3; + FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR = 4; + FLAC__SEEKABLE_STREAM_DECODER_READ_ERROR = 5; + FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR = 6; + FLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED = 7; + FLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK = 8; + FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED = 10; + + FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK = 0; + FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR = 1; + + FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK = 0; + FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR = 1; + + FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK = 0; + FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR = 1; + + FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK = 0; + FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR = 1; + +type + + FLAC__byte = Byte; + PFLAC__byte = ^FLAC__byte; + + FLAC__uint64 = Int64; + PFLAC__uint64 = ^FLAC__uint64; + + FLAC__uint32 = LongWord; + PFLAC__uint32 = ^FLAC__uint32; + + FLAC__int32 = Integer; + PFLAC__int32 = ^FLAC__int32; + + PFLAC__SeekableStreamEncoder = Pointer; + + PFLAC__SeekableStreamDecoder = Pointer; + + FLAC__MetadataType = Integer; + + PFLAC__Frame = Pointer; + + FLAC__FrameHeader = packed record + blocksize : LongWord; + sample_rate : LongWord; + channels : LongWord; + channel_assignment : Integer; + bits_per_sample : LongWord; + frame_number : FLAC__uint32; + crc : Byte; + end; + + FLACInfo = record + min_blocksize : LongWord; + max_blocksize : LongWord; + min_framesize : LongWord; + max_framesize : LongWord; + sample_rate : LongWord; + channels : LongWord; + bits_per_sample : LongWord; + total_samples1 : LongWord; + total_samples2 : LongWord; + end; + + PFLACInfo = ^FLACInfo; + + PFLAC__StreamMetadata = Pointer; + + PFLAC__FrameHeader = ^FLAC__FrameHeader; + + FLACIntBuf = array[0..0] of FLAC__int32; + PFLACIntBuf = ^FLACIntBuf; + + FLACChannels = array[0..1] of PFLACIntBuf; + PFLACChannels = ^FLACChannels; + + FLAC__SeekableStreamEncoderWriteCallback = function(encoder : PFLAC__SeekableStreamEncoder; + buffer : PFLAC__byte; + bytes, + samples, + current_frame : LongWord; + client_data : Pointer) : Integer; cdecl; + + + FLAC__SeekableStreamEncoderSeekCallback = function(encoder : PFLAC__SeekableStreamEncoder; + absolute_byte_offset : FLAC__uint64; + client_data : Pointer) : Integer; cdecl; + + FLAC__SeekableStreamDecoderReadCallback = function(decoder : PFLAC__SeekableStreamDecoder; + buffer : PFLAC__byte; + var bytes : LongWord; + client_data : Pointer) : Integer; cdecl; + + FLAC__SeekableStreamDecoderSeekCallback = function(decoder : PFLAC__SeekableStreamDecoder; + absolute_byte_offset : FLAC__uint64; + client_data : Pointer) : Integer; cdecl; + + FLAC__SeekableStreamDecoderTellCallback = function(decoder : PFLAC__SeekableStreamDecoder; + var absolute_byte_offset : FLAC__uint64; + client_data : Pointer) : Integer; cdecl; + + FLAC__SeekableStreamDecoderLengthCallback = function(decoder : PFLAC__SeekableStreamDecoder; + var stream_length : FLAC__uint64; + client_data : Pointer) : Integer; cdecl; + + FLAC__SeekableStreamDecoderEofCallback = function(decoder : PFLAC__SeekableStreamDecoder; + client_data : Pointer) : Boolean; cdecl; + + FLAC__SeekableStreamDecoderWriteCallback = function(decoder : PFLAC__SeekableStreamDecoder; + frame : PFLAC__Frame; + buffer : PFLACChannels; + client_data : Pointer) : Integer; cdecl; + + FLAC__SeekableStreamDecoderMetadataCallback = procedure(decoder : PFLAC__SeekableStreamDecoder; + metadata : PFLAC__StreamMetadata; + client_data : Pointer); cdecl; + + FLAC__SeekableStreamDecoderErrorCallback = procedure(decoder : PFLAC__SeekableStreamDecoder; + status : Integer; + client_data : Pointer); cdecl; + + FLAC__seekable_stream_encoder_new_t = function : PFLAC__SeekableStreamEncoder; cdecl; + FLAC__seekable_stream_encoder_delete_t = procedure(encoder : PFLAC__SeekableStreamEncoder); cdecl; + FLAC__seekable_stream_encoder_set_verify_t = function( encoder : PFLAC__SeekableStreamEncoder; value : Boolean) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_streamable_subset_t = function( encoder : PFLAC__SeekableStreamEncoder; value : Boolean) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_do_mid_side_stereo_t = function( encoder : PFLAC__SeekableStreamEncoder; value : Boolean) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_loose_mid_side_stereo_t = function( encoder : PFLAC__SeekableStreamEncoder; value : Boolean) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_channels_t = function( encoder : PFLAC__SeekableStreamEncoder; value : LongWord) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_bits_per_sample_t = function( encoder : PFLAC__SeekableStreamEncoder; value : LongWord) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_sample_rate_t = function( encoder : PFLAC__SeekableStreamEncoder; value : LongWord) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_blocksize_t = function( encoder : PFLAC__SeekableStreamEncoder; value : LongWord) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_max_lpc_order_t = function( encoder : PFLAC__SeekableStreamEncoder; value : LongWord) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_qlp_coeff_precision_t = function( encoder : PFLAC__SeekableStreamEncoder; value : LongWord) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search_t = function( encoder : PFLAC__SeekableStreamEncoder; value : Boolean) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_do_escape_coding_t = function( encoder : PFLAC__SeekableStreamEncoder; value : Boolean) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_do_exhaustive_model_search_t = function( encoder : PFLAC__SeekableStreamEncoder; value : Boolean) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_min_residual_partition_order_t = function( encoder : PFLAC__SeekableStreamEncoder; value : LongWord) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_max_residual_partition_order_t = function( encoder : PFLAC__SeekableStreamEncoder; value : LongWord) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_rice_parameter_search_dist_t = function( encoder : PFLAC__SeekableStreamEncoder; value : LongWord) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_total_samples_estimate_t = function( encoder : PFLAC__SeekableStreamEncoder; value : FLAC__uint64) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_metadata_t = function( encoder : PFLAC__SeekableStreamEncoder; metadata : Pointer; num_blocks : LongWord) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_seek_callback_t = function( encoder : PFLAC__SeekableStreamEncoder; value : FLAC__SeekableStreamEncoderSeekCallback) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_write_callback_t = function( encoder : PFLAC__SeekableStreamEncoder; value : FLAC__SeekableStreamEncoderWriteCallback) : Boolean; cdecl; + FLAC__seekable_stream_encoder_set_client_data_t = function( encoder : PFLAC__SeekableStreamEncoder; value : Pointer) : Boolean; cdecl; + FLAC__seekable_stream_encoder_get_state_t = function( encoder : PFLAC__SeekableStreamEncoder) : Integer; cdecl; + FLAC__seekable_stream_encoder_get_stream_encoder_state_t = function( encoder : PFLAC__SeekableStreamEncoder) : Integer; cdecl; + FLAC__seekable_stream_encoder_get_verify_decoder_state_t = function( encoder : PFLAC__SeekableStreamEncoder) : Integer; cdecl; + FLAC__seekable_stream_encoder_get_resolved_state_string_t = function( encoder : PFLAC__SeekableStreamEncoder) : PChar; cdecl; + FLAC__seekable_stream_encoder_get_verify_decoder_error_stats_t = procedure(encoder : PFLAC__SeekableStreamEncoder; absolute_sample : PFLAC__uint64; frame_number, channel, sample : PLongWord; expected, got : FLAC__int32); cdecl; + FLAC__seekable_stream_encoder_get_verify_t = function( encoder : PFLAC__SeekableStreamEncoder) : Boolean; cdecl; + FLAC__seekable_stream_encoder_get_streamable_subset_t = function( encoder : PFLAC__SeekableStreamEncoder) : Boolean; cdecl; + FLAC__seekable_stream_encoder_get_do_mid_side_stereo_t = function( encoder : PFLAC__SeekableStreamEncoder) : Boolean; cdecl; + FLAC__seekable_stream_encoder_get_loose_mid_side_stereo_t = function( encoder : PFLAC__SeekableStreamEncoder) : Boolean; cdecl; + FLAC__seekable_stream_encoder_get_channels_t = function( encoder : PFLAC__SeekableStreamEncoder) : LongWord; cdecl; + FLAC__seekable_stream_encoder_get_bits_per_sample_t = function( encoder : PFLAC__SeekableStreamEncoder) : LongWord; cdecl; + FLAC__seekable_stream_encoder_get_sample_rate_t = function( encoder : PFLAC__SeekableStreamEncoder) : LongWord; cdecl; + FLAC__seekable_stream_encoder_get_blocksize_t = function( encoder : PFLAC__SeekableStreamEncoder) : LongWord; cdecl; + FLAC__seekable_stream_encoder_get_max_lpc_order_t = function( encoder : PFLAC__SeekableStreamEncoder) : LongWord; cdecl; + FLAC__seekable_stream_encoder_get_qlp_coeff_precision_t = function( encoder : PFLAC__SeekableStreamEncoder) : LongWord; cdecl; + FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search_t = function( encoder : PFLAC__SeekableStreamEncoder) : Boolean; cdecl; + FLAC__seekable_stream_encoder_get_do_escape_coding_t = function( encoder : PFLAC__SeekableStreamEncoder) : Boolean; cdecl; + FLAC__seekable_stream_encoder_get_do_exhaustive_model_search_t = function( encoder : PFLAC__SeekableStreamEncoder) : Boolean; cdecl; + FLAC__seekable_stream_encoder_get_min_residual_partition_order_t = function( encoder : PFLAC__SeekableStreamEncoder) : LongWord; cdecl; + FLAC__seekable_stream_encoder_get_max_residual_partition_order_t = function( encoder : PFLAC__SeekableStreamEncoder) : LongWord; cdecl; + FLAC__seekable_stream_encoder_get_rice_parameter_search_dist_t = function( encoder : PFLAC__SeekableStreamEncoder) : LongWord; cdecl; + FLAC__seekable_stream_encoder_get_total_samples_estimate_t = function( encoder : PFLAC__SeekableStreamEncoder) : FLAC__uint64 cdecl; + FLAC__seekable_stream_encoder_init_t = function( encoder : PFLAC__SeekableStreamEncoder) : Integer; cdecl; + FLAC__seekable_stream_encoder_finish_t = procedure(encoder : PFLAC__SeekableStreamEncoder); cdecl; + FLAC__seekable_stream_encoder_process_t = function(encoder : PFLAC__SeekableStreamEncoder; buffer : PFLAC__int32; samples : LongWord) : Boolean; cdecl; + FLAC__seekable_stream_encoder_process_interleaved_t = function(encoder : PFLAC__SeekableStreamEncoder; buffer : PFLAC__int32; samples : LongWord) : Boolean; cdecl; + + FLAC__seekable_stream_decoder_new_t = function : PFLAC__SeekableStreamDecoder; cdecl; + FLAC__seekable_stream_decoder_delete_t = procedure(decoder : PFLAC__SeekableStreamDecoder); cdecl; + FLAC__seekable_stream_decoder_set_md5_checking_t = function( decoder : PFLAC__SeekableStreamDecoder; value : Boolean) : Boolean; cdecl; + FLAC__seekable_stream_decoder_set_read_callback_t = function( decoder : PFLAC__SeekableStreamDecoder; value : FLAC__SeekableStreamDecoderReadCallback) : Boolean; cdecl; + FLAC__seekable_stream_decoder_set_seek_callback_t = function( decoder : PFLAC__SeekableStreamDecoder; value : FLAC__SeekableStreamDecoderSeekCallback) : Boolean; cdecl; + FLAC__seekable_stream_decoder_set_tell_callback_t = function( decoder : PFLAC__SeekableStreamDecoder; value : FLAC__SeekableStreamDecoderTellCallback) : Boolean; cdecl; + FLAC__seekable_stream_decoder_set_length_callback_t = function( decoder : PFLAC__SeekableStreamDecoder; value : FLAC__SeekableStreamDecoderLengthCallback) : Boolean; cdecl; + FLAC__seekable_stream_decoder_set_eof_callback_t = function( decoder : PFLAC__SeekableStreamDecoder; value : FLAC__SeekableStreamDecoderEofCallback) : Boolean; cdecl; + FLAC__seekable_stream_decoder_set_write_callback_t = function( decoder : PFLAC__SeekableStreamDecoder; value : FLAC__SeekableStreamDecoderWriteCallback) : Boolean; cdecl; + FLAC__seekable_stream_decoder_set_metadata_callback_t = function( decoder : PFLAC__SeekableStreamDecoder; value : FLAC__SeekableStreamDecoderMetadataCallback) : Boolean; cdecl; + FLAC__seekable_stream_decoder_set_error_callback_t = function( decoder : PFLAC__SeekableStreamDecoder; value : FLAC__SeekableStreamDecoderErrorCallback) : Boolean; cdecl; + FLAC__seekable_stream_decoder_set_client_data_t = function( decoder : PFLAC__SeekableStreamDecoder; value : Pointer) : Boolean; cdecl; + FLAC__seekable_stream_decoder_set_metadata_respond_t = function( decoder : PFLAC__SeekableStreamDecoder; _type : FLAC__MetadataType) : Boolean; cdecl; + FLAC__seekable_stream_decoder_set_metadata_respond_application_t = function( decoder : PFLAC__SeekableStreamDecoder; id : PFLAC__byte) : Boolean; cdecl; + FLAC__seekable_stream_decoder_set_metadata_respond_all_t = function( decoder : PFLAC__SeekableStreamDecoder) : Boolean; cdecl; + FLAC__seekable_stream_decoder_set_metadata_ignore_t = function( decoder : PFLAC__SeekableStreamDecoder; _type : FLAC__MetadataType) : Boolean; cdecl; + FLAC__seekable_stream_decoder_set_metadata_ignore_application_t = function( decoder : PFLAC__SeekableStreamDecoder; id : PFLAC__byte) : Boolean; cdecl; + FLAC__seekable_stream_decoder_set_metadata_ignore_all_t = function( decoder : PFLAC__SeekableStreamDecoder) : Boolean; cdecl; + FLAC__seekable_stream_decoder_get_state_t = function( decoder : PFLAC__SeekableStreamDecoder) : Integer; cdecl; + FLAC__seekable_stream_decoder_get_stream_decoder_state_t = function( decoder : PFLAC__SeekableStreamDecoder) : Integer; cdecl; + FLAC__seekable_stream_decoder_get_resolved_state_string_t = function( decoder : PFLAC__SeekableStreamDecoder) : PChar; cdecl; + FLAC__seekable_stream_decoder_get_md5_checking_t = function( decoder : PFLAC__SeekableStreamDecoder) : Boolean; cdecl; + FLAC__seekable_stream_decoder_get_channels_t = function( decoder : PFLAC__SeekableStreamDecoder) : Integer; cdecl; + FLAC__seekable_stream_decoder_get_channel_assignment_t = function( decoder : PFLAC__SeekableStreamDecoder) : Integer; cdecl; + FLAC__seekable_stream_decoder_get_bits_per_sample_t = function( decoder : PFLAC__SeekableStreamDecoder) : LongWord; cdecl; + FLAC__seekable_stream_decoder_get_sample_rate_t = function( decoder : PFLAC__SeekableStreamDecoder) : LongWord; cdecl; + FLAC__seekable_stream_decoder_get_blocksize_t = function( decoder : PFLAC__SeekableStreamDecoder) : LongWord; cdecl; + FLAC__seekable_stream_decoder_get_decode_position_t = function( decoder : PFLAC__SeekableStreamDecoder; var position : FLAC__uint64) : Boolean; cdecl; + FLAC__seekable_stream_decoder_init_t = function( decoder : PFLAC__SeekableStreamDecoder) : Integer; cdecl; + FLAC__seekable_stream_decoder_finish_t = function( decoder : PFLAC__SeekableStreamDecoder) : Boolean; cdecl; + FLAC__seekable_stream_decoder_flush_t = function( decoder : PFLAC__SeekableStreamDecoder) : Boolean; cdecl; + FLAC__seekable_stream_decoder_reset_t = function( decoder : PFLAC__SeekableStreamDecoder) : Boolean; cdecl; + FLAC__seekable_stream_decoder_process_single_t = function( decoder : PFLAC__SeekableStreamDecoder) : Boolean; cdecl; + FLAC__seekable_stream_decoder_process_until_end_of_metadata_t = function( decoder : PFLAC__SeekableStreamDecoder) : Boolean; cdecl; + FLAC__seekable_stream_decoder_process_until_end_of_stream_t = function( decoder : PFLAC__SeekableStreamDecoder) : Boolean; cdecl; + FLAC__seekable_stream_decoder_seek_absolute_t = function( decoder : PFLAC__SeekableStreamDecoder; sample : FLAC__uint64) : Boolean; cdecl; + +var + + FLAC__seekable_stream_encoder_new : FLAC__seekable_stream_encoder_new_t; + FLAC__seekable_stream_encoder_delete : FLAC__seekable_stream_encoder_delete_t; + FLAC__seekable_stream_encoder_set_verify : FLAC__seekable_stream_encoder_set_verify_t; + FLAC__seekable_stream_encoder_set_streamable_subset : FLAC__seekable_stream_encoder_set_streamable_subset_t; + FLAC__seekable_stream_encoder_set_do_mid_side_stereo : FLAC__seekable_stream_encoder_set_do_mid_side_stereo_t; + FLAC__seekable_stream_encoder_set_loose_mid_side_stereo : FLAC__seekable_stream_encoder_set_loose_mid_side_stereo_t; + FLAC__seekable_stream_encoder_set_channels : FLAC__seekable_stream_encoder_set_channels_t; + FLAC__seekable_stream_encoder_set_bits_per_sample : FLAC__seekable_stream_encoder_set_bits_per_sample_t; + FLAC__seekable_stream_encoder_set_sample_rate : FLAC__seekable_stream_encoder_set_sample_rate_t; + FLAC__seekable_stream_encoder_set_blocksize : FLAC__seekable_stream_encoder_set_blocksize_t; + FLAC__seekable_stream_encoder_set_max_lpc_order : FLAC__seekable_stream_encoder_set_max_lpc_order_t; + FLAC__seekable_stream_encoder_set_qlp_coeff_precision : FLAC__seekable_stream_encoder_set_qlp_coeff_precision_t; + FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search : FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search_t; + FLAC__seekable_stream_encoder_set_do_escape_coding : FLAC__seekable_stream_encoder_set_do_escape_coding_t; + FLAC__seekable_stream_encoder_set_do_exhaustive_model_search : FLAC__seekable_stream_encoder_set_do_exhaustive_model_search_t; + FLAC__seekable_stream_encoder_set_min_residual_partition_order : FLAC__seekable_stream_encoder_set_min_residual_partition_order_t; + FLAC__seekable_stream_encoder_set_max_residual_partition_order : FLAC__seekable_stream_encoder_set_max_residual_partition_order_t; +// FLAC__seekable_stream_encoder_set_rice_parameter_search_dist : FLAC__seekable_stream_encoder_set_rice_parameter_search_dist_t; + FLAC__seekable_stream_encoder_set_total_samples_estimate : FLAC__seekable_stream_encoder_set_total_samples_estimate_t; + FLAC__seekable_stream_encoder_set_metadata : FLAC__seekable_stream_encoder_set_metadata_t; + FLAC__seekable_stream_encoder_set_seek_callback : FLAC__seekable_stream_encoder_set_seek_callback_t; + FLAC__seekable_stream_encoder_set_write_callback : FLAC__seekable_stream_encoder_set_write_callback_t; + FLAC__seekable_stream_encoder_set_client_data : FLAC__seekable_stream_encoder_set_client_data_t; + FLAC__seekable_stream_encoder_get_state : FLAC__seekable_stream_encoder_get_state_t; + FLAC__seekable_stream_encoder_get_stream_encoder_state : FLAC__seekable_stream_encoder_get_stream_encoder_state_t; + FLAC__seekable_stream_encoder_get_verify_decoder_state : FLAC__seekable_stream_encoder_get_verify_decoder_state_t; + FLAC__seekable_stream_encoder_get_resolved_state_string : FLAC__seekable_stream_encoder_get_resolved_state_string_t; + FLAC__seekable_stream_encoder_get_verify_decoder_error_stats : FLAC__seekable_stream_encoder_get_verify_decoder_error_stats_t; + FLAC__seekable_stream_encoder_get_verify : FLAC__seekable_stream_encoder_get_verify_t; + FLAC__seekable_stream_encoder_get_streamable_subset : FLAC__seekable_stream_encoder_get_streamable_subset_t; + FLAC__seekable_stream_encoder_get_do_mid_side_stereo : FLAC__seekable_stream_encoder_get_do_mid_side_stereo_t; + FLAC__seekable_stream_encoder_get_loose_mid_side_stereo : FLAC__seekable_stream_encoder_get_loose_mid_side_stereo_t; + FLAC__seekable_stream_encoder_get_channels : FLAC__seekable_stream_encoder_get_channels_t; + FLAC__seekable_stream_encoder_get_bits_per_sample : FLAC__seekable_stream_encoder_get_bits_per_sample_t; + FLAC__seekable_stream_encoder_get_sample_rate : FLAC__seekable_stream_encoder_get_sample_rate_t; + FLAC__seekable_stream_encoder_get_blocksize : FLAC__seekable_stream_encoder_get_blocksize_t; + FLAC__seekable_stream_encoder_get_max_lpc_order : FLAC__seekable_stream_encoder_get_max_lpc_order_t; + FLAC__seekable_stream_encoder_get_qlp_coeff_precision : FLAC__seekable_stream_encoder_get_qlp_coeff_precision_t; + FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search : FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search_t; + FLAC__seekable_stream_encoder_get_do_escape_coding : FLAC__seekable_stream_encoder_get_do_escape_coding_t; + FLAC__seekable_stream_encoder_get_do_exhaustive_model_search : FLAC__seekable_stream_encoder_get_do_exhaustive_model_search_t; + FLAC__seekable_stream_encoder_get_min_residual_partition_order : FLAC__seekable_stream_encoder_get_min_residual_partition_order_t; + FLAC__seekable_stream_encoder_get_max_residual_partition_order : FLAC__seekable_stream_encoder_get_max_residual_partition_order_t; +// FLAC__seekable_stream_encoder_get_rice_parameter_search_dist : FLAC__seekable_stream_encoder_get_rice_parameter_search_dist_t; + FLAC__seekable_stream_encoder_get_total_samples_estimate : FLAC__seekable_stream_encoder_get_total_samples_estimate_t; + FLAC__seekable_stream_encoder_init : FLAC__seekable_stream_encoder_init_t; + FLAC__seekable_stream_encoder_finish : FLAC__seekable_stream_encoder_finish_t; + FLAC__seekable_stream_encoder_process : FLAC__seekable_stream_encoder_process_t; + FLAC__seekable_stream_encoder_process_interleaved : FLAC__seekable_stream_encoder_process_interleaved_t; + + FLAC__seekable_stream_decoder_new : FLAC__seekable_stream_decoder_new_t; + FLAC__seekable_stream_decoder_delete : FLAC__seekable_stream_decoder_delete_t; + FLAC__seekable_stream_decoder_set_md5_checking : FLAC__seekable_stream_decoder_set_md5_checking_t; + FLAC__seekable_stream_decoder_set_read_callback : FLAC__seekable_stream_decoder_set_read_callback_t; + FLAC__seekable_stream_decoder_set_seek_callback : FLAC__seekable_stream_decoder_set_seek_callback_t; + FLAC__seekable_stream_decoder_set_tell_callback : FLAC__seekable_stream_decoder_set_tell_callback_t; + FLAC__seekable_stream_decoder_set_length_callback : FLAC__seekable_stream_decoder_set_length_callback_t; + FLAC__seekable_stream_decoder_set_eof_callback : FLAC__seekable_stream_decoder_set_eof_callback_t; + FLAC__seekable_stream_decoder_set_write_callback : FLAC__seekable_stream_decoder_set_write_callback_t; + FLAC__seekable_stream_decoder_set_metadata_callback : FLAC__seekable_stream_decoder_set_metadata_callback_t; + FLAC__seekable_stream_decoder_set_error_callback : FLAC__seekable_stream_decoder_set_error_callback_t; + FLAC__seekable_stream_decoder_set_client_data : FLAC__seekable_stream_decoder_set_client_data_t; + FLAC__seekable_stream_decoder_set_metadata_respond : FLAC__seekable_stream_decoder_set_metadata_respond_t; + FLAC__seekable_stream_decoder_set_metadata_respond_application : FLAC__seekable_stream_decoder_set_metadata_respond_application_t; + FLAC__seekable_stream_decoder_set_metadata_respond_all : FLAC__seekable_stream_decoder_set_metadata_respond_all_t; + FLAC__seekable_stream_decoder_set_metadata_ignore : FLAC__seekable_stream_decoder_set_metadata_ignore_t; + FLAC__seekable_stream_decoder_set_metadata_ignore_application : FLAC__seekable_stream_decoder_set_metadata_ignore_application_t; + FLAC__seekable_stream_decoder_set_metadata_ignore_all : FLAC__seekable_stream_decoder_set_metadata_ignore_all_t; + FLAC__seekable_stream_decoder_get_state : FLAC__seekable_stream_decoder_get_state_t; + FLAC__seekable_stream_decoder_get_stream_decoder_state : FLAC__seekable_stream_decoder_get_stream_decoder_state_t; + FLAC__seekable_stream_decoder_get_resolved_state_string : FLAC__seekable_stream_decoder_get_resolved_state_string_t; + FLAC__seekable_stream_decoder_get_md5_checking : FLAC__seekable_stream_decoder_get_md5_checking_t; + FLAC__seekable_stream_decoder_get_channels : FLAC__seekable_stream_decoder_get_channels_t; + FLAC__seekable_stream_decoder_get_channel_assignment : FLAC__seekable_stream_decoder_get_channel_assignment_t; + FLAC__seekable_stream_decoder_get_bits_per_sample : FLAC__seekable_stream_decoder_get_bits_per_sample_t; + FLAC__seekable_stream_decoder_get_sample_rate : FLAC__seekable_stream_decoder_get_sample_rate_t; + FLAC__seekable_stream_decoder_get_blocksize : FLAC__seekable_stream_decoder_get_blocksize_t; + FLAC__seekable_stream_decoder_get_decode_position : FLAC__seekable_stream_decoder_get_decode_position_t; + FLAC__seekable_stream_decoder_init : FLAC__seekable_stream_decoder_init_t; + FLAC__seekable_stream_decoder_finish : FLAC__seekable_stream_decoder_finish_t; + FLAC__seekable_stream_decoder_flush : FLAC__seekable_stream_decoder_flush_t; + FLAC__seekable_stream_decoder_reset : FLAC__seekable_stream_decoder_reset_t; + FLAC__seekable_stream_decoder_process_single : FLAC__seekable_stream_decoder_process_single_t; + FLAC__seekable_stream_decoder_process_until_end_of_metadata : FLAC__seekable_stream_decoder_process_until_end_of_metadata_t; + FLAC__seekable_stream_decoder_process_until_end_of_stream : FLAC__seekable_stream_decoder_process_until_end_of_stream_t; + FLAC__seekable_stream_decoder_seek_absolute : FLAC__seekable_stream_decoder_seek_absolute_t; + +implementation + +{$IFDEF WIN32} + +var + Libhandle : HMODULE; + +initialization + + Libhandle := LoadLibraryEx(LibFLACPath, 0, 0); + + if Libhandle <> 0 then + begin + LibFLACLoaded := True; + + FLAC__seekable_stream_encoder_new := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_new'); + FLAC__seekable_stream_encoder_delete := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_delete'); + FLAC__seekable_stream_encoder_set_verify := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_verify'); + FLAC__seekable_stream_encoder_set_streamable_subset := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_streamable_subset'); + FLAC__seekable_stream_encoder_set_do_mid_side_stereo := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_do_mid_side_stereo'); + FLAC__seekable_stream_encoder_set_loose_mid_side_stereo := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_loose_mid_side_stereo'); + FLAC__seekable_stream_encoder_set_channels := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_channels'); + FLAC__seekable_stream_encoder_set_bits_per_sample := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_bits_per_sample'); + FLAC__seekable_stream_encoder_set_sample_rate := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_sample_rate'); + FLAC__seekable_stream_encoder_set_blocksize := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_blocksize'); + FLAC__seekable_stream_encoder_set_max_lpc_order := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_max_lpc_order'); + FLAC__seekable_stream_encoder_set_qlp_coeff_precision := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_qlp_coeff_precision'); + FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search'); + FLAC__seekable_stream_encoder_set_do_escape_coding := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_do_escape_coding'); + FLAC__seekable_stream_encoder_set_do_exhaustive_model_search := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_do_exhaustive_model_search'); + FLAC__seekable_stream_encoder_set_min_residual_partition_order := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_min_residual_partition_order'); + FLAC__seekable_stream_encoder_set_max_residual_partition_order := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_max_residual_partition_order'); + // FLAC__seekable_stream_encoder_set_rice_parameter_search_dist := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_rice_parameter_search_dist'); + FLAC__seekable_stream_encoder_set_total_samples_estimate := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_total_samples_estimate'); + FLAC__seekable_stream_encoder_set_metadata := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_metadata'); + FLAC__seekable_stream_encoder_set_seek_callback := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_seek_callback'); + FLAC__seekable_stream_encoder_set_write_callback := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_write_callback'); + FLAC__seekable_stream_encoder_set_client_data := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_set_client_data'); + FLAC__seekable_stream_encoder_get_state := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_state'); + FLAC__seekable_stream_encoder_get_stream_encoder_state := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_stream_encoder_state'); + FLAC__seekable_stream_encoder_get_verify_decoder_state := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_verify_decoder_state'); + FLAC__seekable_stream_encoder_get_resolved_state_string := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_resolved_state_string'); + FLAC__seekable_stream_encoder_get_verify_decoder_error_stats := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_verify_decoder_error_stats'); + FLAC__seekable_stream_encoder_get_verify := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_verify'); + FLAC__seekable_stream_encoder_get_streamable_subset := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_streamable_subset'); + FLAC__seekable_stream_encoder_get_do_mid_side_stereo := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_do_mid_side_stereo'); + FLAC__seekable_stream_encoder_get_loose_mid_side_stereo := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_loose_mid_side_stereo'); + FLAC__seekable_stream_encoder_get_channels := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_channels'); + FLAC__seekable_stream_encoder_get_bits_per_sample := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_bits_per_sample'); + FLAC__seekable_stream_encoder_get_sample_rate := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_sample_rate'); + FLAC__seekable_stream_encoder_get_blocksize := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_blocksize'); + FLAC__seekable_stream_encoder_get_max_lpc_order := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_max_lpc_order'); + FLAC__seekable_stream_encoder_get_qlp_coeff_precision := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_qlp_coeff_precision'); + FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search'); + FLAC__seekable_stream_encoder_get_do_escape_coding := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_do_escape_coding'); + FLAC__seekable_stream_encoder_get_do_exhaustive_model_search := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_do_exhaustive_model_search'); + FLAC__seekable_stream_encoder_get_min_residual_partition_order := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_min_residual_partition_order'); + FLAC__seekable_stream_encoder_get_max_residual_partition_order := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_max_residual_partition_order'); + // FLAC__seekable_stream_encoder_get_rice_parameter_search_dist := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_rice_parameter_search_dist'); + FLAC__seekable_stream_encoder_get_total_samples_estimate := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_get_total_samples_estimate'); + FLAC__seekable_stream_encoder_init := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_init'); + FLAC__seekable_stream_encoder_finish := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_finish'); + FLAC__seekable_stream_encoder_process := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_process'); + FLAC__seekable_stream_encoder_process_interleaved := GetProcAddress(Libhandle, 'FLAC__seekable_stream_encoder_process_interleaved'); + + FLAC__seekable_stream_decoder_new := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_new'); + FLAC__seekable_stream_decoder_delete := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_delete'); + FLAC__seekable_stream_decoder_set_md5_checking := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_set_md5_checking'); + FLAC__seekable_stream_decoder_set_read_callback := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_set_read_callback'); + FLAC__seekable_stream_decoder_set_seek_callback := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_set_seek_callback'); + FLAC__seekable_stream_decoder_set_tell_callback := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_set_tell_callback'); + FLAC__seekable_stream_decoder_set_length_callback := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_set_length_callback'); + FLAC__seekable_stream_decoder_set_eof_callback := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_set_eof_callback'); + FLAC__seekable_stream_decoder_set_write_callback := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_set_write_callback'); + FLAC__seekable_stream_decoder_set_metadata_callback := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_set_metadata_callback'); + FLAC__seekable_stream_decoder_set_error_callback := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_set_error_callback'); + FLAC__seekable_stream_decoder_set_client_data := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_set_client_data'); + FLAC__seekable_stream_decoder_set_metadata_respond := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_set_metadata_respond'); + FLAC__seekable_stream_decoder_set_metadata_respond_application := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_set_metadata_respond_application'); + FLAC__seekable_stream_decoder_set_metadata_respond_all := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_set_metadata_respond_all'); + FLAC__seekable_stream_decoder_set_metadata_ignore := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_set_metadata_ignore'); + FLAC__seekable_stream_decoder_set_metadata_ignore_application := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_set_metadata_ignore_application'); + FLAC__seekable_stream_decoder_set_metadata_ignore_all := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_set_metadata_ignore_all'); + FLAC__seekable_stream_decoder_get_state := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_get_state'); + FLAC__seekable_stream_decoder_get_stream_decoder_state := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_get_stream_decoder_state'); + FLAC__seekable_stream_decoder_get_resolved_state_string := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_get_resolved_state_string'); + FLAC__seekable_stream_decoder_get_md5_checking := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_get_md5_checking'); + FLAC__seekable_stream_decoder_get_channels := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_get_channels'); + FLAC__seekable_stream_decoder_get_channel_assignment := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_get_channel_assignment'); + FLAC__seekable_stream_decoder_get_bits_per_sample := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_get_bits_per_sample'); + FLAC__seekable_stream_decoder_get_sample_rate := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_get_sample_rate'); + FLAC__seekable_stream_decoder_get_blocksize := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_get_blocksize'); + FLAC__seekable_stream_decoder_get_decode_position := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_get_decode_position'); + FLAC__seekable_stream_decoder_init := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_init'); + FLAC__seekable_stream_decoder_finish := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_finish'); + FLAC__seekable_stream_decoder_flush := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_flush'); + FLAC__seekable_stream_decoder_reset := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_reset'); + FLAC__seekable_stream_decoder_process_single := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_process_single'); + FLAC__seekable_stream_decoder_process_until_end_of_metadata := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_process_until_end_of_metadata'); + FLAC__seekable_stream_decoder_process_until_end_of_stream := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_process_until_end_of_stream'); + FLAC__seekable_stream_decoder_seek_absolute := GetProcAddress(Libhandle, 'FLAC__seekable_stream_decoder_seek_absolute'); + + end; + +finalization + + if Libhandle <> 0 then FreeLibrary(Libhandle); + + {$ENDIF} + + {$IFDEF LINUX} + +var + Libhandle : Pointer; + +{$IFDEF SEARCH_LIBS} + Path : String; +{$ENDIF} + +initialization + +{$IFDEF SEARCH_LIBS} + + Libhandle := nil; + Path := FindLibs(LibFLACPath); + if Path <> '' then Libhandle := dlopen(@Path[1], RTLD_NOW or RTLD_GLOBAL); + +{$ELSE} + + Libhandle := dlopen(LibFLACPath, RTLD_NOW or RTLD_GLOBAL); + +{$ENDIF} + + if Libhandle <> nil then + begin + LibFLACLoaded := True; + + FLAC__seekable_stream_encoder_new := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_new'); + FLAC__seekable_stream_encoder_delete := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_delete'); + FLAC__seekable_stream_encoder_set_verify := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_verify'); + FLAC__seekable_stream_encoder_set_streamable_subset := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_streamable_subset'); + FLAC__seekable_stream_encoder_set_do_mid_side_stereo := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_do_mid_side_stereo'); + FLAC__seekable_stream_encoder_set_loose_mid_side_stereo := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_loose_mid_side_stereo'); + FLAC__seekable_stream_encoder_set_channels := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_channels'); + FLAC__seekable_stream_encoder_set_bits_per_sample := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_bits_per_sample'); + FLAC__seekable_stream_encoder_set_sample_rate := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_sample_rate'); + FLAC__seekable_stream_encoder_set_blocksize := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_blocksize'); + FLAC__seekable_stream_encoder_set_max_lpc_order := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_max_lpc_order'); + FLAC__seekable_stream_encoder_set_qlp_coeff_precision := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_qlp_coeff_precision'); + FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search'); + FLAC__seekable_stream_encoder_set_do_escape_coding := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_do_escape_coding'); + FLAC__seekable_stream_encoder_set_do_exhaustive_model_search := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_do_exhaustive_model_search'); + FLAC__seekable_stream_encoder_set_min_residual_partition_order := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_min_residual_partition_order'); + FLAC__seekable_stream_encoder_set_max_residual_partition_order := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_max_residual_partition_order'); + // FLAC__seekable_stream_encoder_set_rice_parameter_search_dist := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_rice_parameter_search_dist'); + FLAC__seekable_stream_encoder_set_total_samples_estimate := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_total_samples_estimate'); + FLAC__seekable_stream_encoder_set_metadata := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_metadata'); + FLAC__seekable_stream_encoder_set_seek_callback := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_seek_callback'); + FLAC__seekable_stream_encoder_set_write_callback := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_write_callback'); + FLAC__seekable_stream_encoder_set_client_data := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_set_client_data'); + FLAC__seekable_stream_encoder_get_state := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_state'); + FLAC__seekable_stream_encoder_get_stream_encoder_state := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_stream_encoder_state'); + FLAC__seekable_stream_encoder_get_verify_decoder_state := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_verify_decoder_state'); + FLAC__seekable_stream_encoder_get_resolved_state_string := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_resolved_state_string'); + FLAC__seekable_stream_encoder_get_verify_decoder_error_stats := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_verify_decoder_error_stats'); + FLAC__seekable_stream_encoder_get_verify := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_verify'); + FLAC__seekable_stream_encoder_get_streamable_subset := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_streamable_subset'); + FLAC__seekable_stream_encoder_get_do_mid_side_stereo := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_do_mid_side_stereo'); + FLAC__seekable_stream_encoder_get_loose_mid_side_stereo := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_loose_mid_side_stereo'); + FLAC__seekable_stream_encoder_get_channels := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_channels'); + FLAC__seekable_stream_encoder_get_bits_per_sample := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_bits_per_sample'); + FLAC__seekable_stream_encoder_get_sample_rate := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_sample_rate'); + FLAC__seekable_stream_encoder_get_blocksize := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_blocksize'); + FLAC__seekable_stream_encoder_get_max_lpc_order := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_max_lpc_order'); + FLAC__seekable_stream_encoder_get_qlp_coeff_precision := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_qlp_coeff_precision'); + FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search'); + FLAC__seekable_stream_encoder_get_do_escape_coding := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_do_escape_coding'); + FLAC__seekable_stream_encoder_get_do_exhaustive_model_search := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_do_exhaustive_model_search'); + FLAC__seekable_stream_encoder_get_min_residual_partition_order := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_min_residual_partition_order'); + FLAC__seekable_stream_encoder_get_max_residual_partition_order := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_max_residual_partition_order'); + // FLAC__seekable_stream_encoder_get_rice_parameter_search_dist := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_rice_parameter_search_dist'); + FLAC__seekable_stream_encoder_get_total_samples_estimate := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_get_total_samples_estimate'); + FLAC__seekable_stream_encoder_init := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_init'); + FLAC__seekable_stream_encoder_finish := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_finish'); + FLAC__seekable_stream_encoder_process := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_process'); + FLAC__seekable_stream_encoder_process_interleaved := dlsym(Libhandle, 'FLAC__seekable_stream_encoder_process_interleaved'); + + FLAC__seekable_stream_decoder_new := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_new'); + FLAC__seekable_stream_decoder_delete := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_delete'); + FLAC__seekable_stream_decoder_set_md5_checking := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_set_md5_checking'); + FLAC__seekable_stream_decoder_set_read_callback := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_set_read_callback'); + FLAC__seekable_stream_decoder_set_seek_callback := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_set_seek_callback'); + FLAC__seekable_stream_decoder_set_tell_callback := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_set_tell_callback'); + FLAC__seekable_stream_decoder_set_length_callback := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_set_length_callback'); + FLAC__seekable_stream_decoder_set_eof_callback := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_set_eof_callback'); + FLAC__seekable_stream_decoder_set_write_callback := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_set_write_callback'); + FLAC__seekable_stream_decoder_set_metadata_callback := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_set_metadata_callback'); + FLAC__seekable_stream_decoder_set_error_callback := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_set_error_callback'); + FLAC__seekable_stream_decoder_set_client_data := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_set_client_data'); + FLAC__seekable_stream_decoder_set_metadata_respond := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_set_metadata_respond'); + FLAC__seekable_stream_decoder_set_metadata_respond_application := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_set_metadata_respond_application'); + FLAC__seekable_stream_decoder_set_metadata_respond_all := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_set_metadata_respond_all'); + FLAC__seekable_stream_decoder_set_metadata_ignore := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_set_metadata_ignore'); + FLAC__seekable_stream_decoder_set_metadata_ignore_application := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_set_metadata_ignore_application'); + FLAC__seekable_stream_decoder_set_metadata_ignore_all := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_set_metadata_ignore_all'); + FLAC__seekable_stream_decoder_get_state := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_get_state'); + FLAC__seekable_stream_decoder_get_stream_decoder_state := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_get_stream_decoder_state'); + FLAC__seekable_stream_decoder_get_resolved_state_string := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_get_resolved_state_string'); + FLAC__seekable_stream_decoder_get_md5_checking := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_get_md5_checking'); + FLAC__seekable_stream_decoder_get_channels := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_get_channels'); + FLAC__seekable_stream_decoder_get_channel_assignment := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_get_channel_assignment'); + FLAC__seekable_stream_decoder_get_bits_per_sample := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_get_bits_per_sample'); + FLAC__seekable_stream_decoder_get_sample_rate := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_get_sample_rate'); + FLAC__seekable_stream_decoder_get_blocksize := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_get_blocksize'); + FLAC__seekable_stream_decoder_get_decode_position := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_get_decode_position'); + FLAC__seekable_stream_decoder_init := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_init'); + FLAC__seekable_stream_decoder_finish := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_finish'); + FLAC__seekable_stream_decoder_flush := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_flush'); + FLAC__seekable_stream_decoder_reset := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_reset'); + FLAC__seekable_stream_decoder_process_single := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_process_single'); + FLAC__seekable_stream_decoder_process_until_end_of_metadata := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_process_until_end_of_metadata'); + FLAC__seekable_stream_decoder_process_until_end_of_stream := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_process_until_end_of_stream'); + FLAC__seekable_stream_decoder_seek_absolute := dlsym(Libhandle, 'FLAC__seekable_stream_decoder_seek_absolute'); + + end; + +finalization + + if Libhandle <> nil then dlclose(Libhandle); + + {$ENDIF} + +end. diff --git a/components/acs/Src/fileformats/general/lame.pas b/components/acs/Src/fileformats/general/lame.pas new file mode 100644 index 000000000..ac6a3b20e --- /dev/null +++ b/components/acs/Src/fileformats/general/lame.pas @@ -0,0 +1,1054 @@ +(* + delphi/kylix header for lame encoder. + translated from lame.h c/c++ header + by andrei borovsky, acs@compiler4.net + the original c/c++ header and library + copyright (c) 1999 mark taylor + + Note by A.B.: Some fragments of the original header file are skipped. + See the comments below. +*) + +{ +$Log: lame.pas,v $ +Revision 1.3 2005/12/19 18:36:56 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:53 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + +unit lame; + +interface + +uses +{$IFDEF WIN32} + Windows; +{$ENDIF} + +{$IFDEF LINUX} + Libc; +{$ENDIF} + +const + +{$IFDEF LINUX} + LAME_PATH = '/usr/lib/libmp3lame.so'; +{$ENDIF} + +{$IFDEF WIN32} + LAME_PATH = 'lame_enc.dll'; +{$ENDIF} + +type + + vbr_mode = ( + vbr_off = 0, + vbr_mt, // obsolete, same as vbr_mtrh + vbr_rh, + vbr_abr, + vbr_mtrh, + vbr_max_indicator, // Don't use this! It's used for sanity checks. + vbr_default = vbr_rh // change this to change the default VBR mode of LAME + ); + +// MPEG modes + + MPEG_mode = ( + STEREO = 0, + JOINT_STEREO, + DUAL_CHANNEL, // LAME doesn't supports this! + MONO, + NOT_SET, + MAX_INDICATOR // Don't use this! It's used for sanity checks. + ); + + Padding_type = ( + PAD_NO = 0, + PAD_ALL, + PAD_ADJUST, + PAD_MAX_INDICATOR // Don't use this! It's used for sanity checks. + ); + + preset_mode = ( + (* values from 8 to 320 should be reserved for abr bitrates + for abr I'd suggest to directly use the targeted bitrate as a value *) + ABR_8 = 8, + ABR_320 = 320, + R3MIX = 1000, + STANDARD = 1001, + EXTREME = 1002, + INSANE = 1003, + STANDARD_FAST = 1004, + EXTREME_FAST = 1005 + ); + + asm_optimizations = ( + MMX = 1, + AMD_3DNOW = 2, + SSE = 3 + ); + +(* Note by A.B.: + The following type is a placeholder for * lame_global_flags. + We treat this type as integer since it is interpreted as such by some + functions and the underlying structure is opaque anyway. +*) + + PLame_global_flags = Integer; + + PLame_t = Pointer; + + // function pointers + + (*********************************************************************** + * + * The LAME API + * These functions should be called, in this order, for each + * MP3 file to be encoded + * + ***********************************************************************) + + (* + * REQUIRED: + * initialize the encoder. sets default for all encoder paramters, + * returns -1 if some malloc()'s failed + * otherwise returns 0 + *) + + lame_init_t = function : PLame_global_flags; cdecl; + + (* + * OPTIONAL: + * set as needed to override defaults + *) + +(******************************************************************** + * input stream description + ***********************************************************************) +// number of samples. default = 2^32-1 + + lame_set_num_samples_t = function(handle : PLame_global_flags; ul : LongWord) + : Integer; cdecl; + lame_get_num_samples_t = function(handle : PLame_global_flags) : LongWord; cdecl; + + // input sample rate in Hz. default = 44100hz + lame_set_in_samplerate_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_in_samplerate_t = function(handle : PLame_global_flags) : Integer; cdecl; + + // number of channels in input stream. default=2 + lame_set_num_channels_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_num_channels_t = function(handle : PLame_global_flags) : Integer; cdecl; + + (* scale the input by this amount before encoding. default=0 (disabled) + (not used by decoding routines) *) + lame_set_scale_t = function(handle : PLame_global_flags; d : Single) + : Integer; cdecl; + lame_get_scale_t = function(handle : PLame_global_flags) : Single; cdecl; + + (* scale the channel 0 (left) input by this amount before encoding. + default=0 (disabled) + (not used by decoding routines) *) + lame_set_scale_left_t = function(handle : PLame_global_flags; d : Single) + : Integer; cdecl; + lame_get_scale_left_t = function(handle : PLame_global_flags) : Single; cdecl; + +(* scale the channel 1 (right) input by this amount before encoding. + default=0 (disabled) + (not used by decoding routines) *) + + lame_set_scale_right_t = function(handle : PLame_global_flags; d : Single) + : Integer; cdecl; + lame_get_scale_right_t = function(handle : PLame_global_flags) : Single; cdecl; + + (* output sample rate in Hz. default = 0, which means LAME picks best value + based on the amount of compression. MPEG only allows: + MPEG1 32, 44.1, 48khz + MPEG2 16, 22.05, 24 + MPEG2.5 8, 11.025, 12 + (not used by decoding routines) *) + + lame_set_out_samplerate_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_out_samplerate_t = function(handle : PLame_global_flags) : Integer; cdecl; + + (******************************************************************** + * general control parameters + ***********************************************************************) +// 1=cause LAME to collect data for an MP3 frame analyzer. default=0 + lame_set_analysis_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_analysis_t = function(handle : PLame_global_flags) : Integer; cdecl; + +(* 1 = write a Xing VBR header frame. + default = 1 for VBR/ABR modes, 0 for CBR mode + this variable must have been added by a Hungarian notation Windows programmer :-) *) + lame_set_bWriteVbrTag_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_bWriteVbrTag_t = function(handle : PLame_global_flags) : Integer; cdecl; + + // 1=decode only. use lame/mpglib to convert mp3/ogg to wav. default=0 + lame_set_decode_only_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_decode_only_t = function(handle : PLame_global_flags) : Integer; cdecl; + + // 1=encode a Vorbis .ogg file. default=0 + lame_set_ogg_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_ogg_t = function(handle : PLame_global_flags) : Integer; cdecl; + +(* internal algorithm selection. True quality is determined by the bitrate + but this variable will effect quality by selecting expensive or cheap algorithms. + quality=0..9. 0=best (very slow). 9=worst. + recommended: 2 near-best quality, not too slow + 5 good quality, fast + 7 ok quality, really fast *) + lame_set_quality_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_quality_t = function(handle : PLame_global_flags) : Integer; cdecl; + +(* mode = 0,1,2,3 = stereo, jstereo, dual channel (not supported), mono + default: lame picks based on compression ration and input channels *) + lame_set_mode_t = function(handle : PLame_global_flags; MPEGMode : Integer) + : Integer; cdecl; + lame_get_mode_t = function(handle : PLame_global_flags) : Integer; cdecl; + +(* mode_automs. Use a M/S mode with a switching threshold based on + compression ratio + default = 0 (disabled) *) + lame_set_mode_automs_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_mode_automs_t = function(handle : PLame_global_flags) : Integer; cdecl; + +(* force_ms. Force M/S for all frames. For testing only. + default = 0 (disabled) *) + lame_set_force_ms_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_force_ms_t = function(handle : PLame_global_flags) : Integer; cdecl; + +// use free_format? default = 0 (disabled) + lame_set_free_format_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_free_format_t = function(handle : PLame_global_flags) : Integer; cdecl; + +// Note by A.B.: Attention! Skipping optional debug/error messages functions. + +// set one of brate compression ratio. default is compression ratio of 11. + lame_set_brate_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_brate_t = function(handle : PLame_global_flags) : Integer; cdecl; + lame_set_compression_ratio_t = function(handle : PLame_global_flags; d : Single) + : Integer; cdecl; + lame_get_compression_ratio_t = function(handle : PLame_global_flags) : Single; cdecl; + + lame_set_preset_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_set_asm_optimizations_t = function(handle : PLame_global_flags; i1, i2 : Integer) + : Integer; cdecl; + + (******************************************************************** + * frame params + ***********************************************************************) +// mark as copyright. default=0 + lame_set_copyright_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_copyright_t = function(handle : PLame_global_flags) : Integer; cdecl; + +// mark as original. default=1 + lame_set_original_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_original_t = function(handle : PLame_global_flags) : Integer; cdecl; + +// error_protection. Use 2 bytes from each frame for CRC checksum. default=0 + lame_set_error_protection_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_error_protection_t = function(handle : PLame_global_flags) : Integer; cdecl; + +// padding_type. 0=pad no frames 1=pad all frames 2=adjust padding(default) + lame_set_padding_type_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_padding_type_t = function(handle : PLame_global_flags) : Integer; cdecl; + +// MP3 'private extension' bit Meaningless. default=0 + lame_set_extension_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_extension_t = function(handle : PLame_global_flags) : Integer; cdecl; + +// enforce strict ISO compliance. default=0 + lame_set_strict_ISO_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_strict_ISO_t = function(handle : PLame_global_flags) : Integer; cdecl; + + (******************************************************************** + * VBR control + ***********************************************************************) + +// Types of VBR. default = vbr_off = CBR + lame_set_VBR_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_VBR_t = function(handle : PLame_global_flags) : Integer; cdecl; + +// VBR quality level. 0=highest 9=lowest + lame_set_VBR_q_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_VBR_q_t = function(handle : PLame_global_flags) : Integer; cdecl; + +// Ignored except for VBR=vbr_abr (ABR mode) + lame_set_VBR_mean_bitrate_kbps_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_VBR_mean_bitrate_kbps_t = function(handle : PLame_global_flags) : Integer; cdecl; + + lame_set_VBR_min_bitrate_kbps_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_VBR_min_bitrate_kbps_t = function(handle : PLame_global_flags) : Integer; cdecl; + + lame_set_VBR_max_bitrate_kbps_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_VBR_max_bitrate_kbps_t = function(handle : PLame_global_flags) : Integer; cdecl; + +(* 1=stricetly enforce VBR_min_bitrate. Normally it will be violated for + analog silence *) + lame_set_VBR_hard_min_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_VBR_hard_min_t = function(handle : PLame_global_flags) : Integer; cdecl; + + (******************************************************************** + * Filtering control + ***********************************************************************) + // freq in Hz to apply lowpass. Default = 0 = lame chooses. -1 = disabled + lame_set_lowpassfreq_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_lowpassfreq_t = function(handle : PLame_global_flags) : Integer; cdecl; +// width of transition band, in Hz. Default = one polyphase filter band + lame_set_lowpasswidth_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_lowpasswidth_t = function(handle : PLame_global_flags) : Integer; cdecl; + +// freq in Hz to apply highpass. Default = 0 = lame chooses. -1 = disabled + lame_set_highpassfreq_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_highpassfreq_t = function(handle : PLame_global_flags) : Integer; cdecl; +// width of transition band, in Hz. Default = one polyphase filter band + lame_set_highpasswidth_t = function(handle : PLame_global_flags; i : Integer) + : Integer; cdecl; + lame_get_highpasswidth_t = function(handle : PLame_global_flags) : Integer; cdecl; + +// Note by A.B.: Attention! Skipping psycho acoustics and other special functions + +(************************************************************************ +* internal variables, cannot be set... * +* provided because they may be of use to calling application * +************************************************************************) +// version 0=MPEG-2 1=MPEG-1 (2=MPEG-2.5) + lame_get_version_t = function(handle : PLame_global_flags) : Integer; cdecl; + +// encoder delay + lame_get_encoder_delay_t = function(handle : PLame_global_flags) : Integer; cdecl; + +(* padding appended to the input to make sure decoder can fully decode + all input. Note that this value can only be calculated during the + call to lame_encoder_flush(). Before lame_encoder_flush() has + been called, the value of encoder_padding = 0. *) + lame_get_encoder_padding_t = function(handle : PLame_global_flags) : Integer; cdecl; + +// size of MPEG frame + lame_get_framesize_t = function(handle : PLame_global_flags) : Integer; cdecl; + +// number of PCM samples buffered, but not yet encoded to mp3 data. + lame_get_mf_samples_to_encode_t = function(handle : PLame_global_flags) : Integer; cdecl; + +(* size (bytes) of mp3 data buffered, but not yet encoded. + this is the number of bytes which would be output by a call to + lame_encode_flush_nogap. NOTE: lame_encode_flush() will return + more bytes than this because it will encode the reamining buffered + PCM samples before flushing the mp3 buffers. *) + lame_get_size_mp3buffer_t = function(handle : PLame_global_flags) : Integer; cdecl; + +// number of frames encoded so far + lame_get_frameNum_t = function(handle : PLame_global_flags) : Integer; cdecl; + +(* lame's estimate of the total number of frames to be encoded + only valid if calling program set num_samples *) + lame_get_totalframes_t = function(handle : PLame_global_flags) : Integer; cdecl; + +(* + * REQUIRED: + * sets more internal configuration based on data provided above. + * returns -1 if something failed. + *) + + lame_init_params_t = function(handle : PLame_global_flags) : Integer; cdecl; + +(* + * OPTIONAL: + * get the version number, in a string. of the form: + * "3.63 (beta)" or just "3.63". + *) + get_lame_version_t = function : PChar; cdecl; + get_lame_short_version_t = function : PChar; cdecl; + get_lame_very_short_version_t = function : PChar; cdecl; + get_psy_version_t = function : PChar; cdecl; + get_lame_url_t = function : PChar; cdecl; + +(* + * OPTIONAL: + * get the version numbers in numerical form. + *) + + lame_version_t = record + // generic LAME version + major : Integer; + minor : Integer; + alpha : Integer; // 0 if not an alpha version + beta : Integer; // 0 if not a beta version + + // version of the psy model + psy_major : Integer; + psy_minor : Integer; + psy_alpha : Integer; // 0 if not an alpha version + psy_beta : Integer; // 0 if not a beta version + + // compile time features + features : PChar; // Don't make assumptions about the contents! + end; + + get_lame_version_numerical_t = procedure(lnv : lame_version_t); cdecl; + +// Note by A.B.: Attention! Skipping optional functions printing internal lame configuration + +(* + * input pcm data, output (maybe) mp3 frames. + * This routine handles all buffering, resampling and filtering for you. + * + * return code number of bytes output in mp3buf. Can be 0 + * -1: mp3buf was too small + * -2: malloc() problem + * -3: lame_init_params() not called + * -4: psycho acoustic problems + * -5: ogg cleanup encoding error + * -6: ogg frame encoding error + * + * The required mp3buf_size can be computed from num_samples, + * samplerate and encoding rate, but here is a worst case estimate: + * + * mp3buf_size in bytes = 1.25*num_samples + 7200 + * + * I think a tighter bound could be: (mt, March 2000) + * MPEG1: + * num_samples*(bitrate/8)/samplerate + 4*1152*(bitrate/8)/samplerate + 512 + * MPEG2: + * num_samples*(bitrate/8)/samplerate + 4*576*(bitrate/8)/samplerate + 256 + * + * but test first if you use that! + * + * set mp3buf_size = 0 and LAME will not check if mp3buf_size is + * large enough. + * + * NOTE: + * if gfp->num_channels=2, but gfp->mode = 3 (mono), the L & R channels + * will be averaged into the L channel before encoding only the L channel + * This will overwrite the data in buffer_l[] and buffer_r[]. + * +*) + + lame_encode_buffer_t = function(handle : PLame_global_flags; // global context handle + buffer_l : PShortInt; // PCM data for left channel + buffer_r : PShortInt; // PCM data for right channel + nsamples : Integer; // number of samples per channel + mp3buf : PByte; // pointer to encoded MP3 stream + mp3buf_size : Integer // number of valid octets in this stream + ) : Integer; cdecl; + +(* + * as above, but input has L & R channel data interleaved. + * NOTE: + * num_samples = number of samples in the L (or R) + * channel, not the total number of samples in pcm[] + *) + lame_encode_buffer_interleaved_t = function(handle : PLame_global_flags; // global context handle + pcm : PShortInt; (* PCM data for left and right + channel, interleaved *) + num_samples : Integer; (* number of samples per channel, + _not_ number of samples in pcm[] *) + mp3buf : PByte; // pointer to encoded MP3 stream + mp3buf_size : Integer // number of valid octets in this stream + ) : Integer; cdecl; + +(* as lame_encode_buffer, but for 'float's. + * !! NOTE: !! data must still be scaled to be in the same range as + * short int, +/- 32768 + *) + lame_encode_buffer_float_t = function(handle : PLame_global_flags; // global context handle + buffer_l : PSingle; // PCM data for left channel + buffer_r : PSingle; // PCM data for right channel + nsamples : Integer; // number of samples per channel + mp3buf : PByte; // pointer to encoded MP3 stream + mp3buf_size : Integer // number of valid octets in this stream + ) : Integer; cdecl; + +// Note by A.B.: Attention! Skipping several variants of encoding functions + +(* + * REQUIRED: + * lame_encode_flush will flush the intenal PCM buffers, padding with + * 0's to make sure the final frame is complete, and then flush + * the internal MP3 buffers, and thus may return a + * final few mp3 frames. 'mp3buf' should be at least 7200 bytes long + * to hold all possible emitted data. + * + * will also write id3v1 tags (if any) into the bitstream + * + * return code = number of bytes output to mp3buf. Can be 0 + *) + lame_encode_flush_t = function(handle : PLame_global_flags; // global context handle + mp3buf : PByte; // pointer to encoded MP3 stream + size : Integer // number of valid octets in this stream + ) : Integer; cdecl; + +(* + * OPTIONAL: + * lame_encode_flush_nogap will flush the internal mp3 buffers and pad + * the last frame with ancillary data so it is a complete mp3 frame. + * + * 'mp3buf' should be at least 7200 bytes long + * to hold all possible emitted data. + * + * After a call to this routine, the outputed mp3 data is complete, but + * you may continue to encode new PCM samples and write future mp3 data + * to a different file. The two mp3 files will play back with no gaps + * if they are concatenated together. + * + * This routine will NOT write id3v1 tags into the bitstream. + * + * return code = number of bytes output to mp3buf. Can be 0 + *) + lame_encode_flush_nogap_t = function(handle : PLame_global_flags; // global context handle + mp3buf : PByte; // pointer to encoded MP3 stream + size : Integer // number of valid octets in this stream + ) : Integer; cdecl; + +(* + * OPTIONAL: + * Normally, this is called by lame_init_params(). It writes id3v2 and + * Xing headers into the front of the bitstream, and sets frame counters + * and bitrate histogram data to 0. You can also call this after + * lame_encode_flush_nogap(). + *) + lame_init_bitstream_t = function(handle : PLame_global_flags) : Integer; cdecl; + +// Note by A.B.: Attention! Skipping several optional functions. + +(* + * REQUIRED: + * final call to free all remaining buffers + *) + lame_close_t = function(handle : PLame_global_flags) : Integer; cdecl; + +(********************************************************************* + * + * decoding + * + * a simple interface to mpglib, part of mpg123, is also included if + * libmp3lame is compiled with HAVE_MPGLIB + * + *********************************************************************) + + PMP3data_struct = ^mp3data_struct; + + mp3data_struct = record + header_parsed : Integer; (* 1 if header was parsed and following + data was computed *) + stereo : Integer; // number of channels + samplerate : Integer; // sample rate + bitrate : Integer; // bitrate + mode : Integer; // mp3 frame type + mode_ext : Integer; // mp3 frame type + framesize : Integer; // number of samples per mp3 frame + + // this data is only computed if mpglib detects a Xing VBR header + nsamp : LongWord; // number of samples in mp3 file. + totalframes : Integer; // total number of frames in mp3 file + + // this data is not currently computed by the mpglib routines + framenum : Integer; // frames decoded counter */ + end; + + +// required call to initialize decoder + lame_decode_init_t = function : Integer; cdecl; + +(********************************************************************* + * input 1 mp3 frame, output (maybe) pcm data. + * lame_decode() return code: + * -1: error + * 0: need more data + * n>0: size of pcm output + *********************************************************************) + lame_decode_t = function(mp3buf : PByte; len : Integer; pcm_l, pcm_r : PShortInt) + : Integer; cdecl; + +// same as lame_decode, and also returns mp3 header data + lame_decode_headers_t = function(mp3buf : PByte; len : Integer; pcm_l, pcm_r : PShortInt; + mp3data : PMP3data_struct) : Integer; cdecl; + +// same as lame_decode, but returns at most one frame + lame_decode1_t = function(mp3buf : PByte; len : Integer; pcm_l, pcm_r : PShortInt) + : Integer; cdecl; + +// same as lame_decode1, but returns at most one frame and mp3 header data + lame_decode1_headers_t = function(mp3buf : PByte; len : Integer; pcm_l, pcm_r : PShortInt; + mp3data : PMP3data_struct) : Integer; cdecl; + +(********************************************************************* + * + * id3tag stuff + * + *********************************************************************) + +(* + * The original header file is + * id3tag.h -- Interface to write ID3 version 1 and 2 tags. + * Copyright (C) 2000 Don Melton. + *) + + id3tag_genre_list_cbf = procedure(Number : Integer; Genre : PChar; CustomData : Pointer); cdecl; + + // utility to obtain alphabetically sorted list of genre names with numbers */ + id3tag_genre_list_t = procedure(handler : id3tag_genre_list_cbf; CustomData : Pointer); cdecl; + + id3tag_init_t = procedure(handle : PLame_global_flags); cdecl; + + // force addition of version 2 tag */ + id3tag_add_v2_t = procedure(handle : PLame_global_flags); cdecl; + + // add only a version 1 tag + id3tag_v1_only_t = procedure(handle : PLame_global_flags); cdecl; + + // add only a version 2 tag + id3tag_v2_only_t = procedure(handle : PLame_global_flags); cdecl; + + // pad version 1 tag with spaces instead of nulls + id3tag_space_v1_t = procedure(handle : PLame_global_flags); cdecl; + + // pad version 2 tag with extra 128 bytes + id3tag_pad_v2_t = procedure(handle : PLame_global_flags); cdecl; + + id3tag_set_title_t = procedure(handle : PLame_global_flags; title : PChar); cdecl; + id3tag_set_artist_t = procedure(handle : PLame_global_flags; artist : PChar); cdecl; + id3tag_set_album_t = procedure(handle : PLame_global_flags; album : PChar); cdecl; + id3tag_set_year_t = procedure(handle : PLame_global_flags; year : PChar); cdecl; + id3tag_set_comment_t = procedure(handle : PLame_global_flags; comment : PChar); cdecl; + id3tag_set_track_t = procedure(handle : PLame_global_flags; track : PChar); cdecl; + + // return non-zero result if genre name or number is invalid + id3tag_set_genre_t = function(handle : PLame_global_flags; genre : PChar) : Integer; cdecl; + +const + LAME_MAXMP3BUFFER = 16384; + +var + LameLoaded : Boolean = False; + + lame_init : lame_init_t; + lame_set_num_samples : lame_set_num_samples_t; + lame_get_num_samples : lame_get_num_samples_t; + lame_set_in_samplerate : lame_set_in_samplerate_t; + lame_get_in_samplerate : lame_get_in_samplerate_t; + lame_set_num_channels : lame_set_num_channels_t; + lame_get_num_channels : lame_get_num_channels_t; + lame_set_scale : lame_set_scale_t; + lame_get_scale : lame_get_scale_t; + lame_set_scale_left : lame_set_scale_left_t; + lame_get_scale_left : lame_get_scale_left_t; + lame_set_scale_right : lame_set_scale_right_t; + lame_get_scale_right : lame_get_scale_right_t; + lame_set_out_samplerate : lame_set_out_samplerate_t; + lame_get_out_samplerate : lame_get_out_samplerate_t; + lame_set_analysis : lame_set_analysis_t; + lame_get_analysis : lame_get_analysis_t; + lame_set_bWriteVbrTag : lame_set_bWriteVbrTag_t; + lame_get_bWriteVbrTag : lame_get_bWriteVbrTag_t; + lame_set_decode_only : lame_set_decode_only_t; + lame_get_decode_only : lame_get_decode_only_t; + lame_set_ogg : lame_set_ogg_t; + lame_get_ogg : lame_get_ogg_t; + lame_set_quality : lame_set_quality_t; + lame_get_quality : lame_get_quality_t; + lame_set_mode : lame_set_mode_t; + lame_get_mode : lame_get_mode_t; + lame_set_mode_automs : lame_set_mode_automs_t; + lame_get_mode_automs : lame_get_mode_automs_t; + lame_set_force_ms : lame_set_force_ms_t; + lame_get_force_ms : lame_get_force_ms_t; + lame_set_free_format : lame_set_free_format_t; + lame_get_free_format : lame_get_free_format_t; + lame_set_brate : lame_set_brate_t; + lame_get_brate : lame_get_brate_t; + lame_set_compression_ratio : lame_set_compression_ratio_t; + lame_get_compression_ratio : lame_get_compression_ratio_t; + lame_set_preset : lame_set_preset_t; + lame_set_asm_optimizations : lame_set_asm_optimizations_t; + lame_set_copyright : lame_set_copyright_t; + lame_get_copyright : lame_get_copyright_t; + lame_set_original : lame_set_original_t; + lame_get_original : lame_get_original_t; + lame_set_error_protection : lame_set_error_protection_t; + lame_get_error_protection : lame_get_error_protection_t; + lame_set_padding_type : lame_set_padding_type_t; + lame_get_padding_type : lame_get_padding_type_t; + lame_set_extension : lame_set_extension_t; + lame_get_extension : lame_get_extension_t; + lame_set_strict_ISO : lame_set_strict_ISO_t; + lame_get_strict_ISO : lame_get_strict_ISO_t; + lame_set_VBR : lame_set_VBR_t; + lame_get_VBR : lame_get_VBR_t; + lame_set_VBR_q : lame_set_VBR_q_t; + lame_get_VBR_q : lame_get_VBR_q_t; + lame_set_VBR_mean_bitrate_kbps : lame_set_VBR_mean_bitrate_kbps_t; + lame_get_VBR_mean_bitrate_kbps : lame_get_VBR_mean_bitrate_kbps_t; + lame_set_VBR_min_bitrate_kbps : lame_set_VBR_min_bitrate_kbps_t; + lame_get_VBR_min_bitrate_kbps : lame_get_VBR_min_bitrate_kbps_t; + lame_set_VBR_max_bitrate_kbps : lame_set_VBR_max_bitrate_kbps_t; + lame_get_VBR_max_bitrate_kbps : lame_get_VBR_max_bitrate_kbps_t; + lame_set_VBR_hard_min : lame_set_VBR_hard_min_t; + lame_get_VBR_hard_min : lame_get_VBR_hard_min_t; + lame_set_lowpassfreq : lame_set_lowpassfreq_t; + lame_get_lowpassfreq : lame_get_lowpassfreq_t; + lame_set_lowpasswidth : lame_set_lowpasswidth_t; + lame_get_lowpasswidth : lame_get_lowpasswidth_t; + lame_set_highpassfreq : lame_set_highpassfreq_t; + lame_get_highpassfreq : lame_get_highpassfreq_t; + lame_set_highpasswidth : lame_set_highpasswidth_t; + lame_get_highpasswidth : lame_get_highpasswidth_t; + lame_get_version : lame_get_version_t; + lame_get_encoder_delay : lame_get_encoder_delay_t; + lame_get_encoder_padding : lame_get_encoder_padding_t; + lame_get_framesize : lame_get_framesize_t; + lame_get_mf_samples_to_encode : lame_get_mf_samples_to_encode_t; + lame_get_size_mp3buffer : lame_get_size_mp3buffer_t; + lame_get_frameNum : lame_get_frameNum_t; + lame_get_totalframes : lame_get_totalframes_t; + lame_init_params : lame_init_params_t; + get_lame_version : get_lame_version_t; + get_lame_short_version : get_lame_short_version_t; + get_lame_very_short_version : get_lame_very_short_version_t; + get_psy_version : get_psy_version_t; + get_lame_url : get_lame_url_t; + get_lame_version_numerical : get_lame_version_numerical_t; + lame_encode_buffer : lame_encode_buffer_t; + lame_encode_buffer_interleaved : lame_encode_buffer_interleaved_t; + lame_encode_buffer_float : lame_encode_buffer_float_t; + lame_encode_flush : lame_encode_flush_t; + lame_encode_flush_nogap : lame_encode_flush_nogap_t; + lame_init_bitstream : lame_init_bitstream_t; + lame_close : lame_close_t; + lame_decode_init : lame_decode_init_t; + lame_decode : lame_decode_t; + lame_decode_headers : lame_decode_headers_t; + lame_decode1 : lame_decode1_t; + lame_decode1_headers : lame_decode1_headers_t; + id3tag_genre_list : id3tag_genre_list_t; + id3tag_init : id3tag_init_t; + id3tag_add_v2 : id3tag_add_v2_t; + id3tag_v1_only : id3tag_v1_only_t; + id3tag_v2_only : id3tag_v2_only_t; + id3tag_space_v1 : id3tag_space_v1_t; + id3tag_pad_v2 : id3tag_pad_v2_t; + id3tag_set_title : id3tag_set_title_t; + id3tag_set_artist : id3tag_set_artist_t; + id3tag_set_album : id3tag_set_album_t; + id3tag_set_year : id3tag_set_year_t; + id3tag_set_comment : id3tag_set_comment_t; + id3tag_set_track : id3tag_set_track_t; + id3tag_set_genre : id3tag_set_genre_t; + +procedure LoadLAME; +procedure UnloadLAME; + +implementation + +var + +{$IFDEF LINUX} + Libhandle : Pointer; +{$ENDIF} + +{$IFDEF WIN32} + Libhandle : HMODULE; +{$ENDIF} + +procedure LoadLAME; +begin + if LAMELoaded then Exit; +{$IFDEF LINUX} + Libhandle := dlopen(LAME_PATH, RTLD_NOW or RTLD_GLOBAL); + if Libhandle <> nil then + begin + LAMELoaded := True; + + lame_init := dlsym(Libhandle, 'lame_init'); + lame_set_num_samples := dlsym(Libhandle, 'lame_set_num_samples'); + lame_get_num_samples := dlsym(Libhandle, 'lame_get_num_samples'); + lame_set_in_samplerate := dlsym(Libhandle, 'lame_set_in_samplerate'); + lame_get_in_samplerate := dlsym(Libhandle, 'lame_get_in_samplerate'); + lame_set_num_channels := dlsym(Libhandle, 'lame_set_num_channels'); + lame_get_num_channels := dlsym(Libhandle, 'lame_get_num_channels'); + lame_set_scale := dlsym(Libhandle, 'lame_set_scale'); + lame_get_scale := dlsym(Libhandle, 'lame_get_scale'); + lame_set_scale_left := dlsym(Libhandle, 'lame_set_scale_left'); + lame_get_scale_left := dlsym(Libhandle, 'lame_get_scale_left'); + lame_set_scale_right := dlsym(Libhandle, 'lame_set_scale_right'); + lame_get_scale_right := dlsym(Libhandle, 'lame_get_scale_right'); + lame_set_out_samplerate := dlsym(Libhandle, 'lame_set_out_samplerate'); + lame_get_out_samplerate := dlsym(Libhandle, 'lame_get_out_samplerate'); + lame_set_analysis := dlsym(Libhandle, 'lame_set_analysis'); + lame_get_analysis := dlsym(Libhandle, 'lame_get_analysis'); + lame_set_bWriteVbrTag := dlsym(Libhandle, 'lame_set_bWriteVbrTag'); + lame_get_bWriteVbrTag := dlsym(Libhandle, 'lame_get_bWriteVbrTag'); + lame_set_decode_only := dlsym(Libhandle, 'lame_set_decode_only'); + lame_get_decode_only := dlsym(Libhandle, 'lame_get_decode_only'); + lame_set_ogg := dlsym(Libhandle, 'lame_set_ogg'); + lame_get_ogg := dlsym(Libhandle, 'lame_get_ogg'); + lame_set_quality := dlsym(Libhandle, 'lame_set_quality'); + lame_get_quality := dlsym(Libhandle, 'lame_get_quality'); + lame_set_mode := dlsym(Libhandle, 'lame_set_mode'); + lame_get_mode := dlsym(Libhandle, 'lame_get_mode'); + lame_set_mode_automs := dlsym(Libhandle, 'lame_set_mode_automs'); + lame_get_mode_automs := dlsym(Libhandle, 'lame_get_mode_automs'); + lame_set_force_ms := dlsym(Libhandle, 'lame_set_force_ms'); + lame_get_force_ms := dlsym(Libhandle, 'lame_get_force_ms'); + lame_set_free_format := dlsym(Libhandle, 'lame_set_free_format'); + lame_get_free_format := dlsym(Libhandle, 'lame_get_free_format'); + lame_set_brate := dlsym(Libhandle, 'lame_set_brate'); + lame_get_brate := dlsym(Libhandle, 'lame_get_brate'); + lame_set_compression_ratio := dlsym(Libhandle, 'lame_set_compression_ratio'); + lame_get_compression_ratio := dlsym(Libhandle, 'lame_get_compression_ratio'); + lame_set_preset := dlsym(Libhandle, 'lame_set_preset'); + lame_set_asm_optimizations := dlsym(Libhandle, 'lame_set_asm_optimizations'); + lame_set_copyright := dlsym(Libhandle, 'lame_set_copyright'); + lame_get_copyright := dlsym(Libhandle, 'lame_get_copyright'); + lame_set_original := dlsym(Libhandle, 'lame_set_original'); + lame_get_original := dlsym(Libhandle, 'lame_get_original'); + lame_set_error_protection := dlsym(Libhandle, 'lame_set_error_protection'); + lame_get_error_protection := dlsym(Libhandle, 'lame_get_error_protection'); + lame_set_padding_type := dlsym(Libhandle, 'lame_set_padding_type'); + lame_get_padding_type := dlsym(Libhandle, 'lame_get_padding_type'); + lame_set_extension := dlsym(Libhandle, 'lame_set_extension'); + lame_get_extension := dlsym(Libhandle, 'lame_get_extension'); + lame_set_strict_ISO := dlsym(Libhandle, 'lame_set_strict_ISO'); + lame_get_strict_ISO := dlsym(Libhandle, 'lame_get_strict_ISO'); + lame_set_VBR := dlsym(Libhandle, 'lame_set_VBR'); + lame_get_VBR := dlsym(Libhandle, 'lame_get_VBR'); + lame_set_VBR_q := dlsym(Libhandle, 'lame_set_VBR_q'); + lame_get_VBR_q := dlsym(Libhandle, 'lame_get_VBR_q'); + lame_set_VBR_mean_bitrate_kbps := dlsym(Libhandle, 'lame_set_VBR_mean_bitrate_kbps'); + lame_get_VBR_mean_bitrate_kbps := dlsym(Libhandle, 'lame_get_VBR_mean_bitrate_kbps'); + lame_set_VBR_min_bitrate_kbps := dlsym(Libhandle, 'lame_set_VBR_min_bitrate_kbps'); + lame_get_VBR_min_bitrate_kbps := dlsym(Libhandle, 'lame_get_VBR_min_bitrate_kbps'); + lame_set_VBR_max_bitrate_kbps := dlsym(Libhandle, 'lame_set_VBR_max_bitrate_kbps'); + lame_get_VBR_max_bitrate_kbps := dlsym(Libhandle, 'lame_get_VBR_max_bitrate_kbps'); + lame_set_VBR_hard_min := dlsym(Libhandle, 'lame_set_VBR_hard_min'); + lame_get_VBR_hard_min := dlsym(Libhandle, 'lame_get_VBR_hard_min'); + lame_set_lowpassfreq := dlsym(Libhandle, 'lame_set_lowpassfreq'); + lame_get_lowpassfreq := dlsym(Libhandle, 'lame_get_lowpassfreq'); + lame_set_lowpasswidth := dlsym(Libhandle, 'lame_set_lowpasswidth'); + lame_get_lowpasswidth := dlsym(Libhandle, 'lame_get_lowpasswidth'); + lame_set_highpassfreq := dlsym(Libhandle, 'lame_set_highpassfreq'); + lame_get_highpassfreq := dlsym(Libhandle, 'lame_get_highpassfreq'); + lame_set_highpasswidth := dlsym(Libhandle, 'lame_set_highpasswidth'); + lame_get_highpasswidth := dlsym(Libhandle, 'lame_get_highpasswidth'); + lame_get_version := dlsym(Libhandle, 'lame_get_version'); + lame_get_encoder_delay := dlsym(Libhandle, 'lame_get_encoder_delay'); + lame_get_encoder_padding := dlsym(Libhandle, 'lame_get_encoder_padding'); + lame_get_framesize := dlsym(Libhandle, 'lame_get_framesize'); + lame_get_mf_samples_to_encode := dlsym(Libhandle, 'lame_get_mf_samples_to_encode'); + lame_get_size_mp3buffer := dlsym(Libhandle, 'lame_get_size_mp3buffer'); + lame_get_frameNum := dlsym(Libhandle, 'lame_get_frameNum'); + lame_get_totalframes := dlsym(Libhandle, 'lame_get_totalframes'); + lame_init_params := dlsym(Libhandle, 'lame_init_params'); + get_lame_version := dlsym(Libhandle, 'get_lame_version'); + get_lame_short_version := dlsym(Libhandle, 'get_lame_short_version'); + get_lame_very_short_version := dlsym(Libhandle, 'get_lame_very_short_version'); + get_psy_version := dlsym(Libhandle, 'get_psy_version'); + get_lame_url := dlsym(Libhandle, 'get_lame_url'); + get_lame_version_numerical := dlsym(Libhandle, 'get_lame_version_numerical'); + lame_encode_buffer := dlsym(Libhandle, 'lame_encode_buffer'); + lame_encode_buffer_interleaved := dlsym(Libhandle, 'lame_encode_buffer_interleaved'); + lame_encode_buffer_float := dlsym(Libhandle, 'lame_encode_buffer_float'); + lame_encode_flush := dlsym(Libhandle, 'lame_encode_flush'); + lame_encode_flush_nogap := dlsym(Libhandle, 'lame_encode_flush_nogap'); + lame_init_bitstream := dlsym(Libhandle, 'lame_init_bitstream'); + lame_close := dlsym(Libhandle, 'lame_close'); + lame_decode_init := dlsym(Libhandle, 'lame_decode_init'); + lame_decode := dlsym(Libhandle, 'lame_decode'); + lame_decode_headers := dlsym(Libhandle, 'lame_decode_headers'); + lame_decode1 := dlsym(Libhandle, 'lame_decode1'); + lame_decode1_headers := dlsym(Libhandle, 'lame_decode1_headers'); + id3tag_genre_list := dlsym(Libhandle, 'id3tag_genre_list'); + id3tag_init := dlsym(Libhandle, 'id3tag_init'); + id3tag_add_v2 := dlsym(Libhandle, 'id3tag_add_v2'); + id3tag_v1_only := dlsym(Libhandle, 'id3tag_v1_only'); + id3tag_v2_only := dlsym(Libhandle, 'id3tag_v2_only'); + id3tag_space_v1 := dlsym(Libhandle, 'id3tag_space_v1'); + id3tag_pad_v2 := dlsym(Libhandle, 'id3tag_pad_v2'); + id3tag_set_title := dlsym(Libhandle, 'id3tag_set_title'); + id3tag_set_artist := dlsym(Libhandle, 'id3tag_set_artist'); + id3tag_set_album := dlsym(Libhandle, 'id3tag_set_album'); + id3tag_set_year := dlsym(Libhandle, 'id3tag_set_year'); + id3tag_set_comment := dlsym(Libhandle, 'id3tag_set_comment'); + id3tag_set_track := dlsym(Libhandle, 'id3tag_set_track'); + id3tag_set_genre := dlsym(Libhandle, 'id3tag_set_genre'); + end; +{$ENDIF} + +{$IFDEF WIN32} + Libhandle := LoadLibraryEx(LAME_PATH, 0, 0); + if Libhandle <> 0 then + begin + LAMELoaded := True; + + lame_init := GetProcAddress(Libhandle, 'lame_init'); + lame_set_num_samples := GetProcAddress(Libhandle, 'lame_set_num_samples'); + lame_get_num_samples := GetProcAddress(Libhandle, 'lame_get_num_samples'); + lame_set_in_samplerate := GetProcAddress(Libhandle, 'lame_set_in_samplerate'); + lame_get_in_samplerate := GetProcAddress(Libhandle, 'lame_get_in_samplerate'); + lame_set_num_channels := GetProcAddress(Libhandle, 'lame_set_num_channels'); + lame_get_num_channels := GetProcAddress(Libhandle, 'lame_get_num_channels'); + lame_set_scale := GetProcAddress(Libhandle, 'lame_set_scale'); + lame_get_scale := GetProcAddress(Libhandle, 'lame_get_scale'); + lame_set_scale_left := GetProcAddress(Libhandle, 'lame_set_scale_left'); + lame_get_scale_left := GetProcAddress(Libhandle, 'lame_get_scale_left'); + lame_set_scale_right := GetProcAddress(Libhandle, 'lame_set_scale_right'); + lame_get_scale_right := GetProcAddress(Libhandle, 'lame_get_scale_right'); + lame_set_out_samplerate := GetProcAddress(Libhandle, 'lame_set_out_samplerate'); + lame_get_out_samplerate := GetProcAddress(Libhandle, 'lame_get_out_samplerate'); + lame_set_analysis := GetProcAddress(Libhandle, 'lame_set_analysis'); + lame_get_analysis := GetProcAddress(Libhandle, 'lame_get_analysis'); + lame_set_bWriteVbrTag := GetProcAddress(Libhandle, 'lame_set_bWriteVbrTag'); + lame_get_bWriteVbrTag := GetProcAddress(Libhandle, 'lame_get_bWriteVbrTag'); + lame_set_decode_only := GetProcAddress(Libhandle, 'lame_set_decode_only'); + lame_get_decode_only := GetProcAddress(Libhandle, 'lame_get_decode_only'); + lame_set_ogg := GetProcAddress(Libhandle, 'lame_set_ogg'); + lame_get_ogg := GetProcAddress(Libhandle, 'lame_get_ogg'); + lame_set_quality := GetProcAddress(Libhandle, 'lame_set_quality'); + lame_get_quality := GetProcAddress(Libhandle, 'lame_get_quality'); + lame_set_mode := GetProcAddress(Libhandle, 'lame_set_mode'); + lame_get_mode := GetProcAddress(Libhandle, 'lame_get_mode'); + lame_set_mode_automs := GetProcAddress(Libhandle, 'lame_set_mode_automs'); + lame_get_mode_automs := GetProcAddress(Libhandle, 'lame_get_mode_automs'); + lame_set_force_ms := GetProcAddress(Libhandle, 'lame_set_force_ms'); + lame_get_force_ms := GetProcAddress(Libhandle, 'lame_get_force_ms'); + lame_set_free_format := GetProcAddress(Libhandle, 'lame_set_free_format'); + lame_get_free_format := GetProcAddress(Libhandle, 'lame_get_free_format'); + lame_set_brate := GetProcAddress(Libhandle, 'lame_set_brate'); + lame_get_brate := GetProcAddress(Libhandle, 'lame_get_brate'); + lame_set_compression_ratio := GetProcAddress(Libhandle, 'lame_set_compression_ratio'); + lame_get_compression_ratio := GetProcAddress(Libhandle, 'lame_get_compression_ratio'); + lame_set_preset := GetProcAddress(Libhandle, 'lame_set_preset'); + lame_set_asm_optimizations := GetProcAddress(Libhandle, 'lame_set_asm_optimizations'); + lame_set_copyright := GetProcAddress(Libhandle, 'lame_set_copyright'); + lame_get_copyright := GetProcAddress(Libhandle, 'lame_get_copyright'); + lame_set_original := GetProcAddress(Libhandle, 'lame_set_original'); + lame_get_original := GetProcAddress(Libhandle, 'lame_get_original'); + lame_set_error_protection := GetProcAddress(Libhandle, 'lame_set_error_protection'); + lame_get_error_protection := GetProcAddress(Libhandle, 'lame_get_error_protection'); + lame_set_padding_type := GetProcAddress(Libhandle, 'lame_set_padding_type'); + lame_get_padding_type := GetProcAddress(Libhandle, 'lame_get_padding_type'); + lame_set_extension := GetProcAddress(Libhandle, 'lame_set_extension'); + lame_get_extension := GetProcAddress(Libhandle, 'lame_get_extension'); + lame_set_strict_ISO := GetProcAddress(Libhandle, 'lame_set_strict_ISO'); + lame_get_strict_ISO := GetProcAddress(Libhandle, 'lame_get_strict_ISO'); + lame_set_VBR := GetProcAddress(Libhandle, 'lame_set_VBR'); + lame_get_VBR := GetProcAddress(Libhandle, 'lame_get_VBR'); + lame_set_VBR_q := GetProcAddress(Libhandle, 'lame_set_VBR_q'); + lame_get_VBR_q := GetProcAddress(Libhandle, 'lame_get_VBR_q'); + lame_set_VBR_mean_bitrate_kbps := GetProcAddress(Libhandle, 'lame_set_VBR_mean_bitrate_kbps'); + lame_get_VBR_mean_bitrate_kbps := GetProcAddress(Libhandle, 'lame_get_VBR_mean_bitrate_kbps'); + lame_set_VBR_min_bitrate_kbps := GetProcAddress(Libhandle, 'lame_set_VBR_min_bitrate_kbps'); + lame_get_VBR_min_bitrate_kbps := GetProcAddress(Libhandle, 'lame_get_VBR_min_bitrate_kbps'); + lame_set_VBR_max_bitrate_kbps := GetProcAddress(Libhandle, 'lame_set_VBR_max_bitrate_kbps'); + lame_get_VBR_max_bitrate_kbps := GetProcAddress(Libhandle, 'lame_get_VBR_max_bitrate_kbps'); + lame_set_VBR_hard_min := GetProcAddress(Libhandle, 'lame_set_VBR_hard_min'); + lame_get_VBR_hard_min := GetProcAddress(Libhandle, 'lame_get_VBR_hard_min'); + lame_set_lowpassfreq := GetProcAddress(Libhandle, 'lame_set_lowpassfreq'); + lame_get_lowpassfreq := GetProcAddress(Libhandle, 'lame_get_lowpassfreq'); + lame_set_lowpasswidth := GetProcAddress(Libhandle, 'lame_set_lowpasswidth'); + lame_get_lowpasswidth := GetProcAddress(Libhandle, 'lame_get_lowpasswidth'); + lame_set_highpassfreq := GetProcAddress(Libhandle, 'lame_set_highpassfreq'); + lame_get_highpassfreq := GetProcAddress(Libhandle, 'lame_get_highpassfreq'); + lame_set_highpasswidth := GetProcAddress(Libhandle, 'lame_set_highpasswidth'); + lame_get_highpasswidth := GetProcAddress(Libhandle, 'lame_get_highpasswidth'); + lame_get_version := GetProcAddress(Libhandle, 'lame_get_version'); + lame_get_encoder_delay := GetProcAddress(Libhandle, 'lame_get_encoder_delay'); + lame_get_encoder_padding := GetProcAddress(Libhandle, 'lame_get_encoder_padding'); + lame_get_framesize := GetProcAddress(Libhandle, 'lame_get_framesize'); + lame_get_mf_samples_to_encode := GetProcAddress(Libhandle, 'lame_get_mf_samples_to_encode'); + lame_get_size_mp3buffer := GetProcAddress(Libhandle, 'lame_get_size_mp3buffer'); + lame_get_frameNum := GetProcAddress(Libhandle, 'lame_get_frameNum'); + lame_get_totalframes := GetProcAddress(Libhandle, 'lame_get_totalframes'); + lame_init_params := GetProcAddress(Libhandle, 'lame_init_params'); + get_lame_version := GetProcAddress(Libhandle, 'get_lame_version'); + get_lame_short_version := GetProcAddress(Libhandle, 'get_lame_short_version'); + get_lame_very_short_version := GetProcAddress(Libhandle, 'get_lame_very_short_version'); + get_psy_version := GetProcAddress(Libhandle, 'get_psy_version'); + get_lame_url := GetProcAddress(Libhandle, 'get_lame_url'); + get_lame_version_numerical := GetProcAddress(Libhandle, 'get_lame_version_numerical'); + lame_encode_buffer := GetProcAddress(Libhandle, 'lame_encode_buffer'); + lame_encode_buffer_interleaved := GetProcAddress(Libhandle, 'lame_encode_buffer_interleaved'); + lame_encode_buffer_float := GetProcAddress(Libhandle, 'lame_encode_buffer_float'); + lame_encode_flush := GetProcAddress(Libhandle, 'lame_encode_flush'); + lame_encode_flush_nogap := GetProcAddress(Libhandle, 'lame_encode_flush_nogap'); + lame_init_bitstream := GetProcAddress(Libhandle, 'lame_init_bitstream'); + lame_close := GetProcAddress(Libhandle, 'lame_close'); + lame_decode_init := GetProcAddress(Libhandle, 'lame_decode_init'); + lame_decode := GetProcAddress(Libhandle, 'lame_decode'); + lame_decode_headers := GetProcAddress(Libhandle, 'lame_decode_headers'); + lame_decode1 := GetProcAddress(Libhandle, 'lame_decode1'); + lame_decode1_headers := GetProcAddress(Libhandle, 'lame_decode1_headers'); + id3tag_genre_list := GetProcAddress(Libhandle, 'id3tag_genre_list'); + id3tag_init := GetProcAddress(Libhandle, 'id3tag_init'); + id3tag_add_v2 := GetProcAddress(Libhandle, 'id3tag_add_v2'); + id3tag_v1_only := GetProcAddress(Libhandle, 'id3tag_v1_only'); + id3tag_v2_only := GetProcAddress(Libhandle, 'id3tag_v2_only'); + id3tag_space_v1 := GetProcAddress(Libhandle, 'id3tag_space_v1'); + id3tag_pad_v2 := GetProcAddress(Libhandle, 'id3tag_pad_v2'); + id3tag_set_title := GetProcAddress(Libhandle, 'id3tag_set_title'); + id3tag_set_artist := GetProcAddress(Libhandle, 'id3tag_set_artist'); + id3tag_set_album := GetProcAddress(Libhandle, 'id3tag_set_album'); + id3tag_set_year := GetProcAddress(Libhandle, 'id3tag_set_year'); + id3tag_set_comment := GetProcAddress(Libhandle, 'id3tag_set_comment'); + id3tag_set_track := GetProcAddress(Libhandle, 'id3tag_set_track'); + id3tag_set_genre := GetProcAddress(Libhandle, 'id3tag_set_genre'); + end; +{$ENDIF} +end; + +procedure UnloadLAME; +begin + + LAMELoaded := False; + +{$IFDEF LINUX} + if Libhandle <> nil then dlclose(Libhandle); +{$ENDIF} + +{$IFDEF WIN32} + if Libhandle <> 0 then FreeLibrary(Libhandle); +{$ENDIF} + +end; +end. diff --git a/components/acs/Src/fileformats/general/mad.pas b/components/acs/Src/fileformats/general/mad.pas new file mode 100644 index 000000000..430f8a9df --- /dev/null +++ b/components/acs/Src/fileformats/general/mad.pas @@ -0,0 +1,293 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: mad.pas,v $ +Revision 1.2 2006/08/03 17:31:09 z0m3ie +*** empty log message *** + +Revision 1.1 2005/12/19 18:36:56 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:53 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + +unit mad; + +interface + +uses + +{$IFDEF WIN32} + Windows; +{$ENDIF} + +{$IFDEF LINUX} + Libc, ACS_Procs; +{$ENDIF} + + +const + +{$IFDEF WIN32} + MADLibPath = 'MADLib.dll'; +{$ENDIF} + +{$IFDEF LINUX} + MADLibPath = 'libmad.so*'; // libmad.so + {$DEFINE SEARCH_LIBS} +{$ENDIF} + + +var + + MADLibLoaded : Boolean = False; + +type + + mad_bitptr = packed record + b : PChar; + Cache, Left : Word; + end; + + mad_stream = packed record + buffer : Pointer; + bufend : Pointer; + skiplen : LongWord; + sync : Integer; + freerate : LongWord; + this_frame : Pointer; + next_frame : Pointer; + ptr : mad_bitptr; + anc_ptr : mad_bitptr; + anc_bitlen : LongWord; + main_data : Pointer; + md_len : LongWord; + options : Integer; + error : Integer; + end; + + p_mad_stream = ^mad_stream; + + mad_timer_t = packed record + seconds : Integer; + fraction : LongWord; + end; + + mad_header = packed record + layer : Integer; + mode : Integer; + mode_extension : Integer; + emphasis : Integer; + bitrate : LongWord; + samplerate : LongWord; + crc_check : Word; + crc_target : Word; + flags : Integer; + private_bits : Integer; + duration : mad_timer_t; + end; + + p_mad_header = ^mad_header; + + mad_frame = packed record + header : mad_header; + options : Integer; + sbsample : packed array[0..1, 0..35, 0..31] of Integer; + overlap : Pointer; + end; + + p_mad_frame = ^mad_frame; + + mad_pcm = packed record + samplerate : LongWord; + channels : Word; + length : Word; + samples : packed array [0..1, 0..1151] of Integer; + end; + + p_mad_pcm = ^mad_pcm; + + mad_synth = packed record + filter : array[0..1, 0..1, 0..1, 0..15, 0..7] of Integer; + phase : LongWord; + pcm : mad_pcm; + end; + + async_struct = packed record + pid : LongWord; + _in : Integer; + _out : Integer; + end; + + sync_struct = packed record + stream : mad_stream; + frame : mad_frame; + synth : mad_synth; + end; + + p_sync_struct = ^sync_struct; + + TInputFunc = function(CData : Pointer; Stream : p_mad_stream) : Integer; cdecl; + THeaderFunc = function(CData : Pointer; Header : p_mad_header) : Integer; cdecl; + TFilterFunc = function(CData : Pointer; Frame : p_mad_frame) : Integer; cdecl; + TOutputFunc = function(CData : Pointer; Header : p_mad_header; pcm : p_mad_pcm) : Integer; cdecl; + TErrorFunc = function(CData : Pointer; Stream : p_mad_stream; Frame : p_mad_frame) : Integer; cdecl; + TMessageFunc = function(P1, P2 : Pointer; var l : LongWord) : Integer; cdecl; + + mad_decoder = packed record + mode : Integer; + options : Integer; + async : async_struct; + sync : p_sync_struct; + data : Pointer; + InputFunc : TInputFunc; + HeaderFunc : THeaderFunc; + FilterFunc : TFilterFunc; + OutputFunc : TOutputFunc; + ErrorFunc : TErrorFunc; + MessageFunc : TMessageFunc; + end; + + p_mad_decoder = ^mad_decoder; + +const + + MAD_F_FRACBITS = 28; + MAD_F_ONE = $10000000; + + MAD_FLOW_CONTINUE = $0; + MAD_FLOW_STOP = $10; + MAD_FLOW_BREAK = $11; + MAD_FLOW_IGNORE = $20; + + MAD_DECODER_MODE_SYNC = 0; + MAD_DECODER_MODE_ASYNC = 1; + +type + + mad_decoder_init_t = procedure(mad_decoder : p_mad_decoder; + CData : Pointer; + InputFunc : TInputFunc; + HeaderFunc : THeaderFunc; + FilterFunc : TFilterFunc; + OutputFunc : TOutputFunc; + ErrorFunc : TErrorFunc; + MessageFunc : TMessageFunc); cdecl; + + mad_decoder_finish_t = function(mad_decoder : p_mad_decoder) : Integer; cdecl; + + mad_decoder_run_t = function(mad_decoder : p_mad_decoder; mad_decoder_mode : Integer) : Integer; cdecl; + + mad_decoder_message_t = function(mad_decoder : p_mad_decoder; P : Pointer; var l : LongWord) : Integer; cdecl; + + mad_stream_buffer_t = procedure(MadStream : p_mad_stream; Data : Pointer; l : LongWord); cdecl; + + mad_stream_skip_t = procedure(MadStream : p_mad_stream; Skip : LongWord); cdecl; + + mad_stream_sync_t = function(MadStream : p_mad_stream) : Integer; cdecl; + +var + + mad_decoder_init: mad_decoder_init_t; + mad_decoder_finish : mad_decoder_finish_t; + mad_decoder_run : mad_decoder_run_t; + mad_decoder_message : mad_decoder_message_t; + mad_stream_buffer : mad_stream_buffer_t; + mad_stream_skip : mad_stream_skip_t; + mad_stream_sync : mad_stream_sync_t; + +implementation + + +{$IFDEF WIN32} + +var + Libhandle : HMODULE; + +initialization + + Libhandle := LoadLibraryEx(MADLibPath, 0, 0); + + if Libhandle <> 0 then + begin + MADLibLoaded := True; + + mad_decoder_init := GetProcAddress(Libhandle, 'mad_decoder_init'); + mad_decoder_finish := GetProcAddress(Libhandle, 'mad_decoder_finish'); + mad_decoder_run := GetProcAddress(Libhandle, 'mad_decoder_run'); + mad_decoder_message := GetProcAddress(Libhandle, 'mad_decoder_message'); + mad_stream_buffer := GetProcAddress(Libhandle, 'mad_stream_buffer'); + mad_stream_skip := GetProcAddress(Libhandle, 'mad_stream_skip'); + mad_stream_sync := GetProcAddress(Libhandle, 'mad_stream_sync'); + + end; + +finalization + + if Libhandle <> 0 then FreeLibrary(Libhandle); + + {$ENDIF} + + {$IFDEF LINUX} + +var + Libhandle : Pointer; + +{$IFDEF SEARCH_LIBS} + Path : String; +{$ENDIF} + +initialization + +{$IFDEF SEARCH_LIBS} + + Libhandle := nil; + Path := FindLibs(MADLibPath); + if Path <> '' then Libhandle := dlopen(@Path[1], RTLD_NOW or RTLD_GLOBAL); + +{$ELSE} + + Libhandle := dlopen(MADLibPath, RTLD_NOW or RTLD_GLOBAL); + +{$ENDIF} + + if Libhandle <> nil then + begin + + MADLibLoaded := True; + + mad_decoder_init := dlsym(Libhandle, 'mad_decoder_init'); + mad_decoder_finish := dlsym(Libhandle, 'mad_decoder_finish'); + mad_decoder_run := dlsym(Libhandle, 'mad_decoder_run'); + mad_decoder_message := dlsym(Libhandle, 'mad_decoder_message'); + mad_stream_buffer := dlsym(Libhandle, 'mad_stream_buffer'); + mad_stream_skip := dlsym(Libhandle, 'mad_stream_skip'); + mad_stream_sync := dlsym(Libhandle, 'mad_stream_sync'); + + end; + +finalization + + if Libhandle <> nil then dlclose(Libhandle); + + {$ENDIF} + + +end. diff --git a/components/acs/Src/fileformats/general/ogg.pas b/components/acs/Src/fileformats/general/ogg.pas new file mode 100644 index 000000000..4ff916593 --- /dev/null +++ b/components/acs/Src/fileformats/general/ogg.pas @@ -0,0 +1,531 @@ +(* + delphi/kylix headers for oggvorbis software codec. + translated from ogg.h and os_types.h headers + by andrei borovsky, acs@compiler4.net + the original c/c++ headers and libraries (c) copyright 1994-2001 + by the xiphophorus company http://www.xiph.org/ +*) + +{ +$Log: ogg.pas,v $ +Revision 1.4 2005/12/29 20:46:00 z0m3ie +fixed some problems with vorbis in lazarus + +Revision 1.3 2005/12/19 18:36:56 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:53 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + +unit ogg; + +interface + +uses + + ACS_Procs, + +{$IFDEF LINUX} + Libc; +{$ENDIF} + +{$IFDEF WIN32} + Windows; +{$ENDIF} + +type + + (* Type declarations from os_types.h header with + some Delphi-specific types added *) + + OGG_INT64_T = int64; + + POGG_INT64_T = ^OGG_INT64_T; + + OGG_INT32_T = Integer; + + OGG_UINT32_T = LongWord; + + OGG_INT16_T = SmallInt; // Word ? + + (* Note by AB: The following three type declarations, + strange as they seem, are required to make C + pointer/array stuff work in Delphi/Kylix. + See TVorbisOut class for details. *) + + FLOAT_T = array[0..0] of Single; + + PFLOAT = ^FLOAT_T; + + PPFLOAT = ^PFLOAT; + + // Type declarations from ogg.h header + + POGGPACK_BUFFER = ^OGGPACK_BUFFER; + + OGGPACK_BUFFER = record + endbyte: LongInt; + endbit: Integer; + buffer: PByte; + ptr: PByte; + storage: LongInt; + end; + +// ogg_page is used to encapsulate the data in one Ogg bitstream page + + OGG_PAGE = record + header: PByte; + header_len: LongInt; + body: PByte; + body_len: LongInt; + end; + +(* ogg_stream_state contains the current encode/decode state of a logical + Ogg bitstream *) + + OGG_STREAM_STATE = record + body_data: PByte; // bytes from packet bodies + body_storage: LongInt; // storage elements allocated + body_fill: LongInt; // elements stored; fill mark + body_returned: LongInt; // elements of fill returned + lacing_vals: PInteger; // The values that will go to the segment table + granule_vals: POGG_INT64_T; (* granulepos values for headers. Not compact + this way, but it is simple coupled to the + lacing fifo *) + lacing_storage: LongInt; + lacing_fill: LongInt; + lacing_packet: LongInt; + lacing_returned: LongInt; + header: array[0..281] of Byte; // working space for header encode + header_fill: Integer; + e_o_s: Integer; (* set when we have buffered the last packet in the + logical bitstream *) + b_o_s: Integer; (* set after we've written the initial page + of a logical bitstream *) + serialno: LongInt; + pageno: LongInt; + packetno: OGG_INT64_T; + (* sequence number for decode; the framing + knows where there's a hole in the data, + but we need coupling so that the codec + (which is in a seperate abstraction + layer) also knows about the gap *) + granulepos: OGG_INT64_T; + end; + +(* ogg_packet is used to encapsulate the data and metadata belonging + to a single raw Ogg/Vorbis packet *) + + POGG_PACKET = ^OGG_PACKET; + + OGG_PACKET = record + packet: PByte; + bytes: LongInt; + b_o_s: LongInt; + e_o_s: LongInt; + granulepos: OGG_INT64_T; + packetno: OGG_INT64_T; + (* sequence number for decode; the framing + knows where there's a hole in the data, + but we need coupling so that the codec + (which is in a seperate abstraction + layer) also knows about the gap *) + end; + + OGG_SYNC_STATE = record + data: PByte; + storage: Integer; + fill: Integer; + returned: Integer; + unsynced: Integer; + headerbytes: Integer; + bodybytes: Integer; + end; + + +const + +{$IFDEF LINUX} + LiboggPath = 'libogg.so*'; // '/usr/lib/libogg.so'; + {$DEFINE SEARCH_LIBS} +{$ENDIF} + +{$IFDEF WIN32} + LiboggPath = 'ogg.dll'; +{$ENDIF} + + +var + LiboggLoaded : Boolean = False; + +type + +// Ogg BITSTREAM PRIMITIVES: bitstream + + oggpack_writeinit_t = procedure(var b: OGGPACK_BUFFER); cdecl; + + oggpack_reset_t = procedure(var b: OGGPACK_BUFFER); cdecl; + + oggpack_writeclear_t = procedure(var b: OGGPACK_BUFFER); cdecl; + + oggpack_readinit_t = procedure(var b: OGGPACK_BUFFER; + buf: PByte; + bytes: Integer); cdecl; + + oggpack_write_t = procedure(var b: OGGPACK_BUFFER; + value: LongInt; + bits: Integer); cdecl; + + oggpack_look_t = function(var b: OGGPACK_BUFFER; + bits: Integer): LongInt; cdecl; + + oggpack_look_huff_t = function(var b: OGGPACK_BUFFER; + bits: Integer): LongInt; cdecl; + + oggpack_look1_t = function(var b: OGGPACK_BUFFER): LongInt; cdecl; + + oggpack_adv_t = procedure(var b: OGGPACK_BUFFER; + bits: Integer); cdecl; + + oggpack_adv_huff_t = function(var b: OGGPACK_BUFFER; + bits: Integer): Integer; cdecl; + + oggpack_adv1_t = procedure(var b: OGGPACK_BUFFER); cdecl; + + oggpack_read_t = function(var b: OGGPACK_BUFFER; + bits: Integer): LongInt; cdecl; + + oggpack_read1_t = function(var b: OGGPACK_BUFFER): LongInt; cdecl; + + oggpack_bytes_t = function(var b: OGGPACK_BUFFER): LongInt; cdecl; + + oggpack_bits_t = function(var b: OGGPACK_BUFFER): LongInt; cdecl; + + oggpack_get_buffer_t = function(var b: OGGPACK_BUFFER): PByte; cdecl; + +// Ogg BITSTREAM PRIMITIVES: encoding + + ogg_stream_packetin_t = function(var os: OGG_STREAM_STATE; + var op: OGG_PACKET): Integer; cdecl; + + ogg_stream_pageout_t = function(var os: OGG_STREAM_STATE; + var og: OGG_PAGE): Integer; cdecl; + + ogg_stream_flush_t = function(var os: OGG_STREAM_STATE; + var og: OGG_PAGE): Integer; cdecl; + +// Ogg BITSTREAM PRIMITIVES: decoding + + ogg_sync_init_t = function(var oy: OGG_SYNC_STATE): Integer; cdecl; + + ogg_sync_clear_t = function(var oy: OGG_SYNC_STATE): Integer; cdecl; + + ogg_sync_reset_t = function(var oy: OGG_SYNC_STATE): Integer; cdecl; + + ogg_sync_destroy_t = function(var oy: OGG_SYNC_STATE): Integer; cdecl; + + ogg_sync_buffer_t = function(var oy: OGG_SYNC_STATE; + size: LongInt): PChar; cdecl; + + ogg_sync_wrote_t = function(var oy: OGG_SYNC_STATE; + bytes: LongInt): Integer; cdecl; + + ogg_sync_pageseek_t = function(var oy: OGG_SYNC_STATE; + var og: OGG_PAGE): LongInt; cdecl; + + ogg_sync_pageout_t = function(var oy: OGG_SYNC_STATE; + var og: OGG_PAGE): Integer; cdecl; + + ogg_stream_pagein_t = function(var os: OGG_STREAM_STATE; + var og: OGG_PAGE): Integer; cdecl; + + ogg_stream_packetout_t = function(var os: OGG_STREAM_STATE; + var op: OGG_PACKET): Integer; cdecl; + + ogg_stream_packetpeek_t = function(var os: OGG_STREAM_STATE; + var op: OGG_PACKET): Integer; cdecl; + + +// Ogg BITSTREAM PRIMITIVES: general + + ogg_stream_init_t = function(var os: OGG_STREAM_STATE; + serialno: Integer): Integer; cdecl; + + ogg_stream_clear_t = function(var os: OGG_STREAM_STATE): Integer; cdecl; + + ogg_stream_reset_t = function(var os: OGG_STREAM_STATE): Integer; cdecl; + + ogg_stream_destroy_t = function(var os: OGG_STREAM_STATE): Integer; cdecl; + + ogg_stream_eos_t = function(var os: OGG_STREAM_STATE): Integer; cdecl; + + ogg_page_checksum_set_t = procedure(var og: OGG_PAGE); cdecl; + + ogg_page_version_t = function(var og: OGG_PAGE): Integer; cdecl; + + ogg_page_continued_t = function(var og: OGG_PAGE): Integer; cdecl; + + ogg_page_bos_t = function(var og: OGG_PAGE): Integer; cdecl; + + ogg_page_eos_t = function(var og: OGG_PAGE): Integer; cdecl; + + ogg_page_granulepos_t = function(var og: OGG_PAGE): OGG_INT64_T; cdecl; + + ogg_page_serialno_t = function(var og: OGG_PAGE): Integer; cdecl; + + ogg_page_pageno_t = function(var og: OGG_PAGE): LongInt; cdecl; + + ogg_page_packets_t = function(var og: OGG_PAGE): Integer; cdecl; + + ogg_packet_clear_t = procedure(var op: OGG_PACKET); cdecl; + +var + + ogg_stream_init : ogg_stream_init_t; + + ogg_stream_clear : ogg_stream_clear_t; + + ogg_stream_reset : ogg_stream_reset_t; + + ogg_stream_destroy : ogg_stream_destroy_t; + + ogg_stream_eos : ogg_stream_eos_t; + + ogg_page_checksum_set : ogg_page_checksum_set_t; + + ogg_page_version : ogg_page_version_t; + + ogg_page_continued : ogg_page_continued_t; + + ogg_page_bos : ogg_page_bos_t; + + ogg_page_eos : ogg_page_eos_t; + + ogg_page_granulepos : ogg_page_granulepos_t; + + ogg_page_serialno : ogg_page_serialno_t; + + ogg_page_pageno : ogg_page_pageno_t; + + ogg_page_packets : ogg_page_packets_t; + + ogg_packet_clear : ogg_packet_clear_t; + + oggpack_writeinit : oggpack_writeinit_t; + + oggpack_reset : oggpack_reset_t; + + oggpack_writeclear : oggpack_writeclear_t; + + oggpack_readinit : oggpack_readinit_t; + + oggpack_write : oggpack_write_t; + + oggpack_look : oggpack_look_t; + + oggpack_look_huff : oggpack_look_huff_t; + + oggpack_look1 : oggpack_look1_t; + + oggpack_adv : oggpack_adv_t; + + oggpack_adv_huff : oggpack_adv_huff_t; + + oggpack_adv1 : oggpack_adv1_t; + + oggpack_read : oggpack_read_t; + + oggpack_read1 : oggpack_read1_t; + + oggpack_bytes : oggpack_bytes_t; + + oggpack_bits : oggpack_bits_t; + + oggpack_get_buffer : oggpack_get_buffer_t; + + ogg_stream_packetin : ogg_stream_packetin_t; + + ogg_stream_pageout : ogg_stream_pageout_t; + + ogg_stream_flush : ogg_stream_flush_t; + + ogg_sync_init : ogg_sync_init_t; + + ogg_sync_clear : ogg_sync_clear_t; + + ogg_sync_reset : ogg_sync_reset_t; + + ogg_sync_destroy : ogg_sync_destroy_t; + + ogg_sync_buffer : ogg_sync_buffer_t; + + ogg_sync_wrote : ogg_sync_wrote_t; + + ogg_sync_pageseek : ogg_sync_pageseek_t; + + ogg_sync_pageout : ogg_sync_pageout_t; + + ogg_stream_pagein : ogg_stream_pagein_t; + + ogg_stream_packetout : ogg_stream_packetout_t; + + ogg_stream_packetpeek : ogg_stream_packetpeek_t; + +implementation + +{$IFDEF LINUX} + +var + Libhandle : Pointer; + +{$IFDEF SEARCH_LIBS} + Path : String; +{$ENDIF} + +initialization + +{$IFDEF SEARCH_LIBS} + + Libhandle := nil; + Path := FindLibs(LiboggPath); + if Path <> '' then Libhandle := dlopen(@Path[1], RTLD_NOW or RTLD_GLOBAL); + +{$ELSE} + + Libhandle := dlopen(LiboggPath, RTLD_NOW or RTLD_GLOBAL); + +{$ENDIF} + + if Libhandle <> nil then + begin + LiboggLoaded := True; + ogg_stream_init := dlsym(Libhandle, 'ogg_stream_init'); + ogg_stream_clear := dlsym(Libhandle, 'ogg_stream_clear'); + ogg_stream_reset := dlsym(Libhandle, 'ogg_stream_reset'); + ogg_stream_destroy := dlsym(Libhandle, 'ogg_stream_destroy'); + ogg_stream_eos := dlsym(Libhandle, 'ogg_stream_eos'); + ogg_page_checksum_set := dlsym(Libhandle, 'ogg_page_checksum_set'); + ogg_page_version := dlsym(Libhandle, 'ogg_page_version'); + ogg_page_continued := dlsym(Libhandle, 'ogg_page_continued'); + ogg_page_bos := dlsym(Libhandle, 'ogg_page_bos'); + ogg_page_eos := dlsym(Libhandle, 'ogg_page_eos'); + ogg_page_granulepos := dlsym(Libhandle, 'ogg_page_granulepos'); + ogg_page_serialno := dlsym(Libhandle, 'ogg_page_serialno'); + ogg_page_pageno := dlsym(Libhandle, 'ogg_page_pageno'); + ogg_page_packets := dlsym(Libhandle, 'ogg_page_packets'); + ogg_packet_clear := dlsym(Libhandle, 'ogg_packet_clear'); + oggpack_writeinit := dlsym(Libhandle, 'oggpack_writeinit'); + oggpack_reset := dlsym(Libhandle, 'oggpack_reset'); + oggpack_writeclear := dlsym(Libhandle, 'oggpack_writeclear'); + oggpack_readinit := dlsym(Libhandle, 'oggpack_readinit'); + oggpack_write := dlsym(Libhandle, 'oggpack_write'); + oggpack_look := dlsym(Libhandle, 'oggpack_look'); + oggpack_look_huff := dlsym(Libhandle, 'oggpack_look_huff'); + oggpack_look1 := dlsym(Libhandle, 'oggpack_look1'); + oggpack_adv := dlsym(Libhandle, 'oggpack_adv'); + oggpack_adv_huff := dlsym(Libhandle, 'oggpack_adv_huff'); + oggpack_adv1 := dlsym(Libhandle, 'oggpack_adv1'); + oggpack_read := dlsym(Libhandle, 'oggpack_read'); + oggpack_read1 := dlsym(Libhandle, 'oggpack_read1'); + oggpack_bytes := dlsym(Libhandle, 'oggpack_bytes'); + oggpack_bits := dlsym(Libhandle, 'oggpack_bits'); + oggpack_get_buffer := dlsym(Libhandle, 'oggpack_get_buffer'); + ogg_stream_packetin := dlsym(Libhandle, 'ogg_stream_packetin'); + ogg_stream_pageout := dlsym(Libhandle, 'ogg_stream_pageout'); + ogg_stream_flush := dlsym(Libhandle, 'ogg_stream_flush'); + ogg_sync_init := dlsym(Libhandle, 'ogg_sync_init'); + ogg_sync_clear := dlsym(Libhandle, 'ogg_sync_clear'); + ogg_sync_reset := dlsym(Libhandle, 'ogg_sync_reset'); + ogg_sync_destroy := dlsym(Libhandle, 'ogg_sync_destroy'); + ogg_sync_buffer := dlsym(Libhandle, 'ogg_sync_buffer'); + ogg_sync_wrote := dlsym(Libhandle, 'ogg_sync_wrote'); + ogg_sync_pageseek := dlsym(Libhandle, 'ogg_sync_pageseek'); + ogg_sync_pageout := dlsym(Libhandle, 'ogg_sync_pageout'); + ogg_stream_pagein := dlsym(Libhandle, 'ogg_stream_pagein'); + ogg_stream_packetout := dlsym(Libhandle, 'ogg_stream_packetout'); + ogg_stream_packetpeek := dlsym(Libhandle, 'ogg_stream_packetpeek'); + end; + +finalization + + if Libhandle <> nil then dlclose(Libhandle); + +{$ENDIF} + +{$IFDEF WIN32} + +var + Libhandle : HMODULE; + +initialization + Libhandle := LoadLibraryEx(LiboggPath, 0, 0); + + if Libhandle <> 0 then + begin + LiboggLoaded := True; + ogg_stream_init := GetProcAddress(Libhandle, 'ogg_stream_init'); + ogg_stream_clear := GetProcAddress(Libhandle, 'ogg_stream_clear'); + ogg_stream_reset := GetProcAddress(Libhandle, 'ogg_stream_reset'); + ogg_stream_destroy := GetProcAddress(Libhandle, 'ogg_stream_destroy'); + ogg_stream_eos := GetProcAddress(Libhandle, 'ogg_stream_eos'); + ogg_page_checksum_set := GetProcAddress(Libhandle, 'ogg_page_checksum_set'); + ogg_page_version := GetProcAddress(Libhandle, 'ogg_page_version'); + ogg_page_continued := GetProcAddress(Libhandle, 'ogg_page_continued'); + ogg_page_bos := GetProcAddress(Libhandle, 'ogg_page_bos'); + ogg_page_eos := GetProcAddress(Libhandle, 'ogg_page_eos'); + ogg_page_granulepos := GetProcAddress(Libhandle, 'ogg_page_granulepos'); + ogg_page_serialno := GetProcAddress(Libhandle, 'ogg_page_serialno'); + ogg_page_pageno := GetProcAddress(Libhandle, 'ogg_page_pageno'); + ogg_page_packets := GetProcAddress(Libhandle, 'ogg_page_packets'); + ogg_packet_clear := GetProcAddress(Libhandle, 'ogg_packet_clear'); + oggpack_writeinit := GetProcAddress(Libhandle, 'oggpack_writeinit'); + oggpack_reset := GetProcAddress(Libhandle, 'oggpack_reset'); + oggpack_writeclear := GetProcAddress(Libhandle, 'oggpack_writeclear'); + oggpack_readinit := GetProcAddress(Libhandle, 'oggpack_readinit'); + oggpack_write := GetProcAddress(Libhandle, 'oggpack_write'); + oggpack_look := GetProcAddress(Libhandle, 'oggpack_look'); + oggpack_look_huff := GetProcAddress(Libhandle, 'oggpack_look_huff'); + oggpack_look1 := GetProcAddress(Libhandle, 'oggpack_look1'); + oggpack_adv := GetProcAddress(Libhandle, 'oggpack_adv'); + oggpack_adv_huff := GetProcAddress(Libhandle, 'oggpack_adv_huff'); + oggpack_adv1 := GetProcAddress(Libhandle, 'oggpack_adv1'); + oggpack_read := GetProcAddress(Libhandle, 'oggpack_read'); + oggpack_read1 := GetProcAddress(Libhandle, 'oggpack_read1'); + oggpack_bytes := GetProcAddress(Libhandle, 'oggpack_bytes'); + oggpack_bits := GetProcAddress(Libhandle, 'oggpack_bits'); + oggpack_get_buffer := GetProcAddress(Libhandle, 'oggpack_get_buffer'); + ogg_stream_packetin := GetProcAddress(Libhandle, 'ogg_stream_packetin'); + ogg_stream_pageout := GetProcAddress(Libhandle, 'ogg_stream_pageout'); + ogg_stream_flush := GetProcAddress(Libhandle, 'ogg_stream_flush'); + ogg_sync_init := GetProcAddress(Libhandle, 'ogg_sync_init'); + ogg_sync_clear := GetProcAddress(Libhandle, 'ogg_sync_clear'); + ogg_sync_reset := GetProcAddress(Libhandle, 'ogg_sync_reset'); + ogg_sync_destroy := GetProcAddress(Libhandle, 'ogg_sync_destroy'); + ogg_sync_buffer := GetProcAddress(Libhandle, 'ogg_sync_buffer'); + ogg_sync_wrote := GetProcAddress(Libhandle, 'ogg_sync_wrote'); + ogg_sync_pageseek := GetProcAddress(Libhandle, 'ogg_sync_pageseek'); + ogg_sync_pageout := GetProcAddress(Libhandle, 'ogg_sync_pageout'); + ogg_stream_pagein := GetProcAddress(Libhandle, 'ogg_stream_pagein'); + ogg_stream_packetout := GetProcAddress(Libhandle, 'ogg_stream_packetout'); + ogg_stream_packetpeek := GetProcAddress(Libhandle, 'ogg_stream_packetpeek'); + end; + +finalization + + if Libhandle <> 0 then FreeLibrary(Libhandle); + +{$ENDIF} + +end. diff --git a/components/acs/Src/fileformats/general/vorbiscodec.pas b/components/acs/Src/fileformats/general/vorbiscodec.pas new file mode 100644 index 000000000..6a1f0d313 --- /dev/null +++ b/components/acs/Src/fileformats/general/vorbiscodec.pas @@ -0,0 +1,476 @@ +(* + delphi/kylix headers for oggvorbis software codec. + translated from codec.h header + by andrei borovsky, acs@compiler4.net + the original c/c++ headers and libraries (c) copyright 1994-2001 + by the xiphophorus company http://www.xiph.org/ +*) + +{ +$Log: vorbiscodec.pas,v $ +Revision 1.1 2005/12/29 20:46:00 z0m3ie +fixed some problems with vorbis in lazarus + +Revision 1.1 2005/12/19 18:36:56 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:53 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} +{$IFDEF FPC} + {$IFDEF WIN32} + {$PACKRECORDS C} + {$ENDIF WIN32} +{$ENDIF WIN32} + +unit vorbiscodec; + +interface + +uses + + ACS_Procs, + + {$IFDEF LINUX} + Libc, + {$ENDIF} + {$IFDEF WIN32} + Windows, + {$ENDIF} + ogg; + +type + + PVORBIS_INFO = ^VORBIS_INFO; + + VORBIS_INFO = record + version: Integer; + channels: Integer; + rate: LongInt; + + (* The below bitrate declarations are *hints*. + Combinations of the three values carry the following implications: + all three set to the same value: + implies a fixed rate bitstream + only nominal set: + implies a VBR stream that averages the nominal bitrate. No hard + upper/lower limit + upper and or lower set: + implies a VBR bitstream that obeys the bitrate limits. nominal + may also be set to give a nominal rate. + none set: + the coder does not care to speculate. *) + + bitrate_upper: LongInt; + bitrate_nominal: LongInt; + bitrate_lower: LongInt; + bitrate_window: LongInt; + codec_setup: Pointer; + end; + +(* vorbis_dsp_state buffers the current vorbis audio + analysis/synthesis state. The DSP state belongs to a specific + logical bitstream *) + + PVORBIS_DSP_STATE = ^VORBIS_DSP_STATE; + + VORBIS_DSP_STATE = record + analysisp: Integer; + vi: PVORBIS_INFO; + pcm: PPFLOAT; + pcmret: PPFLOAT; + pcm_storage: Integer; + pcm_current: Integer; + pcm_returned: Integer; + preextrapolate: Integer; + eofflag: Integer; + lW: LongInt; + W: LongInt; + nW: LongInt; + centerW: LongInt; + granulepos: OGG_INT64_T; + sequence: OGG_INT64_T; + glue_bits: OGG_INT64_T; + time_bits: OGG_INT64_T; + floor_bits: OGG_INT64_T; + res_bits: OGG_INT64_T; + backend_state: Pointer; + end; + + PALLOC_CHAIN = ^ALLOC_CHAIN; + + ALLOC_CHAIN = record + ptr: Pointer; + next: PALLOC_CHAIN; + end; + + + VORBIS_BLOCK = record + // necessary stream state for linking to the framing abstraction + pcm: PPFLOAT; + // this is a pointer into local storage + opb: OGGPACK_BUFFER; + lW: LongInt; + W: LongInt; + nW: LongInt; + pcmend: Integer; + mode: Integer; + eofflag: Integer; + granulepos: OGG_INT64_T; + sequence: OGG_INT64_T; + vd: PVORBIS_DSP_STATE; // For read-only access of configuration + (* local storage to avoid remallocing; it's up to the mapping to + structure it *) + localstore: Pointer; + localtop: LongInt; + localalloc: LongInt; + totaluse: LongInt; + reap: PALLOC_CHAIN; + // bitmetrics for the frame + glue_bits: LongInt; + time_bits: LongInt; + floor_bits: LongInt; + res_bits: LongInt; + internal: Pointer; + end; + +(* vorbis_block is a single block of data to be processed as part of + the analysis/synthesis stream; it belongs to a specific logical + bitstream, but is independant from other vorbis_blocks belonging to + that logical bitstream. *) + +(* vorbis_info contains all the setup information specific to the + specific compression/decompression mode in progress (eg, + psychoacoustic settings, channel setup, options, codebook + etc). vorbis_info and substructures are in backends.h. *) + +(* the comments are not part of vorbis_info so that vorbis_info can be + static storage *) + + PVORBIS_COMMENT = ^VORBIS_COMMENT; + + VORBIS_COMMENT = record + (* unlimited user comment fields. libvorbis writes 'libvorbis' + whatever vendor is set to in encode *) + user_comments: PPChar; + comment_lengths: PInteger; + comments: Integer; + vendor: PChar; + end; + + (* libvorbis encodes in two abstraction layers; first we perform DSP + and produce a packet (see docs/analysis.txt). The packet is then + coded into a framed OggSquish bitstream by the second layer (see + docs/framing.txt). Decode is the reverse process; we sync/frame + the bitstream and extract individual packets, then decode the + packet back into PCM audio. *) + +(* The extra framing/packetizing is used in streaming formats, such as + files. Over the net (such as with UDP), the framing and + packetization aren't necessary as they're provided by the transport + and the streaming layer is not used *) + +// Vorbis PRIMITIVES: general + + +const + +{$IFDEF LINUX} + LibvorbisPath = 'libvorbis.so*'; //'/usr/lib/libvorbis.so'; + {$DEFINE SEARCH_LIBS} +{$ENDIF} + +{$IFDEF WIN32} + LibvorbisPath = 'vorbis.dll'; +{$ENDIF} + +var + LibvorbisLoaded : Boolean = False; + +type + + vorbis_info_init_t = procedure(var vi: VORBIS_INFO); cdecl; + + vorbis_info_clear_t = procedure(var vi: VORBIS_INFO); cdecl; + + vorbis_info_blocksize_t = function(var vi: VORBIS_INFO; + zo: Integer): Integer; cdecl; + + vorbis_comment_init_t = procedure(var vc: VORBIS_COMMENT); cdecl; + + vorbis_comment_add_t = procedure(var vc: VORBIS_COMMENT; + comment: PChar); cdecl; + + vorbis_comment_add_tag_t = procedure(var vc: VORBIS_COMMENT; + tag: PChar; + contents: PChar); cdecl; + + vorbis_comment_query_t = function(var vc: VORBIS_COMMENT; + tag: PChar; + count: Integer): PChar; cdecl; + + vorbis_comment_query_count_t = function(var vc: VORBIS_COMMENT; + tag: PChar): Integer; cdecl; + + vorbis_comment_clear_t = procedure(var vc: VORBIS_COMMENT) cdecl; + + vorbis_block_init_t = function(var v: VORBIS_DSP_STATE; + var vb: VORBIS_BLOCK): Integer; cdecl; + + vorbis_block_clear_t = function(var vb: VORBIS_BLOCK): Integer; cdecl; + + vorbis_dsp_clear_t = procedure(var v: VORBIS_DSP_STATE); cdecl; + +// Vorbis PRIMITIVES: analysis/DSP layer + + vorbis_analysis_init_t = function(var v: VORBIS_DSP_STATE; + var vi: VORBIS_INFO): Integer; cdecl; + + vorbis_commentheader_out_t = function(var vc: VORBIS_COMMENT; + var op: OGG_PACKET): Integer; cdecl; + + vorbis_analysis_headerout_t = function(var v: VORBIS_DSP_STATE; + var vc: VORBIS_COMMENT; + var op: OGG_PACKET; + var op_comm: OGG_PACKET; + var op_code: OGG_PACKET): Integer; cdecl; + + vorbis_analysis_buffer_t = function(var v: VORBIS_DSP_STATE; + vals: Integer): PPFLOAT; cdecl; + + vorbis_analysis_wrote_t = function(var v: VORBIS_DSP_STATE; + vals: Integer): Integer; cdecl; + + vorbis_analysis_blockout_t = function(var v: VORBIS_DSP_STATE; + var vb: VORBIS_BLOCK): Integer; cdecl; + + vorbis_analysis_t = function(var vb: VORBIS_BLOCK; + op: POGG_PACKET): Integer; cdecl; + + vorbis_bitrate_addblock_t = function(var vb: VORBIS_BLOCK): Integer; cdecl; + + vorbis_bitrate_flushpacket_t = function(var vd: VORBIS_DSP_STATE; + var op: OGG_PACKET): Integer; cdecl; + +// Vorbis PRIMITIVES: synthesis layer + + vorbis_synthesis_headerin_t = function(var vi: VORBIS_INFO; + var vc: VORBIS_COMMENT; + var op: OGG_PACKET): Integer; cdecl; + + vorbis_synthesis_init_t = function(var v: VORBIS_DSP_STATE; + var vi: VORBIS_INFO): Integer; cdecl; + + vorbis_synthesis_t = function(var vb: VORBIS_BLOCK; + var op: OGG_PACKET): Integer; cdecl; + + vorbis_synthesis_blockin_t = function(var v: VORBIS_DSP_STATE; + var vb: VORBIS_BLOCK): Integer; cdecl; + + vorbis_synthesis_pcmout_t = function(var v: VORBIS_DSP_STATE; + var pcm: PPFLOAT): Integer; cdecl; + + vorbis_synthesis_read_t = function(var v: VORBIS_DSP_STATE; + samples: Integer): Integer; cdecl; + + vorbis_packet_blocksize_t = function(var vi: VORBIS_INFO; + var op: OGG_PACKET): LongInt; cdecl; +var + + vorbis_info_init : vorbis_info_init_t; + + vorbis_info_clear : vorbis_info_clear_t; + + vorbis_info_blocksize : vorbis_info_blocksize_t; + + vorbis_comment_init : vorbis_comment_init_t; + + vorbis_comment_add : vorbis_comment_add_t; + + vorbis_comment_add_tag : vorbis_comment_add_tag_t; + + vorbis_comment_query : vorbis_comment_query_t; + + vorbis_comment_query_count : vorbis_comment_query_count_t; + + vorbis_comment_clear : vorbis_comment_clear_t; + + vorbis_block_init : vorbis_block_init_t; + + vorbis_block_clear : vorbis_block_clear_t; + + vorbis_dsp_clear : vorbis_dsp_clear_t; + + vorbis_analysis_init : vorbis_analysis_init_t; + + vorbis_commentheader_out : vorbis_commentheader_out_t; + + vorbis_analysis_headerout : vorbis_analysis_headerout_t; + + vorbis_analysis_buffer : vorbis_analysis_buffer_t; + + vorbis_analysis_wrote : vorbis_analysis_wrote_t; + + vorbis_analysis_blockout : vorbis_analysis_blockout_t; + + vorbis_analysis : vorbis_analysis_t; + + vorbis_bitrate_addblock : vorbis_bitrate_addblock_t; + + vorbis_bitrate_flushpacket : vorbis_bitrate_flushpacket_t; + + vorbis_synthesis_headerin : vorbis_synthesis_headerin_t; + + vorbis_synthesis_init : vorbis_synthesis_init_t; + + vorbis_synthesis : vorbis_synthesis_t; + + vorbis_synthesis_blockin : vorbis_synthesis_blockin_t; + + vorbis_synthesis_pcmout : vorbis_synthesis_pcmout_t; + + vorbis_synthesis_read : vorbis_synthesis_read_t; + + vorbis_packet_blocksize : vorbis_packet_blocksize_t; + +// Vorbis ERRORS and return codes + +const + + OV_FALSE = -1; + OV_EOF = -2; + OV_HOLE = -3; + OV_EREAD = -128; + OV_EFAULT = -129; + OV_EIMPL = -130; + OV_EINVAL = -131; + OV_ENOTVORBIS = -132; + OV_EBADHEADER = -133; + OV_EVERSION = -134; + OV_ENOTAUDIO = -135; + OV_EBADPACKET = -136; + OV_EBADLINK = -137; + OV_ENOSEEK = -138; + +implementation + +{$IFDEF LINUX} + +var + Libhandle : Pointer; + +{$IFDEF SEARCH_LIBS} + Path : String; +{$ENDIF} + +initialization + +{$IFDEF SEARCH_LIBS} + + Libhandle := nil; + Path := FindLibs(LibvorbisPath); + if Path <> '' then Libhandle := dlopen(@Path[1], RTLD_NOW or RTLD_GLOBAL); + +{$ELSE} + + Libhandle := dlopen(LibvorbisPath, RTLD_NOW or RTLD_GLOBAL); + +{$ENDIF} + + if Libhandle <> nil then + begin + LibvorbisLoaded := True; + vorbis_info_init := dlsym(Libhandle, 'vorbis_info_init'); + vorbis_info_clear := dlsym(Libhandle, 'vorbis_info_clear'); + vorbis_info_blocksize := dlsym(Libhandle, 'vorbis_info_blocksize'); + vorbis_comment_init := dlsym(Libhandle, 'vorbis_comment_init'); + vorbis_comment_add := dlsym(Libhandle, 'vorbis_comment_add'); + vorbis_comment_add_tag := dlsym(Libhandle, 'vorbis_comment_add_tag'); + vorbis_comment_query := dlsym(Libhandle, 'vorbis_comment_query'); + vorbis_comment_query_count := dlsym(Libhandle, 'vorbis_comment_query_count'); + vorbis_comment_clear := dlsym(Libhandle, 'vorbis_comment_clear'); + vorbis_block_init := dlsym(Libhandle, 'vorbis_block_init'); + vorbis_block_clear := dlsym(Libhandle, 'vorbis_block_clear'); + vorbis_dsp_clear := dlsym(Libhandle, 'vorbis_dsp_clear'); + vorbis_analysis_init := dlsym(Libhandle, 'vorbis_analysis_init'); + vorbis_commentheader_out := dlsym(Libhandle, 'vorbis_commentheader_out'); + vorbis_analysis_headerout := dlsym(Libhandle, 'vorbis_analysis_headerout'); + vorbis_analysis_buffer := dlsym(Libhandle, 'vorbis_analysis_buffer'); + vorbis_analysis_wrote := dlsym(Libhandle, 'vorbis_analysis_wrote'); + vorbis_analysis_blockout := dlsym(Libhandle, 'vorbis_analysis_blockout'); + vorbis_analysis := dlsym(Libhandle, 'vorbis_analysis'); + vorbis_bitrate_addblock := dlsym(Libhandle, 'vorbis_bitrate_addblock'); + vorbis_bitrate_flushpacket := dlsym(Libhandle, 'vorbis_bitrate_flushpacket'); + vorbis_synthesis_headerin := dlsym(Libhandle, 'vorbis_synthesis_headerin'); + vorbis_synthesis_init := dlsym(Libhandle, 'vorbis_synthesis_init'); + vorbis_synthesis := dlsym(Libhandle, 'vorbis_synthesis'); + vorbis_synthesis_blockin := dlsym(Libhandle, 'vorbis_synthesis_blockin'); + vorbis_synthesis_pcmout := dlsym(Libhandle, 'vorbis_synthesis_pcmout'); + vorbis_synthesis_read := dlsym(Libhandle, 'vorbis_synthesis_read'); + vorbis_packet_blocksize := dlsym(Libhandle, 'vorbis_packet_blocksize'); + end; + + finalization + if libhandle <> nil then dlclose(libhandle); + +{$ENDIF} + +{$IFDEF WIN32} + +var + Libhandle : HMODULE; + +initialization + + Libhandle := LoadLibraryEx(LibvorbisPath, 0, 0); + if Libhandle <> 0 then + begin + LibvorbisLoaded := True; + vorbis_info_init := GetProcAddress(Libhandle, 'vorbis_info_init'); + vorbis_info_clear := GetProcAddress(Libhandle, 'vorbis_info_clear'); + vorbis_info_blocksize := GetProcAddress(Libhandle, 'vorbis_info_blocksize'); + vorbis_comment_init := GetProcAddress(Libhandle, 'vorbis_comment_init'); + vorbis_comment_add := GetProcAddress(Libhandle, 'vorbis_comment_add'); + vorbis_comment_add_tag := GetProcAddress(Libhandle, 'vorbis_comment_add_tag'); + vorbis_comment_query := GetProcAddress(Libhandle, 'vorbis_comment_query'); + vorbis_comment_query_count := GetProcAddress(Libhandle, 'vorbis_comment_query_count'); + vorbis_comment_clear := GetProcAddress(Libhandle, 'vorbis_comment_clear'); + vorbis_block_init := GetProcAddress(Libhandle, 'vorbis_block_init'); + vorbis_block_clear := GetProcAddress(Libhandle, 'vorbis_block_clear'); + vorbis_dsp_clear := GetProcAddress(Libhandle, 'vorbis_dsp_clear'); + vorbis_analysis_init := GetProcAddress(Libhandle, 'vorbis_analysis_init'); + vorbis_commentheader_out := GetProcAddress(Libhandle, 'vorbis_commentheader_out'); + vorbis_analysis_headerout := GetProcAddress(Libhandle, 'vorbis_analysis_headerout'); + vorbis_analysis_buffer := GetProcAddress(Libhandle, 'vorbis_analysis_buffer'); + vorbis_analysis_wrote := GetProcAddress(Libhandle, 'vorbis_analysis_wrote'); + vorbis_analysis_blockout := GetProcAddress(Libhandle, 'vorbis_analysis_blockout'); + vorbis_analysis := GetProcAddress(Libhandle, 'vorbis_analysis'); + vorbis_bitrate_addblock := GetProcAddress(Libhandle, 'vorbis_bitrate_addblock'); + vorbis_bitrate_flushpacket := GetProcAddress(Libhandle, 'vorbis_bitrate_flushpacket'); + vorbis_synthesis_headerin := GetProcAddress(Libhandle, 'vorbis_synthesis_headerin'); + vorbis_synthesis_init := GetProcAddress(Libhandle, 'vorbis_synthesis_init'); + vorbis_synthesis := GetProcAddress(Libhandle, 'vorbis_synthesis'); + vorbis_synthesis_blockin := GetProcAddress(Libhandle, 'vorbis_synthesis_blockin'); + vorbis_synthesis_pcmout := GetProcAddress(Libhandle, 'vorbis_synthesis_pcmout'); + vorbis_synthesis_read := GetProcAddress(Libhandle, 'vorbis_synthesis_read'); + vorbis_packet_blocksize := GetProcAddress(Libhandle, 'vorbis_packet_blocksize'); + end; + + finalization + if Libhandle <> 0 then FreeLibrary(Libhandle); + +{$ENDIF} + + +end. diff --git a/components/acs/Src/fileformats/general/vorbisenc.pas b/components/acs/Src/fileformats/general/vorbisenc.pas new file mode 100644 index 000000000..225bc4883 --- /dev/null +++ b/components/acs/Src/fileformats/general/vorbisenc.pas @@ -0,0 +1,195 @@ +(* + delphi/kylix headers for oggvorbis software codec. + translated from vorbisenc.h header + by andrei borovsky, acs@compiler4.net + the original c/c++ headers and libraries (c) copyright 1994-2001 + by the xiphophorus company http://www.xiph.org/ +*) + +{ +$Log: vorbisenc.pas,v $ +Revision 1.2 2005/12/29 20:46:00 z0m3ie +fixed some problems with vorbis in lazarus + +Revision 1.1 2005/12/19 18:36:56 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:53 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + + +unit vorbisenc; + +interface + +uses + + ACS_Procs, + + {$IFDEF LINUX} + Libc, + {$ENDIF} + {$IFDEF WIN32} + Windows, + {$ENDIF} + + vorbiscodec; + + +const + +{$IFDEF LINUX} + LibvorbisencPath = 'libvorbisenc.so*'; //'/usr/lib/libvorbisenc.so'; + {$DEFINE SEARCH_LIBS} +{$ENDIF} + +{$IFDEF WIN32} + LibvorbisencPath = 'vorbisenc.dll'; +{$ENDIF} + + +OV_ECTL_RATEMANAGE2_GET = $14; +OV_ECTL_RATEMANAGE2_SET = $15; + + +var + LibvorbisencLoaded : Boolean = False; + +type + + vorbis_encode_init_t = function(var vi: VORBIS_INFO; + channels: LongInt; + rate: LongInt; + max_bitrate: LongInt; + nominal_bitrate: LongInt; + min_bitrate: LongInt): Integer cdecl; + + vorbis_encode_setup_managed_t = function(var vi: VORBIS_INFO; + channels: LongInt; + rate: LongInt; + max_bitrate: LongInt; + nominal_bitrate: LongInt; + min_bitrate: LongInt): Integer; cdecl; + + vorbis_encode_setup_vbr_t = function(var vi: VORBIS_INFO; + channels: LongInt; + rate: LongInt; + fl: Single): Integer; cdecl; + + vorbis_encode_init_vbr_t = function(var vi: VORBIS_INFO; + channels: LongInt; + rate: LongInt; + base_quality: Single): Integer; cdecl; + + vorbis_encode_setup_init_t = function(var vi: VORBIS_INFO): Integer; cdecl; + + vorbis_encode_ctl_t = function(var vi: VORBIS_INFO; + number: Integer; + arg: Pointer): Integer; cdecl; + +ovectl_ratemanage2_arg = record + management_active : Integer; + bitrate_limit_min_kbps : LongWord; + bitrate_limit_max_kbps : LongWord; + bitrate_limit_reservoir_bits : LongWord; + bitrate_limit_reservoir_bias : Double; + bitrate_average_kbps : LongWord; + bitrate_average_damping : Double; +end; + + +var + + vorbis_encode_init : vorbis_encode_init_t; + + vorbis_encode_setup_managed : vorbis_encode_setup_managed_t; + + vorbis_encode_setup_vbr : vorbis_encode_setup_vbr_t; + + vorbis_encode_init_vbr : vorbis_encode_init_vbr_t; + + vorbis_encode_setup_init : vorbis_encode_setup_init_t; + + vorbis_encode_ctl : vorbis_encode_ctl_t; + + +implementation + +{$IFDEF LINUX} + +var + Libhandle : Pointer; + +{$IFDEF SEARCH_LIBS} + Path : String; +{$ENDIF} + +initialization + +{$IFDEF SEARCH_LIBS} + + Libhandle := nil; + Path := FindLibs(LibvorbisencPath); + if Path <> '' then Libhandle := dlopen(@Path[1], RTLD_NOW or RTLD_GLOBAL); + +{$ELSE} + + Libhandle := dlopen(LibvorbisencPath, RTLD_NOW or RTLD_GLOBAL); + +{$ENDIF} + + if Libhandle <> nil then + begin + LibvorbisencLoaded := True; + vorbis_encode_init := dlsym(Libhandle, 'vorbis_encode_init'); + vorbis_encode_setup_managed := dlsym(Libhandle, 'vorbis_encode_setup_managed'); + vorbis_encode_setup_vbr := dlsym(Libhandle, 'vorbis_encode_setup_vbr'); + vorbis_encode_init_vbr := dlsym(Libhandle, 'vorbis_encode_init_vbr'); + vorbis_encode_setup_init := dlsym(Libhandle, 'vorbis_encode_setup_init'); + vorbis_encode_ctl := dlsym(Libhandle, 'vorbis_encode_ctl'); + end; + +finalization + + if libhandle <> nil then dlclose(Libhandle); + +{$ENDIF} + +{$IFDEF WIN32} + +var + Libhandle : HMODULE; + +initialization + + Libhandle := LoadLibraryEx(LibvorbisencPath, 0, 0); + if Libhandle <> 0 then + begin + LibvorbisencLoaded := True; + vorbis_encode_init := GetProcAddress(Libhandle, 'vorbis_encode_init'); + vorbis_encode_setup_managed := GetProcAddress(Libhandle, 'vorbis_encode_setup_managed'); + vorbis_encode_setup_vbr := GetProcAddress(Libhandle, 'vorbis_encode_setup_vbr'); + vorbis_encode_init_vbr := GetProcAddress(Libhandle, 'vorbis_encode_init_vbr'); + vorbis_encode_setup_init := GetProcAddress(Libhandle, 'vorbis_encode_setup_init'); + vorbis_encode_ctl := GetProcAddress(Libhandle, 'vorbis_encode_ctl'); + end; + +finalization + + if libhandle <> 0 then FreeLibrary(Libhandle); + +{$ENDIF} + +end. diff --git a/components/acs/Src/fileformats/general/vorbisfile.pas b/components/acs/Src/fileformats/general/vorbisfile.pas new file mode 100644 index 000000000..7a4f49b43 --- /dev/null +++ b/components/acs/Src/fileformats/general/vorbisfile.pas @@ -0,0 +1,312 @@ +(* + delphi/kylix headers for oggvorbis software codec. + translated from vorbisfile.h header + by andrei borovsky, acs@compiler4.net + the original c/c++ headers and libraries (c) copyright 1994-2001 + by the xiphophorus company http://www.xiph.org/ +*) + +{ +$Log: vorbisfile.pas,v $ +Revision 1.2 2005/12/29 20:46:00 z0m3ie +fixed some problems with vorbis in lazarus + +Revision 1.1 2005/12/19 18:36:56 z0m3ie +*** empty log message *** + +Revision 1.2 2005/10/09 19:01:03 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:53 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.2 2005/09/10 08:25:40 z0m3ie +*** empty log message *** + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + +{$IFDEF FPC} + {$IFDEF WIN32} + {$PACKRECORDS C} + {$ENDIF WIN32} +{$ENDIF WIN32} + +unit vorbisfile; + + +interface + +uses + + ACS_Procs, + + {$IFDEF LINUX} + Libc, + {$ENDIF} + {$IFDEF WIN32} + Windows, + {$ENDIF} + ogg, + vorbiscodec; + +(* The function prototypes for the callbacks are basically the same as for + the stdio functions fread, fseek, fclose, ftell. + The one difference is that the FILE* arguments have been replaced with + a void* - this is to be used as a pointer to whatever internal data these + functions might need. In the stdio case, it's just a FILE* cast to a void* + + If you use other functions, check the docs for these functions and return + the right values. For seek_func(), you*MUST* return -1 if the stream is + unseekable *) + +type + + read_func_t = function(ptr : Pointer; size, nmemb : Cardinal;const datasource : Pointer) : Cardinal; cdecl; + seek_func_t = function(const datasource : Pointer; offset : ogg_int64_t; whence : Integer) : Integer; cdecl; + close_func_t = function(const datasource : Pointer) : Integer; cdecl; + tell_func_t = function(const datasource : Pointer) : Integer; cdecl; + + OV_CALLBACKS = record + read_func : read_func_t; + seek_func : seek_func_t; + close_func : close_func_t; + tell_func : tell_func_t; + end; + +const + + NOTOPEN = 0; + PARTOPEN = 1; + OPENED = 2; + STREAMSET = 3; + INITSET = 4; + +type + + OGGVORBIS_FILE = record + datasource: Pointer; // Pointer to a FILE*, etc. + seekable: Integer; + offset: OGG_INT64_T; + _end: OGG_INT64_T; + oy: OGG_SYNC_STATE; + (* If the FILE handle isn't seekable (eg, a pipe), + only the current stream appears *) + links: Integer; + offsets: POGG_INT64_T; + dataoffsets: POGG_INT64_T; + serialnos: PLongInt; + pcmlengths: POGG_INT64_T; + vi: PVORBIS_INFO; + vc: PVORBIS_COMMENT; + // Decoding working state local storage + pcm_offset: OGG_INT64_T; + ready_state: Integer; + current_serialno: LongInt; + current_link: Integer; + bittrack: Double; + samptrack: Double; + os: OGG_STREAM_STATE; + (* take physical pages, weld into a logical + stream of packets *) + vd: VORBIS_DSP_STATE; + // central working state for the packet->PCM decoder + vb: VORBIS_BLOCK; + // local working space for packet->PCM decode + callbacks: OV_CALLBACKS; + end; + +const + +{$IFDEF LINUX} + LibvorbisfilePath = 'libvorbisfile.so*'; //'/usr/lib/libvorbisfile.so'; + {$DEFINE SEARCH_LIBS} +{$ENDIF} +{$IFDEF WIN32} + LibvorbisfilePath = 'vorbisfile.dll'; +{$ENDIF} + +// stdio.h constants + SEEK_CUR = 1; + SEEK_END = 2; + SEEK_SET = 0; + +var + LibvorbisfileLoaded : Boolean = False; + +type + +{$IFDEF LINUX} + ov_open_t = function(f: PIOFILE;var vf: OGGVORBIS_FILE;initial: PChar;ibytes: LongInt): Integer; cdecl; + ov_test_t = function(f: PIOFILE;var vf: OGGVORBIS_FILE;initial: PChar;ibytes: LongInt): Integer; cdecl; +{$ENDIF} + ov_clear_t = function(var vf: OGGVORBIS_FILE): Integer; cdecl; + ov_open_callbacks_t = function(datasource: Pointer;var vf: OGGVORBIS_FILE;initial: PChar;ibytes: LongInt; callbacks: OV_CALLBACKS): Integer; cdecl; + ov_test_callbacks_t = function(datasource: Pointer;var vf: OGGVORBIS_FILE;initial: PChar;ibytes: LongInt; callbacks: OV_CALLBACKS): Integer; cdecl; + ov_test_open_t = function(var vf: OGGVORBIS_FILE): Integer; cdecl; + ov_bitrate_t = function(var vf: OGGVORBIS_FILE;i: Integer): LongInt cdecl; + ov_bitrate_instant_t = function(var vf: OGGVORBIS_FILE): LongInt cdecl; + ov_streams_t = function(var vf: OGGVORBIS_FILE): LongInt cdecl; + ov_seekable_t = function(var vf: OGGVORBIS_FILE): LongInt cdecl; + ov_serialnumber_t = function(var vf: OGGVORBIS_FILE;i: Integer): LongInt cdecl; + ov_raw_total_t = function(var vf: OGGVORBIS_FILE;i: Integer): OGG_INT64_T cdecl; + ov_pcm_total_t = function(var vf: OGGVORBIS_FILE;i: Integer): OGG_INT64_T cdecl; + ov_time_total_t = function(var vf: OGGVORBIS_FILE;i: Integer): Double cdecl; + ov_raw_seek_t = function(var vf: OGGVORBIS_FILE;pos: LongInt): Integer cdecl; + ov_pcm_seek_t = function(var vf: OGGVORBIS_FILE;pos: OGG_INT64_T): Integer cdecl; + ov_pcm_seek_page_t = function(var vf: OGGVORBIS_FILE;pos: OGG_INT64_T): Integer cdecl; + ov_time_seek_t = function(var vf: OGGVORBIS_FILE;pos: Double): Integer cdecl; + ov_time_seek_page_t = function(var vf: OGGVORBIS_FILE;pos: Double): Integer cdecl; + ov_raw_tell_t = function(var vf: OGGVORBIS_FILE): OGG_INT64_T cdecl; + ov_pcm_tell_t = function(var vf: OGGVORBIS_FILE): OGG_INT64_T cdecl; + ov_time_tell_t = function(var vf: OGGVORBIS_FILE): Double cdecl; + ov_info_t = function(var vf: OGGVORBIS_FILE;link : Integer): PVORBIS_INFO cdecl; + ov_comment_t = function(var vf: OGGVORBIS_FILE;link : Integer): PVORBIS_COMMENT cdecl; + ov_read_float_t = function(var vf: OGGVORBIS_FILE;var pcm_channels: PPFLOAT;bitstream: PInteger): LongInt cdecl; + ov_read_t = function(var vf: OGGVORBIS_FILE;buffer: PChar;length: Integer;bigendianp: Integer;word: Integer;sgned: Integer;bitstream: PInteger): LongInt cdecl; +var +{$IFDEF LINUX} + ov_open : ov_open_t; + ov_test : ov_test_t; +{$ENDIF} + ov_clear : ov_clear_t; + ov_open_callbacks : ov_open_callbacks_t; + ov_test_callbacks : ov_test_callbacks_t; + ov_test_open : ov_test_open_t; + ov_bitrate : ov_bitrate_t; + ov_bitrate_instant : ov_bitrate_instant_t; + ov_streams : ov_streams_t; + ov_seekable : ov_seekable_t; + ov_serialnumber : ov_serialnumber_t; + ov_raw_total : ov_raw_total_t; + ov_pcm_total : ov_pcm_total_t; + ov_time_total : ov_time_total_t; + ov_raw_seek : ov_raw_seek_t; + ov_pcm_seek : ov_pcm_seek_t; + ov_pcm_seek_page : ov_pcm_seek_page_t; + ov_time_seek : ov_time_seek_t; + ov_time_seek_page : ov_time_seek_page_t; + ov_raw_tell : ov_raw_tell_t; + ov_pcm_tell : ov_pcm_tell_t; + ov_time_tell : ov_time_tell_t; + ov_info : ov_info_t; + ov_comment : ov_comment_t; + ov_read_float : ov_read_float_t; + ov_read : ov_read_t; + + +{$IFDEF WIN32} + Libhandle : HMODULE; +{$ELSE} + Libhandle : Pointer; +{$ENDIF} + +procedure VORBISLoadLibrary; + +implementation + +{$IFDEF SEARCH_LIBS} +var + Path : String; +{$ENDIF} + +procedure VORBISLoadLibrary; +begin + if LibvorbisfileLoaded then + exit; +{$IFDEF MSWINDOWS} + Libhandle := LoadLibraryEx(LibvorbisfilePath, 0, 0); + if Libhandle <> 0 then + begin + LibvorbisfileLoaded := True; + ov_clear := GetProcAddress(Libhandle, 'ov_clear'); + ov_open_callbacks := GetProcAddress(Libhandle, 'ov_open_callbacks'); + ov_test_callbacks := GetProcAddress(Libhandle, 'ov_test_callbacks'); + ov_test_open := GetProcAddress(Libhandle, 'ov_test_open'); + ov_bitrate := GetProcAddress(Libhandle, 'ov_bitrate'); + ov_bitrate_instant := GetProcAddress(Libhandle, 'ov_bitrate_instant'); + ov_streams := GetProcAddress(Libhandle, 'ov_streams'); + ov_seekable := GetProcAddress(Libhandle, 'ov_seekable'); + ov_serialnumber := GetProcAddress(Libhandle, 'ov_serialnumber'); + ov_raw_total := GetProcAddress(Libhandle, 'ov_raw_total'); + ov_pcm_total := GetProcAddress(Libhandle, 'ov_pcm_total'); + ov_time_total := GetProcAddress(Libhandle, 'ov_time_total'); + ov_raw_seek := GetProcAddress(Libhandle, 'ov_raw_seek'); + ov_pcm_seek := GetProcAddress(Libhandle, 'ov_pcm_seek'); + ov_pcm_seek_page := GetProcAddress(Libhandle, 'ov_pcm_seek_page'); + ov_time_seek := GetProcAddress(Libhandle, 'ov_time_seek'); + ov_time_seek_page := GetProcAddress(Libhandle, 'ov_time_seek_page'); + ov_raw_tell := GetProcAddress(Libhandle, 'ov_raw_tell'); + ov_pcm_tell := GetProcAddress(Libhandle, 'ov_pcm_tell'); + ov_time_tell := GetProcAddress(Libhandle, 'ov_time_tell'); + ov_info := GetProcAddress(Libhandle, 'ov_info'); + ov_comment := GetProcAddress(Libhandle, 'ov_comment'); + ov_read_float := GetProcAddress(Libhandle, 'ov_read_float'); + ov_read := GetProcAddress(Libhandle, 'ov_read'); + end; +{$ELSE} +{$IFDEF SEARCH_LIBS} + Libhandle := nil; + Path := FindLibs(LibvorbisfilePath); + if Path <> '' then Libhandle := dlopen(@Path[1], RTLD_NOW or RTLD_GLOBAL); +{$ELSE} + Libhandle := dlopen(LibvorbisfilePath, RTLD_NOW or RTLD_GLOBAL); +{$ENDIF} + if Libhandle <> nil then + begin {$IFDEF FPC} + {$IFDEF WIN32} + {$PACKRECORDS C} + {$ENDIF WIN32} +{$ENDIF WIN32} + + LibvorbisfileLoaded := True; + ov_open := dlsym(Libhandle, 'ov_open'); + ov_test := dlsym(Libhandle, 'ov_test'); + ov_clear := dlsym(Libhandle, 'ov_clear'); + ov_open_callbacks := dlsym(Libhandle, 'ov_open_callbacks'); + ov_test_callbacks := dlsym(Libhandle, 'ov_test_callbacks'); + ov_test_open := dlsym(Libhandle, 'ov_test_open'); + ov_bitrate := dlsym(Libhandle, 'ov_bitrate'); + ov_bitrate_instant := dlsym(Libhandle, 'ov_bitrate_instant'); + ov_streams := dlsym(Libhandle, 'ov_streams'); + ov_seekable := dlsym(Libhandle, 'ov_seekable'); + ov_serialnumber := dlsym(Libhandle, 'ov_serialnumber'); + ov_raw_total := dlsym(Libhandle, 'ov_raw_total'); + ov_pcm_total := dlsym(Libhandle, 'ov_pcm_total'); + ov_time_total := dlsym(Libhandle, 'ov_time_total'); + ov_raw_seek := dlsym(Libhandle, 'ov_raw_seek'); + ov_pcm_seek := dlsym(Libhandle, 'ov_pcm_seek'); + ov_pcm_seek_page := dlsym(Libhandle, 'ov_pcm_seek_page'); + ov_time_seek := dlsym(Libhandle, 'ov_time_seek'); + ov_time_seek_page := dlsym(Libhandle, 'ov_time_seek_page'); + ov_raw_tell := dlsym(Libhandle, 'ov_raw_tell'); + ov_pcm_tell := dlsym(Libhandle, 'ov_pcm_tell'); + ov_time_tell := dlsym(Libhandle, 'ov_time_tell'); + ov_info := dlsym(Libhandle, 'ov_info'); + ov_comment := dlsym(Libhandle, 'ov_comment'); + ov_read_float := dlsym(Libhandle, 'ov_read_float'); + ov_read := dlsym(Libhandle, 'ov_read'); + end; +{$ENDIF} +end; + +initialization + +finalization + +{$IFDEF MSWINDOWS} + if Libhandle <> 0 then FreeLibrary(Libhandle); +{$ELSE} + if libhandle <> nil then dlclose(Libhandle); +{$ENDIF} + +end. diff --git a/components/acs/Src/fileformats/linux/smpeg.pas b/components/acs/Src/fileformats/linux/smpeg.pas new file mode 100644 index 000000000..4a29b9e11 --- /dev/null +++ b/components/acs/Src/fileformats/linux/smpeg.pas @@ -0,0 +1,249 @@ +(* + this file is a part of audio components suite v 2.3. + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at mail@z0m3ie.de +*) + +{ +$Log: smpeg.pas,v $ +Revision 1.5 2006/09/04 14:40:16 z0m3ie +*** empty log message *** + +Revision 1.4 2006/08/30 18:59:51 z0m3ie +*** empty log message *** + +Revision 1.3 2005/12/19 18:37:03 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:53 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.4 2005/08/22 20:17:01 z0m3ie +changed Headers to log +changed mail adress + +} + + +{$weakpackageunit on} + +// Linux and Windows C-Compilers use different byte-allignment +{$IFDEF Linux} + {$align 4} // linux uses dword alignment +{$endif} +{$ifdef win32} + {$ifdef ver140} + {$align 8} // windows uses quad-word alignment + {$endif} +{$endif} + +{$IFDEF FPC} +{$PACKRECORDS 4} +{$ENDIF FPC} + +unit smpeg; + +interface + +uses + SysUtils,ACS_Procs,Dialogs + {$ifdef LINUX} + , Libc + {$else} + , Windows + {$endif} + ; + +const + + SMPEG_ERROR = -1; + SMPEG_STOPPED = 0; + SMPEG_PLAYING = 1; + +type + + _SMPEG = record + //obj: PMPEG; + end; + TSMPEG = _SMPEG; + PSMPEG = ^_SMPEG; + + SDL_AudioSpec = record + freq: Integer; + format: Word; + channels: Byte; + silence: Byte; + samples: Word; + padding: Word; + size: LongWord; + callback: Pointer; + userdata: Pointer; + end; + + SMPEG_Info ={ packed} record + has_audio : Integer; + has_video : Integer; + width : Integer; + height: Integer; + current_frame: Integer; + current_fps: Double; + audio_string : array[0..79] of Char; + audio_current_frame : Integer; + current_offset: LongWord; + total_size: LongWord; + current_time: Double; + total_time: Double; + end; + +const + + {$ifdef LINUX} + LibsmpegPath = 'libsmpeg*.so*'; + LibSDLPath = 'libSDL*.so*'; + {$ELSE} + LibsmpegPath = 'smpeg.dll'; + LibSDLPath = 'SDL.dll'; + {$ENDIF} + +var + LibsmpegLoaded : Boolean = False; + +type + + SMPEG_new_t = function(const filename : PChar; var info : SMPEG_Info; sdl_audio : Integer): PSMPEG; cdecl; + + SMPEG_delete_t = procedure(mpeg: Pointer); cdecl; + + SMPEG_wantedSpec_t = function(mpeg: Pointer; var spec: SDL_AudioSpec): Integer; cdecl; + + SMPEG_play_t = procedure(mpeg: Pointer); cdecl; + + SMPEG_status_t = function(mpeg: Pointer) : Integer; cdecl; + + SMPEG_stop_t = procedure(mpeg: Pointer); cdecl; + + SMPEG_playAudio_t = function(mpeg: Pointer; stream: Pointer; len: Integer): Integer; cdecl; + + SMPEG_skip_t = procedure(mpeg : Pointer; Pos : Single); cdecl; + + SMPEG_rewind_t = procedure(mpeg : Pointer); cdecl; + +var + + SMPEG_new : SMPEG_new_t; + + SMPEG_delete : SMPEG_delete_t; + + SMPEG_wantedSpec : SMPEG_wantedSpec_t; + + SMPEG_play : SMPEG_play_t; + + SMPEG_status : SMPEG_status_t; + + SMPEG_stop : SMPEG_stop_t; + + SMPEG_playAudio : SMPEG_playAudio_t; + + SMPEG_skip : SMPEG_skip_t; + + SMPEG_rewind : SMPEG_rewind_t; + + procedure LoadMPEGLibrary; + procedure UnloadMPEGLibrary; + + +implementation + +type + SDL_Init_t = function(Flags : LongWord) : Integer; cdecl; + SDL_Quit_t = procedure; cdecl; + +const + SDL_INIT_AUDIO = $00000010; + +var + {$ifdef LINUX} + Libhandle : Pointer; + SDLhandle : Pointer; + {$else} + Libhandle : Cardinal; + SDLhandle : Cardinal; + {$endif} + SDL_Init : SDL_Init_t; + SDL_Quit : SDL_Quit_t; + +procedure LoadMPEGLibrary; +var + Path : string; +begin + {$ifdef LINUX} + Path := FindLibs(LibSDLPath); + if Path <> '' then SDLhandle := dlopen(@Path[1], RTLD_NOW or RTLD_GLOBAL); +// SDLhandle := dlopen(LibSDLPath, RTLD_NOW{$IFDEF LINUX} or RTLD_GLOBAL{$ENDIF}); + if SDLhandle = nil then exit; + SDL_Init := dlsym(SDLhandle, 'SDL_Init'); + SDL_Quit := dlsym(SDLhandle, 'SDL_Quit'); + SDL_Init(SDL_INIT_AUDIO); + + Path := FindLibs(LibsmpegPath); + if Path <> '' then Libhandle := dlopen(@Path[1], RTLD_NOW or RTLD_GLOBAL); +// Libhandle := dlopen(LibsmpegPath, RTLD_NOW{$IFDEF LINUX} or RTLD_GLOBAL{$ENDIF}); + if Libhandle = nil then exit; + if Libhandle <> nil then + begin + LibsmpegLoaded := True; + SMPEG_new := dlsym(Libhandle, 'SMPEG_new'); + SMPEG_delete := dlsym(Libhandle, 'SMPEG_delete'); + SMPEG_wantedSpec := dlsym(Libhandle, 'SMPEG_wantedSpec'); + SMPEG_play := dlsym(Libhandle, 'SMPEG_play'); + SMPEG_status := dlsym(Libhandle, 'SMPEG_status'); + SMPEG_stop := dlsym(Libhandle, 'SMPEG_stop'); + SMPEG_playAudio := dlsym(Libhandle, 'SMPEG_playAudio'); + SMPEG_skip := dlsym(Libhandle, 'SMPEG_skip'); + SMPEG_rewind := dlsym(Libhandle, 'SMPEG_rewind'); + end; + {$ELSE} + SDLhandle := LoadLibrary(LibSDLPath); + if SDLhandle = 0 then exit; + SDL_Init := GetProcAddress(SDLhandle, 'SDL_Init'); + SDL_Quit := GetProcAddress(SDLhandle, 'SDL_Quit'); + SDL_Init(SDL_INIT_AUDIO); + Libhandle := LoadLibrary(LibsmpegPath); + if Libhandle = 0 then exit; + if Libhandle <> 0 then + begin + LibsmpegLoaded := True; + SMPEG_new := GetProcAddress(Libhandle, 'SMPEG_new'); + SMPEG_delete := GetProcAddress(Libhandle, 'SMPEG_delete'); + SMPEG_wantedSpec := GetProcAddress(Libhandle, 'SMPEG_wantedSpec'); + SMPEG_play := GetProcAddress(Libhandle, 'SMPEG_play'); + SMPEG_status := GetProcAddress(Libhandle, 'SMPEG_status'); + SMPEG_stop := GetProcAddress(Libhandle, 'SMPEG_stop'); + SMPEG_playAudio := GetProcAddress(Libhandle, 'SMPEG_playAudio'); + SMPEG_skip := GetProcAddress(Libhandle, 'SMPEG_skip'); + SMPEG_rewind := GetProcAddress(Libhandle, 'SMPEG_rewind'); + end; + {$ENDIF} +end; + +procedure UnloadMPEGLibrary; + +begin + SDL_Quit; + {$ifdef LINUX} + if Libhandle <> nil then dlclose(Libhandle); + if SDLhandle <> nil then dlclose(SDLhandle); + {$else} + if Libhandle <> 0 then FreeLibrary(Libhandle); + if SDLhandle <> 0 then FreeLibrary(SDLhandle); + {$endif} +end; + +end. diff --git a/components/acs/Src/fileformats/windows/direct3d9.pas b/components/acs/Src/fileformats/windows/direct3d9.pas new file mode 100644 index 000000000..8a1be662c --- /dev/null +++ b/components/acs/Src/fileformats/windows/direct3d9.pas @@ -0,0 +1,3619 @@ +{******************************************************************************} +{* *} +{* copyright (c) microsoft corporation. all rights reserved. *} +{* *} +{* files: d3d9types.h d3d9caps.h d3d9.h *} +{* content: direct3d9 include files *} +{* *} +{* directx 9.0 delphi / freepascal adaptation by alexey barkovoy *} +{* e-mail: directx@clootie.ru *} +{* *} +{* latest version can be downloaded from: *} +{* http://clootie.ru *} +{* http://sourceforge.net/projects/delphi-dx9sdk *} +{* *} +{*----------------------------------------------------------------------------*} +{* $id: direct3d9.pas,v 1.1 2005/09/12 22:04:53 z0m3ie exp $ } +{******************************************************************************} +{ } +{ obtained through: joint endeavour of delphi innovators (project jedi) } +{ } +{ the contents of this file are used with permission, subject to the mozilla } +{ public license version 1.1 (the "license"); you may not use this file except } +{ in compliance with the license. you may obtain a copy of the license at } +{ http://www.mozilla.org/mpl/mpl-1.1.html } +{ } +{ software distributed under the license is distributed on an "as is" basis, } +{ without warranty of any kind, either express or implied. see the license for } +{ the specific language governing rights and limitations under the license. } +{ } +{ alternatively, the contents of this file may be used under the terms of the } +{ gnu lesser general public license (the "lgpl license"), in which case the } +{ provisions of the lgpl license are applicable instead of those above. } +{ if you wish to allow use of your version of this file only under the terms } +{ of the lgpl license and not to allow others to use your version of this file } +{ under the mpl, indicate your decision by deleting the provisions above and } +{ replace them with the notice and other provisions required by the lgpl } +{ license. if you do not delete the provisions above, a recipient may use } +{ your version of this file under either the mpl or the lgpl license. } +{ } +{ for more information about the lgpl: http://www.gnu.org/copyleft/lesser.html } +{ } +{******************************************************************************} + +{.$I DirectX.inc} + +unit direct3d9; + +interface + +// Global level dynamic loading support +{$IFDEF DYNAMIC_LINK_ALL} + {$DEFINE DIRECT3D9_DYNAMIC_LINK} +{$ENDIF} +{$IFDEF DYNAMIC_LINK_EXPLICIT_ALL} + {$DEFINE DIRECT3D9_DYNAMIC_LINK_EXPLICIT} +{$ENDIF} + +// Remove "dots" below to force some kind of dynamic linking +{.$DEFINE DIRECT3D9_DYNAMIC_LINK} +{.$DEFINE DIRECT3D9_DYNAMIC_LINK_EXPLICIT} + + +uses windows, dxtypes; + +///// Helper constants (for use in SetRenderState) ///// +const + iTrue = DWORD(True); + iFalse = DWORD(False); + + + + +(*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d9types.h + * Content: Direct3D capabilities include file + * + ***************************************************************************) + +type + // D3DCOLOR is equivalent to D3DFMT_A8R8G8B8 + D3DCOLOR = DXTypes.D3DCOLOR; + TD3DColor = DXTypes.TD3DColor; + +// maps unsigned 8 bits/channel to D3DCOLOR +// #define D3DCOLOR_ARGB(a,r,g,b) \ +// ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) +function D3DCOLOR_ARGB(a,r,g,b: DWord): TD3DColor;{$IFDEF SUPPORTS_INLINE} inline;{$ENDIF} +// #define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b) +function D3DCOLOR_RGBA(r,g,b,a: DWord): TD3DColor;{$IFDEF SUPPORTS_INLINE} inline;{$ENDIF} +// #define D3DCOLOR_XRGB(r,g,b) D3DCOLOR_ARGB(0xff,r,g,b) +function D3DCOLOR_XRGB(r,g,b: DWord): TD3DColor;{$IFDEF SUPPORTS_INLINE} inline;{$ENDIF} + +// #define D3DCOLOR_XYUV(y,u,v) D3DCOLOR_ARGB(0xff,y,u,v) +function D3DCOLOR_XYUV(y,u,v: DWord): TD3DColor;{$IFDEF SUPPORTS_INLINE} inline;{$ENDIF} +// #define D3DCOLOR_AYUV(a,y,u,v) D3DCOLOR_ARGB(a,y,u,v) +function D3DCOLOR_AYUV(a,y,u,v: DWord): TD3DColor;{$IFDEF SUPPORTS_INLINE} inline;{$ENDIF} + +// maps floating point channels (0.f to 1.f range) to D3DCOLOR +// #define D3DCOLOR_COLORVALUE(r,g,b,a) \ +// D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f)) +function D3DCOLOR_COLORVALUE(r,g,b,a: Single): TD3DColor;{$IFDEF SUPPORTS_INLINE} inline;{$ENDIF} + +type + _D3DVECTOR = DXTypes._D3DVECTOR; + D3DVECTOR = DXTypes.D3DVECTOR; + TD3DVector = DXTypes.TD3DVector; + PD3DVector = DXTypes.PD3DVector; + + PD3DColorValue = ^TD3DColorValue; + _D3DCOLORVALUE = packed record + r: Single; + g: Single; + b: Single; + a: Single; + end {_D3DCOLORVALUE}; + D3DCOLORVALUE = _D3DCOLORVALUE; + TD3DColorValue = _D3DCOLORVALUE; + + PD3DRect = ^TD3DRect; + _D3DRECT = packed record + x1: LongInt; + y1: LongInt; + x2: LongInt; + y2: LongInt; + end {_D3DRECT}; + D3DRECT = _D3DRECT; + TD3DRect = _D3DRECT; + + PD3DMatrix = ^TD3DMatrix; + _D3DMATRIX = packed record + case integer of + 0 : (_11, _12, _13, _14: Single; + _21, _22, _23, _24: Single; + _31, _32, _33, _34: Single; + _41, _42, _43, _44: Single); + 1 : (m : array [0..3, 0..3] of Single); + end {_D3DMATRIX}; + D3DMATRIX = _D3DMATRIX; + TD3DMatrix = _D3DMATRIX; + + PD3DViewport9 = ^TD3DViewport9; + _D3DVIEWPORT9 = packed record + X: DWord; + Y: DWord; { Viewport Top left } + Width: DWord; + Height: DWord; { Viewport Dimensions } + MinZ: Single; { Min/max of clip Volume } + MaxZ: Single; + end {_D3DVIEWPORT9}; + D3DVIEWPORT9 = _D3DVIEWPORT9; + TD3DViewport9 = _D3DVIEWPORT9; + +(* + * Values for clip fields. + *) + +const + // Max number of user clipping planes, supported in D3D. + D3DMAXUSERCLIPPLANES = 32; + + // These bits could be ORed together to use with D3DRS_CLIPPLANEENABLE + // + D3DCLIPPLANE0 = (1 shl 0); + D3DCLIPPLANE1 = (1 shl 1); + D3DCLIPPLANE2 = (1 shl 2); + D3DCLIPPLANE3 = (1 shl 3); + D3DCLIPPLANE4 = (1 shl 4); + D3DCLIPPLANE5 = (1 shl 5); + + // The following bits are used in the ClipUnion and ClipIntersection + // members of the D3DCLIPSTATUS9 + // + D3DCS_LEFT = $00000001; + D3DCS_RIGHT = $00000002; + D3DCS_TOP = $00000004; + D3DCS_BOTTOM = $00000008; + D3DCS_FRONT = $00000010; + D3DCS_BACK = $00000020; + D3DCS_PLANE0 = $00000040; + D3DCS_PLANE1 = $00000080; + D3DCS_PLANE2 = $00000100; + D3DCS_PLANE3 = $00000200; + D3DCS_PLANE4 = $00000400; + D3DCS_PLANE5 = $00000800; + + D3DCS_ALL = D3DCS_LEFT or + D3DCS_RIGHT or + D3DCS_TOP or + D3DCS_BOTTOM or + D3DCS_FRONT or + D3DCS_BACK or + D3DCS_PLANE0 or + D3DCS_PLANE1 or + D3DCS_PLANE2 or + D3DCS_PLANE3 or + D3DCS_PLANE4 or + D3DCS_PLANE5; + +type + PD3DClipStatus9 = ^TD3DClipStatus9; + _D3DCLIPSTATUS9 = packed record + ClipUnion: DWord; + ClipIntersection: DWord; + end {_D3DCLIPSTATUS9}; + D3DCLIPSTATUS9 = _D3DCLIPSTATUS9; + TD3DClipStatus9 = _D3DCLIPSTATUS9; + + PD3DMaterial9 = ^TD3DMaterial9; + _D3DMATERIAL9 = packed record + Diffuse: TD3DColorValue; { Diffuse color RGBA } + Ambient: TD3DColorValue; { Ambient color RGB } + Specular: TD3DColorValue; { Specular 'shininess' } + Emissive: TD3DColorValue; { Emissive color RGB } + Power: Single; { Sharpness if specular highlight } + end {_D3DMATERIAL9}; + D3DMATERIAL9 = _D3DMATERIAL9; + TD3DMaterial9 = _D3DMATERIAL9; + + _D3DLIGHTTYPE = ( + D3DLIGHT_INVALID_0, {= 0} + D3DLIGHT_POINT, {= 1} + D3DLIGHT_SPOT, {= 2} + D3DLIGHT_DIRECTIONAL{= 3} + ); + D3DLIGHTTYPE = _D3DLIGHTTYPE; + TD3DLightType = _D3DLIGHTTYPE; + + PD3DLight9 = ^TD3DLight9; + _D3DLIGHT9 = packed record + _Type: TD3DLightType; { Type of light source } + Diffuse: TD3DColorValue; { Diffuse color of light } + Specular: TD3DColorValue; { Specular color of light } + Ambient: TD3DColorValue; { Ambient color of light } + Position: TD3DVector; { Position in world space } + Direction: TD3DVector; { Direction in world space } + Range: Single; { Cutoff range } + Falloff: Single; { Falloff } + Attenuation0: Single; { Constant attenuation } + Attenuation1: Single; { Linear attenuation } + Attenuation2: Single; { Quadratic attenuation } + Theta: Single; { Inner angle of spotlight cone } + Phi: Single; { Outer angle of spotlight cone } + end {_D3DLIGHT9}; + D3DLIGHT9 = _D3DLIGHT9; + TD3DLight9 = _D3DLIGHT9; + +(* + * Options for clearing + *) +const + D3DCLEAR_TARGET = $00000001; { Clear target surface } + D3DCLEAR_ZBUFFER = $00000002; { Clear target z buffer } + D3DCLEAR_STENCIL = $00000004; { Clear stencil planes } + +(* + * The following defines the rendering states + *) +type + _D3DSHADEMODE = DWord; + D3DSHADEMODE = _D3DSHADEMODE; + TD3DShadeMode = _D3DSHADEMODE; + +const + D3DSHADE_FLAT = 1; + D3DSHADE_GOURAUD = 2; + D3DSHADE_PHONG = 3; + +type + _D3DFILLMODE = DWord; + D3DFILLMODE = _D3DFILLMODE; + TD3DFillMode = _D3DFILLMODE; + +const + D3DFILL_POINT = 1; + D3DFILL_WIREFRAME = 2; + D3DFILL_SOLID = 3; + +type + _D3DBLEND = DWord; + D3DBLEND = _D3DBLEND; + TD3DBlend = _D3DBLEND; + +const + D3DBLEND_ZERO = 1; + D3DBLEND_ONE = 2; + D3DBLEND_SRCCOLOR = 3; + D3DBLEND_INVSRCCOLOR = 4; + D3DBLEND_SRCALPHA = 5; + D3DBLEND_INVSRCALPHA = 6; + D3DBLEND_DESTALPHA = 7; + D3DBLEND_INVDESTALPHA = 8; + D3DBLEND_DESTCOLOR = 9; + D3DBLEND_INVDESTCOLOR = 10; + D3DBLEND_SRCALPHASAT = 11; + D3DBLEND_BOTHSRCALPHA = 12; + D3DBLEND_BOTHINVSRCALPHA = 13; + D3DBLEND_BLENDFACTOR = 14; (* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on *) + D3DBLEND_INVBLENDFACTOR = 15; (* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on *) + +type + _D3DBLENDOP = DWord; + D3DBLENDOP = _D3DBLENDOP; + TD3DBlendOp = _D3DBLENDOP; + +const + D3DBLENDOP_ADD = 1; + D3DBLENDOP_SUBTRACT = 2; + D3DBLENDOP_REVSUBTRACT = 3; + D3DBLENDOP_MIN = 4; + D3DBLENDOP_MAX = 5; + +type + _D3DTEXTUREADDRESS = DWord; + D3DTEXTUREADDRESS = _D3DTEXTUREADDRESS; + TD3DTextureAddress = _D3DTEXTUREADDRESS; + +const + D3DTADDRESS_WRAP = 1; + D3DTADDRESS_MIRROR = 2; + D3DTADDRESS_CLAMP = 3; + D3DTADDRESS_BORDER = 4; + D3DTADDRESS_MIRRORONCE = 5; + +type + _D3DCULL = DWord; + D3DCULL = _D3DCULL; + TD3DCull = _D3DCULL; + +const + D3DCULL_NONE = 1; + D3DCULL_CW = 2; + D3DCULL_CCW = 3; + +type + _D3DCMPFUNC = DWord; + D3DCMPFUNC = _D3DCMPFUNC; + TD3DCmpFunc = _D3DCMPFUNC; + +const + D3DCMP_NEVER = 1; + D3DCMP_LESS = 2; + D3DCMP_EQUAL = 3; + D3DCMP_LESSEQUAL = 4; + D3DCMP_GREATER = 5; + D3DCMP_NOTEQUAL = 6; + D3DCMP_GREATEREQUAL = 7; + D3DCMP_ALWAYS = 8; + +type + _D3DSTENCILOP = DWord; + D3DSTENCILOP = _D3DSTENCILOP; + TD3DStencilOp = _D3DSTENCILOP; + +const + D3DSTENCILOP_KEEP = 1; + D3DSTENCILOP_ZERO = 2; + D3DSTENCILOP_REPLACE = 3; + D3DSTENCILOP_INCRSAT = 4; + D3DSTENCILOP_DECRSAT = 5; + D3DSTENCILOP_INVERT = 6; + D3DSTENCILOP_INCR = 7; + D3DSTENCILOP_DECR = 8; + +type + _D3DFOGMODE = DWord; + D3DFOGMODE = _D3DFOGMODE; + TD3DFogMode = _D3DFOGMODE; + +const + D3DFOG_NONE = 0; + D3DFOG_EXP = 1; + D3DFOG_EXP2 = 2; + D3DFOG_LINEAR = 3; + +type + _D3DZBUFFERTYPE = DWord; + D3DZBUFFERTYPE = _D3DZBUFFERTYPE; + TD3DZBufferType = _D3DZBUFFERTYPE; + +const + D3DZB_FALSE = 0; + D3DZB_TRUE = 1; + D3DZB_USEW = 2; + +type + // Primitives supported by draw-primitive API + _D3DPRIMITIVETYPE = ( + D3DPT_INVALID_0 {= 0}, + D3DPT_POINTLIST {= 1}, + D3DPT_LINELIST {= 2}, + D3DPT_LINESTRIP {= 3}, + D3DPT_TRIANGLELIST {= 4}, + D3DPT_TRIANGLESTRIP{= 5}, + D3DPT_TRIANGLEFAN {= 6} + ); + D3DPRIMITIVETYPE = _D3DPRIMITIVETYPE; + TD3DPrimitiveType = _D3DPRIMITIVETYPE; + +const + D3DTS_VIEW = 2; + D3DTS_PROJECTION = 3; + D3DTS_TEXTURE0 = 16; + D3DTS_TEXTURE1 = 17; + D3DTS_TEXTURE2 = 18; + D3DTS_TEXTURE3 = 19; + D3DTS_TEXTURE4 = 20; + D3DTS_TEXTURE5 = 21; + D3DTS_TEXTURE6 = 22; + D3DTS_TEXTURE7 = 23; + D3DTS_FORCE_DWORD = $7fffffff; (* force 32-bit size enum *) + +type + _D3DTRANSFORMSTATETYPE = DWord; + D3DTRANSFORMSTATETYPE = _D3DTRANSFORMSTATETYPE; + TD3DTransformStateType = _D3DTRANSFORMSTATETYPE; + +// #define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256) +function D3DTS_WORLDMATRIX(index: Byte): TD3DTransformStateType;{$IFDEF SUPPORTS_INLINE} inline;{$ENDIF} + +const + D3DTS_WORLD = TD3DTransformStateType(0 + 256); // #define D3DTS_WORLD D3DTS_WORLDMATRIX(0) + D3DTS_WORLD1 = TD3DTransformStateType(1 + 256); // #define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1) + D3DTS_WORLD2 = TD3DTransformStateType(2 + 256); // #define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2) + D3DTS_WORLD3 = TD3DTransformStateType(3 + 256); // #define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3) + +type + _D3DRENDERSTATETYPE = DWord; + D3DRENDERSTATETYPE = _D3DRENDERSTATETYPE; + TD3DRenderStateType = _D3DRENDERSTATETYPE; + +const + D3DRS_ZENABLE = TD3DRenderStateType(7); { D3DZBUFFERTYPE (or TRUE/FALSE for legacy) } + D3DRS_FILLMODE = TD3DRenderStateType(8); { D3DFILLMODE } + D3DRS_SHADEMODE = TD3DRenderStateType(9); { D3DSHADEMODE } + D3DRS_ZWRITEENABLE = TD3DRenderStateType(14); { TRUE to enable z writes } + D3DRS_ALPHATESTENABLE = TD3DRenderStateType(15); { TRUE to enable alpha tests } + D3DRS_LASTPIXEL = TD3DRenderStateType(16); { TRUE for last-pixel on lines } + D3DRS_SRCBLEND = TD3DRenderStateType(19); { D3DBLEND } + D3DRS_DESTBLEND = TD3DRenderStateType(20); { D3DBLEND } + D3DRS_CULLMODE = TD3DRenderStateType(22); { D3DCULL } + D3DRS_ZFUNC = TD3DRenderStateType(23); { D3DCMPFUNC } + D3DRS_ALPHAREF = TD3DRenderStateType(24); { D3DFIXED } + D3DRS_ALPHAFUNC = TD3DRenderStateType(25); { D3DCMPFUNC } + D3DRS_DITHERENABLE = TD3DRenderStateType(26); { TRUE to enable dithering } + D3DRS_ALPHABLENDENABLE = TD3DRenderStateType(27); { TRUE to enable alpha blending } + D3DRS_FOGENABLE = TD3DRenderStateType(28); { TRUE to enable fog blending } + D3DRS_SPECULARENABLE = TD3DRenderStateType(29); { TRUE to enable specular } + D3DRS_FOGCOLOR = TD3DRenderStateType(34); { D3DCOLOR } + D3DRS_FOGTABLEMODE = TD3DRenderStateType(35); { D3DFOGMODE } + D3DRS_FOGSTART = TD3DRenderStateType(36); { Fog start (for both vertex and pixel fog) } + D3DRS_FOGEND = TD3DRenderStateType(37); { Fog end } + D3DRS_FOGDENSITY = TD3DRenderStateType(38); { Fog density } + D3DRS_RANGEFOGENABLE = TD3DRenderStateType(48); { Enables range-based fog } + D3DRS_STENCILENABLE = TD3DRenderStateType(52); { BOOL enable/disable stenciling } + D3DRS_STENCILFAIL = TD3DRenderStateType(53); { D3DSTENCILOP to do if stencil test fails } + D3DRS_STENCILZFAIL = TD3DRenderStateType(54); { D3DSTENCILOP to do if stencil test passes and Z test fails } + D3DRS_STENCILPASS = TD3DRenderStateType(55); { D3DSTENCILOP to do if both stencil and Z tests pass } + D3DRS_STENCILFUNC = TD3DRenderStateType(56); { D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true } + D3DRS_STENCILREF = TD3DRenderStateType(57); { Reference value used in stencil test } + D3DRS_STENCILMASK = TD3DRenderStateType(58); { Mask value used in stencil test } + D3DRS_STENCILWRITEMASK = TD3DRenderStateType(59); { Write mask applied to values written to stencil buffer } + D3DRS_TEXTUREFACTOR = TD3DRenderStateType(60); { D3DCOLOR used for multi-texture blend } + D3DRS_WRAP0 = TD3DRenderStateType(128); { wrap for 1st texture coord. set } + D3DRS_WRAP1 = TD3DRenderStateType(129); { wrap for 2nd texture coord. set } + D3DRS_WRAP2 = TD3DRenderStateType(130); { wrap for 3rd texture coord. set } + D3DRS_WRAP3 = TD3DRenderStateType(131); { wrap for 4th texture coord. set } + D3DRS_WRAP4 = TD3DRenderStateType(132); { wrap for 5th texture coord. set } + D3DRS_WRAP5 = TD3DRenderStateType(133); { wrap for 6th texture coord. set } + D3DRS_WRAP6 = TD3DRenderStateType(134); { wrap for 7th texture coord. set } + D3DRS_WRAP7 = TD3DRenderStateType(135); { wrap for 8th texture coord. set } + D3DRS_CLIPPING = TD3DRenderStateType(136); + D3DRS_LIGHTING = TD3DRenderStateType(137); + D3DRS_AMBIENT = TD3DRenderStateType(139); + D3DRS_FOGVERTEXMODE = TD3DRenderStateType(140); + D3DRS_COLORVERTEX = TD3DRenderStateType(141); + D3DRS_LOCALVIEWER = TD3DRenderStateType(142); + D3DRS_NORMALIZENORMALS = TD3DRenderStateType(143); + D3DRS_DIFFUSEMATERIALSOURCE = TD3DRenderStateType(145); + D3DRS_SPECULARMATERIALSOURCE = TD3DRenderStateType(146); + D3DRS_AMBIENTMATERIALSOURCE = TD3DRenderStateType(147); + D3DRS_EMISSIVEMATERIALSOURCE = TD3DRenderStateType(148); + D3DRS_VERTEXBLEND = TD3DRenderStateType(151); + D3DRS_CLIPPLANEENABLE = TD3DRenderStateType(152); + D3DRS_POINTSIZE = TD3DRenderStateType(154); { float point size } + D3DRS_POINTSIZE_MIN = TD3DRenderStateType(155); { float point size min threshold } + D3DRS_POINTSPRITEENABLE = TD3DRenderStateType(156); { BOOL point texture coord control } + D3DRS_POINTSCALEENABLE = TD3DRenderStateType(157); { BOOL point size scale enable } + D3DRS_POINTSCALE_A = TD3DRenderStateType(158); { float point attenuation A value } + D3DRS_POINTSCALE_B = TD3DRenderStateType(159); { float point attenuation B value } + D3DRS_POINTSCALE_C = TD3DRenderStateType(160); { float point attenuation C value } + D3DRS_MULTISAMPLEANTIALIAS = TD3DRenderStateType(161); // BOOL - set to do FSAA with multisample buffer + D3DRS_MULTISAMPLEMASK = TD3DRenderStateType(162); // DWORD - per-sample enable/disable + D3DRS_PATCHEDGESTYLE = TD3DRenderStateType(163); // Sets whether patch edges will use float style tessellation + D3DRS_DEBUGMONITORTOKEN = TD3DRenderStateType(165); // DEBUG ONLY - token to debug monitor + D3DRS_POINTSIZE_MAX = TD3DRenderStateType(166); { float point size max threshold } + D3DRS_INDEXEDVERTEXBLENDENABLE = TD3DRenderStateType(167); + D3DRS_COLORWRITEENABLE = TD3DRenderStateType(168); // per-channel write enable + D3DRS_TWEENFACTOR = TD3DRenderStateType(170); // float tween factor + D3DRS_BLENDOP = TD3DRenderStateType(171); // D3DBLENDOP setting + D3DRS_POSITIONDEGREE = TD3DRenderStateType(172); // NPatch position interpolation degree. D3DDEGREE_LINEAR or D3DDEGREE_CUBIC (default) + D3DRS_NORMALDEGREE = TD3DRenderStateType(173); // NPatch normal interpolation degree. D3DDEGREE_LINEAR (default) or D3DDEGREE_QUADRATIC + D3DRS_SCISSORTESTENABLE = TD3DRenderStateType(174); + D3DRS_SLOPESCALEDEPTHBIAS = TD3DRenderStateType(175); + D3DRS_ANTIALIASEDLINEENABLE = TD3DRenderStateType(176); + D3DRS_MINTESSELLATIONLEVEL = TD3DRenderStateType(178); + D3DRS_MAXTESSELLATIONLEVEL = TD3DRenderStateType(179); + D3DRS_ADAPTIVETESS_X = TD3DRenderStateType(180); + D3DRS_ADAPTIVETESS_Y = TD3DRenderStateType(181); + D3DRS_ADAPTIVETESS_Z = TD3DRenderStateType(182); + D3DRS_ADAPTIVETESS_W = TD3DRenderStateType(183); + D3DRS_ENABLEADAPTIVETESSELLATION = TD3DRenderStateType(184); + D3DRS_TWOSIDEDSTENCILMODE = TD3DRenderStateType(185); (* BOOL enable/disable 2 sided stenciling *) + D3DRS_CCW_STENCILFAIL = TD3DRenderStateType(186); (* D3DSTENCILOP to do if ccw stencil test fails *) + D3DRS_CCW_STENCILZFAIL = TD3DRenderStateType(187); (* D3DSTENCILOP to do if ccw stencil test passes and Z test fails *) + D3DRS_CCW_STENCILPASS = TD3DRenderStateType(188); (* D3DSTENCILOP to do if both ccw stencil and Z tests pass *) + D3DRS_CCW_STENCILFUNC = TD3DRenderStateType(189); (* D3DCMPFUNC fn. ccw Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true *) + D3DRS_COLORWRITEENABLE1 = TD3DRenderStateType(190); (* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS *) + D3DRS_COLORWRITEENABLE2 = TD3DRenderStateType(191); (* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS *) + D3DRS_COLORWRITEENABLE3 = TD3DRenderStateType(192); (* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS *) + D3DRS_BLENDFACTOR = TD3DRenderStateType(193); (* D3DCOLOR used for a constant blend factor during alpha blending for devices that support D3DPBLENDCAPS_BLENDFACTOR *) + D3DRS_SRGBWRITEENABLE = TD3DRenderStateType(194); (* Enable rendertarget writes to be DE-linearized to SRGB (for formats that expose D3DUSAGE_QUERY_SRGBWRITE) *) + D3DRS_DEPTHBIAS = TD3DRenderStateType(195); + D3DRS_WRAP8 = TD3DRenderStateType(198); (* Additional wrap states for vs_3_0+ attributes with D3DDECLUSAGE_TEXCOORD *) + D3DRS_WRAP9 = TD3DRenderStateType(199); + D3DRS_WRAP10 = TD3DRenderStateType(200); + D3DRS_WRAP11 = TD3DRenderStateType(201); + D3DRS_WRAP12 = TD3DRenderStateType(202); + D3DRS_WRAP13 = TD3DRenderStateType(203); + D3DRS_WRAP14 = TD3DRenderStateType(204); + D3DRS_WRAP15 = TD3DRenderStateType(205); + D3DRS_SEPARATEALPHABLENDENABLE = TD3DRenderStateType(206); (* TRUE to enable a separate blending function for the alpha channel *) + D3DRS_SRCBLENDALPHA = TD3DRenderStateType(207); (* SRC blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE *) + D3DRS_DESTBLENDALPHA = TD3DRenderStateType(208); (* DST blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE *) + D3DRS_BLENDOPALPHA = TD3DRenderStateType(209); (* Blending operation for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE *) + + + D3DRS_FORCE_DWORD = TD3DRenderStateType($7fffffff); { force 32-bit size enum } + +const + // Maximum number of simultaneous render targets D3D supports + D3D_MAX_SIMULTANEOUS_RENDERTARGETS = 4; + +type + // Values for material source + _D3DMATERIALCOLORSOURCE = DWord; + D3DMATERIALCOLORSOURCE = _D3DMATERIALCOLORSOURCE; + TD3DMaterialSource = _D3DMATERIALCOLORSOURCE; + +const + D3DMCS_MATERIAL = TD3DMaterialSource(0); // Color from material is used + D3DMCS_COLOR1 = TD3DMaterialSource(1); // Diffuse vertex color is used + D3DMCS_COLOR2 = TD3DMaterialSource(2); // Specular vertex color is used + D3DMCS_FORCE_DWORD = TD3DMaterialSource($7fffffff); // force 32-bit size enum + + // Bias to apply to the texture coordinate set to apply a wrap to. + D3DRENDERSTATE_WRAPBIAS = DWORD(128); + + { Flags to construct the WRAP render states } + D3DWRAP_U = $00000001; + D3DWRAP_V = $00000002; + D3DWRAP_W = $00000004; + + { Flags to construct the WRAP render states for 1D thru 4D texture coordinates } + D3DWRAPCOORD_0 = $00000001; // same as D3DWRAP_U + D3DWRAPCOORD_1 = $00000002; // same as D3DWRAP_V + D3DWRAPCOORD_2 = $00000004; // same as D3DWRAP_W + D3DWRAPCOORD_3 = $00000008; + + { Flags to construct D3DRS_COLORWRITEENABLE } + D3DCOLORWRITEENABLE_RED = (1 shl 0); + D3DCOLORWRITEENABLE_GREEN = (1 shl 1); + D3DCOLORWRITEENABLE_BLUE = (1 shl 2); + D3DCOLORWRITEENABLE_ALPHA = (1 shl 3); + +(* + * State enumerants for per-stage processing of fixed function pixel processing + * Two of these affect fixed function vertex processing as well: TEXTURETRANSFORMFLAGS and TEXCOORDINDEX. + *) +type + _D3DTEXTURESTAGESTATETYPE = DWord; + D3DTEXTURESTAGESTATETYPE = _D3DTEXTURESTAGESTATETYPE; + TD3DTextureStageStateType = _D3DTEXTURESTAGESTATETYPE; + +const + D3DTSS_COLOROP = TD3DTextureStageStateType( 1); { D3DTEXTUREOP - per-stage blending controls for color channels } + D3DTSS_COLORARG1 = TD3DTextureStageStateType( 2); { D3DTA_* (texture arg) } + D3DTSS_COLORARG2 = TD3DTextureStageStateType( 3); { D3DTA_* (texture arg) } + D3DTSS_ALPHAOP = TD3DTextureStageStateType( 4); { D3DTEXTUREOP - per-stage blending controls for alpha channel } + D3DTSS_ALPHAARG1 = TD3DTextureStageStateType( 5); { D3DTA_* (texture arg) } + D3DTSS_ALPHAARG2 = TD3DTextureStageStateType( 6); { D3DTA_* (texture arg) } + D3DTSS_BUMPENVMAT00 = TD3DTextureStageStateType( 7); { float (bump mapping matrix) } + D3DTSS_BUMPENVMAT01 = TD3DTextureStageStateType( 8); { float (bump mapping matrix) } + D3DTSS_BUMPENVMAT10 = TD3DTextureStageStateType( 9); { float (bump mapping matrix) } + D3DTSS_BUMPENVMAT11 = TD3DTextureStageStateType(10); { float (bump mapping matrix) } + D3DTSS_TEXCOORDINDEX = TD3DTextureStageStateType(11); { identifies which set of texture coordinates index this texture } + D3DTSS_BUMPENVLSCALE = TD3DTextureStageStateType(22); { float scale for bump map luminance } + D3DTSS_BUMPENVLOFFSET = TD3DTextureStageStateType(23); { float offset for bump map luminance } + D3DTSS_TEXTURETRANSFORMFLAGS = TD3DTextureStageStateType(24); { D3DTEXTURETRANSFORMFLAGS controls texture transform } + D3DTSS_COLORARG0 = TD3DTextureStageStateType(26); { D3DTA_* third arg for triadic ops } + D3DTSS_ALPHAARG0 = TD3DTextureStageStateType(27); { D3DTA_* third arg for triadic ops } + D3DTSS_RESULTARG = TD3DTextureStageStateType(28); { D3DTA_* arg for result (CURRENT or TEMP) } + D3DTSS_CONSTANT = TD3DTextureStageStateType(32); { Per-stage constant D3DTA_CONSTANT } + + D3DTSS_FORCE_DWORD = TD3DTextureStageStateType($7fffffff); { force 32-bit size enum } + +type +(* + * State enumerants for per-sampler texture processing. + *) + _D3DSAMPLERSTATETYPE = ( + D3DSAMP_invalid_0 {= 0}, + D3DSAMP_ADDRESSU {= 1}, { D3DTEXTUREADDRESS for U coordinate } + D3DSAMP_ADDRESSV {= 2}, { D3DTEXTUREADDRESS for V coordinate } + D3DSAMP_ADDRESSW {= 3}, { D3DTEXTUREADDRESS for W coordinate } + D3DSAMP_BORDERCOLOR {= 4}, { D3DCOLOR } + D3DSAMP_MAGFILTER {= 5}, { D3DTEXTUREFILTER filter to use for magnification } + D3DSAMP_MINFILTER {= 6}, { D3DTEXTUREFILTER filter to use for minification } + D3DSAMP_MIPFILTER {= 7}, { D3DTEXTUREFILTER filter to use between mipmaps during minification } + D3DSAMP_MIPMAPLODBIAS {= 8}, { float Mipmap LOD bias } + D3DSAMP_MAXMIPLEVEL {= 9}, { DWORD 0..(n-1) LOD index of largest map to use (0 == largest) } + D3DSAMP_MAXANISOTROPY {= 10}, { DWORD maximum anisotropy } + D3DSAMP_SRGBTEXTURE {= 11}, { Default = 0 (which means Gamma 1.0, + no correction required.) else correct for + Gamma = 2.2 } + D3DSAMP_ELEMENTINDEX {= 12}, { When multi-element texture is assigned to sampler, this + indicates which element index to use. Default = 0. } + D3DSAMP_DMAPOFFSET {= 13} { Offset in vertices in the pre-sampled displacement map. + Only valid for D3DDMAPSAMPLER sampler } + ); + D3DSAMPLERSTATETYPE = _D3DSAMPLERSTATETYPE; + TD3DSamplerStateType = _D3DSAMPLERSTATETYPE; + +const + { Special sampler which is used in the tesselator } + D3DDMAPSAMPLER = 256; + + // Samplers used in vertex shaders + D3DVERTEXTEXTURESAMPLER0 = (D3DDMAPSAMPLER+1); + D3DVERTEXTEXTURESAMPLER1 = (D3DDMAPSAMPLER+2); + D3DVERTEXTEXTURESAMPLER2 = (D3DDMAPSAMPLER+3); + D3DVERTEXTEXTURESAMPLER3 = (D3DDMAPSAMPLER+4); + + // Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position + // and normal in the camera space) should be taken as texture coordinates + // Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from + // + D3DTSS_TCI_PASSTHRU = $00000000; + D3DTSS_TCI_CAMERASPACENORMAL = $00010000; + D3DTSS_TCI_CAMERASPACEPOSITION = $00020000; + D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR = $00030000; + D3DTSS_TCI_SPHEREMAP = $00040000; + +(* + * Enumerations for COLOROP and ALPHAOP texture blending operations set in + * texture processing stage controls in D3DTSS. + *) +type + _D3DTEXTUREOP = DWord; + D3DTEXTUREOP = _D3DTEXTUREOP; + TD3DTextureOp = _D3DTEXTUREOP; + +const + // Control + D3DTOP_DISABLE = 1; // disables stage + D3DTOP_SELECTARG1 = 2; // the default + D3DTOP_SELECTARG2 = 3; + + // Modulate + D3DTOP_MODULATE = 4; // multiply args together + D3DTOP_MODULATE2X = 5; // multiply and 1 bit + D3DTOP_MODULATE4X = 6; // multiply and 2 bits + + // Add + D3DTOP_ADD = 7; // add arguments together + D3DTOP_ADDSIGNED = 8; // add with -0.5 bias + D3DTOP_ADDSIGNED2X = 9; // as above but left 1 bit + D3DTOP_SUBTRACT = 10; // Arg1 - Arg2, with no saturation + D3DTOP_ADDSMOOTH = 11; // add 2 args, subtract product + // Arg1 + Arg2 - Arg1*Arg2 + // = Arg1 + (1-Arg1)*Arg2 + + // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha) + D3DTOP_BLENDDIFFUSEALPHA = 12; // iterated alpha + D3DTOP_BLENDTEXTUREALPHA = 13; // texture alpha + D3DTOP_BLENDFACTORALPHA = 14; // alpha from D3DRS_TEXTUREFACTOR + + // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha) + D3DTOP_BLENDTEXTUREALPHAPM = 15; // texture alpha + D3DTOP_BLENDCURRENTALPHA = 16; // by alpha of current color + + // Specular mapping + D3DTOP_PREMODULATE = 17; // modulate with next texture before use + D3DTOP_MODULATEALPHA_ADDCOLOR = 18; // Arg1.RGB + Arg1.A*Arg2.RGB + // COLOROP only + D3DTOP_MODULATECOLOR_ADDALPHA = 19; // Arg1.RGB*Arg2.RGB + Arg1.A + // COLOROP only + D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20; // (1-Arg1.A)*Arg2.RGB + Arg1.RGB + // COLOROP only + D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21; // (1-Arg1.RGB)*Arg2.RGB + Arg1.A + // COLOROP only + + // Bump mapping + D3DTOP_BUMPENVMAP = 22; // per pixel env map perturbation + D3DTOP_BUMPENVMAPLUMINANCE = 23; // with luminance channel + + // This can do either diffuse or specular bump mapping with correct input. + // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B) + // where each component has been scaled and offset to make it signed. + // The result is replicated into all four (including alpha) channels. + // This is a valid COLOROP only. + D3DTOP_DOTPRODUCT3 = 24; + + // Triadic ops + D3DTOP_MULTIPLYADD = 25; // Arg0 + Arg1*Arg2 + D3DTOP_LERP = 26; // (Arg0)*Arg1 + (1-Arg0)*Arg2 + +(* + * Values for COLORARG0,1,2, ALPHAARG0,1,2, and RESULTARG texture blending + * operations set in texture processing stage controls in D3DRENDERSTATE. + *) +const + D3DTA_SELECTMASK = $0000000f; // mask for arg selector + D3DTA_DIFFUSE = $00000000; // select diffuse color (read only) + D3DTA_CURRENT = $00000001; // select stage destination register (read/write) + D3DTA_TEXTURE = $00000002; // select texture color (read only) + D3DTA_TFACTOR = $00000003; // select D3DRS_TEXTUREFACTOR (read only) + D3DTA_SPECULAR = $00000004; // select specular color (read only) + D3DTA_TEMP = $00000005; // select temporary register color (read/write) + D3DTA_CONSTANT = $00000006; // select texture stage constant + D3DTA_COMPLEMENT = $00000010; // take 1.0 - x (read modifier) + D3DTA_ALPHAREPLICATE = $00000020; // replicate alpha to color components (read modifier) + +type + // + // Values for D3DSAMP_***FILTER texture stage states + // + _D3DTEXTUREFILTERTYPE = DWord; + D3DTEXTUREFILTERTYPE = _D3DTEXTUREFILTERTYPE; + TD3DTextureFilterType = _D3DTEXTUREFILTERTYPE; + +const + D3DTEXF_NONE = 0; // filtering disabled (valid for mip filter only) + D3DTEXF_POINT = 1; // nearest + D3DTEXF_LINEAR = 2; // linear interpolation + D3DTEXF_ANISOTROPIC = 3; // anisotropic + D3DTEXF_PYRAMIDALQUAD = 6; // 4-sample tent + D3DTEXF_GAUSSIANQUAD = 7; // 4-sample gaussian + +const + { Bits for Flags in ProcessVertices call } + D3DPV_DONOTCOPYDATA = (1 shl 0); + +//------------------------------------------------------------------- + + // Flexible vertex format bits + // + D3DFVF_RESERVED0 = $001; + D3DFVF_POSITION_MASK = $400E; + D3DFVF_XYZ = $002; + D3DFVF_XYZRHW = $004; + D3DFVF_XYZB1 = $006; + D3DFVF_XYZB2 = $008; + D3DFVF_XYZB3 = $00a; + D3DFVF_XYZB4 = $00c; + D3DFVF_XYZB5 = $00e; + D3DFVF_XYZW = $4002; + + D3DFVF_NORMAL = $010; + D3DFVF_PSIZE = $020; + D3DFVF_DIFFUSE = $040; + D3DFVF_SPECULAR = $080; + + D3DFVF_TEXCOUNT_MASK = $f00; + D3DFVF_TEXCOUNT_SHIFT = 8; + D3DFVF_TEX0 = $000; + D3DFVF_TEX1 = $100; + D3DFVF_TEX2 = $200; + D3DFVF_TEX3 = $300; + D3DFVF_TEX4 = $400; + D3DFVF_TEX5 = $500; + D3DFVF_TEX6 = $600; + D3DFVF_TEX7 = $700; + D3DFVF_TEX8 = $800; + + D3DFVF_LASTBETA_UBYTE4 = $1000; + D3DFVF_LASTBETA_D3DCOLOR = $8000; + + D3DFVF_RESERVED2 = $6000; // 2 reserved bits + +//--------------------------------------------------------------------- +// Vertex Shaders +// + +// Vertex shader declaration + +// Forces TD3DDeclUsage, TD3DDeclMethod, TD3DDeclType be 1 byte enums +{$MINENUMSIZE 1} + +type + // Vertex element semantics + // + _D3DDECLUSAGE = ( + D3DDECLUSAGE_POSITION, // = 0 + D3DDECLUSAGE_BLENDWEIGHT, // 1 + D3DDECLUSAGE_BLENDINDICES, // 2 + D3DDECLUSAGE_NORMAL, // 3 + D3DDECLUSAGE_PSIZE, // 4 + D3DDECLUSAGE_TEXCOORD, // 5 + D3DDECLUSAGE_TANGENT, // 6 + D3DDECLUSAGE_BINORMAL, // 7 + D3DDECLUSAGE_TESSFACTOR, // 8 + D3DDECLUSAGE_POSITIONT, // 9 + D3DDECLUSAGE_COLOR, // 10 + D3DDECLUSAGE_FOG, // 11 + D3DDECLUSAGE_DEPTH, // 12 + D3DDECLUSAGE_SAMPLE // 13 + ); + D3DDECLUSAGE = _D3DDECLUSAGE; + TD3DDeclUsage = _D3DDECLUSAGE; + +const + MAXD3DDECLUSAGE = DWORD(D3DDECLUSAGE_SAMPLE); + MAXD3DDECLUSAGEINDEX = 15; + MAXD3DDECLLENGTH = 64; // does not include "end" marker vertex element + +type + _D3DDECLMETHOD = ( + D3DDECLMETHOD_DEFAULT, // = 0, + D3DDECLMETHOD_PARTIALU, + D3DDECLMETHOD_PARTIALV, + D3DDECLMETHOD_CROSSUV, // Normal + D3DDECLMETHOD_UV, + D3DDECLMETHOD_LOOKUP, // Lookup a displacement map + D3DDECLMETHOD_LOOKUPPRESAMPLED // Lookup a pre-sampled displacement map + ); + D3DDECLMETHOD = _D3DDECLMETHOD; + TD3DDeclMethod = _D3DDECLMETHOD; + +const + MAXD3DDECLMETHOD = DWORD(D3DDECLMETHOD_LOOKUPPRESAMPLED); + +type + // Declarations for _Type fields + // + _D3DDECLTYPE = ( + D3DDECLTYPE_FLOAT1 {= 0}, // 1D float expanded to (value, 0., 0., 1.) + D3DDECLTYPE_FLOAT2 {= 1}, // 2D float expanded to (value, value, 0., 1.) + D3DDECLTYPE_FLOAT3 {= 2}, // 3D float expanded to (value, value, value, 1.) + D3DDECLTYPE_FLOAT4 {= 3}, // 4D float + D3DDECLTYPE_D3DCOLOR {= 4}, // 4D packed unsigned bytes mapped to 0. to 1. range + // Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A) + D3DDECLTYPE_UBYTE4 {= 5}, // 4D unsigned byte + D3DDECLTYPE_SHORT2 {= 6}, // 2D signed short expanded to (value, value, 0., 1.) + D3DDECLTYPE_SHORT4 {= 7}, // 4D signed short + + // The following types are valid only with vertex shaders >= 2.0 + + + D3DDECLTYPE_UBYTE4N {= 8}, // Each of 4 bytes is normalized by dividing to 255.0 + D3DDECLTYPE_SHORT2N {= 9}, // 2D signed short normalized (v[0]/32767.0,v[1]/32767.0,0,1) + D3DDECLTYPE_SHORT4N {= 10}, // 4D signed short normalized (v[0]/32767.0,v[1]/32767.0,v[2]/32767.0,v[3]/32767.0) + D3DDECLTYPE_USHORT2N {= 11}, // 2D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,0,1) + D3DDECLTYPE_USHORT4N {= 12}, // 4D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,v[2]/65535.0,v[3]/65535.0) + D3DDECLTYPE_UDEC3 {= 13}, // 3D unsigned 10 10 10 format expanded to (value, value, value, 1) + D3DDECLTYPE_DEC3N {= 14}, // 3D signed 10 10 10 format normalized and expanded to (v[0]/511.0, v[1]/511.0, v[2]/511.0, 1) + D3DDECLTYPE_FLOAT16_2{= 15}, // Two 16-bit floating point values, expanded to (value, value, 0, 1) + D3DDECLTYPE_FLOAT16_4{= 16}, // Four 16-bit floating point values + D3DDECLTYPE_UNUSED {= 17} // When the type field in a decl is unused. + ); + D3DDECLTYPE = _D3DDECLTYPE; + TD3DDeclType = _D3DDECLTYPE; + +// Restores enums to be 4 byte in size +{$MINENUMSIZE 4} + +const + MAXD3DDECLTYPE = DWORD(D3DDECLTYPE_UNUSED); + +type + PD3DVertexElement9 = ^TD3DVertexElement9; + _D3DVERTEXELEMENT9 = packed record + Stream: Word; // Stream index + Offset: Word; // Offset in the stream in bytes + _Type: TD3DDeclType{Byte}; // Data type + Method: TD3DDeclMethod{Byte}; // Processing method + Usage: TD3DDeclUsage{Byte}; // Semantics + UsageIndex: Byte; // Semantic index + end; + D3DVERTEXELEMENT9 = _D3DVERTEXELEMENT9; + TD3DVertexElement9 = _D3DVERTEXELEMENT9; + +// This is used to initialize the last vertex element in a vertex declaration +// array +// +const + D3DDECL_END: TD3DVertexElement9 = (Stream : $FF; + Offset : 0; + _Type : D3DDECLTYPE_UNUSED; + Method : TD3DDeclMethod(0); + Usage : TD3DDeclUsage(0); + UsageIndex : 0); + +// Maximum supported number of texture coordinate sets +const + D3DDP_MAXTEXCOORD = 8; + +//--------------------------------------------------------------------- +// Values for IDirect3DDevice9::SetStreamSourceFreq's Setting parameter +//--------------------------------------------------------------------- + D3DSTREAMSOURCE_INDEXEDDATA = LongWord(1 shl 30); + D3DSTREAMSOURCE_INSTANCEDATA = LongWord(2 shl 30); + + +//--------------------------------------------------------------------- +// +// The internal format of Pixel Shader (PS) & Vertex Shader (VS) +// Instruction Tokens is defined in the Direct3D Device Driver Kit +// +//--------------------------------------------------------------------- + + // + // Instruction Token Bit Definitions + // + D3DSI_OPCODE_MASK = $0000FFFF; + + D3DSI_INSTLENGTH_MASK = $0F000000; + D3DSI_INSTLENGTH_SHIFT = 24; + +type + _D3DSHADER_INSTRUCTION_OPCODE_TYPE = DWord; + D3DSHADER_INSTRUCTION_OPCODE_TYPE = _D3DSHADER_INSTRUCTION_OPCODE_TYPE; + TD3DShaderInstructionOpcodeType = _D3DSHADER_INSTRUCTION_OPCODE_TYPE; + +const + D3DSIO_NOP = 0; + D3DSIO_MOV = 1; + D3DSIO_ADD = 2; + D3DSIO_SUB = 3; + D3DSIO_MAD = 4; + D3DSIO_MUL = 5; + D3DSIO_RCP = 6; + D3DSIO_RSQ = 7; + D3DSIO_DP3 = 8; + D3DSIO_DP4 = 9; + D3DSIO_MIN = 10; + D3DSIO_MAX = 11; + D3DSIO_SLT = 12; + D3DSIO_SGE = 13; + D3DSIO_EXP = 14; + D3DSIO_LOG = 15; + D3DSIO_LIT = 16; + D3DSIO_DST = 17; + D3DSIO_LRP = 18; + D3DSIO_FRC = 19; + D3DSIO_M4x4 = 20; + D3DSIO_M4x3 = 21; + D3DSIO_M3x4 = 22; + D3DSIO_M3x3 = 23; + D3DSIO_M3x2 = 24; + D3DSIO_CALL = 25; + D3DSIO_CALLNZ = 26; + D3DSIO_LOOP = 27; + D3DSIO_RET = 28; + D3DSIO_ENDLOOP = 29; + D3DSIO_LABEL = 30; + D3DSIO_DCL = 31; + D3DSIO_POW = 32; + D3DSIO_CRS = 33; + D3DSIO_SGN = 34; + D3DSIO_ABS = 35; + D3DSIO_NRM = 36; + D3DSIO_SINCOS = 37; + D3DSIO_REP = 38; + D3DSIO_ENDREP = 39; + D3DSIO_IF = 40; + D3DSIO_IFC = 41; + D3DSIO_ELSE = 42; + D3DSIO_ENDIF = 43; + D3DSIO_BREAK = 44; + D3DSIO_BREAKC = 45; + D3DSIO_MOVA = 46; + D3DSIO_DEFB = 47; + D3DSIO_DEFI = 48; + + D3DSIO_TEXCOORD = 64; + D3DSIO_TEXKILL = 65; + D3DSIO_TEX = 66; + D3DSIO_TEXBEM = 67; + D3DSIO_TEXBEML = 68; + D3DSIO_TEXREG2AR = 69; + D3DSIO_TEXREG2GB = 70; + D3DSIO_TEXM3x2PAD = 71; + D3DSIO_TEXM3x2TEX = 72; + D3DSIO_TEXM3x3PAD = 73; + D3DSIO_TEXM3x3TEX = 74; + D3DSIO_RESERVED0 = 75; + D3DSIO_TEXM3x3SPEC = 76; + D3DSIO_TEXM3x3VSPEC = 77; + D3DSIO_EXPP = 78; + D3DSIO_LOGP = 79; + D3DSIO_CND = 80; + D3DSIO_DEF = 81; + D3DSIO_TEXREG2RGB = 82; + D3DSIO_TEXDP3TEX = 83; + D3DSIO_TEXM3x2DEPTH = 84; + D3DSIO_TEXDP3 = 85; + D3DSIO_TEXM3x3 = 86; + D3DSIO_TEXDEPTH = 87; + D3DSIO_CMP = 88; + D3DSIO_BEM = 89; + + D3DSIO_DP2ADD = 90; + D3DSIO_DSX = 91; + D3DSIO_DSY = 92; + D3DSIO_TEXLDD = 93; + D3DSIO_SETP = 94; + D3DSIO_TEXLDL = 95; + D3DSIO_BREAKP = 96; + + + D3DSIO_PHASE = $FFFD; + D3DSIO_COMMENT = $FFFE; + D3DSIO_END = $FFFF; + + //--------------------------------------------------------------------- + // Use these constants with D3DSIO_SINCOS macro as SRC2, SRC3 + // + //#define D3DSINCOSCONST1 -1.5500992e-006f, -2.1701389e-005f, 0.0026041667f, 0.00026041668f + //#define D3DSINCOSCONST2 -0.020833334f, -0.12500000f, 1.0f, 0.50000000f + + //--------------------------------------------------------------------- + // Co-Issue Instruction Modifier - if set then this instruction is to be + // issued in parallel with the previous instruction(s) for which this bit + // is not set. + // + D3DSI_COISSUE = $40000000; + + //--------------------------------------------------------------------- + // Opcode specific controls + + D3DSP_OPCODESPECIFICCONTROL_MASK = $00ff0000; + D3DSP_OPCODESPECIFICCONTROL_SHIFT = 16; + + // ps_2_0 texld controls + D3DSI_TEXLD_PROJECT = ($01 shl D3DSP_OPCODESPECIFICCONTROL_SHIFT); + D3DSI_TEXLD_BIAS = ($02 shl D3DSP_OPCODESPECIFICCONTROL_SHIFT); + +type + // Comparison for dynamic conditional instruction opcodes (i.e. if, breakc) + {$MINENUMSIZE 1} // Forces TD3DShaderComparison be 1 byte enum + _D3DSHADER_COMPARISON = ( + // < = > + D3DSPC_RESERVED0{= 0}, // 0 0 0 + D3DSPC_GT {= 1}, // 0 0 1 + D3DSPC_EQ {= 2}, // 0 1 0 + D3DSPC_GE {= 3}, // 0 1 1 + D3DSPC_LT {= 4}, // 1 0 0 + D3DSPC_NE {= 5}, // 1 0 1 + D3DSPC_LE {= 6}, // 1 1 0 + D3DSPC_RESERVED1{= 7} // 1 1 1 + ); + D3DSHADER_COMPARISON = _D3DSHADER_COMPARISON; + TD3DShaderComparison = _D3DSHADER_COMPARISON; + {$MINENUMSIZE 4} // Restores enums to be 4 byte in size + +const + // Comparison is part of instruction opcode token: + D3DSHADER_COMPARISON_SHIFT = D3DSP_OPCODESPECIFICCONTROL_SHIFT; + D3DSHADER_COMPARISON_MASK = ($7 shl D3DSHADER_COMPARISON_SHIFT); + + //--------------------------------------------------------------------- + // Predication flags on instruction token + D3DSHADER_INSTRUCTION_PREDICATED = ($1 shl 28); + + //--------------------------------------------------------------------- + // DCL Info Token Controls + + // For dcl info tokens requiring a semantic (usage + index) + D3DSP_DCL_USAGE_SHIFT = 0; + D3DSP_DCL_USAGE_MASK = $0000000f; + + D3DSP_DCL_USAGEINDEX_SHIFT = 16; + D3DSP_DCL_USAGEINDEX_MASK = $000f0000; + + // DCL pixel shader sampler info token. + D3DSP_TEXTURETYPE_SHIFT = 27; + D3DSP_TEXTURETYPE_MASK = $78000000; + +type + _D3DSAMPLER_TEXTURE_TYPE = DWord; + D3DSAMPLER_TEXTURE_TYPE = _D3DSAMPLER_TEXTURE_TYPE; + TD3DSamplerTextureType = _D3DSAMPLER_TEXTURE_TYPE; + +const + D3DSTT_UNKNOWN = 0 shl D3DSP_TEXTURETYPE_SHIFT; // uninitialized value + D3DSTT_2D = 2 shl D3DSP_TEXTURETYPE_SHIFT; // dcl_2d s# (for declaring a 2-D texture) + D3DSTT_CUBE = 3 shl D3DSP_TEXTURETYPE_SHIFT; // dcl_cube s# (for declaring a cube texture) + D3DSTT_VOLUME = 4 shl D3DSP_TEXTURETYPE_SHIFT; // dcl_volume s# (for declaring a volume texture) + D3DSTT_FORCE_DWORD = $7fffffff; // force 32-bit size enum + +const + //--------------------------------------------------------------------- + // Parameter Token Bit Definitions + // + D3DSP_REGNUM_MASK = $000007FF; + + // destination parameter write mask + D3DSP_WRITEMASK_0 = $00010000; // Component 0 (X;Red) + D3DSP_WRITEMASK_1 = $00020000; // Component 1 (Y;Green) + D3DSP_WRITEMASK_2 = $00040000; // Component 2 (Z;Blue) + D3DSP_WRITEMASK_3 = $00080000; // Component 3 (W;Alpha) + D3DSP_WRITEMASK_ALL = $000F0000; // All Components + + // destination parameter modifiers + D3DSP_DSTMOD_SHIFT = 20; + D3DSP_DSTMOD_MASK = $00F00000; + + // Bit masks for destination parameter modifiers + D3DSPDM_NONE = (0 shl D3DSP_DSTMOD_SHIFT); // nop + D3DSPDM_SATURATE = (1 shl D3DSP_DSTMOD_SHIFT); // clamp to 0. to 1. range + D3DSPDM_PARTIALPRECISION = (2 shl D3DSP_DSTMOD_SHIFT); // Partial precision hint + D3DSPDM_MSAMPCENTROID = (4 shl D3DSP_DSTMOD_SHIFT); // Relevant to multisampling only: + // When the pixel center is not covered, sample + // attribute or compute gradients/LOD + // using multisample "centroid" location. + // "Centroid" is some location within the covered + // region of the pixel. + + // destination parameter + D3DSP_DSTSHIFT_SHIFT = 24; + D3DSP_DSTSHIFT_MASK = $0F000000; + + // destination/source parameter register type + D3DSP_REGTYPE_SHIFT = 28; + D3DSP_REGTYPE_SHIFT2 = 8; + D3DSP_REGTYPE_MASK = $70000000; + D3DSP_REGTYPE_MASK2 = $00001800; + + +const + D3DSPR_TEMP = 0; // Temporary Register File + D3DSPR_INPUT = 1; // Input Register File + D3DSPR_CONST = 2; // Constant Register File + D3DSPR_ADDR = 3; // Address Register (VS) + D3DSPR_TEXTURE = 3; // Texture Register File (PS) + D3DSPR_RASTOUT = 4; // Rasterizer Register File + D3DSPR_ATTROUT = 5; // Attribute Output Register File + D3DSPR_TEXCRDOUT = 6; // Texture Coordinate Output Register File + D3DSPR_OUTPUT = 6; // Output register file for VS3.0+ + D3DSPR_CONSTINT = 7; // Constant Integer Vector Register File + D3DSPR_COLOROUT = 8; // Color Output Register File + D3DSPR_DEPTHOUT = 9; // Depth Output Register File + D3DSPR_SAMPLER = 10; // Sampler State Register File + D3DSPR_CONST2 = 11; // Constant Register File 2048 - 4095 + D3DSPR_CONST3 = 12; // Constant Register File 4096 - 6143 + D3DSPR_CONST4 = 13; // Constant Register File 6144 - 8191 + D3DSPR_CONSTBOOL = 14; // Constant Boolean register file + D3DSPR_LOOP = 15; // Loop counter register file + D3DSPR_TEMPFLOAT16 = 16; // 16-bit float temp register file + D3DSPR_MISCTYPE = 17; // Miscellaneous (single) registers. + D3DSPR_LABEL = 18; // Label + D3DSPR_PREDICATE = 19; // Predicate register + +type + _D3DSHADER_PARAM_REGISTER_TYPE = DWord; + D3DSHADER_PARAM_REGISTER_TYPE = _D3DSHADER_PARAM_REGISTER_TYPE; + TD3DShaderParamRegisterType = _D3DSHADER_PARAM_REGISTER_TYPE; + + // The miscellaneous register file (D3DSPR_MISCTYPES) + // contains register types for which there is only ever one + // register (i.e. the register # is not needed). + // Rather than use up additional register types for such + // registers, they are defined + // as particular offsets into the misc. register file: + {$MINENUMSIZE 1} // Forces TD3DShaderMiscTypeOffsets be 1 byte enum + _D3DSHADER_MISCTYPE_OFFSETS = ( + D3DSMO_POSITION {= 0}, // Input position x,y,z,rhw (PS) + D3DSMO_FACE {= 1} // Floating point primitive area (PS) + ); + D3DSHADER_MISCTYPE_OFFSETS = _D3DSHADER_MISCTYPE_OFFSETS; + TD3DShaderMiscTypeOffsets = _D3DSHADER_MISCTYPE_OFFSETS; + {$MINENUMSIZE 4} // Restores enums to be 4 byte in size + + // Register offsets in the Rasterizer Register File + // + _D3DVS_RASTOUT_OFFSETS = ( + D3DSRO_POSITION, // = 0, + D3DSRO_FOG, + D3DSRO_POINT_SIZE + ); + D3DVS_RASTOUT_OFFSETS = _D3DVS_RASTOUT_OFFSETS; + TD3DVSRastoutOffsets = _D3DVS_RASTOUT_OFFSETS; + +// Source operand addressing modes + +const + D3DVS_ADDRESSMODE_SHIFT = 13; + D3DVS_ADDRESSMODE_MASK = 1 shl D3DVS_ADDRESSMODE_SHIFT; + +type + _D3DVS_ADDRESSMODE_TYPE = DWord; + D3DVS_ADDRESSMODE_TYPE = _D3DVS_ADDRESSMODE_TYPE; + TD3DVSAddressModeType = _D3DVS_ADDRESSMODE_TYPE; + +const + D3DVS_ADDRMODE_ABSOLUTE = 0 shl D3DVS_ADDRESSMODE_SHIFT; + D3DVS_ADDRMODE_RELATIVE = 1 shl D3DVS_ADDRESSMODE_SHIFT; + D3DVS_ADDRMODE_FORCE_DWORD = $7fffffff; // force 32-bit size enum + +const + D3DSHADER_ADDRESSMODE_SHIFT = 13; + D3DSHADER_ADDRESSMODE_MASK = (1 shl D3DSHADER_ADDRESSMODE_SHIFT); + +type + _D3DSHADER_ADDRESSMODE_TYPE = DWord; + D3DSHADER_ADDRESSMODE_TYPE = _D3DSHADER_ADDRESSMODE_TYPE; + TD3DShaderAddressModeType = _D3DSHADER_ADDRESSMODE_TYPE; + +const + D3DSHADER_ADDRMODE_ABSOLUTE = (0 shl D3DSHADER_ADDRESSMODE_SHIFT); + D3DSHADER_ADDRMODE_RELATIVE = (1 shl D3DSHADER_ADDRESSMODE_SHIFT); + D3DSHADER_ADDRMODE_FORCE_DWORD = $7fffffff; // force 32-bit size enum + + // Source operand swizzle definitions + // + D3DVS_SWIZZLE_SHIFT = 16; + D3DVS_SWIZZLE_MASK = $00FF0000; + + // The following bits define where to take component X from: + + D3DVS_X_X = 0 shl D3DVS_SWIZZLE_SHIFT; + D3DVS_X_Y = 1 shl D3DVS_SWIZZLE_SHIFT; + D3DVS_X_Z = 2 shl D3DVS_SWIZZLE_SHIFT; + D3DVS_X_W = 3 shl D3DVS_SWIZZLE_SHIFT; + + // The following bits define where to take component Y from: + + D3DVS_Y_X = 0 shl (D3DVS_SWIZZLE_SHIFT + 2); + D3DVS_Y_Y = 1 shl (D3DVS_SWIZZLE_SHIFT + 2); + D3DVS_Y_Z = 2 shl (D3DVS_SWIZZLE_SHIFT + 2); + D3DVS_Y_W = 3 shl (D3DVS_SWIZZLE_SHIFT + 2); + + // The following bits define where to take component Z from: + + D3DVS_Z_X = 0 shl (D3DVS_SWIZZLE_SHIFT + 4); + D3DVS_Z_Y = 1 shl (D3DVS_SWIZZLE_SHIFT + 4); + D3DVS_Z_Z = 2 shl (D3DVS_SWIZZLE_SHIFT + 4); + D3DVS_Z_W = 3 shl (D3DVS_SWIZZLE_SHIFT + 4); + + // The following bits define where to take component W from: + + D3DVS_W_X = 0 shl (D3DVS_SWIZZLE_SHIFT + 6); + D3DVS_W_Y = 1 shl (D3DVS_SWIZZLE_SHIFT + 6); + D3DVS_W_Z = 2 shl (D3DVS_SWIZZLE_SHIFT + 6); + D3DVS_W_W = 3 shl (D3DVS_SWIZZLE_SHIFT + 6); + + // Value when there is no swizzle (X is taken from X, Y is taken from Y, + // Z is taken from Z, W is taken from W + // + D3DVS_NOSWIZZLE = D3DVS_X_X or D3DVS_Y_Y or D3DVS_Z_Z or D3DVS_W_W; + + // source parameter swizzle + D3DSP_SWIZZLE_SHIFT = 16; + D3DSP_SWIZZLE_MASK = $00FF0000; + + D3DSP_NOSWIZZLE = + (0 shl (D3DSP_SWIZZLE_SHIFT + 0)) or + (1 shl (D3DSP_SWIZZLE_SHIFT + 2)) or + (2 shl (D3DSP_SWIZZLE_SHIFT + 4)) or + (3 shl (D3DSP_SWIZZLE_SHIFT + 6)); + + // pixel-shader swizzle ops + D3DSP_REPLICATERED = + (0 shl (D3DSP_SWIZZLE_SHIFT + 0)) or + (0 shl (D3DSP_SWIZZLE_SHIFT + 2)) or + (0 shl (D3DSP_SWIZZLE_SHIFT + 4)) or + (0 shl (D3DSP_SWIZZLE_SHIFT + 6)); + + D3DSP_REPLICATEGREEN = + (1 shl (D3DSP_SWIZZLE_SHIFT + 0)) or + (1 shl (D3DSP_SWIZZLE_SHIFT + 2)) or + (1 shl (D3DSP_SWIZZLE_SHIFT + 4)) or + (1 shl (D3DSP_SWIZZLE_SHIFT + 6)); + + D3DSP_REPLICATEBLUE = + (2 shl (D3DSP_SWIZZLE_SHIFT + 0)) or + (2 shl (D3DSP_SWIZZLE_SHIFT + 2)) or + (2 shl (D3DSP_SWIZZLE_SHIFT + 4)) or + (2 shl (D3DSP_SWIZZLE_SHIFT + 6)); + + D3DSP_REPLICATEALPHA = + (3 shl (D3DSP_SWIZZLE_SHIFT + 0)) or + (3 shl (D3DSP_SWIZZLE_SHIFT + 2)) or + (3 shl (D3DSP_SWIZZLE_SHIFT + 4)) or + (3 shl (D3DSP_SWIZZLE_SHIFT + 6)); + + // source parameter modifiers + D3DSP_SRCMOD_SHIFT = 24; + D3DSP_SRCMOD_MASK = $0F000000; + +type + _D3DSHADER_PARAM_SRCMOD_TYPE = DWord; + D3DSHADER_PARAM_SRCMOD_TYPE = _D3DSHADER_PARAM_SRCMOD_TYPE; + TD3DShaderParamSRCModType = _D3DSHADER_PARAM_SRCMOD_TYPE; + +const + D3DSPSM_NONE = 0 shl D3DSP_SRCMOD_SHIFT; // nop + D3DSPSM_NEG = 1 shl D3DSP_SRCMOD_SHIFT; // negate + D3DSPSM_BIAS = 2 shl D3DSP_SRCMOD_SHIFT; // bias + D3DSPSM_BIASNEG = 3 shl D3DSP_SRCMOD_SHIFT; // bias and negate + D3DSPSM_SIGN = 4 shl D3DSP_SRCMOD_SHIFT; // sign + D3DSPSM_SIGNNEG = 5 shl D3DSP_SRCMOD_SHIFT; // sign and negate + D3DSPSM_COMP = 6 shl D3DSP_SRCMOD_SHIFT; // complement + D3DSPSM_X2 = 7 shl D3DSP_SRCMOD_SHIFT; // *2 + D3DSPSM_X2NEG = 8 shl D3DSP_SRCMOD_SHIFT; // *2 and negate + D3DSPSM_DZ = 9 shl D3DSP_SRCMOD_SHIFT; // divide through by z component + D3DSPSM_DW = 10 shl D3DSP_SRCMOD_SHIFT; // divide through by w component + D3DSPSM_ABS = 11 shl D3DSP_SRCMOD_SHIFT; // abs() + D3DSPSM_ABSNEG = 12 shl D3DSP_SRCMOD_SHIFT; // -abs() + D3DSPSM_NOT = 13 shl D3DSP_SRCMOD_SHIFT; // for predicate register: "!p0" + D3DSPSM_FORCE_DWORD = $7fffffff; // force 32-bit size enum + +// pixel shader version token +//#define D3DPS_VERSION(_Major,_Minor) (0xFFFF0000|((_Major)<<8)|(_Minor)) +function D3DPS_VERSION(_Major, _Minor: DWord): DWord;{$IFDEF SUPPORTS_INLINE} inline;{$ENDIF} + +// vertex shader version token +//#define D3DVS_VERSION(_Major,_Minor) (0xFFFE0000|((_Major)<<8)|(_Minor)) +function D3DVS_VERSION(_Major, _Minor: DWord): DWord;{$IFDEF SUPPORTS_INLINE} inline;{$ENDIF} + +// extract major/minor from version cap +//#define D3DSHADER_VERSION_MAJOR(_Version) (((_Version)>>8)&0xFF) +function D3DSHADER_VERSION_MAJOR(_Version: DWord): DWord;{$IFDEF SUPPORTS_INLINE} inline;{$ENDIF} +//#define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF) +function D3DSHADER_VERSION_MINOR(_Version: DWord): DWord;{$IFDEF SUPPORTS_INLINE} inline;{$ENDIF} + +const + // destination/source parameter register type + D3DSI_COMMENTSIZE_SHIFT = 16; + D3DSI_COMMENTSIZE_MASK = $7FFF0000; + +//#define D3DSHADER_COMMENT(_DWordSize) \ +// ((((_DWordSize)<=400) + D3DCURSORCAPS_COLOR = $00000001; + // Driver supports HW cursor also in low-res modes(height < 400) + D3DCURSORCAPS_LOWRES = $00000002; + + // + // DevCaps + // + D3DDEVCAPS_EXECUTESYSTEMMEMORY = $00000010; { Device can use execute buffers from system memory } + D3DDEVCAPS_EXECUTEVIDEOMEMORY = $00000020; { Device can use execute buffers from video memory } + D3DDEVCAPS_TLVERTEXSYSTEMMEMORY = $00000040; { Device can use TL buffers from system memory } + D3DDEVCAPS_TLVERTEXVIDEOMEMORY = $00000080; { Device can use TL buffers from video memory } + D3DDEVCAPS_TEXTURESYSTEMMEMORY = $00000100; { Device can texture from system memory } + D3DDEVCAPS_TEXTUREVIDEOMEMORY = $00000200; { Device can texture from device memory } + D3DDEVCAPS_DRAWPRIMTLVERTEX = $00000400; { Device can draw TLVERTEX primitives } + D3DDEVCAPS_CANRENDERAFTERFLIP = $00000800; { Device can render without waiting for flip to complete } + D3DDEVCAPS_TEXTURENONLOCALVIDMEM = $00001000; { Device can texture from nonlocal video memory } + D3DDEVCAPS_DRAWPRIMITIVES2 = $00002000; { Device can support DrawPrimitives2 } + D3DDEVCAPS_SEPARATETEXTUREMEMORIES = $00004000; { Device is texturing from separate memory pools } + D3DDEVCAPS_DRAWPRIMITIVES2EX = $00008000; { Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver } + D3DDEVCAPS_HWTRANSFORMANDLIGHT = $00010000; { Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also } + D3DDEVCAPS_CANBLTSYSTONONLOCAL = $00020000; { Device supports a Tex Blt from system memory to non-local vidmem } + D3DDEVCAPS_HWRASTERIZATION = $00080000; { Device has HW acceleration for rasterization } + D3DDEVCAPS_PUREDEVICE = $00100000; { Device supports D3DCREATE_PUREDEVICE } + D3DDEVCAPS_QUINTICRTPATCHES = $00200000; { Device supports quintic Beziers and BSplines } + D3DDEVCAPS_RTPATCHES = $00400000; { Device supports Rect and Tri patches } + D3DDEVCAPS_RTPATCHHANDLEZERO = $00800000; { Indicates that RT Patches may be drawn efficiently using handle 0 } + D3DDEVCAPS_NPATCHES = $01000000; { Device supports N-Patches } + + // + // PrimitiveMiscCaps + // + D3DPMISCCAPS_MASKZ = $00000002; + D3DPMISCCAPS_CULLNONE = $00000010; + D3DPMISCCAPS_CULLCW = $00000020; + D3DPMISCCAPS_CULLCCW = $00000040; + D3DPMISCCAPS_COLORWRITEENABLE = $00000080; + D3DPMISCCAPS_CLIPPLANESCALEDPOINTS = $00000100; { Device correctly clips scaled points to clip planes } + D3DPMISCCAPS_CLIPTLVERTS = $00000200; { device will clip post-transformed vertex primitives } + D3DPMISCCAPS_TSSARGTEMP = $00000400; { device supports D3DTA_TEMP for temporary register } + D3DPMISCCAPS_BLENDOP = $00000800; { device supports D3DRS_BLENDOP } + D3DPMISCCAPS_NULLREFERENCE = $00001000; { Reference Device that doesnt render } + D3DPMISCCAPS_INDEPENDENTWRITEMASKS = $00004000; { Device supports independent write masks for MET or MRT } + D3DPMISCCAPS_PERSTAGECONSTANT = $00008000; { Device supports per-stage constants } + D3DPMISCCAPS_FOGANDSPECULARALPHA = $00010000; { Device supports separate fog and specular alpha (many devices + use the specular alpha channel to store fog factor) } + D3DPMISCCAPS_SEPARATEALPHABLEND = $00020000; { Device supports separate blend settings for the alpha channel } + D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS = $00040000; { Device supports different bit depths for MRT } + D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING = $00080000; { Device supports post-pixel shader operations for MRT } + D3DPMISCCAPS_FOGVERTEXCLAMPED = $00100000; { Device clamps fog blend factor per vertex } + + // + // LineCaps + // + D3DLINECAPS_TEXTURE = $00000001; + D3DLINECAPS_ZTEST = $00000002; + D3DLINECAPS_BLEND = $00000004; + D3DLINECAPS_ALPHACMP = $00000008; + D3DLINECAPS_FOG = $00000010; + D3DLINECAPS_ANTIALIAS = $00000020; + + // + // RasterCaps + // + D3DPRASTERCAPS_DITHER = $00000001; + D3DPRASTERCAPS_ZTEST = $00000010; + D3DPRASTERCAPS_FOGVERTEX = $00000080; + D3DPRASTERCAPS_FOGTABLE = $00000100; + D3DPRASTERCAPS_MIPMAPLODBIAS = $00002000; + D3DPRASTERCAPS_ZBUFFERLESSHSR = $00008000; + D3DPRASTERCAPS_FOGRANGE = $00010000; + D3DPRASTERCAPS_ANISOTROPY = $00020000; + D3DPRASTERCAPS_WBUFFER = $00040000; + D3DPRASTERCAPS_WFOG = $00100000; + D3DPRASTERCAPS_ZFOG = $00200000; + D3DPRASTERCAPS_COLORPERSPECTIVE = $00400000; { Device iterates colors perspective correct } + D3DPRASTERCAPS_SCISSORTEST = $01000000; + D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS = $02000000; + D3DPRASTERCAPS_DEPTHBIAS = $04000000; + D3DPRASTERCAPS_MULTISAMPLE_TOGGLE = $08000000; + + // + // ZCmpCaps, AlphaCmpCaps + // + D3DPCMPCAPS_NEVER = $00000001; + D3DPCMPCAPS_LESS = $00000002; + D3DPCMPCAPS_EQUAL = $00000004; + D3DPCMPCAPS_LESSEQUAL = $00000008; + D3DPCMPCAPS_GREATER = $00000010; + D3DPCMPCAPS_NOTEQUAL = $00000020; + D3DPCMPCAPS_GREATEREQUAL = $00000040; + D3DPCMPCAPS_ALWAYS = $00000080; + + // + // SourceBlendCaps, DestBlendCaps + // + D3DPBLENDCAPS_ZERO = $00000001; + D3DPBLENDCAPS_ONE = $00000002; + D3DPBLENDCAPS_SRCCOLOR = $00000004; + D3DPBLENDCAPS_INVSRCCOLOR = $00000008; + D3DPBLENDCAPS_SRCALPHA = $00000010; + D3DPBLENDCAPS_INVSRCALPHA = $00000020; + D3DPBLENDCAPS_DESTALPHA = $00000040; + D3DPBLENDCAPS_INVDESTALPHA = $00000080; + D3DPBLENDCAPS_DESTCOLOR = $00000100; + D3DPBLENDCAPS_INVDESTCOLOR = $00000200; + D3DPBLENDCAPS_SRCALPHASAT = $00000400; + D3DPBLENDCAPS_BOTHSRCALPHA = $00000800; + D3DPBLENDCAPS_BOTHINVSRCALPHA = $00001000; + D3DPBLENDCAPS_BLENDFACTOR = $00002000; { Supports both D3DBLEND_BLENDFACTOR and D3DBLEND_INVBLENDFACTOR } + + // + // ShadeCaps + // + D3DPSHADECAPS_COLORGOURAUDRGB = $00000008; + D3DPSHADECAPS_SPECULARGOURAUDRGB = $00000200; + D3DPSHADECAPS_ALPHAGOURAUDBLEND = $00004000; + D3DPSHADECAPS_FOGGOURAUD = $00080000; + + // + // TextureCaps + // + D3DPTEXTURECAPS_PERSPECTIVE = $00000001; { Perspective-correct texturing is supported } + D3DPTEXTURECAPS_POW2 = $00000002; { Power-of-2 texture dimensions are required - applies to non-Cube/Volume textures only. } + D3DPTEXTURECAPS_ALPHA = $00000004; { Alpha in texture pixels is supported } + D3DPTEXTURECAPS_SQUAREONLY = $00000020; { Only square textures are supported } + D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE = $00000040; { Texture indices are not scaled by the texture size prior to interpolation } + D3DPTEXTURECAPS_ALPHAPALETTE = $00000080; { Device can draw alpha from texture palettes } + // Device can use non-POW2 textures if: + // 1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage + // 2) D3DRS_WRAP(N) is zero for this texture's coordinates + // 3) mip mapping is not enabled (use magnification filter only) + D3DPTEXTURECAPS_NONPOW2CONDITIONAL = $00000100; + D3DPTEXTURECAPS_PROJECTED = $00000400; { Device can do D3DTTFF_PROJECTED } + D3DPTEXTURECAPS_CUBEMAP = $00000800; { Device can do cubemap textures } + D3DPTEXTURECAPS_VOLUMEMAP = $00002000; { Device can do volume textures } + D3DPTEXTURECAPS_MIPMAP = $00004000; { Device can do mipmapped textures } + D3DPTEXTURECAPS_MIPVOLUMEMAP = $00008000; { Device can do mipmapped volume textures } + D3DPTEXTURECAPS_MIPCUBEMAP = $00010000; { Device can do mipmapped cube maps } + D3DPTEXTURECAPS_CUBEMAP_POW2 = $00020000; { Device requires that cubemaps be power-of-2 dimension } + D3DPTEXTURECAPS_VOLUMEMAP_POW2 = $00040000; { Device requires that volume maps be power-of-2 dimension } + D3DPTEXTURECAPS_NOPROJECTEDBUMPENV = $00200000; { Device does not support projected bump env lookup operation + in programmable and fixed function pixel shaders } + + // + // TextureFilterCaps, StretchRectFilterCaps + // + D3DPTFILTERCAPS_MINFPOINT = $00000100; { Min Filter } + D3DPTFILTERCAPS_MINFLINEAR = $00000200; + D3DPTFILTERCAPS_MINFANISOTROPIC = $00000400; + D3DPTFILTERCAPS_MINFPYRAMIDALQUAD = $00000800; + D3DPTFILTERCAPS_MINFGAUSSIANQUAD = $00001000; + D3DPTFILTERCAPS_MIPFPOINT = $00010000; { Mip Filter } + D3DPTFILTERCAPS_MIPFLINEAR = $00020000; + D3DPTFILTERCAPS_MAGFPOINT = $01000000; { Mag Filter } + D3DPTFILTERCAPS_MAGFLINEAR = $02000000; + D3DPTFILTERCAPS_MAGFANISOTROPIC = $04000000; + D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD = $08000000; + D3DPTFILTERCAPS_MAGFGAUSSIANQUAD = $10000000; + + // + // TextureAddressCaps + // + D3DPTADDRESSCAPS_WRAP = $00000001; + D3DPTADDRESSCAPS_MIRROR = $00000002; + D3DPTADDRESSCAPS_CLAMP = $00000004; + D3DPTADDRESSCAPS_BORDER = $00000008; + D3DPTADDRESSCAPS_INDEPENDENTUV = $00000010; + D3DPTADDRESSCAPS_MIRRORONCE = $00000020; + + // + // StencilCaps + // + D3DSTENCILCAPS_KEEP = $00000001; + D3DSTENCILCAPS_ZERO = $00000002; + D3DSTENCILCAPS_REPLACE = $00000004; + D3DSTENCILCAPS_INCRSAT = $00000008; + D3DSTENCILCAPS_DECRSAT = $00000010; + D3DSTENCILCAPS_INVERT = $00000020; + D3DSTENCILCAPS_INCR = $00000040; + D3DSTENCILCAPS_DECR = $00000080; + D3DSTENCILCAPS_TWOSIDED = $00000100; + + // + // TextureOpCaps + // + D3DTEXOPCAPS_DISABLE = $00000001; + D3DTEXOPCAPS_SELECTARG1 = $00000002; + D3DTEXOPCAPS_SELECTARG2 = $00000004; + D3DTEXOPCAPS_MODULATE = $00000008; + D3DTEXOPCAPS_MODULATE2X = $00000010; + D3DTEXOPCAPS_MODULATE4X = $00000020; + D3DTEXOPCAPS_ADD = $00000040; + D3DTEXOPCAPS_ADDSIGNED = $00000080; + D3DTEXOPCAPS_ADDSIGNED2X = $00000100; + D3DTEXOPCAPS_SUBTRACT = $00000200; + D3DTEXOPCAPS_ADDSMOOTH = $00000400; + D3DTEXOPCAPS_BLENDDIFFUSEALPHA = $00000800; + D3DTEXOPCAPS_BLENDTEXTUREALPHA = $00001000; + D3DTEXOPCAPS_BLENDFACTORALPHA = $00002000; + D3DTEXOPCAPS_BLENDTEXTUREALPHAPM = $00004000; + D3DTEXOPCAPS_BLENDCURRENTALPHA = $00008000; + D3DTEXOPCAPS_PREMODULATE = $00010000; + D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR = $00020000; + D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA = $00040000; + D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR = $00080000; + D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA = $00100000; + D3DTEXOPCAPS_BUMPENVMAP = $00200000; + D3DTEXOPCAPS_BUMPENVMAPLUMINANCE = $00400000; + D3DTEXOPCAPS_DOTPRODUCT3 = $00800000; + D3DTEXOPCAPS_MULTIPLYADD = $01000000; + D3DTEXOPCAPS_LERP = $02000000; + + // + // FVFCaps + // + D3DFVFCAPS_TEXCOORDCOUNTMASK = $0000ffff; { mask for texture coordinate count field } + D3DFVFCAPS_DONOTSTRIPELEMENTS = $00080000; { Device prefers that vertex elements not be stripped } + D3DFVFCAPS_PSIZE = $00100000; { Device can receive point size } + + // + // VertexProcessingCaps + // + D3DVTXPCAPS_TEXGEN = $00000001; { device can do texgen } + D3DVTXPCAPS_MATERIALSOURCE7 = $00000002; { device can do DX7-level colormaterialsource ops } + D3DVTXPCAPS_DIRECTIONALLIGHTS = $00000008; { device can do directional lights } + D3DVTXPCAPS_POSITIONALLIGHTS = $00000010; { device can do positional lights (includes point and spot) } + D3DVTXPCAPS_LOCALVIEWER = $00000020; { device can do local viewer } + D3DVTXPCAPS_TWEENING = $00000040; { device can do vertex tweening } + D3DVTXPCAPS_TEXGEN_SPHEREMAP = $00000100; { device supports D3DTSS_TCI_SPHEREMAP } + D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER = $00000200; { device does not support TexGen in non-local + viewer mode } + + // + // DevCaps2 + // + D3DDEVCAPS2_STREAMOFFSET = $00000001; { Device supports offsets in streams. Must be set by DX9 drivers } + D3DDEVCAPS2_DMAPNPATCH = $00000002; { Device supports displacement maps for N-Patches} + D3DDEVCAPS2_ADAPTIVETESSRTPATCH = $00000004; { Device supports adaptive tesselation of RT-patches} + D3DDEVCAPS2_ADAPTIVETESSNPATCH = $00000008; { Device supports adaptive tesselation of N-patches} + D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES = $00000010; { Device supports StretchRect calls with a texture as the source} + D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH = $00000020; { Device supports presampled displacement maps for N-Patches } + D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET = $00000040; { Vertex elements in a vertex declaration can share the same stream offset } + + // + // DeclTypes + // + D3DDTCAPS_UBYTE4 = $00000001; + D3DDTCAPS_UBYTE4N = $00000002; + D3DDTCAPS_SHORT2N = $00000004; + D3DDTCAPS_SHORT4N = $00000008; + D3DDTCAPS_USHORT2N = $00000010; + D3DDTCAPS_USHORT4N = $00000020; + D3DDTCAPS_UDEC3 = $00000040; + D3DDTCAPS_DEC3N = $00000080; + D3DDTCAPS_FLOAT16_2 = $00000100; + D3DDTCAPS_FLOAT16_4 = $00000200; + + + + +(*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d9.h + * Content: Direct3D include file + * + ****************************************************************************) + +(* This identifier is passed to Direct3DCreate9 in order to ensure that an + * application was built against the correct header files. This number is + * incremented whenever a header (or other) change would require applications + * to be rebuilt. If the version doesn't match, Direct3DCreate9 will fail. + * (The number itself has no meaning.)*) + +const + D3D_SDK_VERSION = (32 or $80000000); + D3D9b_SDK_VERSION = (31 or $80000000); + +type + HMONITOR = THandle; + +(* + * Direct3D interfaces + *) + + // forward interfaces declaration + IDirect3D9 = interface; + IDirect3DDevice9 = interface; + IDirect3DStateBlock9 = interface; + IDirect3DVertexDeclaration9 = interface; + IDirect3DVertexShader9 = interface; + IDirect3DPixelShader9 = interface; + IDirect3DResource9 = interface; + IDirect3DBaseTexture9 = interface; + IDirect3DTexture9 = interface; + IDirect3DVolumeTexture9 = interface; + IDirect3DCubeTexture9 = interface; + IDirect3DVertexBuffer9 = interface; + IDirect3DIndexBuffer9 = interface; + IDirect3DSurface9 = interface; + IDirect3DVolume9 = interface; + IDirect3DSwapChain9 = interface; + IDirect3DQuery9 = interface; + + + IDirect3D9 = interface(IUnknown) + ['{81BDCBCA-64D4-426d-AE8D-AD0147F4275C}'] + (*** IDirect3D9 methods ***) + function RegisterSoftwareDevice(pInitializeFunction: Pointer): HResult; stdcall; + function GetAdapterCount: LongWord; stdcall; + function GetAdapterIdentifier(Adapter: LongWord; Flags: DWord; out pIdentifier: TD3DAdapterIdentifier9): HResult; stdcall; + function GetAdapterModeCount(Adapter: LongWord; Format: TD3DFormat): LongWord; stdcall; + function EnumAdapterModes(Adapter: LongWord; Format: TD3DFormat; Mode: LongWord; out pMode: TD3DDisplayMode): HResult; stdcall; + function GetAdapterDisplayMode(Adapter: LongWord; out pMode: TD3DDisplayMode): HResult; stdcall; + function CheckDeviceType(Adapter: LongWord; CheckType: TD3DDevType; AdapterFormat, BackBufferFormat: TD3DFormat; Windowed: BOOL): HResult; stdcall; + function CheckDeviceFormat(Adapter: LongWord; DeviceType: TD3DDevType; AdapterFormat: TD3DFormat; Usage: DWord; RType: TD3DResourceType; CheckFormat: TD3DFormat): HResult; stdcall; + function CheckDeviceMultiSampleType(Adapter: LongWord; DeviceType: TD3DDevType; SurfaceFormat: TD3DFormat; Windowed: BOOL; MultiSampleType: TD3DMultiSampleType; pQualityLevels: PDWORD): HResult; stdcall; + function CheckDepthStencilMatch(Adapter: LongWord; DeviceType: TD3DDevType; AdapterFormat, RenderTargetFormat, DepthStencilFormat: TD3DFormat): HResult; stdcall; + function CheckDeviceFormatConversion(Adapter: LongWord; DeviceType: TD3DDevType; SourceFormat, TargetFormat: TD3DFormat): HResult; stdcall; + function GetDeviceCaps(Adapter: LongWord; DeviceType: TD3DDevType; out pCaps: TD3DCaps9): HResult; stdcall; + function GetAdapterMonitor(Adapter: LongWord): HMONITOR; stdcall; + function CreateDevice(Adapter: LongWord; DeviceType: TD3DDevType; hFocusWindow: HWND; BehaviorFlags: DWord; pPresentationParameters: PD3DPresentParameters; out ppReturnedDeviceInterface: IDirect3DDevice9): HResult; stdcall; + end; + + IDirect3D9Helper = class + (*** helper information ***) + szVersionString: PWideChar; + end; + + + + +{ SwapChain } + + + + + + IDirect3DDevice9 = interface(IUnknown) + ['{D0223B96-BF7A-43fd-92BD-A43B0D82B9EB}'] + (*** IDirect3DDevice9 methods ***) + function TestCooperativeLevel: HResult; stdcall; + function GetAvailableTextureMem: LongWord; stdcall; + function EvictManagedResources: HResult; stdcall; + function GetDirect3D(out ppD3D9: IDirect3D9): HResult; stdcall; + function GetDeviceCaps(out pCaps: TD3DCaps9): HResult; stdcall; + function GetDisplayMode(iSwapChain: LongWord; out pMode: TD3DDisplayMode): HResult; stdcall; + function GetCreationParameters(out pParameters: TD3DDeviceCreationParameters): HResult; stdcall; + function SetCursorProperties(XHotSpot, YHotSpot: LongWord; pCursorBitmap: IDirect3DSurface9): HResult; stdcall; + procedure SetCursorPosition(XScreenSpace, YScreenSpace: LongWord; Flags: DWord); stdcall; + function ShowCursor(bShow: BOOL): BOOL; stdcall; + function CreateAdditionalSwapChain(const pPresentationParameters: TD3DPresentParameters; out pSwapChain: IDirect3DSwapChain9): HResult; stdcall; + function GetSwapChain(iSwapChain: LongWord; out pSwapChain: IDirect3DSwapChain9): HResult; stdcall; + function GetNumberOfSwapChains: LongWord; stdcall; + function Reset(const pPresentationParameters: TD3DPresentParameters): HResult; stdcall; + function Present(pSourceRect, pDestRect: PRect; hDestWindowOverride: HWND; pDirtyRegion: PRgnData): HResult; stdcall; + function GetBackBuffer(iSwapChain: LongWord; iBackBuffer: LongWord; _Type: TD3DBackBufferType; out ppBackBuffer: IDirect3DSurface9): HResult; stdcall; + function GetRasterStatus(iSwapChain: LongWord; out pRasterStatus: TD3DRasterStatus): HResult; stdcall; + function SetDialogBoxMode(bEnableDialogs: BOOL): HResult; stdcall; + procedure SetGammaRamp(iSwapChain: LongWord; Flags: DWord; const pRamp: TD3DGammaRamp); stdcall; + procedure GetGammaRamp(iSwapChain: LongWord; out pRamp: TD3DGammaRamp); stdcall; + function CreateTexture(Width, Height, Levels: LongWord; Usage: DWord; Format: TD3DFormat; Pool: TD3DPool; out ppTexture: IDirect3DTexture9; pSharedHandle: PHandle): HResult; stdcall; + function CreateVolumeTexture(Width, Height, Depth, Levels: LongWord; Usage: DWord; Format: TD3DFormat; Pool: TD3DPool; out ppVolumeTexture: IDirect3DVolumeTexture9; pSharedHandle: PHandle): HResult; stdcall; + function CreateCubeTexture(EdgeLength, Levels: LongWord; Usage: DWord; Format: TD3DFormat; Pool: TD3DPool; out ppCubeTexture: IDirect3DCubeTexture9; pSharedHandle: PHandle): HResult; stdcall; + function CreateVertexBuffer(Length: LongWord; Usage, FVF: DWord; Pool: TD3DPool; out ppVertexBuffer: IDirect3DVertexBuffer9; pSharedHandle: PHandle): HResult; stdcall; + function CreateIndexBuffer(Length: LongWord; Usage: DWord; Format: TD3DFormat; Pool: TD3DPool; out ppIndexBuffer: IDirect3DIndexBuffer9; pSharedHandle: PHandle): HResult; stdcall; + function CreateRenderTarget(Width, Height: LongWord; Format: TD3DFormat; MultiSample: TD3DMultiSampleType; MultisampleQuality: DWORD; Lockable: BOOL; out ppSurface: IDirect3DSurface9; pSharedHandle: PHandle): HResult; stdcall; + function CreateDepthStencilSurface(Width, Height: LongWord; Format: TD3DFormat; MultiSample: TD3DMultiSampleType; MultisampleQuality: DWORD; Discard: BOOL; out ppSurface: IDirect3DSurface9; pSharedHandle: PHandle): HResult; stdcall; + function UpdateSurface(pSourceSurface: IDirect3DSurface9; pSourceRect: PRect; pDestinationSurface: IDirect3DSurface9; pDestPoint: PPoint): HResult; stdcall; + function UpdateTexture(pSourceTexture, pDestinationTexture: IDirect3DBaseTexture9): HResult; stdcall; + function GetRenderTargetData(pRenderTarget, pDestSurface: IDirect3DSurface9): HResult; stdcall; + function GetFrontBufferData(iSwapChain: LongWord; pDestSurface: IDirect3DSurface9): HResult; stdcall; + function StretchRect(pSourceSurface: IDirect3DSurface9; pSourceRect: PRect; pDestSurface: IDirect3DSurface9; pDestRect: PRect; Filter: TD3DTextureFilterType): HResult; stdcall; + function ColorFill(pSurface: IDirect3DSurface9; pRect: PRect; color: TD3DColor): HResult; stdcall; + function CreateOffscreenPlainSurface(Width, Height: LongWord; Format: TD3DFormat; Pool: TD3DPool; out ppSurface: IDirect3DSurface9; pSharedHandle: PHandle): HResult; stdcall; + function SetRenderTarget(RenderTargetIndex: DWORD; pRenderTarget: IDirect3DSurface9): HResult; stdcall; + function GetRenderTarget(RenderTargetIndex: DWORD; out ppRenderTarget: IDirect3DSurface9): HResult; stdcall; + function SetDepthStencilSurface(pNewZStencil: IDirect3DSurface9): HResult; stdcall; + function GetDepthStencilSurface(out ppZStencilSurface: IDirect3DSurface9): HResult; stdcall; + function BeginScene: HResult; stdcall; + function EndScene: HResult; stdcall; + function Clear(Count: DWord; pRects: PD3DRect; Flags: DWord; Color: TD3DColor; Z: Single; Stencil: DWord): HResult; stdcall; + function SetTransform(State: TD3DTransformStateType; const pMatrix: TD3DMatrix): HResult; stdcall; + function GetTransform(State: TD3DTransformStateType; out pMatrix: TD3DMatrix): HResult; stdcall; + function MultiplyTransform(State: TD3DTransformStateType; const pMatrix: TD3DMatrix): HResult; stdcall; + function SetViewport(const pViewport: TD3DViewport9): HResult; stdcall; + function GetViewport(out pViewport: TD3DViewport9): HResult; stdcall; + function SetMaterial(const pMaterial: TD3DMaterial9): HResult; stdcall; + function GetMaterial(out pMaterial: TD3DMaterial9): HResult; stdcall; + function SetLight(Index: DWord; const pLight: TD3DLight9): HResult; stdcall; + function GetLight(Index: DWord; out pLight: TD3DLight9): HResult; stdcall; + function LightEnable(Index: DWord; Enable: BOOL): HResult; stdcall; + function GetLightEnable(Index: DWord; out pEnable: BOOL): HResult; stdcall; + function SetClipPlane(Index: DWord; pPlane: PSingle): HResult; stdcall; + function GetClipPlane(Index: DWord; pPlane: PSingle): HResult; stdcall; + function SetRenderState(State: TD3DRenderStateType; Value: DWord): HResult; stdcall; + function GetRenderState(State: TD3DRenderStateType; out pValue: DWord): HResult; stdcall; + function CreateStateBlock(_Type: TD3DStateBlockType; out ppSB: IDirect3DStateBlock9): HResult; stdcall; + function BeginStateBlock: HResult; stdcall; + function EndStateBlock(out ppSB: IDirect3DStateBlock9): HResult; stdcall; + function SetClipStatus(const pClipStatus: TD3DClipStatus9): HResult; stdcall; + function GetClipStatus(out pClipStatus: TD3DClipStatus9): HResult; stdcall; + function GetTexture(Stage: DWord; out ppTexture: IDirect3DBaseTexture9): HResult; stdcall; + function SetTexture(Stage: DWord; pTexture: IDirect3DBaseTexture9): HResult; stdcall; + function GetTextureStageState(Stage: DWord; _Type: TD3DTextureStageStateType; out pValue: DWord): HResult; stdcall; + function SetTextureStageState(Stage: DWord; _Type: TD3DTextureStageStateType; Value: DWord): HResult; stdcall; + function GetSamplerState(Sampler: DWORD; _Type: TD3DSamplerStateType; out pValue: DWORD): HResult; stdcall; + function SetSamplerState(Sampler: DWORD; _Type: TD3DSamplerStateType; Value: DWORD): HResult; stdcall; + function ValidateDevice(out pNumPasses: DWord): HResult; stdcall; + function SetPaletteEntries(PaletteNumber: LongWord; pEntries: pPaletteEntry): HResult; stdcall; + function GetPaletteEntries(PaletteNumber: LongWord; pEntries: pPaletteEntry): HResult; stdcall; + function SetCurrentTexturePalette(PaletteNumber: LongWord): HResult; stdcall; + function GetCurrentTexturePalette(out PaletteNumber: LongWord): HResult; stdcall; + function SetScissorRect(pRect: PRect): HResult; stdcall; + function GetScissorRect(out pRect: TRect): HResult; stdcall; + function SetSoftwareVertexProcessing(bSoftware: BOOL): HResult; stdcall; + function GetSoftwareVertexProcessing: BOOL; stdcall; + function SetNPatchMode(nSegments: Single): HResult; stdcall; + function GetNPatchMode: Single; stdcall; + function DrawPrimitive(PrimitiveType: TD3DPrimitiveType; StartVertex, PrimitiveCount: LongWord): HResult; stdcall; + function DrawIndexedPrimitive(_Type: TD3DPrimitiveType; BaseVertexIndex: Integer; MinVertexIndex, NumVertices, startIndex, primCount: LongWord): HResult; stdcall; + function DrawPrimitiveUP(PrimitiveType: TD3DPrimitiveType; PrimitiveCount: LongWord; const pVertexStreamZeroData; VertexStreamZeroStride: LongWord): HResult; stdcall; + function DrawIndexedPrimitiveUP(PrimitiveType: TD3DPrimitiveType; MinVertexIndex, NumVertice, PrimitiveCount: LongWord; const pIndexData; IndexDataFormat: TD3DFormat; const pVertexStreamZeroData; VertexStreamZeroStride: LongWord): HResult; stdcall; + function ProcessVertices(SrcStartIndex, DestIndex, VertexCount: LongWord; pDestBuffer: IDirect3DVertexBuffer9; pVertexDecl: IDirect3DVertexDeclaration9; Flags: DWord): HResult; stdcall; + function CreateVertexDeclaration(pVertexElements: PD3DVertexElement9; out ppDecl: IDirect3DVertexDeclaration9): HResult; stdcall; + function SetVertexDeclaration(pDecl: IDirect3DVertexDeclaration9): HResult; stdcall; + function GetVertexDeclaration(out ppDecl: IDirect3DVertexDeclaration9): HResult; stdcall; + function SetFVF(FVF: DWORD): HResult; stdcall; + function GetFVF(out FVF: DWORD): HResult; stdcall; + function CreateVertexShader(pFunction: PDWord; out ppShader: IDirect3DVertexShader9): HResult; stdcall; + function SetVertexShader(pShader: IDirect3DVertexShader9): HResult; stdcall; + function GetVertexShader(out ppShader: IDirect3DVertexShader9): HResult; stdcall; + function SetVertexShaderConstantF(StartRegister: LongWord; pConstantData: PSingle; Vector4fCount: LongWord): HResult; stdcall; + function GetVertexShaderConstantF(StartRegister: LongWord; pConstantData: PSingle; Vector4fCount: LongWord): HResult; stdcall; + function SetVertexShaderConstantI(StartRegister: LongWord; pConstantData: PInteger; Vector4iCount: LongWord): HResult; stdcall; + function GetVertexShaderConstantI(StartRegister: LongWord; pConstantData: PInteger; Vector4iCount: LongWord): HResult; stdcall; + function SetVertexShaderConstantB(StartRegister: LongWord; pConstantData: PBOOL; BoolCount: LongWord): HResult; stdcall; + function GetVertexShaderConstantB(StartRegister: LongWord; pConstantData: PBOOL; BoolCount: LongWord): HResult; stdcall; + function SetStreamSource(StreamNumber: LongWord; pStreamData: IDirect3DVertexBuffer9; OffsetInBytes, Stride: LongWord): HResult; stdcall; + function GetStreamSource(StreamNumber: LongWord; out ppStreamData: IDirect3DVertexBuffer9; out pOffsetInBytes, pStride: LongWord): HResult; stdcall; + function SetStreamSourceFreq(StreamNumber: LongWord; Setting: LongWord): HResult; stdcall; + function GetStreamSourceFreq(StreamNumber: LongWord; out Setting: LongWord): HResult; stdcall; + function SetIndices(pIndexData: IDirect3DIndexBuffer9): HResult; stdcall; + function GetIndices(out ppIndexData: IDirect3DIndexBuffer9): HResult; stdcall; + function CreatePixelShader(pFunction: PDWord; out ppShader: IDirect3DPixelShader9): HResult; stdcall; + function SetPixelShader(pShader: IDirect3DPixelShader9): HResult; stdcall; + function GetPixelShader(out ppShader: IDirect3DPixelShader9): HResult; stdcall; + function SetPixelShaderConstantF(StartRegister: LongWord; pConstantData: PSingle; Vector4fCount: LongWord): HResult; stdcall; + function GetPixelShaderConstantF(StartRegister: LongWord; pConstantData: PSingle; Vector4fCount: LongWord): HResult; stdcall; + function SetPixelShaderConstantI(StartRegister: LongWord; pConstantData: PInteger; Vector4iCount: LongWord): HResult; stdcall; + function GetPixelShaderConstantI(StartRegister: LongWord; pConstantData: PInteger; Vector4iCount: LongWord): HResult; stdcall; + function SetPixelShaderConstantB(StartRegister: LongWord; pConstantData: PBOOL; BoolCount: LongWord): HResult; stdcall; + function GetPixelShaderConstantB(StartRegister: LongWord; pConstantData: PBOOL; BoolCount: LongWord): HResult; stdcall; + function DrawRectPatch(Handle: LongWord; pNumSegs: PSingle; pTriPatchInfo: PD3DRectPatchInfo): HResult; stdcall; + function DrawTriPatch(Handle: LongWord; pNumSegs: PSingle; pTriPatchInfo: PD3DTriPatchInfo): HResult; stdcall; + function DeletePatch(Handle: LongWord): HResult; stdcall; + function CreateQuery(_Type: TD3DQueryType; out ppQuery: IDirect3DQuery9): HResult; stdcall; + end; + + IDirect3DDevice9Helper = class + (*** helper information ***) + CreationParameters: TD3DDeviceCreationParameters; + PresentParameters: TD3DPresentParameters; + DisplayMode: TD3DDisplayMode; + Caps: TD3DCaps9; + + AvailableTextureMem: LongWord; + SwapChains: LongWord; + Textures: LongWord; + VertexBuffers: LongWord; + IndexBuffers: LongWord; + VertexShaders: LongWord; + PixelShaders: LongWord; + + Viewport: TD3DViewport9; + ProjectionMatrix: TD3DMatrix; + ViewMatrix: TD3DMatrix; + WorldMatrix: TD3DMatrix; + TextureMatrices: array[0..7] of TD3DMatrix; + + FVF: DWORD; + VertexSize: LongWord; + VertexShaderVersion: DWORD; + PixelShaderVersion: DWORD; + SoftwareVertexProcessing: BOOL; + + Material: TD3DMaterial9; + Lights: array[0..15] of TD3DLight9; + LightsEnabled: array[0..15] of BOOL; + + GammaRamp: TD3DGammaRamp; + ScissorRect: TRect; + DialogBoxMode: BOOL; + end; + + + + IDirect3DStateBlock9 = interface(IUnknown) + ['{B07C4FE5-310D-4ba8-A23C-4F0F206F218B}'] + (*** IDirect3DStateBlock9 methods ***) + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function Capture: HResult; stdcall; + function Apply: HResult; stdcall; + end; + + IDirect3DStateBlock9Helper = class + (*** helper information ***) + CreationCallStack: PWideChar; + end; + + + + IDirect3DSwapChain9 = interface(IUnknown) + ['{794950F2-ADFC-458a-905E-10A10B0B503B}'] + (*** IDirect3DSwapChain9 methods ***) + function Present(pSourceRect, pDestRect: PRect; hDestWindowOverride: HWND; pDirtyRegion: PRgnData; dwFlags: DWORD): HResult; stdcall; + function GetFrontBufferData(pDestSurface: IDirect3DSurface9): HResult; stdcall; + function GetBackBuffer(iBackBuffer: LongWord; _Type: TD3DBackBufferType; out ppBackBuffer: IDirect3DSurface9): HResult; stdcall; + function GetRasterStatus(out pRasterStatus: TD3DRasterStatus): HResult; stdcall; + function GetDisplayMode(out pMode: TD3DDisplayMode): HResult; stdcall; + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function GetPresentParameters(out pPresentationParameters: TD3DPresentParameters): HResult; stdcall; + end; + + IDirect3DSwapChain9Helper = class + (*** helper information ***) + PresentParameters: TD3DPresentParameters; + DisplayMode: TD3DDisplayMode; + CreationCallStack: PWideChar; + end; + + + + IDirect3DResource9 = interface(IUnknown) + ['{05EEC05D-8F7D-4362-B999-D1BAF357C704}'] + (*** IDirect3DResource9 methods ***) + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function SetPrivateData(const refguid: TGUID; const pData: Pointer; SizeOfData, Flags: DWord): HResult; stdcall; + function GetPrivateData(const refguid: TGUID; pData: Pointer; out pSizeOfData: DWord): HResult; stdcall; + function FreePrivateData(const refguid: TGUID): HResult; stdcall; + function SetPriority(PriorityNew: DWord): DWord; stdcall; + function GetPriority: DWord; stdcall; + procedure PreLoad; stdcall; + function GetType: TD3DResourceType; stdcall; + end; + + + IDirect3DVertexDeclaration9 = interface(IUnknown) + ['{DD13C59C-36FA-4098-A8FB-C7ED39DC8546}'] + (*** IDirect3DVertexDeclaration9 methods ***) + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function GetDeclaration(pElement: PD3DVertexElement9; out pNumElements: LongWord): HResult; stdcall; + end; + + IDirect3DVertexDeclaration9Helper = class + (*** helper information ***) + CreationCallStack: PWideChar; + end; + + + + IDirect3DVertexShader9 = interface(IUnknown) + ['{EFC5557E-6265-4613-8A94-43857889EB36}'] + (*** IDirect3DVertexShader9 methods ***) + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function GetFunction(pData: Pointer; out pSizeOfData: LongWord): HResult; stdcall; + end; + + IDirect3DVertexShader9Helper = class + (*** helper information ***) + Version: DWORD; + CreationCallStack: PWideChar; + end; + + + + IDirect3DPixelShader9 = interface(IUnknown) + ['{6D3BDBDC-5B02-4415-B852-CE5E8BCCB289}'] + (*** IDirect3DPixelShader9 methods ***) + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function GetFunction(pData: Pointer; out pSizeOfData: LongWord): HResult; stdcall; + end; + + IDirect3DPixelShader9Helper = class + (*** helper information ***) + Version: DWORD; + CreationCallStack: PWideChar; + end; + + + + IDirect3DBaseTexture9 = interface(IDirect3DResource9) + ['{580CA87E-1D3C-4d54-991D-B7D3E3C298CE}'] + (*** IDirect3DBaseTexture9 methods ***) + function SetLOD(LODNew: DWord): DWord; stdcall; + function GetLOD: DWord; stdcall; + function GetLevelCount: DWord; stdcall; + function SetAutoGenFilterType(FilterType: TD3DTextureFilterType): HResult; stdcall; + function GetAutoGenFilterType: TD3DTextureFilterType; stdcall; + procedure GenerateMipSubLevels; + end; + + + IDirect3DTexture9 = interface(IDirect3DBaseTexture9) + ['{85C31227-3DE5-4f00-9B3A-F11AC38C18B5}'] + (*** IDirect3DTexture9 methods ***) + function GetLevelDesc(Level: LongWord; out pDesc: TD3DSurfaceDesc): HResult; stdcall; + function GetSurfaceLevel(Level: LongWord; out ppSurfaceLevel: IDirect3DSurface9): HResult; stdcall; + function LockRect(Level: LongWord; out pLockedRect: TD3DLockedRect; pRect: PRect; Flags: DWord): HResult; stdcall; + function UnlockRect(Level: LongWord): HResult; stdcall; + function AddDirtyRect(pDirtyRect: PRect): HResult; stdcall; + end; + + IDirect3DTexture9Helper = class + (*** helper information ***) + Name: PWideChar; + Width: LongWord; + Height: LongWord; + Levels: LongWord; + Usage: DWORD; + Format: TD3DFormat; + Pool: TD3DPool; + Priority: DWORD; + LOD: DWORD; + FilterType: TD3DTextureFilterType; + LockCount: LongWord; + CreationCallStack: PWideChar; + end; + + + + IDirect3DVolumeTexture9 = interface(IDirect3DBaseTexture9) + ['{2518526C-E789-4111-A7B9-47EF328D13E6}'] + (*** IDirect3DVolumeTexture9 methods ***) + function GetLevelDesc(Level: LongWord; out pDesc: TD3DVolumeDesc): HResult; stdcall; + function GetVolumeLevel(Level: LongWord; out ppVolumeLevel: IDirect3DVolume9): HResult; stdcall; + function LockBox(Level: LongWord; out pLockedVolume: TD3DLockedBox; pBox: PD3DBox; Flags: DWord): HResult; stdcall; + function UnlockBox(Level: LongWord): HResult; stdcall; + function AddDirtyBox(pDirtyBox: PD3DBox): HResult; stdcall; + end; + + IDirect3DVolumeTexture9Helper = class + (*** helper information ***) + Name: PWideChar; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + Levels: LongWord; + Usage: DWORD; + Format: TD3DFormat; + Pool: TD3DPool; + Priority: DWORD; + LOD: DWORD; + FilterType: TD3DTextureFilterType; + LockCount: LongWord; + CreationCallStack: PWideChar; + end; + + + + IDirect3DCubeTexture9 = interface(IDirect3DBaseTexture9) + ['{FFF32F81-D953-473a-9223-93D652ABA93F}'] + (*** IDirect3DCubeTexture9 methods ***) + function GetLevelDesc(Level: LongWord; out pDesc: TD3DSurfaceDesc): HResult; stdcall; + function GetCubeMapSurface(FaceType: TD3DCubeMapFaces; Level: LongWord; out ppCubeMapSurface: IDirect3DSurface9): HResult; stdcall; + function LockRect(FaceType: TD3DCubeMapFaces; Level: LongWord; out pLockedRect: TD3DLockedRect; pRect: PRect; Flags: DWord): HResult; stdcall; + function UnlockRect(FaceType: TD3DCubeMapFaces; Level: LongWord): HResult; stdcall; + function AddDirtyRect(FaceType: TD3DCubeMapFaces; pDirtyRect: PRect): HResult; stdcall; + end; + + IDirect3DCubeTexture9Helper = class + (*** helper information ***) + Name: PWideChar; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + Levels: LongWord; + Usage: DWORD; + Format: TD3DFormat; + Pool: TD3DPool; + Priority: DWORD; + LOD: DWORD; + FilterType: TD3DTextureFilterType; + LockCount: LongWord; + CreationCallStack: PWideChar; + end; + + + + IDirect3DVertexBuffer9 = interface(IDirect3DResource9) + ['{B64BB1B5-FD70-4df6-BF91-19D0A12455E3}'] + (*** IDirect3DVertexBuffer9 methods ***) + function Lock(OffsetToLock, SizeToLock: LongWord; out ppbData: Pointer; Flags: DWord): HResult; stdcall; + function Unlock: HResult; stdcall; + function GetDesc(out pDesc: TD3DVertexBufferDesc): HResult; stdcall; + end; + + IDirect3DVertexBuffer9Helper = class + (*** helper information ***) + Name: PWideChar; + Length: LongWord; + Usage: DWORD; + FVF: DWORD; + Pool: TD3DPool; + Priority: DWORD; + LockCount: LongWord; + CreationCallStack: PWideChar; + end; + + + + IDirect3DIndexBuffer9 = interface(IDirect3DResource9) + ['{7C9DD65E-D3F7-4529-ACEE-785830ACDE35}'] + (*** IDirect3DIndexBuffer9 methods ***) + function Lock(OffsetToLock, SizeToLock: DWord; out ppbData: Pointer; Flags: DWord): HResult; stdcall; + function Unlock: HResult; stdcall; + function GetDesc(out pDesc: TD3DIndexBufferDesc): HResult; stdcall; + end; + + IDirect3DIndexBuffer9Helper = class + (*** helper information ***) + Name: PWideChar; + Length: LongWord; + Usage: DWORD; + Format: TD3DFormat; + Pool: TD3DPool; + Priority: DWORD; + LockCount: LongWord; + CreationCallStack: PWideChar; + end; + + + + IDirect3DSurface9 = interface(IDirect3DResource9) + ['{0CFBAF3A-9FF6-429a-99B3-A2796AF8B89B}'] + (*** IDirect3DSurface9 methods ***) + function GetContainer(const riid: TGUID; out ppContainer{: Pointer}): HResult; stdcall; + function GetDesc(out pDesc: TD3DSurfaceDesc): HResult; stdcall; + function LockRect(out pLockedRect: TD3DLockedRect; pRect: PRect; Flags: DWord): HResult; stdcall; + function UnlockRect: HResult; stdcall; + function GetDC(out phdc: HDC): HResult; stdcall; + function ReleaseDC(hdc: HDC): HResult; stdcall; + end; + + IDirect3DSurface9Helper = class + (*** helper information ***) + Name: PWideChar; + Width: LongWord; + Height: LongWord; + Usage: DWORD; + Format: TD3DFormat; + Pool: TD3DPool; + MultiSampleType: TD3DMultiSampleType; + MultiSampleQuality: DWORD; + Priority: DWORD; + LockCount: LongWord; + DCCount: LongWord; + CreationCallStack: PWideChar; + end; + + + + IDirect3DVolume9 = interface (IUnknown) + ['{24F416E6-1F67-4aa7-B88E-D33F6F3128A1}'] + (*** IDirect3DVolume9 methods ***) + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function SetPrivateData(const refguid: TGUID; const pData; SizeOfData, Flags: DWord): HResult; stdcall; + function GetPrivateData(const refguid: TGUID; pData: Pointer; out pSizeOfData: DWord): HResult; stdcall; + function FreePrivateData(const refguid: TGUID): HResult; stdcall; + function GetContainer(const riid: TGUID; var ppContainer: Pointer): HResult; stdcall; + function GetDesc(out pDesc: TD3DVolumeDesc): HResult; stdcall; + function LockBox(out pLockedVolume: TD3DLockedBox; pBox: PD3DBox; Flags: DWord): HResult; stdcall; + function UnlockBox: HResult; stdcall; + end; + + IDirect3DVolume9Helper = class + (*** helper information ***) + Name: PWideChar; + Width: LongWord; + Height: LongWord; + Depth: LongWord; + Usage: DWORD; + Format: TD3DFormat; + Pool: TD3DPool; + LockCount: LongWord; + CreationCallStack: PWideChar; + end; + + + + IDirect3DQuery9 = interface(IUnknown) + ['{d9771460-a695-4f26-bbd3-27b840b541cc}'] + (*** IDirect3DQuery9 methods ***) + function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall; + function GetType: TD3DQueryType; stdcall; + function GetDataSize: DWORD; stdcall; + function Issue(dwIssueFlags: DWORD): HResult; stdcall; + function GetData(pData: Pointer; dwSize: DWORD; dwGetDataFlags: DWORD): HResult; stdcall; + end; + + IDirect3DQuery9Helper = class + (*** helper information ***) + _Type: TD3DQueryType; + DataSize: DWORD; + CreationCallStack: PWideChar; + end; + + + + +(* + * Interface IID's + *) +type + IID_IDirect3D9 = IDirect3D9; + IID_IDirect3DDevice9 = IDirect3DDevice9; + IID_IDirect3DResource9 = IDirect3DResource9; + IID_IDirect3DBaseTexture9 = IDirect3DBaseTexture9; + IID_IDirect3DTexture9 = IDirect3DTexture9; + IID_IDirect3DCubeTexture9 = IDirect3DCubeTexture9; + IID_IDirect3DVolumeTexture9 = IDirect3DVolumeTexture9; + IID_IDirect3DVertexBuffer9 = IDirect3DVertexBuffer9; + IID_IDirect3DIndexBuffer9 = IDirect3DIndexBuffer9; + IID_IDirect3DSurface9 = IDirect3DSurface9; + IID_IDirect3DVolume9 = IDirect3DVolume9; + IID_IDirect3DSwapChain9 = IDirect3DSwapChain9; + IID_IDirect3DVertexDeclaration9 = IDirect3DVertexDeclaration9; + IID_IDirect3DVertexShader9 = IDirect3DVertexShader9; + IID_IDirect3DPixelShader9 = IDirect3DPixelShader9; + IID_IDirect3DStateBlock9 = IDirect3DStateBlock9; + IID_IDirect3DQuery9 = IDirect3DQuery9; +const + IID_HelperName : TGUID = '{E4A36723-FDFE-4b22-B146-3C04C07F4CC8}'; + + + +const +{**************************************************************************** + * Flags for SetPrivateData method on all D3D9 interfaces + * + * The passed pointer is an IUnknown ptr. The SizeOfData argument to SetPrivateData + * must be set to sizeof(IUnknown*). Direct3D will call AddRef through this + * pointer and Release when the private data is destroyed. The data will be + * destroyed when another SetPrivateData with the same GUID is set, when + * FreePrivateData is called, or when the D3D9 object is freed. + ****************************************************************************} + D3DSPD_IUNKNOWN = $00000001; + +(**************************************************************************** + * + * Flags for IDirect3D9::CreateDevice's BehaviorFlags + * + ****************************************************************************) + + D3DCREATE_FPU_PRESERVE = $00000002; + D3DCREATE_MULTITHREADED = $00000004; + + D3DCREATE_PUREDEVICE = $00000010; + D3DCREATE_SOFTWARE_VERTEXPROCESSING = $00000020; + D3DCREATE_HARDWARE_VERTEXPROCESSING = $00000040; + D3DCREATE_MIXED_VERTEXPROCESSING = $00000080; + + D3DCREATE_DISABLE_DRIVER_MANAGEMENT = $00000100; + D3DCREATE_ADAPTERGROUP_DEVICE = $00000200; + D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX = $00000400; + + // this flag causes the d3d runtime not to alter the focus + // window in any way. use with caution- the burden of supporting + // focus management events (alt-tab, etc.) falls on the + // application, and appropriate responses (switching display + // mode, etc.) should be coded. + d3dcreate_nowindowchanges = $00000800; + + +(**************************************************************************** + * + * Parameter for IDirect3D9::CreateDevice's Adapter argument + * + ****************************************************************************) + + D3DADAPTER_DEFAULT = 0; + +(**************************************************************************** + * + * Flags for IDirect3D9::EnumAdapters + * + ****************************************************************************) + + D3DENUM_WHQL_LEVEL = $00000002; + +(**************************************************************************** + * + * Maximum number of back-buffers supported in DX9 + * + ****************************************************************************) + + D3DPRESENT_BACK_BUFFERS_MAX = 3; + +(**************************************************************************** + * + * Flags for IDirect3DDevice9::SetGammaRamp + * + ****************************************************************************) + + D3DSGR_NO_CALIBRATION = $00000000; + D3DSGR_CALIBRATE = $00000001; + +(**************************************************************************** + * + * Flags for IDirect3DDevice9::SetCursorPosition + * + ****************************************************************************) + + D3DCURSOR_IMMEDIATE_UPDATE = $00000001; + +(**************************************************************************** + * + * Flags for IDirect3DSwapChain9::Present + * + ****************************************************************************) + + D3DPRESENT_DONOTWAIT = $00000001; + D3DPRESENT_LINEAR_CONTENT = $00000002; + +(**************************************************************************** + * + * Flags for DrawPrimitive/DrawIndexedPrimitive + * Also valid for Begin/BeginIndexed + * Also valid for VertexBuffer::CreateVertexBuffer + ****************************************************************************) + + +(* + * DirectDraw error codes + *) + _FACD3D = $876; + +//#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) +function MAKE_D3DHRESULT(Code: DWord): DWord;{$IFDEF SUPPORTS_INLINE} inline;{$ENDIF} +//#define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code ) +function MAKE_D3DSTATUS(Code: DWord): DWord;{$IFDEF SUPPORTS_INLINE} inline;{$ENDIF} + +const + MAKE_D3DHRESULT_R = (1 shl 31) or (_FACD3D shl 16); + MAKE_D3DSTATUS_R = (0 shl 31) or (_FACD3D shl 16); + +(* + * Direct3D Errors + *) + D3D_OK = S_OK; + + D3DERR_WRONGTEXTUREFORMAT = HResult(MAKE_D3DHRESULT_R or 2072); + D3DERR_UNSUPPORTEDCOLOROPERATION = HResult(MAKE_D3DHRESULT_R or 2073); + D3DERR_UNSUPPORTEDCOLORARG = HResult(MAKE_D3DHRESULT_R or 2074); + D3DERR_UNSUPPORTEDALPHAOPERATION = HResult(MAKE_D3DHRESULT_R or 2075); + D3DERR_UNSUPPORTEDALPHAARG = HResult(MAKE_D3DHRESULT_R or 2076); + D3DERR_TOOMANYOPERATIONS = HResult(MAKE_D3DHRESULT_R or 2077); + D3DERR_CONFLICTINGTEXTUREFILTER = HResult(MAKE_D3DHRESULT_R or 2078); + D3DERR_UNSUPPORTEDFACTORVALUE = HResult(MAKE_D3DHRESULT_R or 2079); + D3DERR_CONFLICTINGRENDERSTATE = HResult(MAKE_D3DHRESULT_R or 2081); + D3DERR_UNSUPPORTEDTEXTUREFILTER = HResult(MAKE_D3DHRESULT_R or 2082); + D3DERR_CONFLICTINGTEXTUREPALETTE = HResult(MAKE_D3DHRESULT_R or 2086); + D3DERR_DRIVERINTERNALERROR = HResult(MAKE_D3DHRESULT_R or 2087); + + D3DERR_NOTFOUND = HResult(MAKE_D3DHRESULT_R or 2150); + D3DERR_MOREDATA = HResult(MAKE_D3DHRESULT_R or 2151); + D3DERR_DEVICELOST = HResult(MAKE_D3DHRESULT_R or 2152); + D3DERR_DEVICENOTRESET = HResult(MAKE_D3DHRESULT_R or 2153); + D3DERR_NOTAVAILABLE = HResult(MAKE_D3DHRESULT_R or 2154); + D3DERR_OUTOFVIDEOMEMORY = HResult(MAKE_D3DHRESULT_R or 380); + D3DERR_INVALIDDEVICE = HResult(MAKE_D3DHRESULT_R or 2155); + D3DERR_INVALIDCALL = HResult(MAKE_D3DHRESULT_R or 2156); + D3DERR_DRIVERINVALIDCALL = HResult(MAKE_D3DHRESULT_R or 2157); + D3DERR_WASSTILLDRAWING = HResult(MAKE_D3DHRESULT_R or 540); + D3DOK_NOAUTOGEN = HResult(MAKE_D3DSTATUS_R or 2159); + + + +(* + * DLL Function for creating a Direct3D9 object. This object supports + * enumeration and allows the creation of Direct3DDevice9 objects. + * Pass the value of the constant D3D_SDK_VERSION to this function, so + * that the run-time can validate that your application was compiled + * against the right headers. + *) + + +function Direct3D9Loaded: Boolean; +function LoadDirect3D9: Boolean; +function UnLoadDirect3D9: Boolean; + +const + Direct3D9dll = 'd3d9.dll'; + +// Due to the way Object Pascal handles functions resulting in 'native' interface +// pointer we should declare result not as interface but as usial pointer + +{$IFDEF DIRECT3D9_DYNAMIC_LINK} +type + TDirect3DCreate9 = function (SDKVersion: LongWord): Pointer; stdcall; + +var + _Direct3DCreate9: TDirect3DCreate9 = nil; + +{$ELSE} +function _Direct3DCreate9(SDKVersion: LongWord): Pointer; stdcall; +{$ENDIF} + +function Direct3DCreate9(SDKVersion: LongWord): IDirect3D9; stdcall; + +(* + * Stubs for graphics profiling. + *) + +function D3DPERF_BeginEvent(col: TD3DColor; wszName: PWideChar): Integer; stdcall; external Direct3D9dll; +function D3DPERF_EndEvent: Integer; stdcall; external Direct3D9dll; +procedure D3DPERF_SetMarker(col: TD3DColor; wszName: PWideChar); stdcall; external Direct3D9dll; +procedure D3DPERF_SetRegion(col: TD3DColor; wszName: PWideChar); stdcall; external Direct3D9dll; +function D3DPERF_QueryRepeatFrame: BOOL; stdcall; external Direct3D9dll; + +procedure D3DPERF_SetOptions(dwOptions: DWORD); stdcall; external Direct3D9dll; +function D3DPERF_GetStatus: DWORD; stdcall; external Direct3D9dll; + + +//******************************************************************** +// Introduced types for compatibility with non-Borland compliant translation +// by Ampaze (Tim Baumgarten) from http://www.crazyentertainment.net +type + PD3DAdapter_Identifier9 = PD3DAdapterIdentifier9; + PD3DDevice_Creation_Parameters = PD3DDeviceCreationParameters; + PD3DDevInfo_D3DVertexStats = PD3DDevInfoD3DVertexStats; + PD3DDevInfo_ResourceManager = PD3DDevInfoResourceManager; + PD3DDevInfo_VCache = PD3DDevInfoVCache; + PD3DIndexBuffer_Desc = PD3DIndexBufferDesc; + PD3DLocked_Box = PD3DLockedBox; + PD3DLocked_Rect = PD3DLockedRect; + PD3DPresent_Parameters = PD3DPresentParameters; + PD3DRaster_Status = PD3DRasterStatus; + PD3DRectPatch_Info = PD3DRectPatchInfo; + PD3DSurface_Desc = PD3DSurfaceDesc; + PD3DTriPatch_Info = PD3DTriPatchInfo; + PD3DVertexBuffer_Desc = PD3DVertexBufferDesc; + PD3DVolume_Desc = PD3DVolumeDesc; + + TD3DAdapter_Identifier9 = TD3DAdapterIdentifier9; + TD3DBackBuffer_Type = TD3DBackBufferType; + TD3DCubeMap_Faces = TD3DCubeMapFaces; + TD3DDevice_Creation_Parameters = TD3DDeviceCreationParameters; + TD3DDevInfo_D3DVertexStats = TD3DDevInfoD3DVertexStats; + TD3DDevInfo_ResourceManager = TD3DDevInfoResourceManager; + TD3DDevInfo_VCache = TD3DDevInfoVCache; + TD3DIndexBuffer_Desc = TD3DIndexBufferDesc; + TD3DLocked_Box = TD3DLockedBox; + TD3DLocked_Rect = TD3DLockedRect; + TD3DMultiSample_Type = TD3DMultiSampleType; + TD3DPresent_Parameters = TD3DPresentParameters; + TD3DRaster_Status = TD3DRasterStatus; + TD3DRectPatch_Info = TD3DRectPatchInfo; + TD3DSampler_Texture_Type = TD3DSamplerTextureType; + TD3DShader_AddressMode_Type = TD3DShaderAddressModeType; + TD3DShader_Comparison = TD3DShaderComparison; + TD3DShader_Instruction_Opcode_Type = TD3DShaderInstructionOpcodeType; + TD3DShader_MiscType_Offsets = TD3DShaderMiscTypeOffsets; + TD3DShader_Param_Register_Type = TD3DShaderParamRegisterType; + TD3DShader_Param_SRCMod_Type = TD3DShaderParamSRCModType; + TD3DSurface_Desc = TD3DSurfaceDesc; + TD3DTriPatch_Info = TD3DTriPatchInfo; + TD3DVertexBuffer_Desc = TD3DVertexBufferDesc; + TD3DVolume_Desc = TD3DVolumeDesc; + TD3DVS_AddressMode_Type = TD3DVSAddressModeType; + TD3DVS_RastOut_Offsets = TD3DVSRastOutOffsets; + + +implementation + +(*==========================================================================; + * File: d3d9types.h + * Content: Direct3D capabilities include file + ***************************************************************************) + +// #define D3DCOLOR_ARGB(a,r,g,b) \ +// ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) +function D3DCOLOR_ARGB(a,r,g,b: DWord): TD3DColor; +begin + Result := (a shl 24) or (r shl 16) or (g shl 8) or b; +end; + +// #define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b) +function D3DCOLOR_RGBA(r,g,b,a: DWord): TD3DColor; +begin + Result := (a shl 24) or (r shl 16) or (g shl 8) or b; +end; + +// #define D3DCOLOR_XRGB(r,g,b) D3DCOLOR_ARGB(0xff,r,g,b) +function D3DCOLOR_XRGB(r,g,b: DWord): TD3DColor; +begin + Result := DWORD($FF shl 24) or (r shl 16) or (g shl 8) or b; +end; + +// #define D3DCOLOR_XYUV(y,u,v) D3DCOLOR_ARGB(0xff,y,u,v) +function D3DCOLOR_XYUV(y,u,v: DWord): TD3DColor; +begin + Result := DWORD($FF shl 24) or (y shl 16) or (u shl 8) or v; +end; + +// #define D3DCOLOR_AYUV(a,y,u,v) D3DCOLOR_ARGB(a,y,u,v) +function D3DCOLOR_AYUV(a,y,u,v: DWord): TD3DColor; +begin + Result := (a shl 24) or (y shl 16) or (u shl 8) or v; +end; + +// #define D3DCOLOR_COLORVALUE(r,g,b,a) \ +// D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f)) +function D3DCOLOR_COLORVALUE(r,g,b,a: Single): TD3DColor; +begin + Result := (round(a * 255) shl 24) or + (round(r * 255) shl 16) or + (round(g * 255) shl 8) or + (round(b * 255)); +end; + +// #define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256) +function D3DTS_WORLDMATRIX(index: Byte): TD3DTransformStateType; +begin + Result:= TD3DTransformStateType(index + 256); +end; + +//#define D3DPS_VERSION(_Major,_Minor) (0xFFFF0000|((_Major)<<8)|(_Minor)) +function D3DPS_VERSION(_Major, _Minor : Cardinal) : Cardinal; +begin + Result:= $FFFF0000 or (_Major shl 8 ) or _Minor; +end; + +//#define D3DVS_VERSION(_Major,_Minor) (0xFFFE0000|((_Major)<<8)|(_Minor)) +function D3DVS_VERSION(_Major, _Minor : Cardinal) : Cardinal; +begin + Result:= $FFFE0000 or (_Major shl 8 ) or _Minor; +end; + +//#define D3DSHADER_VERSION_MAJOR(_Version) (((_Version)>>8)&0xFF) +function D3DSHADER_VERSION_MAJOR(_Version : Cardinal) : Cardinal; +begin + Result:= (_Version shr 8 ) and $FF; +end; + +//#define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF) +function D3DSHADER_VERSION_MINOR(_Version : Cardinal) : Cardinal; +begin + Result:= (_Version shr 0) and $FF; +end; + +//#define D3DSHADER_COMMENT(_DWordSize) \ +// ((((_DWordSize)< 0; +end; + +function UnLoadDirect3D9: Boolean; +begin + Result:= True; + if Direct3D9Loaded then + begin + Result:= FreeLibrary(Direct3D9Lib); + _Direct3DCreate9:= nil; + Direct3D9Lib:= 0; + end; +end; + +function LoadDirect3D9: Boolean; +const + ProcName = 'Direct3DCreate9'; +begin + Result:= Direct3D9Loaded; + if (not Result) then + begin + Direct3D9Lib:= LoadLibrary(Direct3D9dll); + if Direct3D9Loaded then + begin + _Direct3DCreate9:= GetProcAddress(Direct3D9Lib, ProcName); + Result:= Assigned(_Direct3DCreate9); + if not Result then UnLoadDirect3D9; + end; + end; +end; +{$ELSE} +function Direct3D9Loaded: Boolean; +begin // Stub function for static linking + Result:= True; +end; + +function UnLoadDirect3D9: Boolean; +begin // Stub function for static linking + Result:= True; // should emulate "normal" behaviour +end; + +function LoadDirect3D9: Boolean; +begin // Stub function for static linking + Result:= True; +end; + +function _Direct3DCreate9(SDKVersion: LongWord): Pointer; stdcall; external Direct3D9dll name 'Direct3DCreate9'; +{$ENDIF} + +function Direct3DCreate9(SDKVersion: LongWord): IDirect3D9;stdcall; +begin +{$IFDEF DIRECT3D9_DYNAMIC_LINK} +{$IFDEF DIRECT3D9_DYNAMIC_LINK_EXPLICIT} + LoadDirect3D9; + +{$ENDIF} +{$ENDIF} + Result:= IDirect3D9(_Direct3DCreate9(SDKVersion)); + if Assigned(Result) then Result._Release; // Delphi autoincrement reference count +end; + +{$IFDEF DIRECT3D9_DYNAMIC_LINK} +initialization +{$IFNDEF DIRECT3D9_DYNAMIC_LINK_EXPLICIT} + LoadDirect3D9; +{$ENDIF} +finalization + UnLoadDirect3D9; +{$ENDIF} +end. diff --git a/components/acs/Src/fileformats/windows/directdraw.pas b/components/acs/Src/fileformats/windows/directdraw.pas new file mode 100644 index 000000000..65582bf5f --- /dev/null +++ b/components/acs/Src/fileformats/windows/directdraw.pas @@ -0,0 +1,6340 @@ +{******************************************************************************} +{* *} +{* copyright (c) microsoft corporation. all rights reserved. *} +{* *} +{* files: ddraw.h dvp.h *} +{* content: directdraw and directdrawvideoport include files *} +{* *} +{* directx 9.0 delphi / freepascal adaptation by alexey barkovoy *} +{* e-mail: directx@clootie.ru *} +{* *} +{* modified: 07-sep-2003 *} +{* *} +{* based upon : *} +{* directx 7.0 object pascal adaptation by *} +{* erik unger, e-mail: delphidirectx@next-reality.com *} +{* *} +{* latest version can be downloaded from: *} +{* http://www.clootie.ru *} +{* http://sourceforge.net/projects/delphi-dx9sdk *} +{* *} +{******************************************************************************} +{ } +{ obtained through: joint endeavour of delphi innovators (project jedi) } +{ } +{ the contents of this file are used with permission, subject to the mozilla } +{ public license version 1.1 (the "license"); you may not use this file except } +{ in compliance with the license. you may obtain a copy of the license at } +{ http://www.mozilla.org/mpl/mpl-1.1.html } +{ } +{ software distributed under the license is distributed on an "as is" basis, } +{ without warranty of any kind, either express or implied. see the license for } +{ the specific language governing rights and limitations under the license. } +{ } +{ alternatively, the contents of this file may be used under the terms of the } +{ gnu lesser general public license (the "lgpl license"), in which case the } +{ provisions of the lgpl license are applicable instead of those above. } +{ if you wish to allow use of your version of this file only under the terms } +{ of the lgpl license and not to allow others to use your version of this file } +{ under the mpl, indicate your decision by deleting the provisions above and } +{ replace them with the notice and other provisions required by the lgpl } +{ license. if you do not delete the provisions above, a recipient may use } +{ your version of this file under either the mpl or the lgpl license. } +{ } +{ for more information about the lgpl: http://www.gnu.org/copyleft/lesser.html } +{ } +{******************************************************************************} + +/////////////////////////////////////////////////////////////////////////////// +// Notes: +//---------------------------------------------------------------------------- +// Possible input defines for this file, mapped to original C values: +// DIRECTDRAW_VERSION_7 : DIRECTDRAW_VERSION = 0x0700, +// DIRECTDRAW_VERSION_6 : DIRECTDRAW_VERSION = 0x0600, +// DIRECTDRAW_VERSION_5 : DIRECTDRAW_VERSION = 0x0500, +// DIRECTDRAW_VERSION_3 : DIRECTDRAW_VERSION = 0x0300, +// DIRECTDRAW_VERSION_LESS_3 : DIRECTDRAW_VERSION < 0x0300, +// +// By default DIRECTDRAW_VERSION_7 (DIRECTDRAW_VERSION = 0x0700) is assumed +// +// Also you can use generic DIRECTXx defines, so: +// DIRECTX7 equal to DIRECTDRAW_VERSION_7; +// DIRECTX6 equal to DIRECTDRAW_VERSION_6; +// DIRECTX5 equal to DIRECTDRAW_VERSION_5; +// DIRECTX3 equal to DIRECTDRAW_VERSION_3 +/////////////////////////////////////////////////////////////////////////////// + +unit directdraw; + +interface + +{.$I DirectX.inc} + +//////////////////////////////////////////////////////////////////////// +// Global level dynamic loading support +{$IFDEF DYNAMIC_LINK_ALL} + {$DEFINE DIRECTDRAW_DYNAMIC_LINK} +{$ENDIF} +{$IFDEF DYNAMIC_LINK_EXPLICIT_ALL} + {$DEFINE DIRECTDRAW_DYNAMIC_LINK_EXPLICIT} +{$ENDIF} + +// Remove "dots" below to force some kind of dynamic linking +{.$DEFINE DIRECTDRAW_DYNAMIC_LINK} +{.$DEFINE DIRECTDRAW_DYNAMIC_LINK_EXPLICIT} + +//////////////////////////////////////////////////////////////////////// +// Assume for what DirectDraw version we will compile headers +{$IFDEF DIRECTX7} + {$DEFINE DIRECTDRAW_VERSION_7} +{$ENDIF} +{$IFDEF DIRECTX6} + {$DEFINE DIRECTDRAW_VERSION_6} +{$ENDIF} +{$IFDEF DIRECTX5} + {$DEFINE DIRECTDRAW_VERSION_5} +{$ENDIF} +{$IFDEF DIRECTX3} + {$DEFINE DIRECTDRAW_VERSION_3} +{$ENDIF} + +{$IFNDEF DIRECTDRAW_VERSION_7} + {$IFNDEF DIRECTDRAW_VERSION_6} + {$IFNDEF DIRECTDRAW_VERSION_5} + {$IFNDEF DIRECTDRAW_VERSION_3} + {$IFNDEF DIRECTDRAW_VERSION_LESS_3} + {$DEFINE DIRECTDRAW_VERSION_7} // Compiling for DirectDraw7 by default + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} +{$ENDIF} + +//////////////////////////////////////////////////////////////////////// +// Emit conditionals to C++Builder compiler +{$IFDEF DIRECTDRAW_VERSION_LESS_3} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_3} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_5} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_6} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_7} +{$ENDIF} + +//////////////////////////////////////////////////////////////////////// +// Define symbols for '<=' comparision +{$IFDEF DIRECTDRAW_VERSION_7} + {$DEFINE DIRECTDRAW_VERSION_6} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_6} + {$DEFINE DIRECTDRAW_VERSION_5} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_5} + {$DEFINE DIRECTDRAW_VERSION_3} +{$ENDIF} +{$IFDEF DIRECTDRAW_VERSION_3} + {$DEFINE DIRECTDRAW_VERSION_LESS_3} +{$ENDIF} + + +uses + Windows; + + +(*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: ddraw.h + * Content: DirectDraw include file + * + ***************************************************************************) + +function MAKEFOURCC(ch0, ch1, ch2, ch3: Char): DWORD; + +(* + * FOURCC codes for DX compressed-texture pixel formats + *) +const + //#define FOURCC_DXT1 (MAKEFOURCC('D','X','T','1')) + FOURCC_DXT1 = DWORD(Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('1') shl 24)); + //#define FOURCC_DXT2 (MAKEFOURCC('D','X','T','2')) + FOURCC_DXT2 = DWORD(Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('2') shl 24)); + //#define FOURCC_DXT3 (MAKEFOURCC('D','X','T','3')) + FOURCC_DXT3 = DWORD(Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('3') shl 24)); + //#define FOURCC_DXT4 (MAKEFOURCC('D','X','T','4')) + FOURCC_DXT4 = DWORD(Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('4') shl 24)); + //#define FOURCC_DXT5 (MAKEFOURCC('D','X','T','5')) + FOURCC_DXT5 = DWORD(Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('5') shl 24)); + +(* + * GUIDS used by DirectDraw objects + *) +const + CLSID_DirectDraw: TGUID = '{D7B70EE0-4340-11CF-B063-0020AFC2CD35}'; + CLSID_DirectDraw7: TGUID = '{3c305196-50db-11d3-9cfe-00c04fd930c5}'; + CLSID_DirectDrawClipper: TGUID = '{593817A0-7DB3-11CF-A2DE-00AA00b93356}'; + (* These GUID's defined later by typedefing to Delphi interfaces + DEFINE_GUID( IID_IDirectDraw, 0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); + DEFINE_GUID( IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); + DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 ); + DEFINE_GUID( IID_IDirectDraw7, 0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b ); + DEFINE_GUID( IID_IDirectDrawSurface, 0x6C14DB81,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); + DEFINE_GUID( IID_IDirectDrawSurface2, 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27 ); + DEFINE_GUID( IID_IDirectDrawSurface3, 0xDA044E00,0x69B2,0x11D0,0xA1,0xD5,0x00,0xAA,0x00,0xB8,0xDF,0xBB ); + DEFINE_GUID( IID_IDirectDrawSurface4, 0x0B2B8630,0xAD35,0x11D0,0x8E,0xA6,0x00,0x60,0x97,0x97,0xEA,0x5B ); + DEFINE_GUID( IID_IDirectDrawSurface7, 0x06675a80,0x3b9b,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b ); + DEFINE_GUID( IID_IDirectDrawPalette, 0x6C14DB84,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); + DEFINE_GUID( IID_IDirectDrawClipper, 0x6C14DB85,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); + DEFINE_GUID( IID_IDirectDrawColorControl, 0x4B9F0EE0,0x0D7E,0x11D0,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8 ); + DEFINE_GUID( IID_IDirectDrawGammaControl, 0x69C11C3E,0xB46B,0x11D1,0xAD,0x7A,0x00,0xC0,0x4F,0xC2,0x9B,0x4E ); + *) + +const + DD_ROP_SPACE = (256 div 32); // space required to store ROP array + + MAX_DDDEVICEID_STRING = 512; + + +(*============================================================================ + * + * DirectDraw Structures + * + * Various structures used to invoke DirectDraw. + * + *==========================================================================*) + +var + NilGUID : TGUID = '{00000000-0000-0000-0000-000000000000}'; + + +type + //Clootie: This was originally in Erik Unger headers - don't know why, so leave it alone + TRefGUID = packed record + case Integer of + 1: (guid : PGUID); + 2: (dwFlags : DWORD); + end; + + REFGUID = PGUID; + + + IDirectDraw = interface; + IDirectDraw2 = interface; + IDirectDraw4 = interface; + IDirectDraw7 = interface; + IDirectDrawSurface = interface; + IDirectDrawSurface2 = interface; + IDirectDrawSurface3 = interface; + IDirectDrawSurface4 = interface; + IDirectDrawSurface7 = interface; + + IDirectDrawPalette = interface; + IDirectDrawClipper = interface; + IDirectDrawColorControl = interface; + IDirectDrawGammaControl = interface; + +(* + * Generic pixel format with 8-bit RGB and alpha components + *) + PDDARGB = ^TDDARGB; + _DDARGB = packed record + blue: Byte; + green: Byte; + red: Byte; + alpha: Byte; + end; + DDARGB = _DDARGB; + TDDARGB = _DDARGB; + +(* + * This version of the structure remains for backwards source compatibility. + * The DDARGB structure is the one that should be used for all DirectDraw APIs. + *) + PDDRGBA = ^TDDRGBA; + _DDRGBA = packed record + red : Byte; + green : Byte; + blue : Byte; + alpha : Byte; + end; + DDRGBA = _DDRGBA; + TDDRGBA = _DDRGBA; + +(* + * TDDColorKey + *) + PDDColorKey = ^TDDColorKey; + _DDCOLORKEY = packed record + dwColorSpaceLowValue: DWORD; // low boundary of color space that is to + // be treated as Color Key, inclusive + dwColorSpaceHighValue: DWORD; // high boundary of color space that is + // to be treated as Color Key, inclusive + end; + DDCOLORKEY = _DDCOLORKEY; + TDDColorKey = _DDCOLORKEY; + + // Delphi 5 and up don't allow interfaces in variant records + // so we have to use pointers instead (which can be type-casted into interfaces): + PDirectDrawSurface = Pointer; + +(* + * TDDBltFX + * Used to pass override information to the DIRECTDRAWSURFACE callback Blt. + *) + PDDBltFX = ^TDDBltFX; + _DDBLTFX = packed record + dwSize : DWORD; // size of structure + dwDDFX : DWORD; // FX operations + dwROP : DWORD; // Win32 raster operations + dwDDROP : DWORD; // Raster operations new for DirectDraw + dwRotationAngle : DWORD; // Rotation angle for blt + dwZBufferOpCode : DWORD; // ZBuffer compares + dwZBufferLow : DWORD; // Low limit of Z buffer + dwZBufferHigh : DWORD; // High limit of Z buffer + dwZBufferBaseDest : DWORD; // Destination base value + dwZDestConstBitDepth : DWORD; // Bit depth used to specify Z constant for destination + case Integer of + 0: ( + dwZDestConst : DWORD // Constant to use as Z buffer for dest + ); + 1: ( + lpDDSZBufferDest : PDirectDrawSurface; // Surface to use as Z buffer for dest + dwZSrcConstBitDepth : DWORD; // Bit depth used to specify Z constant for source + case integer of + 0: ( + dwZSrcConst : DWORD; // Constant to use as Z buffer for src + ); + 1: ( + lpDDSZBufferSrc : PDirectDrawSurface; // Surface to use as Z buffer for src + dwAlphaEdgeBlendBitDepth : DWORD; // Bit depth used to specify constant for alpha edge blend + dwAlphaEdgeBlend : DWORD; // Alpha for edge blending + dwReserved : DWORD; + dwAlphaDestConstBitDepth : DWORD; // Bit depth used to specify alpha constant for destination + case integer of + 0: ( + dwAlphaDestConst : DWORD; // Constant to use as Alpha Channel + ); + 1: ( + lpDDSAlphaDest : PDirectDrawSurface; // Surface to use as Alpha Channel + dwAlphaSrcConstBitDepth : DWORD; // Bit depth used to specify alpha constant for source + case integer of + 0: ( + dwAlphaSrcConst : DWORD; // Constant to use as Alpha Channel + ); + 1: ( + lpDDSAlphaSrc : PDirectDrawSurface; // Surface to use as Alpha Channel + case integer of + 0: ( + dwFillColor : DWORD; // color in RGB or Palettized + ); + 1: ( + dwFillDepth : DWORD; // depth value for z-buffer + ); + 2: ( + dwFillPixel : DWORD; // pixel value + ); + 3: ( + lpDDSPattern : PDirectDrawSurface; // Surface to use as pattern + ddckDestColorkey : TDDColorKey; // DestColorkey override + ddckSrcColorkey : TDDColorKey; // SrcColorkey override + ) + ) + ) + ) + ) + end; + DDBLTFX = _DDBLTFX; + TDDBltFX = _DDBLTFX; + +(* + * TDDSCaps + *) + PDDSCaps = ^TDDSCaps; + _DDSCAPS = packed record + dwCaps: DWORD; // capabilities of surface wanted + end; + DDSCAPS = _DDSCAPS; + TDDSCaps = _DDSCAPS; + +(* + * TDDOSCaps + *) + PDDOSCaps = ^TDDOSCaps; + _DDOSCAPS = packed record + dwCaps: DWORD; // capabilities of surface wanted + end; + DDOSCAPS = _DDOSCAPS; + TDDOSCaps = _DDOSCAPS; + +(* + * This structure is used internally by DirectDraw. + *) + PDDSCapsEx = ^TDDSCapsEx; + _DDSCAPSEX = packed record + dwCaps2 : DWORD; + dwCaps3 : DWORD; + dwCaps4 : DWORD; + end; + DDSCAPSEX = _DDSCAPSEX; + TDDSCapsEx = _DDSCAPSEX; + +(* + * TDDSCaps2 + *) + PDDSCaps2 = ^TDDSCaps2; + _DDSCAPS2 = packed record + dwCaps: DWORD; // capabilities of surface wanted + dwCaps2 : DWORD; + dwCaps3 : DWORD; + dwCaps4 : DWORD; + end; + DDSCAPS2 = _DDSCAPS2; + TDDSCaps2 = _DDSCAPS2; + +(* + * NOTE: Our choosen structure number scheme is to append a single digit to + * the end of the structure giving the version that structure is associated + * with. + *) + +(* + * This structure represents the DDCAPS structure released in DirectDraw 1.0. It is used internally + * by DirectDraw to interpret caps passed into ddraw by drivers written prior to the release of DirectDraw 2.0. + * New applications should use the DDCAPS structure defined below. + *) + PDDCaps_DX1 = ^TDDCaps_DX1; + _DDCAPS_DX1 = packed record + dwSize: DWORD; // size of the DDDRIVERCAPS structure + dwCaps: DWORD; // driver specific capabilities + dwCaps2: DWORD; // more driver specific capabilites + dwCKeyCaps: DWORD; // color key capabilities of the surface + dwFXCaps: DWORD; // driver specific stretching and effects capabilites + dwFXAlphaCaps: DWORD; // alpha driver specific capabilities + dwPalCaps: DWORD; // palette capabilities + dwSVCaps: DWORD; // stereo vision capabilities + dwAlphaBltConstBitDepths: DWORD; // DDBD_2,4,8 + dwAlphaBltPixelBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaBltSurfaceBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaOverlayConstBitDepths: DWORD; // DDBD_2,4,8 + dwAlphaOverlayPixelBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8 + dwZBufferBitDepths: DWORD; // DDBD_8,16,24,32 + dwVidMemTotal: DWORD; // total amount of video memory + dwVidMemFree: DWORD; // amount of free video memory + dwMaxVisibleOverlays: DWORD; // maximum number of visible overlays + dwCurrVisibleOverlays: DWORD; // current number of visible overlays + dwNumFourCCCodes: DWORD; // number of four cc codes + dwAlignBoundarySrc: DWORD; // source rectangle alignment + dwAlignSizeSrc: DWORD; // source rectangle byte size + dwAlignBoundaryDest: DWORD; // dest rectangle alignment + dwAlignSizeDest: DWORD; // dest rectangle byte size + dwAlignStrideAlign: DWORD; // stride alignment + dwRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported + ddsCaps: TDDSCaps; // TDDSCaps structure has all the general capabilities + dwMinOverlayStretch: DWORD; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxOverlayStretch: DWORD; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMinLiveVideoStretch: DWORD; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxLiveVideoStretch: DWORD; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMinHwCodecStretch: DWORD; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxHwCodecStretch: DWORD; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwReserved1: DWORD; // reserved + dwReserved2: DWORD; // reserved + dwReserved3: DWORD; // reserved + end; + DDCAPS_DX1 = _DDCAPS_DX1; + TDDCaps_DX1 = _DDCAPS_DX1; + +(* + * This structure is the TDDCaps structure as it was in version 2 and 3 of Direct X. + * It is present for back compatability. + *) + PDDCaps_DX3 = ^TDDCaps_DX3; + _DDCAPS_DX3 = packed record + dwSize: DWORD; // size of the DDDRIVERCAPS structure + dwCaps: DWORD; // driver specific capabilities + dwCaps2: DWORD; // more driver specific capabilites + dwCKeyCaps: DWORD; // color key capabilities of the surface + dwFXCaps: DWORD; // driver specific stretching and effects capabilites + dwFXAlphaCaps: DWORD; // alpha driver specific capabilities + dwPalCaps: DWORD; // palette capabilities + dwSVCaps: DWORD; // stereo vision capabilities + dwAlphaBltConstBitDepths: DWORD; // DDBD_2,4,8 + dwAlphaBltPixelBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaBltSurfaceBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaOverlayConstBitDepths: DWORD; // DDBD_2,4,8 + dwAlphaOverlayPixelBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8 + dwZBufferBitDepths: DWORD; // DDBD_8,16,24,32 + dwVidMemTotal: DWORD; // total amount of video memory + dwVidMemFree: DWORD; // amount of free video memory + dwMaxVisibleOverlays: DWORD; // maximum number of visible overlays + dwCurrVisibleOverlays: DWORD; // current number of visible overlays + dwNumFourCCCodes: DWORD; // number of four cc codes + dwAlignBoundarySrc: DWORD; // source rectangle alignment + dwAlignSizeSrc: DWORD; // source rectangle byte size + dwAlignBoundaryDest: DWORD; // dest rectangle alignment + dwAlignSizeDest: DWORD; // dest rectangle byte size + dwAlignStrideAlign: DWORD; // stride alignment + dwRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported + ddsCaps: TDDSCaps; // TDDSCaps structure has all the general capabilities + dwMinOverlayStretch: DWORD; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxOverlayStretch: DWORD; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMinLiveVideoStretch: DWORD; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxLiveVideoStretch: DWORD; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMinHwCodecStretch: DWORD; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxHwCodecStretch: DWORD; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwReserved1: DWORD; // reserved + dwReserved2: DWORD; // reserved + dwReserved3: DWORD; // reserved + dwSVBCaps: DWORD; // driver specific capabilities for System->Vmem blts + dwSVBCKeyCaps: DWORD; // driver color key capabilities for System->Vmem blts + dwSVBFXCaps: DWORD; // driver FX capabilities for System->Vmem blts + dwSVBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts + dwVSBCaps: DWORD; // driver specific capabilities for Vmem->System blts + dwVSBCKeyCaps: DWORD; // driver color key capabilities for Vmem->System blts + dwVSBFXCaps: DWORD; // driver FX capabilities for Vmem->System blts + dwVSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts + dwSSBCaps: DWORD; // driver specific capabilities for System->System blts + dwSSBCKeyCaps: DWORD; // driver color key capabilities for System->System blts + dwSSBFXCaps: DWORD; // driver FX capabilities for System->System blts + dwSSBRops: array[0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts + dwReserved4 : DWORD; + dwReserved5 : DWORD; + dwReserved6 : DWORD; + end; + DDCAPS_DX3 = _DDCAPS_DX3; + TDDCaps_DX3 = _DDCAPS_DX3; + +(* + * This structure is the TDDCaps structure as it was in version 5 of Direct X. + * It is present for back compatability. + *) + PDDCaps_DX5 = ^TDDCaps_DX5; + _DDCAPS_DX5 = packed record + dwSize: DWORD; // size of the DDDRIVERCAPS structure + dwCaps: DWORD; // driver specific capabilities + dwCaps2: DWORD; // more driver specific capabilites + dwCKeyCaps: DWORD; // color key capabilities of the surface + dwFXCaps: DWORD; // driver specific stretching and effects capabilites + dwFXAlphaCaps: DWORD; // alpha driver specific capabilities + dwPalCaps: DWORD; // palette capabilities + dwSVCaps: DWORD; // stereo vision capabilities + dwAlphaBltConstBitDepths: DWORD; // DDBD_2,4,8 + dwAlphaBltPixelBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaBltSurfaceBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaOverlayConstBitDepths: DWORD; // DDBD_2,4,8 + dwAlphaOverlayPixelBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8 + dwZBufferBitDepths: DWORD; // DDBD_8,16,24,32 + dwVidMemTotal: DWORD; // total amount of video memory + dwVidMemFree: DWORD; // amount of free video memory + dwMaxVisibleOverlays: DWORD; // maximum number of visible overlays + dwCurrVisibleOverlays: DWORD; // current number of visible overlays + dwNumFourCCCodes: DWORD; // number of four cc codes + dwAlignBoundarySrc: DWORD; // source rectangle alignment + dwAlignSizeSrc: DWORD; // source rectangle byte size + dwAlignBoundaryDest: DWORD; // dest rectangle alignment + dwAlignSizeDest: DWORD; // dest rectangle byte size + dwAlignStrideAlign: DWORD; // stride alignment + dwRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported + ddsCaps: TDDSCaps; // TDDSCaps structure has all the general capabilities + dwMinOverlayStretch: DWORD; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxOverlayStretch: DWORD; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMinLiveVideoStretch: DWORD; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxLiveVideoStretch: DWORD; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMinHwCodecStretch: DWORD; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxHwCodecStretch: DWORD; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwReserved1: DWORD; // reserved + dwReserved2: DWORD; // reserved + dwReserved3: DWORD; // reserved + dwSVBCaps: DWORD; // driver specific capabilities for System->Vmem blts + dwSVBCKeyCaps: DWORD; // driver color key capabilities for System->Vmem blts + dwSVBFXCaps: DWORD; // driver FX capabilities for System->Vmem blts + dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts + dwVSBCaps: DWORD; // driver specific capabilities for Vmem->System blts + dwVSBCKeyCaps: DWORD; // driver color key capabilities for Vmem->System blts + dwVSBFXCaps: DWORD; // driver FX capabilities for Vmem->System blts + dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts + dwSSBCaps: DWORD; // driver specific capabilities for System->System blts + dwSSBCKeyCaps: DWORD; // driver color key capabilities for System->System blts + dwSSBFXCaps: DWORD; // driver FX capabilities for System->System blts + dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts + // Members added for DX5: + dwMaxVideoPorts: DWORD; // maximum number of usable video ports + dwCurrVideoPorts: DWORD; // current number of video ports used + dwSVBCaps2: DWORD; // more driver specific capabilities for System->Vmem blts + dwNLVBCaps: DWORD; // driver specific capabilities for non-local->local vidmem blts + dwNLVBCaps2: DWORD; // more driver specific capabilities non-local->local vidmem blts + dwNLVBCKeyCaps: DWORD; // driver color key capabilities for non-local->local vidmem blts + dwNLVBFXCaps: DWORD; // driver FX capabilities for non-local->local blts + dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts + end; + DDCAPS_DX5 = _DDCAPS_DX5; + TDDCaps_DX5 = _DDCAPS_DX5; + + PDDCaps_DX6 = ^TDDCaps_DX6; + _DDCAPS_DX6 = packed record + dwSize: DWORD; // size of the DDDRIVERCAPS structure + dwCaps: DWORD; // driver specific capabilities + dwCaps2: DWORD; // more driver specific capabilites + dwCKeyCaps: DWORD; // color key capabilities of the surface + dwFXCaps: DWORD; // driver specific stretching and effects capabilites + dwFXAlphaCaps: DWORD; // alpha driver specific capabilities + dwPalCaps: DWORD; // palette capabilities + dwSVCaps: DWORD; // stereo vision capabilities + dwAlphaBltConstBitDepths: DWORD; // DDBD_2,4,8 + dwAlphaBltPixelBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaBltSurfaceBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaOverlayConstBitDepths: DWORD; // DDBD_2,4,8 + dwAlphaOverlayPixelBitDepths: DWORD; // DDBD_1,2,4,8 + dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8 + dwZBufferBitDepths: DWORD; // DDBD_8,16,24,32 + dwVidMemTotal: DWORD; // total amount of video memory + dwVidMemFree: DWORD; // amount of free video memory + dwMaxVisibleOverlays: DWORD; // maximum number of visible overlays + dwCurrVisibleOverlays: DWORD; // current number of visible overlays + dwNumFourCCCodes: DWORD; // number of four cc codes + dwAlignBoundarySrc: DWORD; // source rectangle alignment + dwAlignSizeSrc: DWORD; // source rectangle byte size + dwAlignBoundaryDest: DWORD; // dest rectangle alignment + dwAlignSizeDest: DWORD; // dest rectangle byte size + dwAlignStrideAlign: DWORD; // stride alignment + dwRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported + ddsOldCaps: TDDSCaps; // Was dssCaps: TDDSCaps. ddsCaps is of type TDDScaps2 for DX6 + dwMinOverlayStretch: DWORD; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxOverlayStretch: DWORD; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMinLiveVideoStretch: DWORD; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxLiveVideoStretch: DWORD; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMinHwCodecStretch: DWORD; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwMaxHwCodecStretch: DWORD; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 + dwReserved1: DWORD; // reserved + dwReserved2: DWORD; // reserved + dwReserved3: DWORD; // reserved + dwSVBCaps: DWORD; // driver specific capabilities for System->Vmem blts + dwSVBCKeyCaps: DWORD; // driver color key capabilities for System->Vmem blts + dwSVBFXCaps: DWORD; // driver FX capabilities for System->Vmem blts + dwSVBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->Vmem blts + dwVSBCaps: DWORD; // driver specific capabilities for Vmem->System blts + dwVSBCKeyCaps: DWORD; // driver color key capabilities for Vmem->System blts + dwVSBFXCaps: DWORD; // driver FX capabilities for Vmem->System blts + dwVSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for Vmem->System blts + dwSSBCaps: DWORD; // driver specific capabilities for System->System blts + dwSSBCKeyCaps: DWORD; // driver color key capabilities for System->System blts + dwSSBFXCaps: DWORD; // driver FX capabilities for System->System blts + dwSSBRops: Array [0..DD_ROP_SPACE-1] of DWORD;// ROPS supported for System->System blts + // Members added for DX5: + dwMaxVideoPorts: DWORD; // maximum number of usable video ports + dwCurrVideoPorts: DWORD; // current number of video ports used + dwSVBCaps2: DWORD; // more driver specific capabilities for System->Vmem blts + dwNLVBCaps: DWORD; // driver specific capabilities for non-local->local vidmem blts + dwNLVBCaps2: DWORD; // more driver specific capabilities non-local->local vidmem blts + dwNLVBCKeyCaps: DWORD; // driver color key capabilities for non-local->local vidmem blts + dwNLVBFXCaps: DWORD; // driver FX capabilities for non-local->local blts + dwNLVBRops: Array [0..DD_ROP_SPACE-1] of DWORD; // ROPS supported for non-local->local blts + // Members added for DX6 release + ddsCaps : TDDSCaps2 ; // Surface Caps + end; + DDCAPS_DX6 = _DDCAPS_DX6; + TDDCaps_DX6 = _DDCAPS_DX6; + + _DDCAPS_DX7 = TDDCaps_DX6; + DDCAPS_DX7 = _DDCAPS_DX7; + PDDCaps_DX7 = ^TDDCaps_DX7; + TDDCaps_DX7 = TDDCaps_DX6; + +{$IFDEF DIRECTDRAW_VERSION_7} + PDDCaps = PDDCaps_DX7; + TDDCaps = TDDCaps_DX7; +{$ELSE} +{$IFDEF DIRECTDRAW_VERSION_6} + PDDCaps = PDDCaps_DX6; + TDDCaps = TDDCaps_DX6; +{$ELSE} +{$IFDEF DIRECTDRAW_VERSION_5} + PDDCaps = PDDCaps_DX5; + TDDCaps = TDDCaps_DX5; +{$ELSE} +{$IFDEF DIRECTDRAW_VERSION_3} + PDDCaps = PDDCaps_DX3; + TDDCaps = TDDCaps_DX3; +{$ELSE} + PDDCaps = PDDCaps_DX1; + TDDCaps = TDDCaps_DX1; +{$ENDIF} +{$ENDIF} +{$ENDIF} +{$ENDIF} + + + +(* + * TDDPixelFormat + *) + PDDPixelFormat = ^TDDPixelFormat; + _DDPIXELFORMAT = packed record + dwSize: DWORD; // size of structure + dwFlags: DWORD; // pixel format flags + dwFourCC: DWORD; // (FOURCC code) + case Integer of + 1: ( + dwRGBBitCount : DWORD; // how many bits per pixel + dwRBitMask : DWORD; // mask for red bit + dwGBitMask : DWORD; // mask for green bits + dwBBitMask : DWORD; // mask for blue bits + dwRGBAlphaBitMask : DWORD; // mask for alpha channel + ); + 2: ( + dwYUVBitCount : DWORD; // how many bits per pixel + dwYBitMask : DWORD; // mask for Y bits + dwUBitMask : DWORD; // mask for U bits + dwVBitMask : DWORD; // mask for V bits + dwYUVAlphaBitMask : DWORD; // mask for alpha channel + ); + 3: ( + dwZBufferBitDepth : DWORD; // how many total bits/pixel in z buffer (including any stencil bits) + dwStencilBitDepth : DWORD; // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits) + dwZBitMask : DWORD; // mask for Z bits + dwStencilBitMask : DWORD; // mask for stencil bits + dwLuminanceAlphaBitMask : DWORD; // mask for alpha channel + ); + 4: ( + dwAlphaBitDepth : DWORD; // how many bits for alpha channels + dwLuminanceBitMask : DWORD; // mask for luminance bits + dwBumpDvBitMask : DWORD; // mask for bump map V delta bits + dwBumpLuminanceBitMask : DWORD; // mask for luminance in bump map + dwRGBZBitMask : DWORD; // mask for Z channel + ); + 5: ( + dwLuminanceBitCount : DWORD; // how many bits per pixel + dwBumpDuBitMask : DWORD; // mask for bump map U delta bits + Fill1, Fill2 : DWORD; + dwYUVZBitMask : DWORD; // mask for Z channel + ); + 6: ( dwBumpBitCount : DWORD; // how many bits per "buxel", total + ); + end; + DDPIXELFORMAT = _DDPIXELFORMAT; + TDDPixelFormat = _DDPIXELFORMAT; + + // These definitions are for compatibility with Erik Unger original conversion + PDDPixelFormat_DX3 = PDDPixelFormat; + TDDPixelFormat_DX3 = TDDPixelFormat; + + PDDPixelFormat_DX5 = PDDPixelFormat; + TDDPixelFormat_DX5 = TDDPixelFormat; + + PDDPixelFormat_DX6 = PDDPixelFormat; + TDDPixelFormat_DX6 = TDDPixelFormat; + + PDDPixelFormat_DX7 = PDDPixelFormat; + TDDPixelFormat_DX7 = TDDPixelFormat; + + + +(* + * TDDOverlayFX + *) + PDDOverlayFX = ^TDDOverlayFX; + _DDOVERLAYFX = packed record + dwSize: DWORD; // size of structure + dwAlphaEdgeBlendBitDepth: DWORD; // Bit depth used to specify constant for alpha edge blend + dwAlphaEdgeBlend: DWORD; // Constant to use as alpha for edge blend + dwReserved: DWORD; + dwAlphaDestConstBitDepth: DWORD; // Bit depth used to specify alpha constant for destination + case Integer of + 0: ( + dwAlphaDestConst: DWORD; // Constant to use as alpha channel for dest + dwAlphaSrcConstBitDepth: DWORD; // Bit depth used to specify alpha constant for source + dwAlphaSrcConst: DWORD; // Constant to use as alpha channel for src + dckDestColorkey: TDDColorKey; // DestColorkey override + dckSrcColorkey: TDDColorKey; // DestColorkey override + dwDDFX: DWORD; // Overlay FX + dwFlags: DWORD; // flags + ); + 1: ( + lpDDSAlphaDest: PDirectDrawSurface; // Surface to use as alpha channel for dest + filler: DWORD; + lpDDSAlphaSrc: PDirectDrawSurface; // Surface to use as alpha channel for src + ); + end; + DDOVERLAYFX = _DDOVERLAYFX; + TDDOverlayFX = _DDOVERLAYFX; + +(* + * TDDBltBatch: BltBatch entry structure + *) + PDDBltBatch = ^TDDBltBatch; + _DDBLTBATCH = packed record + lprDest: PRect; + lpDDSSrc: IDirectDrawSurface; + lprSrc: PRect; + dwFlags: DWORD; + lpDDBltFx: TDDBltFX; + end; + DDBLTBATCH = _DDBLTBATCH; + TDDBltBatch = _DDBLTBATCH; + +(* + * TDDGammaRamp + *) + PDDGammaRamp = ^TDDGammaRamp; + _DDGAMMARAMP = packed record + red : array[0..255] of WORD; + green : array[0..255] of WORD; + blue : array[0..255] of WORD; + end; + DDGAMMARAMP = _DDGAMMARAMP; + TDDGammaRamp = _DDGAMMARAMP; + +(* + * This is the structure within which DirectDraw returns data about the current graphics driver and chipset + *) + + PDDDeviceIdentifier = ^TDDDeviceIdentifier; + tagDDDEVICEIDENTIFIER = packed record + // + // These elements are for presentation to the user only. They should not be used to identify particular + // drivers, since this is unreliable and many different strings may be associated with the same + // device, and the same driver from different vendors. + // + szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char; + szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char; + + // + // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons + // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic + // drivers. It is recommended that guidDeviceIdentifier is used for this purpose. + // + // This version has the form: + // wProduct = HIWORD(liDriverVersion.HighPart) + // wVersion = LOWORD(liDriverVersion.HighPart) + // wSubVersion = HIWORD(liDriverVersion.LowPart) + // wBuild = LOWORD(liDriverVersion.LowPart) + // + liDriverVersion: TLargeInteger; // Defined for applications and other 32 bit components + + // + // These elements can be used to identify particular chipsets. Use with extreme caution. + // dwVendorId Identifies the manufacturer. May be zero if unknown. + // dwDeviceId Identifies the type of chipset. May be zero if unknown. + // dwSubSysId Identifies the subsystem, typically this means the particular board. May be zero if unknown. + // dwRevision Identifies the revision level of the chipset. May be zero if unknown. + // + dwVendorId: DWORD; + dwDeviceId: DWORD; + dwSubSysId: DWORD; + dwRevision: DWORD; + + // + // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the + // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to + // reprofile the graphics subsystem. + // This element can also be used to identify particular problematic drivers. + // + guidDeviceIdentifier: TGUID; + end; + DDDEVICEIDENTIFIER = tagDDDEVICEIDENTIFIER; + TDDDeviceIdentifier = tagDDDEVICEIDENTIFIER; + + PDDDeviceIdentifier2 = ^TDDDeviceIdentifier2; + tagDDDEVICEIDENTIFIER2 = packed record + // + // These elements are for presentation to the user only. They should not be used to identify particular + // drivers, since this is unreliable and many different strings may be associated with the same + // device, and the same driver from different vendors. + // + szDriver: array[0..MAX_DDDEVICEID_STRING-1] of Char; + szDescription: array[0..MAX_DDDEVICEID_STRING-1] of Char; + + // + // This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons + // on the whole 64 bits. Caution should be exercised if you use this element to identify problematic + // drivers. It is recommended that guidDeviceIdentifier is used for this purpose. + // + // This version has the form: + // wProduct = HIWORD(liDriverVersion.HighPart) + // wVersion = LOWORD(liDriverVersion.HighPart) + // wSubVersion = HIWORD(liDriverVersion.LowPart) + // wBuild = LOWORD(liDriverVersion.LowPart) + // + liDriverVersion: TLargeInteger; // Defined for applications and other 32 bit components + + // + // These elements can be used to identify particular chipsets. Use with extreme caution. + // dwVendorId Identifies the manufacturer. May be zero if unknown. + // dwDeviceId Identifies the type of chipset. May be zero if unknown. + // dwSubSysId Identifies the subsystem, typically this means the particular board. May be zero if unknown. + // dwRevision Identifies the revision level of the chipset. May be zero if unknown. + // + dwVendorId: DWORD; + dwDeviceId: DWORD; + dwSubSysId: DWORD; + dwRevision: DWORD; + + // + // This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the + // driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to + // reprofile the graphics subsystem. + // This element can also be used to identify particular problematic drivers. + // + guidDeviceIdentifier: TGUID; + + (* + * This element is used to determine the Windows Hardware Quality Lab (WHQL) + * certification level for this driver/device pair. + *) + dwWHQLLevel: DWORD; + end; + DDDEVICEIDENTIFIER2 = tagDDDEVICEIDENTIFIER2; + TDDDeviceIdentifier2 = tagDDDEVICEIDENTIFIER2; + +(* + * callbacks + *) + TClipperCallback = function(lpDDClipper: IDirectDrawClipper; hWnd: HWND; + Code: DWORD; lpContext: Pointer): HResult; stdcall; + TSurfacesStreamingCallback = function(arg: DWORD): HResult; stdcall; + +(* + * TDDSurfaceDesc + *) + PDDSurfaceDesc = ^TDDSurfaceDesc; + _DDSURFACEDESC = packed record + dwSize: DWORD; // size of the TDDSurfaceDesc structure + dwFlags: DWORD; // determines what fields are valid + dwHeight: DWORD; // height of surface to be created + dwWidth: DWORD; // width of input surface + case Integer of + 0: ( + dwLinearSize: DWORD; // unused at the moment + ); + 1: ( + lPitch: Longint; // distance to start of next line (return value only) + dwBackBufferCount: DWORD; // number of back buffers requested + case Integer of + 0: ( + dwMipMapCount: DWORD; // number of mip-map levels requested + dwAlphaBitDepth: DWORD; // depth of alpha buffer requested + dwReserved: DWORD; // reserved + lpSurface: Pointer; // pointer to the associated surface memory + ddckCKDestOverlay: TDDColorKey; // color key for destination overlay use + ddckCKDestBlt: TDDColorKey; // color key for destination blt use + ddckCKSrcOverlay: TDDColorKey; // color key for source overlay use + ddckCKSrcBlt: TDDColorKey; // color key for source blt use + ddpfPixelFormat: TDDPixelFormat; // pixel format description of the surface + ddsCaps: TDDSCaps; // direct draw surface capabilities + ); + 1: ( + dwZBufferBitDepth: DWORD; // depth of Z buffer requested + ); + 2: ( + dwRefreshRate: DWORD; // refresh rate (used when display mode is described) + ); + ); + end; + DDSURFACEDESC = _DDSURFACEDESC; + TDDSurfaceDesc = _DDSURFACEDESC; + + // These definitions are for compatibility with Erik Unger original conversion + PDDSurfaceDesc_DX5 = PDDSurfaceDesc; + TDDSurfaceDesc_DX5 = TDDSurfaceDesc; + + PDDSurfaceDesc_DX6 = PDDSurfaceDesc; + TDDSurfaceDesc_DX6 = TDDSurfaceDesc; + + +(* + * TDDSurfaceDesc2 + *) + PDDSurfaceDesc2 = ^TDDSurfaceDesc2; + _DDSURFACEDESC2 = packed record + dwSize: DWORD; // size of the TDDSurfaceDesc structure + dwFlags: DWORD; // determines what fields are valid + dwHeight: DWORD; // height of surface to be created + dwWidth: DWORD; // width of input surface + case Integer of + 0: ( + lPitch : Longint; // distance to start of next line (return value only) + ); + 1: ( + dwLinearSize : DWORD; // Formless late-allocated optimized surface size + dwBackBufferCount: DWORD; // number of back buffers requested + case Integer of + 0: ( + dwMipMapCount: DWORD; // number of mip-map levels requested + dwAlphaBitDepth: DWORD; // depth of alpha buffer requested + dwReserved: DWORD; // reserved + lpSurface: Pointer; // pointer to the associated surface memory + ddckCKDestOverlay: TDDColorKey; // color key for destination overlay use + ddckCKDestBlt: TDDColorKey; // color key for destination blt use + ddckCKSrcOverlay: TDDColorKey; // color key for source overlay use + ddckCKSrcBlt: TDDColorKey; // color key for source blt use + ddpfPixelFormat: TDDPixelFormat; // pixel format description of the surface + ddsCaps: TDDSCaps2; // direct draw surface capabilities + dwTextureStage: DWORD; // stage in multitexture cascade + ); + 1: ( + dwRefreshRate: DWORD; // refresh rate (used when display mode is described) + ); + ); + end; + DDSURFACEDESC2 = _DDSURFACEDESC2; + TDDSurfaceDesc2 = _DDSURFACEDESC2; + +(* + * TDDOptSurfaceDesc + *) + + PDDOptSurfaceDesc = ^TDDOptSurfaceDesc; + _DDOPTSURFACEDESC = packed record + dwSize : DWORD; // size of the DDOPTSURFACEDESC structure + dwFlags : DWORD; // determines what fields are valid + ddSCaps : TDDSCaps2; // Common caps like: Memory type + ddOSCaps : TDDOSCaps; // Common caps like: Memory type + guid : TGUID; // Compression technique GUID + dwCompressionRatio : DWORD; // Compression ratio + end; + DDOPTSURFACEDESC = _DDOPTSURFACEDESC; + TDDOptSurfaceDesc = _DDOPTSURFACEDESC; + +(* + * DDCOLORCONTROL + *) + PDDColorControl = ^TDDColorControl; + _DDCOLORCONTROL = packed record + dwSize: DWORD; + dwFlags: DWORD; + lBrightness: Longint; + lContrast: Longint; + lHue: Longint; + lSaturation: Longint; + lSharpness: Longint; + lGamma: Longint; + lColorEnable: Longint; + dwReserved1: DWORD; + end; + DDCOLORCONTROL = _DDCOLORCONTROL; + TDDColorControl = _DDCOLORCONTROL; + +(* + * callbacks + *) + +//{$IFNDEF WINNT} + TDDEnumModesCallback = function (const lpDDSurfaceDesc: TDDSurfaceDesc; + lpContext: Pointer): HResult; stdcall; + TDDEnumModesCallback2 = function (const lpDDSurfaceDesc: TDDSurfaceDesc2; + lpContext: Pointer): HResult; stdcall; + TDDEnumSurfacesCallback = function (lpDDSurface: IDirectDrawSurface; + const lpDDSurfaceDesc: TDDSurfaceDesc; lpContext: Pointer): HResult; stdcall; + TDDEnumSurfacesCallback2 = function (lpDDSurface: IDirectDrawSurface4; + const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer): HResult; stdcall; + TDDEnumSurfacesCallback7 = function (lpDDSurface: IDirectDrawSurface7; + const lpDDSurfaceDesc: TDDSurfaceDesc2; lpContext: Pointer): HResult; stdcall; +//{$ENDIF} + +(* + * INTERACES FOLLOW: + * IDirectDraw + * IDirectDrawClipper + * IDirectDrawPalette + * IDirectDrawSurface + *) + +(* + * IDirectDraw + *) + + IDirectDraw = interface(IUnknown) + ['{6C14DB80-A733-11CE-A521-0020AF0BE560}'] + (*** IDirectDraw methods ***) + function Compact: HResult; stdcall; + function CreateClipper(dwFlags: DWORD; + out lplpDDClipper: IDirectDrawClipper; + pUnkOuter: IUnknown): HResult; stdcall; + function CreatePalette(dwFlags: DWORD; lpColorTable: Pointer; + out lplpDDPalette: IDirectDrawPalette; + pUnkOuter: IUnknown): HResult; stdcall; + function CreateSurface(var lpDDSurfaceDesc: TDDSurfaceDesc; + out lplpDDSurface: IDirectDrawSurface; + pUnkOuter: IUnknown): HResult; stdcall; + function DuplicateSurface(lpDDSurface: IDirectDrawSurface; + out lplpDupDDSurface: IDirectDrawSurface): HResult; stdcall; + function EnumDisplayModes(dwFlags: DWORD; + lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer; + lpEnumModesCallback: TDDEnumModesCallback): HResult; stdcall; + function EnumSurfaces(dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc; + lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback) : + HResult; stdcall; + function FlipToGDISurface: HResult; stdcall; + function GetCaps(lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps): HResult; stdcall; + function GetDisplayMode(out lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function GetFourCCCodes(var lpNumCodes: DWORD; lpCodes: PDWORD): HResult; stdcall; + function GetGDISurface(out lplpGDIDDSSurface: IDirectDrawSurface): HResult; stdcall; + function GetMonitorFrequency(out lpdwFrequency: DWORD): HResult; stdcall; + function GetScanLine(out lpdwScanLine: DWORD): HResult; stdcall; + function GetVerticalBlankStatus(out lpbIsInVB: BOOL): HResult; stdcall; + function Initialize(lpGUID: PGUID): HResult; stdcall; + function RestoreDisplayMode: HResult; stdcall; + function SetCooperativeLevel(hWnd: HWND; dwFlags: DWORD): HResult; stdcall; + (*** Warning! SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***) + function SetDisplayMode(dwWidth: DWORD; dwHeight: DWORD; + dwBpp: DWORD): HResult; stdcall; + function WaitForVerticalBlank(dwFlags: DWORD; hEvent: THandle): HResult; stdcall; + end; + + IDirectDraw2 = interface(IUnknown) + ['{B3A6F3E0-2B43-11CF-A2DE-00AA00B93356}'] + (*** IDirectDraw methods ***) + function Compact: HResult; stdcall; + function CreateClipper(dwFlags: DWORD; + out lplpDDClipper: IDirectDrawClipper; + pUnkOuter: IUnknown): HResult; stdcall; + function CreatePalette(dwFlags: DWORD; lpColorTable: Pointer; + out lplpDDPalette: IDirectDrawPalette; + pUnkOuter: IUnknown): HResult; stdcall; + function CreateSurface(var lpDDSurfaceDesc: TDDSurfaceDesc; + out lplpDDSurface: IDirectDrawSurface; + pUnkOuter: IUnknown): HResult; stdcall; + function DuplicateSurface(lpDDSurface: IDirectDrawSurface; + out lplpDupDDSurface: IDirectDrawSurface): HResult; stdcall; + function EnumDisplayModes(dwFlags: DWORD; + lpDDSurfaceDesc: PDDSurfaceDesc; lpContext: Pointer; + lpEnumModesCallback: TDDEnumModesCallback): HResult; stdcall; + function EnumSurfaces(dwFlags: DWORD; var lpDDSD: TDDSurfaceDesc; + lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback): HResult; stdcall; + function FlipToGDISurface: HResult; stdcall; + function GetCaps(lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps): HResult; stdcall; + function GetDisplayMode(out lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function GetFourCCCodes(var lpNumCodes: DWORD; lpCodes: PDWORD): HResult; stdcall; + function GetGDISurface(out lplpGDIDDSSurface: IDirectDrawSurface): HResult; stdcall; + function GetMonitorFrequency(out lpdwFrequency: DWORD): HResult; stdcall; + function GetScanLine(out lpdwScanLine: DWORD): HResult; stdcall; + function GetVerticalBlankStatus(out lpbIsInVB: BOOL): HResult; stdcall; + function Initialize(lpGUID: PGUID): HResult; stdcall; + function RestoreDisplayMode: HResult; stdcall; + function SetCooperativeLevel(hWnd: HWND; dwFlags: DWORD): HResult; stdcall; + function SetDisplayMode(dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD; + dwRefreshRate: DWORD; dwFlags: DWORD): HResult; stdcall; + function WaitForVerticalBlank(dwFlags: DWORD; hEvent: THandle): HResult; stdcall; + (*** Added in the v2 interface ***) + function GetAvailableVidMem(var lpDDSCaps: TDDSCaps; + out lpdwTotal, lpdwFree: DWORD): HResult; stdcall; + end; + + IDirectDraw4 = interface(IUnknown) + ['{9c59509a-39bd-11d1-8c4a-00c04fd930c5}'] + (*** IDirectDraw methods ***) + function Compact: HResult; stdcall; + function CreateClipper(dwFlags: DWORD; + out lplpDDClipper: IDirectDrawClipper; + pUnkOuter: IUnknown): HResult; stdcall; + function CreatePalette(dwFlags: DWORD; lpColorTable: Pointer; + out lplpDDPalette: IDirectDrawPalette; + pUnkOuter: IUnknown): HResult; stdcall; + function CreateSurface(const lpDDSurfaceDesc: TDDSurfaceDesc2; + out lplpDDSurface: IDirectDrawSurface4; + pUnkOuter: IUnknown): HResult; stdcall; + function DuplicateSurface(lpDDSurface: IDirectDrawSurface4; + out lplpDupDDSurface: IDirectDrawSurface4): HResult; stdcall; + function EnumDisplayModes(dwFlags: DWORD; + lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer; + lpEnumModesCallback: TDDEnumModesCallback2): HResult; stdcall; + function EnumSurfaces(dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2; + lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback2): + HResult; stdcall; + function FlipToGDISurface: HResult; stdcall; + function GetCaps(lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps): HResult; stdcall; + function GetDisplayMode(out lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall; + function GetFourCCCodes(var lpNumCodes: DWORD; lpCodes: PDWORD): HResult; stdcall; + function GetGDISurface(out lplpGDIDDSSurface: IDirectDrawSurface4): HResult; stdcall; + function GetMonitorFrequency(out lpdwFrequency: DWORD): HResult; stdcall; + function GetScanLine(out lpdwScanLine: DWORD): HResult; stdcall; + function GetVerticalBlankStatus(out lpbIsInVB: BOOL): HResult; stdcall; + function Initialize(lpGUID: PGUID): HResult; stdcall; + function RestoreDisplayMode: HResult; stdcall; + function SetCooperativeLevel(hWnd: HWND; dwFlags: DWORD): HResult; stdcall; + function SetDisplayMode(dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD; + dwRefreshRate: DWORD; dwFlags: DWORD): HResult; stdcall; + function WaitForVerticalBlank(dwFlags: DWORD; hEvent: THandle): HResult; stdcall; + (*** Added in the v2 interface ***) + function GetAvailableVidMem(const lpDDSCaps: TDDSCaps2; + out lpdwTotal, lpdwFree: DWORD): HResult; stdcall; + (*** Added in the V4 Interface ***) + function GetSurfaceFromDC(hdc: Windows.HDC; + out lpDDS4: IDirectDrawSurface4): HResult; stdcall; + function RestoreAllSurfaces: HResult; stdcall; + function TestCooperativeLevel: HResult; stdcall; + function GetDeviceIdentifier(out lpdddi: TDDDeviceIdentifier; + dwFlags: DWORD): HResult; stdcall; + end; + + IDirectDraw7 = interface(IUnknown) + ['{15e65ec0-3b9c-11d2-b92f-00609797ea5b}'] + (*** IDirectDraw methods ***) + function Compact: HResult; stdcall; + function CreateClipper(dwFlags: DWORD; + out lplpDDClipper: IDirectDrawClipper; + pUnkOuter: IUnknown): HResult; stdcall; + function CreatePalette(dwFlags: DWORD; lpColorTable: Pointer; + out lplpDDPalette: IDirectDrawPalette; + pUnkOuter: IUnknown): HResult; stdcall; + function CreateSurface(const lpDDSurfaceDesc: TDDSurfaceDesc2; + out lplpDDSurface: IDirectDrawSurface7; + pUnkOuter: IUnknown): HResult; stdcall; + function DuplicateSurface(lpDDSurface: IDirectDrawSurface7; + out lplpDupDDSurface: IDirectDrawSurface7): HResult; stdcall; + function EnumDisplayModes(dwFlags: DWORD; + lpDDSurfaceDesc: PDDSurfaceDesc2; lpContext: Pointer; + lpEnumModesCallback: TDDEnumModesCallback2): HResult; stdcall; + function EnumSurfaces(dwFlags: DWORD; const lpDDSD: TDDSurfaceDesc2; + lpContext: Pointer; lpEnumCallback: TDDEnumSurfacesCallback7) : + HResult; stdcall; + function FlipToGDISurface: HResult; stdcall; + function GetCaps(lpDDDriverCaps: PDDCaps; lpDDHELCaps: PDDCaps): HResult; stdcall; + function GetDisplayMode(out lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall; + function GetFourCCCodes(var lpNumCodes: DWORD; lpCodes: PDWORD): HResult; stdcall; + function GetGDISurface(out lplpGDIDDSSurface: IDirectDrawSurface7) : + HResult; stdcall; + function GetMonitorFrequency(out lpdwFrequency: DWORD): HResult; stdcall; + function GetScanLine(out lpdwScanLine: DWORD): HResult; stdcall; + function GetVerticalBlankStatus(out lpbIsInVB: BOOL): HResult; stdcall; + function Initialize(lpGUID: PGUID): HResult; stdcall; + function RestoreDisplayMode: HResult; stdcall; + function SetCooperativeLevel(hWnd: HWND; dwFlags: DWORD): HResult; stdcall; + function SetDisplayMode(dwWidth: DWORD; dwHeight: DWORD; dwBPP: DWORD; + dwRefreshRate: DWORD; dwFlags: DWORD): HResult; stdcall; + function WaitForVerticalBlank(dwFlags: DWORD; hEvent: THandle) : + HResult; stdcall; + (*** Added in the v2 interface ***) + function GetAvailableVidMem(const lpDDSCaps: TDDSCaps2; + out lpdwTotal, lpdwFree: DWORD): HResult; stdcall; + (*** Added in the V4 Interface ***) + function GetSurfaceFromDC(hdc: Windows.HDC; + out lpDDS: IDirectDrawSurface7): HResult; stdcall; + function RestoreAllSurfaces: HResult; stdcall; + function TestCooperativeLevel: HResult; stdcall; + function GetDeviceIdentifier(out lpdddi: TDDDeviceIdentifier2; + dwFlags: DWORD): HResult; stdcall; + function StartModeTest(const lpModesToTest; dwNumEntries, dwFlags: DWORD): HResult; stdcall; + function EvaluateMode(dwFlags: DWORD; out pSecondsUntilTimeout: DWORD): HResult; stdcall; + end; + + + +(* + * IDirectDrawPalette + *) + + IDirectDrawPalette = interface(IUnknown) + ['{6C14DB84-A733-11CE-A521-0020AF0BE560}'] + (*** IDirectDrawPalette methods ***) + function GetCaps(out lpdwCaps: DWORD): HResult; stdcall; + function GetEntries(dwFlags: DWORD; dwBase: DWORD; dwNumEntries: DWORD; + lpEntries: Pointer): HResult; stdcall; + function Initialize(lpDD: IDirectDraw; dwFlags: DWORD; + lpDDColorTable: Pointer): HResult; stdcall; + function SetEntries(dwFlags: DWORD; dwStartingEntry: DWORD; + dwCount: DWORD; lpEntries: Pointer): HResult; stdcall; + end; + +(* + * IDirectDrawClipper + *) + + IDirectDrawClipper = interface(IUnknown) + ['{6C14DB85-A733-11CE-A521-0020AF0BE560}'] + (*** IDirectDrawClipper methods ***) + function GetClipList(lpRect: PRect; lpClipList: PRgnData; + var lpdwSize: DWORD): HResult; stdcall; + function GetHWnd(out lphWnd: HWND): HResult; stdcall; + function Initialize(lpDD: IDirectDraw; dwFlags: DWORD): HResult; stdcall; + function IsClipListChanged(out lpbChanged: BOOL): HResult; stdcall; + function SetClipList(lpClipList: PRgnData; dwFlags: DWORD): HResult; stdcall; + function SetHWnd(dwFlags: DWORD; hWnd: HWND): HResult; stdcall; + end; + +(* + * IDirectDrawSurface and related interfaces + *) + + IDirectDrawSurface = interface(IUnknown) + ['{6C14DB81-A733-11CE-A521-0020AF0BE560}'] + (*** IDirectDrawSurface methods ***) + function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface) : + HResult; stdcall; + function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall; + function Blt(lpDestRect: PRect; + lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect; + dwFlags: DWORD; lpDDBltFx: PDDBltFX): HResult; stdcall; + function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD; + dwFlags: DWORD): HResult; stdcall; + function BltFast(dwX: DWORD; dwY: DWORD; + lpDDSrcSurface: IDirectDrawSurface; lpSrcRect: PRect; + dwTrans: DWORD): HResult; stdcall; + function DeleteAttachedSurface(dwFlags: DWORD; + lpDDSAttachedSurface: IDirectDrawSurface): HResult; stdcall; + function EnumAttachedSurfaces(lpContext: Pointer; + lpEnumSurfacesCallback: TDDEnumSurfacesCallback): HResult; stdcall; + function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer; + lpfnCallback: TDDEnumSurfacesCallback): HResult; stdcall; + function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface; + dwFlags: DWORD): HResult; stdcall; + function GetAttachedSurface(var lpDDSCaps: TDDSCaps; + (*out*)var lplpDDAttachedSurface: IDirectDrawSurface): HResult; stdcall; + function GetBltStatus(dwFlags: DWORD): HResult; stdcall; + function GetCaps(out lpDDSCaps: TDDSCaps): HResult; stdcall; + function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall; + function GetColorKey(dwFlags: DWORD; out lpDDColorKey: TDDColorKey) : + HResult; stdcall; + function GetDC(out lphDC: HDC): HResult; stdcall; + function GetFlipStatus(dwFlags: DWORD): HResult; stdcall; + function GetOverlayPosition(out lplX, lplY: Longint): HResult; stdcall; + function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall; + function GetPixelFormat(out lpDDPixelFormat: TDDPixelFormat): HResult; stdcall; + function GetSurfaceDesc(out lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function Initialize(lpDD: IDirectDraw; + out lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function IsLost: HResult; stdcall; + function Lock(lpDestRect: PRect; out lpDDSurfaceDesc: + TDDSurfaceDesc; dwFlags: DWORD; hEvent: THandle): HResult; stdcall; + function ReleaseDC(hDC: Windows.HDC): HResult; stdcall; + function _Restore: HResult; stdcall; + function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall; + function SetColorKey(dwFlags: DWORD; lpDDColorKey: PDDColorKey) : + HResult; stdcall; + function SetOverlayPosition(lX, lY: Longint): HResult; stdcall; + function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall; + function Unlock(lpSurfaceData: Pointer): HResult; stdcall; + function UpdateOverlay(lpSrcRect: PRect; + lpDDDestSurface: IDirectDrawSurface; lpDestRect: PRect; + dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX): HResult; stdcall; + function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall; + function UpdateOverlayZOrder(dwFlags: DWORD; + lpDDSReference: IDirectDrawSurface): HResult; stdcall; + end; + +(* + * IDirectDrawSurface2 and related interfaces + *) + + IDirectDrawSurface2 = interface(IUnknown) + ['{57805885-6eec-11cf-9441-a82303c10e27}'] + (*** IDirectDrawSurface methods ***) + function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface2) : + HResult; stdcall; + function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall; + function Blt(lpDestRect: PRect; + lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect; + dwFlags: DWORD; lpDDBltFx: PDDBltFX): HResult; stdcall; + function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD; + dwFlags: DWORD): HResult; stdcall; + function BltFast(dwX: DWORD; dwY: DWORD; + lpDDSrcSurface: IDirectDrawSurface2; lpSrcRect: PRect; + dwTrans: DWORD): HResult; stdcall; + function DeleteAttachedSurface(dwFlags: DWORD; + lpDDSAttachedSurface: IDirectDrawSurface2): HResult; stdcall; + function EnumAttachedSurfaces(lpContext: Pointer; + lpEnumSurfacesCallback: TDDEnumSurfacesCallback): HResult; stdcall; + function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer; + lpfnCallback: TDDEnumSurfacesCallback): HResult; stdcall; + function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface2; + dwFlags: DWORD): HResult; stdcall; + function GetAttachedSurface(var lpDDSCaps: TDDSCaps; + out lplpDDAttachedSurface: IDirectDrawSurface2): HResult; stdcall; + function GetBltStatus(dwFlags: DWORD): HResult; stdcall; + function GetCaps(out lpDDSCaps: TDDSCaps): HResult; stdcall; + function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall; + function GetColorKey(dwFlags: DWORD; out lpDDColorKey: TDDColorKey) : + HResult; stdcall; + function GetDC(out lphDC: HDC): HResult; stdcall; + function GetFlipStatus(dwFlags: DWORD): HResult; stdcall; + function GetOverlayPosition(out lplX, lplY: Longint): HResult; stdcall; + function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall; + function GetPixelFormat(out lpDDPixelFormat: TDDPixelFormat): HResult; stdcall; + function GetSurfaceDesc(out lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function Initialize(lpDD: IDirectDraw; + out lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function IsLost: HResult; stdcall; + function Lock(lpDestRect: PRect; + out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD; + hEvent: THandle): HResult; stdcall; + function ReleaseDC(hDC: Windows.HDC): HResult; stdcall; + function _Restore: HResult; stdcall; + function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall; + function SetColorKey(dwFlags: DWORD; lpDDColorKey: PDDColorKey) : + HResult; stdcall; + function SetOverlayPosition(lX, lY: Longint): HResult; stdcall; + function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall; + function Unlock(lpSurfaceData: Pointer): HResult; stdcall; + function UpdateOverlay(lpSrcRect: PRect; + lpDDDestSurface: IDirectDrawSurface2; lpDestRect: PRect; + dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX): HResult; stdcall; + function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall; + function UpdateOverlayZOrder(dwFlags: DWORD; + lpDDSReference: IDirectDrawSurface2): HResult; stdcall; + (*** Added in the v2 interface ***) + function GetDDInterface(var lplpDD: IDirectDraw): HResult; stdcall; + function PageLock(dwFlags: DWORD): HResult; stdcall; + function PageUnlock(dwFlags: DWORD): HResult; stdcall; + end; + + IDirectDrawSurface3 = interface(IUnknown) + ['{DA044E00-69B2-11D0-A1D5-00AA00B8DFBB}'] + (*** IDirectDrawSurface methods ***) + function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface3) : + HResult; stdcall; + function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall; + function Blt(lpDestRect: PRect; + lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect; + dwFlags: DWORD; lpDDBltFx: PDDBltFX): HResult; stdcall; + function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD; + dwFlags: DWORD): HResult; stdcall; + function BltFast(dwX: DWORD; dwY: DWORD; + lpDDSrcSurface: IDirectDrawSurface3; lpSrcRect: PRect; + dwTrans: DWORD): HResult; stdcall; + function DeleteAttachedSurface(dwFlags: DWORD; + lpDDSAttachedSurface: IDirectDrawSurface3): HResult; stdcall; + function EnumAttachedSurfaces(lpContext: Pointer; + lpEnumSurfacesCallback: TDDEnumSurfacesCallback): HResult; stdcall; + function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer; + lpfnCallback: TDDEnumSurfacesCallback): HResult; stdcall; + function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface3; + dwFlags: DWORD): HResult; stdcall; + function GetAttachedSurface(var lpDDSCaps: TDDSCaps; + out lplpDDAttachedSurface: IDirectDrawSurface3): HResult; stdcall; + function GetBltStatus(dwFlags: DWORD): HResult; stdcall; + function GetCaps(out lpDDSCaps: TDDSCaps): HResult; stdcall; + function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall; + function GetColorKey(dwFlags: DWORD; out lpDDColorKey: TDDColorKey) : + HResult; stdcall; + function GetDC(out lphDC: HDC): HResult; stdcall; + function GetFlipStatus(dwFlags: DWORD): HResult; stdcall; + function GetOverlayPosition(out lplX, lplY: Longint): HResult; stdcall; + function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall; + function GetPixelFormat(out lpDDPixelFormat: TDDPixelFormat): HResult; stdcall; + function GetSurfaceDesc(out lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function Initialize(lpDD: IDirectDraw; + out lpDDSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function IsLost: HResult; stdcall; + function Lock(lpDestRect: PRect; + out lpDDSurfaceDesc: TDDSurfaceDesc; dwFlags: DWORD; + hEvent: THandle): HResult; stdcall; + function ReleaseDC(hDC: Windows.HDC): HResult; stdcall; + function _Restore: HResult; stdcall; + function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall; + function SetColorKey(dwFlags: DWORD; lpDDColorKey: PDDColorKey) : + HResult; stdcall; + function SetOverlayPosition(lX, lY: Longint): HResult; stdcall; + function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall; + function Unlock(lpSurfaceData: Pointer): HResult; stdcall; + function UpdateOverlay(lpSrcRect: PRect; + lpDDDestSurface: IDirectDrawSurface3; lpDestRect: PRect; + dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX): HResult; stdcall; + function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall; + function UpdateOverlayZOrder(dwFlags: DWORD; + lpDDSReference: IDirectDrawSurface3): HResult; stdcall; + (*** Added in the v2 interface ***) + function GetDDInterface(out lplpDD: IDirectDraw): HResult; stdcall; + function PageLock(dwFlags: DWORD): HResult; stdcall; + function PageUnlock(dwFlags: DWORD): HResult; stdcall; + (*** Added in the V3 interface ***) + function SetSurfaceDesc(const lpddsd: TDDSurfaceDesc; dwFlags: DWORD): HResult; stdcall; + end; + +(* + * IDirectDrawSurface4 and related interfaces + *) + IDirectDrawSurface4 = interface(IUnknown) + ['{0B2B8630-AD35-11D0-8EA6-00609797EA5B}'] + (*** IDirectDrawSurface methods ***) + function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface4) : + HResult; stdcall; + function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall; + function Blt(lpDestRect: PRect; + lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect; + dwFlags: DWORD; lpDDBltFx: PDDBltFX): HResult; stdcall; + function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD; + dwFlags: DWORD): HResult; stdcall; + function BltFast(dwX: DWORD; dwY: DWORD; + lpDDSrcSurface: IDirectDrawSurface4; lpSrcRect: PRect; + dwTrans: DWORD): HResult; stdcall; + function DeleteAttachedSurface(dwFlags: DWORD; + lpDDSAttachedSurface: IDirectDrawSurface4): HResult; stdcall; + function EnumAttachedSurfaces(lpContext: Pointer; + lpEnumSurfacesCallback: TDDEnumSurfacesCallback2): HResult; stdcall; + function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer; + lpfnCallback: TDDEnumSurfacesCallback2): HResult; stdcall; + function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface4; + dwFlags: DWORD): HResult; stdcall; + function GetAttachedSurface(const lpDDSCaps: TDDSCaps2; + out lplpDDAttachedSurface: IDirectDrawSurface4): HResult; stdcall; + function GetBltStatus(dwFlags: DWORD): HResult; stdcall; + function GetCaps(out lpDDSCaps: TDDSCaps2): HResult; stdcall; + function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall; + function GetColorKey(dwFlags: DWORD; out lpDDColorKey: TDDColorKey) : + HResult; stdcall; + function GetDC(out lphDC: HDC): HResult; stdcall; + function GetFlipStatus(dwFlags: DWORD): HResult; stdcall; + function GetOverlayPosition(out lplX, lplY: Longint): HResult; stdcall; + function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall; + function GetPixelFormat(out lpDDPixelFormat: TDDPixelFormat): HResult; stdcall; + function GetSurfaceDesc(out lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall; + function Initialize(lpDD: IDirectDraw; + out lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall; + function IsLost: HResult; stdcall; + function Lock(lpDestRect: PRect; + out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD; + hEvent: THandle): HResult; stdcall; + function ReleaseDC(hDC: Windows.HDC): HResult; stdcall; + function _Restore: HResult; stdcall; + function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall; + function SetColorKey(dwFlags: DWORD; lpDDColorKey: PDDColorKey) : + HResult; stdcall; + function SetOverlayPosition(lX, lY: Longint): HResult; stdcall; + function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall; + function Unlock(lpRect: PRect): HResult; stdcall; + function UpdateOverlay(lpSrcRect: PRect; + lpDDDestSurface: IDirectDrawSurface4; lpDestRect: PRect; + dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX): HResult; stdcall; + function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall; + function UpdateOverlayZOrder(dwFlags: DWORD; + lpDDSReference: IDirectDrawSurface4): HResult; stdcall; + (*** Added in the v2 interface ***) + function GetDDInterface(out lplpDD: IUnknown): HResult; stdcall; + function PageLock(dwFlags: DWORD): HResult; stdcall; + function PageUnlock(dwFlags: DWORD): HResult; stdcall; + (*** Added in the V3 interface ***) + function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD): HResult; stdcall; + (*** Added in the v4 interface ***) + function SetPrivateData(const guidTag: TGUID; lpData: Pointer; + cbSize: DWORD; dwFlags: DWORD): HResult; stdcall; + function GetPrivateData(const guidTag: TGUID; lpBuffer: Pointer; + var lpcbBufferSize: DWORD): HResult; stdcall; + function FreePrivateData(const guidTag: TGUID): HResult; stdcall; + function GetUniquenessValue(out lpValue: DWORD): HResult; stdcall; + function ChangeUniquenessValue: HResult; stdcall; + end; + + IDirectDrawSurface7 = interface(IUnknown) + ['{06675a80-3b9b-11d2-b92f-00609797ea5b}'] + (*** IDirectDrawSurface methods ***) + function AddAttachedSurface(lpDDSAttachedSurface: IDirectDrawSurface7) : + HResult; stdcall; + function AddOverlayDirtyRect(const lpRect: TRect): HResult; stdcall; + function Blt(lpDestRect: PRect; + lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect; + dwFlags: DWORD; lpDDBltFx: PDDBltFX): HResult; stdcall; + function BltBatch(const lpDDBltBatch: TDDBltBatch; dwCount: DWORD; + dwFlags: DWORD): HResult; stdcall; + function BltFast(dwX: DWORD; dwY: DWORD; + lpDDSrcSurface: IDirectDrawSurface7; lpSrcRect: PRect; + dwTrans: DWORD): HResult; stdcall; + function DeleteAttachedSurface(dwFlags: DWORD; + lpDDSAttachedSurface: IDirectDrawSurface7): HResult; stdcall; + function EnumAttachedSurfaces(lpContext: Pointer; + lpEnumSurfacesCallback: TDDEnumSurfacesCallback7): HResult; stdcall; + function EnumOverlayZOrders(dwFlags: DWORD; lpContext: Pointer; + lpfnCallback: TDDEnumSurfacesCallback7): HResult; stdcall; + function Flip(lpDDSurfaceTargetOverride: IDirectDrawSurface7; + dwFlags: DWORD): HResult; stdcall; + function GetAttachedSurface(const lpDDSCaps: TDDSCaps2; + out lplpDDAttachedSurface: IDirectDrawSurface7): HResult; stdcall; + function GetBltStatus(dwFlags: DWORD): HResult; stdcall; + function GetCaps(out lpDDSCaps: TDDSCaps2): HResult; stdcall; + function GetClipper(out lplpDDClipper: IDirectDrawClipper): HResult; stdcall; + function GetColorKey(dwFlags: DWORD; out lpDDColorKey: TDDColorKey) : + HResult; stdcall; + function GetDC(out lphDC: HDC): HResult; stdcall; + function GetFlipStatus(dwFlags: DWORD): HResult; stdcall; + function GetOverlayPosition(out lplX, lplY: Longint): HResult; stdcall; + function GetPalette(out lplpDDPalette: IDirectDrawPalette): HResult; stdcall; + function GetPixelFormat(out lpDDPixelFormat: TDDPixelFormat): HResult; stdcall; + function GetSurfaceDesc(out lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall; + function Initialize(lpDD: IDirectDraw; + out lpDDSurfaceDesc: TDDSurfaceDesc2): HResult; stdcall; + function IsLost: HResult; stdcall; + function Lock(lpDestRect: PRect; + out lpDDSurfaceDesc: TDDSurfaceDesc2; dwFlags: DWORD; + hEvent: THandle): HResult; stdcall; + function ReleaseDC(hDC: Windows.HDC): HResult; stdcall; + function _Restore: HResult; stdcall; + function SetClipper(lpDDClipper: IDirectDrawClipper): HResult; stdcall; + function SetColorKey(dwFlags: DWORD; lpDDColorKey: PDDColorKey) : + HResult; stdcall; + function SetOverlayPosition(lX, lY: Longint): HResult; stdcall; + function SetPalette(lpDDPalette: IDirectDrawPalette): HResult; stdcall; + function Unlock(lpRect: PRect): HResult; stdcall; + function UpdateOverlay(lpSrcRect: PRect; + lpDDDestSurface: IDirectDrawSurface7; lpDestRect: PRect; + dwFlags: DWORD; lpDDOverlayFx: PDDOverlayFX): HResult; stdcall; + function UpdateOverlayDisplay(dwFlags: DWORD): HResult; stdcall; + function UpdateOverlayZOrder(dwFlags: DWORD; + lpDDSReference: IDirectDrawSurface7): HResult; stdcall; + (*** Added in the v2 interface ***) + function GetDDInterface(out lplpDD: IUnknown): HResult; stdcall; + function PageLock(dwFlags: DWORD): HResult; stdcall; + function PageUnlock(dwFlags: DWORD): HResult; stdcall; + (*** Added in the V3 interface ***) + function SetSurfaceDesc(const lpddsd2: TDDSurfaceDesc2; dwFlags: DWORD): HResult; stdcall; + (*** Added in the v4 interface ***) + function SetPrivateData(const guidTag: TGUID; lpData: Pointer; + cbSize: DWORD; dwFlags: DWORD): HResult; stdcall; + function GetPrivateData(const guidTag: TGUID; lpBuffer: Pointer; + var lpcbBufferSize: DWORD): HResult; stdcall; + function FreePrivateData(const guidTag: TGUID): HResult; stdcall; + function GetUniquenessValue(out lpValue: DWORD): HResult; stdcall; + function ChangeUniquenessValue: HResult; stdcall; + (*** Moved Texture7 methods here ***) + function SetPriority(dwPriority: DWORD): HResult; stdcall; + function GetPriority(out lpdwPriority: DWORD): HResult; stdcall; + function SetLOD(dwMaxLOD: DWORD): HResult; stdcall; + function GetLOD(out lpdwMaxLOD: DWORD): HResult; stdcall; + end; + + IDirectDrawColorControl = interface(IUnknown) + ['{4B9F0EE0-0D7E-11D0-9B06-00A0C903A3B8}'] + function GetColorControls(out lpColorControl: TDDColorControl): HResult; stdcall; + function SetColorControls(const lpColorControl: TDDColorControl): HResult; stdcall; + end; + +(* + * IDirectDrawGammaControl + *) + IDirectDrawGammaControl = interface(IUnknown) + ['{69C11C3E-B46B-11D1-AD7A-00C04FC29B4E}'] + function GetGammaRamp(dwFlags: DWORD; out lpRampData: TDDGammaRamp): HResult; stdcall; + function SetGammaRamp(dwFlags: DWORD; const lpRampData: TDDGammaRamp): HResult; stdcall; + end; + +type + IID_IDirectDraw = IDirectDraw; + IID_IDirectDraw2 = IDirectDraw2; + IID_IDirectDraw4 = IDirectDraw4; + IID_IDirectDraw7 = IDirectDraw7; + IID_IDirectDrawSurface = IDirectDrawSurface; + IID_IDirectDrawSurface2 = IDirectDrawSurface2; + IID_IDirectDrawSurface3 = IDirectDrawSurface3; + IID_IDirectDrawSurface4 = IDirectDrawSurface4; + IID_IDirectDrawSurface7 = IDirectDrawSurface7; + + IID_IDirectDrawPalette = IDirectDrawPalette; + IID_IDirectDrawClipper = IDirectDrawClipper; + IID_IDirectDrawColorControl = IDirectDrawColorControl; + IID_IDirectDrawGammaControl = IDirectDrawGammaControl; + +const +(* + * ddsCaps field is valid. + *) + DDSD_CAPS = $00000001; // default + +(* + * dwHeight field is valid. + *) + DDSD_HEIGHT = $00000002; + +(* + * dwWidth field is valid. + *) + DDSD_WIDTH = $00000004; + +(* + * lPitch is valid. + *) + DDSD_PITCH = $00000008; + +(* + * dwBackBufferCount is valid. + *) + DDSD_BACKBUFFERCOUNT = $00000020; + +(* + * dwZBufferBitDepth is valid. (shouldnt be used in DDSURFACEDESC2) + *) + DDSD_ZBUFFERBITDEPTH = $00000040; + +(* + * dwAlphaBitDepth is valid. + *) + DDSD_ALPHABITDEPTH = $00000080; + +(* + * lpSurface is valid. + *) + DDSD_LPSURFACE = $00000800; + +(* + * ddpfPixelFormat is valid. + *) + DDSD_PIXELFORMAT = $00001000; + +(* + * ddckCKDestOverlay is valid. + *) + DDSD_CKDESTOVERLAY = $00002000; + +(* + * ddckCKDestBlt is valid. + *) + DDSD_CKDESTBLT = $00004000; + +(* + * ddckCKSrcOverlay is valid. + *) + DDSD_CKSRCOVERLAY = $00008000; + +(* + * ddckCKSrcBlt is valid. + *) + DDSD_CKSRCBLT = $00010000; + +(* + * dwMipMapCount is valid. + *) + DDSD_MIPMAPCOUNT = $00020000; + + (* + * dwRefreshRate is valid + *) + DDSD_REFRESHRATE = $00040000; + +(* + * dwLinearSize is valid + *) + DDSD_LINEARSIZE = $00080000; + +(* + * dwTextureStage is valid + *) + DDSD_TEXTURESTAGE = $00100000; + +(* + * dwFVF is valid + *) + DDSD_FVF = $00200000; + +(* + * dwSrcVBHandle is valid + *) + DDSD_SRCVBHANDLE = $00400000; + +(* + * dwDepth is valid + *) + DDSD_DEPTH = $00800000; + +(* + * All input fields are valid. + *) + DDSD_ALL = $00fff9ee; + + +(* + * guid field is valid. + *) + DDOSD_GUID = $00000001; + +(* + * dwCompressionRatio field is valid. + *) + DDOSD_COMPRESSION_RATIO = $00000002; + +(* + * ddSCaps field is valid. + *) + DDOSD_SCAPS = $00000004; + +(* + * ddOSCaps field is valid. + *) + DDOSD_OSCAPS = $00000008; + +(* + * All input fields are valid. + *) + DDOSD_ALL = $0000000f; + +(* + * The surface's optimized pixelformat is compressed + *) + DDOSDCAPS_OPTCOMPRESSED = $00000001; + +(* + * The surface's optimized pixelformat is reordered + *) + DDOSDCAPS_OPTREORDERED = $00000002; + +(* + * The opt surface is a monolithic mipmap + *) + DDOSDCAPS_MONOLITHICMIPMAP = $00000004; + +(* + * The valid Surf caps: + * DDSCAPS_SYSTEMMEMORY = $00000800; + * DDSCAPS_VIDEOMEMORY = $00004000; + * DDSCAPS_LOCALVIDMEM = $10000000; + * DDSCAPS_NONLOCALVIDMEM = $20000000; + *) + DDOSDCAPS_VALIDSCAPS = $30004800; + +(* + * The valid OptSurf caps + *) + DDOSDCAPS_VALIDOSCAPS = $00000007; + + +(* + * DDCOLORCONTROL + *) + +(* + * lBrightness field is valid. + *) + DDCOLOR_BRIGHTNESS = $00000001; + +(* + * lContrast field is valid. + *) + DDCOLOR_CONTRAST = $00000002; + +(* + * lHue field is valid. + *) + DDCOLOR_HUE = $00000004; + +(* + * lSaturation field is valid. + *) + DDCOLOR_SATURATION = $00000008; + +(* + * lSharpness field is valid. + *) + DDCOLOR_SHARPNESS = $00000010; + +(* + * lGamma field is valid. + *) + DDCOLOR_GAMMA = $00000020; + +(* + * lColorEnable field is valid. + *) + DDCOLOR_COLORENABLE = $00000040; + + + +(*============================================================================ + * + * Direct Draw Capability Flags + * + * These flags are used to describe the capabilities of a given Surface. + * All flags are bit flags. + * + *==========================================================================*) + +(**************************************************************************** + * + * DIRECTDRAWSURFACE CAPABILITY FLAGS + * + ****************************************************************************) +(* + * This bit currently has no meaning. + *) + DDSCAPS_RESERVED1 = $00000001; + +(* + * Indicates that this surface contains alpha-only information. + * (To determine if a surface is RGBA/YUVA, the pixel format must be + * interrogated.) + *) + DDSCAPS_ALPHA = $00000002; + +(* + * Indicates that this surface is a backbuffer. It is generally + * set by CreateSurface when the DDSCAPS_FLIP capability bit is set. + * It indicates that this surface is THE back buffer of a surface + * flipping structure. DirectDraw supports N surfaces in a + * surface flipping structure. Only the surface that immediately + * precedeces the DDSCAPS_FRONTBUFFER has this capability bit set. + * The other surfaces are identified as back buffers by the presence + * of the DDSCAPS_FLIP capability, their attachment order, and the + * absence of the DDSCAPS_FRONTBUFFER and DDSCAPS_BACKBUFFER + * capabilities. The bit is sent to CreateSurface when a standalone + * back buffer is being created. This surface could be attached to + * a front buffer and/or back buffers to form a flipping surface + * structure after the CreateSurface call. See AddAttachments for + * a detailed description of the behaviors in this case. + *) + DDSCAPS_BACKBUFFER = $00000004; + +(* + * Indicates a complex surface structure is being described. A + * complex surface structure results in the creation of more than + * one surface. The additional surfaces are attached to the root + * surface. The complex structure can only be destroyed by + * destroying the root. + *) + DDSCAPS_COMPLEX = $00000008; + +(* + * Indicates that this surface is a part of a surface flipping structure. + * When it is passed to CreateSurface the DDSCAPS_FRONTBUFFER and + * DDSCAP_BACKBUFFER bits are not set. They are set by CreateSurface + * on the resulting creations. The dwBackBufferCount field in the + * TDDSurfaceDesc structure must be set to at least 1 in order for + * the CreateSurface call to succeed. The DDSCAPS_COMPLEX capability + * must always be set with creating multiple surfaces through CreateSurface. + *) + DDSCAPS_FLIP = $00000010; + +(* + * Indicates that this surface is THE front buffer of a surface flipping + * structure. It is generally set by CreateSurface when the DDSCAPS_FLIP + * capability bit is set. + * If this capability is sent to CreateSurface then a standalonw front buffer + * is created. This surface will not have the DDSCAPS_FLIP capability. + * It can be attached to other back buffers to form a flipping structure. + * See AddAttachments for a detailed description of the behaviors in this + * case. + *) + DDSCAPS_FRONTBUFFER = $00000020; + +(* + * Indicates that this surface is any offscreen surface that is not an overlay, + * texture, zbuffer, front buffer, back buffer, or alpha surface. It is used + * to identify plain vanilla surfaces. + *) + DDSCAPS_OFFSCREENPLAIN = $00000040; + +(* + * Indicates that this surface is an overlay. It may or may not be directly visible + * depending on whether or not it is currently being overlayed onto the primary + * surface. DDSCAPS_VISIBLE can be used to determine whether or not it is being + * overlayed at the moment. + *) + DDSCAPS_OVERLAY = $00000080; + +(* + * Indicates that unique DirectDrawPalette objects can be created and + * attached to this surface. + *) + DDSCAPS_PALETTE = $00000100; + +(* + * Indicates that this surface is the primary surface. The primary + * surface represents what the user is seeing at the moment. + *) + DDSCAPS_PRIMARYSURFACE = $00000200; + +(* + * This flag used to be DDSCAPS_PRIMARYSURFACELEFT, which is now + * obsolete. + *) + DDSCAPS_RESERVED3 = $00000400; + DDSCAPS_PRIMARYSURFACELEFT = DDSCAPS_RESERVED3; + +(* + * Indicates that this surface memory was allocated in system memory + *) + DDSCAPS_SYSTEMMEMORY = $00000800; + +(* + * Indicates that this surface can be used as a 3D texture. It does not + * indicate whether or not the surface is being used for that purpose. + *) + DDSCAPS_TEXTURE = $00001000; + +(* + * Indicates that a surface may be a destination for 3D rendering. This + * bit must be set in order to query for a Direct3D Device Interface + * from this surface. + *) + DDSCAPS_3DDEVICE = $00002000; + +(* + * Indicates that this surface exists in video memory. + *) + DDSCAPS_VIDEOMEMORY = $00004000; + +(* + * Indicates that changes made to this surface are immediately visible. + * It is always set for the primary surface and is set for overlays while + * they are being overlayed and texture maps while they are being textured. + *) + DDSCAPS_VISIBLE = $00008000; + +(* + * Indicates that only writes are permitted to the surface. Read accesses + * from the surface may or may not generate a protection fault, but the + * results of a read from this surface will not be meaningful. READ ONLY. + *) + DDSCAPS_WRITEONLY = $00010000; + +(* + * Indicates that this surface is a z buffer. A z buffer does not contain + * displayable information. Instead it contains bit depth information that is + * used to determine which pixels are visible and which are obscured. + *) + DDSCAPS_ZBUFFER = $00020000; + +(* + * Indicates surface will have a DC associated long term + *) + DDSCAPS_OWNDC = $00040000; + +(* + * Indicates surface should be able to receive live video + *) + DDSCAPS_LIVEVIDEO = $00080000; + +(* + * Indicates surface should be able to have a stream decompressed + * to it by the hardware. + *) + DDSCAPS_HWCODEC = $00100000; + +(* + * Surface is a ModeX surface. + * + *) + DDSCAPS_MODEX = $00200000; + +(* + * Indicates surface is one level of a mip-map. This surface will + * be attached to other DDSCAPS_MIPMAP surfaces to form the mip-map. + * This can be done explicitly, by creating a number of surfaces and + * attaching them with AddAttachedSurface or by implicitly by CreateSurface. + * If this bit is set then DDSCAPS_TEXTURE must also be set. + *) + DDSCAPS_MIPMAP = $00400000; + +(* + * This bit is reserved. It should not be specified. + *) + DDSCAPS_RESERVED2 = $00800000; + +(* + * Indicates that memory for the surface is not allocated until the surface + * is loaded (via the Direct3D texture Load() function). + *) + DDSCAPS_ALLOCONLOAD = $04000000; + +(* + * Indicates that the surface will recieve data from a video port. + *) + DDSCAPS_VIDEOPORT = $08000000; + +(* + * Indicates that a video memory surface is resident in true, local video + * memory rather than non-local video memory. If this flag is specified then + * so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with + * DDSCAPS_NONLOCALVIDMEM. + *) + DDSCAPS_LOCALVIDMEM = $10000000; + +(* + * Indicates that a video memory surface is resident in non-local video + * memory rather than true, local video memory. If this flag is specified + * then so must DDSCAPS_VIDEOMEMORY. This flag is mutually exclusive with + * DDSCAPS_LOCALVIDMEM. + *) + DDSCAPS_NONLOCALVIDMEM = $20000000; + +(* + * Indicates that this surface is a standard VGA mode surface, and not a + * ModeX surface. (This flag will never be set in combination with the + * DDSCAPS_MODEX flag). + *) + DDSCAPS_STANDARDVGAMODE = $40000000; + +(* + * Indicates that this surface will be an optimized surface. This flag is + * currently only valid in conjunction with the DDSCAPS_TEXTURE flag. The surface + * will be created without any underlying video memory until loaded. + *) + DDSCAPS_OPTIMIZED = $80000000; + + + +(* + * This bit is reserved + *) + DDSCAPS2_RESERVED4 = $00000002; + DDSCAPS2_HARDWAREDEINTERLACE = $00000000; + +(* + * Indicates to the driver that this surface will be locked very frequently + * (for procedural textures, dynamic lightmaps, etc). Surfaces with this cap + * set must also have DDSCAPS_TEXTURE. This cap cannot be used with + * DDSCAPS2_HINTSTATIC and DDSCAPS2_OPAQUE. + *) + DDSCAPS2_HINTDYNAMIC = $00000004; + +(* + * Indicates to the driver that this surface can be re-ordered/retiled on + * load. This operation will not change the size of the texture. It is + * relatively fast and symmetrical, since the application may lock these + * bits (although it will take a performance hit when doing so). Surfaces + * with this cap set must also have DDSCAPS_TEXTURE. This cap cannot be + * used with DDSCAPS2_HINTDYNAMIC and DDSCAPS2_OPAQUE. + *) + DDSCAPS2_HINTSTATIC = $00000008; + +(* + * Indicates that the client would like this texture surface to be managed by the + * DirectDraw/Direct3D runtime. Surfaces with this cap set must also have + * DDSCAPS_TEXTURE and DDSCAPS_SYSTEMMEMORY. + *) + DDSCAPS2_TEXTUREMANAGE = $00000010; + +(* + * These bits are reserved for internal use *) + DDSCAPS2_RESERVED1 = $00000020; + DDSCAPS2_RESERVED2 = $00000040; + +(* + * Indicates to the driver that this surface will never be locked again. + * The driver is free to optimize this surface via retiling and actual compression. + * All calls to Lock() or Blts from this surface will fail. Surfaces with this + * cap set must also have DDSCAPS_TEXTURE. This cap cannot be used with + * DDSCAPS2_HINTDYNAMIC and DDSCAPS2_HINTSTATIC. + *) + DDSCAPS2_OPAQUE = $00000080; + +(* + * Applications should set this bit at CreateSurface time to indicate that they + * intend to use antialiasing. Only valid if DDSCAPS_3DDEVICE is also set. + *) + DDSCAPS2_HINTANTIALIASING = $00000100; + +(* + * This flag is used at CreateSurface time to indicate that this set of + * surfaces is a cubic environment map + *) + DDSCAPS2_CUBEMAP = $00000200; + +(* + * These flags preform two functions: + * - At CreateSurface time, they define which of the six cube faces are + * required by the application. + * - After creation, each face in the cubemap will have exactly one of these + * bits set. + *) + DDSCAPS2_CUBEMAP_POSITIVEX = $00000400; + DDSCAPS2_CUBEMAP_NEGATIVEX = $00000800; + DDSCAPS2_CUBEMAP_POSITIVEY = $00001000; + DDSCAPS2_CUBEMAP_NEGATIVEY = $00002000; + DDSCAPS2_CUBEMAP_POSITIVEZ = $00004000; + DDSCAPS2_CUBEMAP_NEGATIVEZ = $00008000; + +(* + * This macro may be used to specify all faces of a cube map at CreateSurface time + *) + DDSCAPS2_CUBEMAP_ALLFACES = ( DDSCAPS2_CUBEMAP_POSITIVEX or + DDSCAPS2_CUBEMAP_NEGATIVEX or + DDSCAPS2_CUBEMAP_POSITIVEY or + DDSCAPS2_CUBEMAP_NEGATIVEY or + DDSCAPS2_CUBEMAP_POSITIVEZ or + DDSCAPS2_CUBEMAP_NEGATIVEZ ); + + +(* + * This flag is an additional flag which is present on mipmap sublevels from DX7 onwards + * It enables easier use of GetAttachedSurface rather than EnumAttachedSurfaces for surface + * constructs such as Cube Maps, wherein there are more than one mipmap surface attached + * to the root surface. + * This caps bit is ignored by CreateSurface + *) + DDSCAPS2_MIPMAPSUBLEVEL = $00010000; + +(* This flag indicates that the texture should be managed by D3D only *) + DDSCAPS2_D3DTEXTUREMANAGE = $00020000; + +(* This flag indicates that the managed surface can be safely lost *) + DDSCAPS2_DONOTPERSIST = $00040000; + +(* indicates that this surface is part of a stereo flipping chain *) + DDSCAPS2_STEREOSURFACELEFT = $00080000; + + +(* + * Indicates that the surface is a volume. + * Can be combined with DDSCAPS_MIPMAP to indicate a multi-level volume + *) + DDSCAPS2_VOLUME = $00200000; + +(* + * Indicates that the surface may be locked multiple times by the application. + * This cap cannot be used with DDSCAPS2_OPAQUE. + *) + DDSCAPS2_NOTUSERLOCKABLE = $00400000; + +(* + * Indicates that the vertex buffer data can be used to render points and + * point sprites. + *) + DDSCAPS2_POINTS = $00800000; + +(* + * Indicates that the vertex buffer data can be used to render rt pactches. + *) + DDSCAPS2_RTPATCHES = $01000000; + +(* + * Indicates that the vertex buffer data can be used to render n patches. + *) + DDSCAPS2_NPATCHES = $02000000; + +(* + * This bit is reserved for internal use + *) + DDSCAPS2_RESERVED3 = $04000000; + + +(* + * Indicates that the contents of the backbuffer do not have to be preserved + * the contents of the backbuffer after they are presented. + *) + DDSCAPS2_DISCARDBACKBUFFER = $10000000; + +(* + * Indicates that all surfaces in this creation chain should be given an alpha channel. + * This flag will be set on primary surface chains that may have no explicit pixel format + * (and thus take on the format of the current display mode). + * The driver should infer that all these surfaces have a format having an alpha channel. + * (e.g. assume D3DFMT_A8R8G8B8 if the display mode is x888.) + *) + DDSCAPS2_ENABLEALPHACHANNEL = $20000000; + +(* + * Indicates that all surfaces in this creation chain is extended primary surface format. + * This flag will be set on extended primary surface chains that always have explicit pixel + * format and the pixel format is typically GDI (Graphics Device Interface) couldn't handle, + * thus only used with fullscreen application. (e.g. D3DFMT_A2R10G10B10 format) + *) + DDSCAPS2_EXTENDEDFORMATPRIMARY = $40000000; + +(* + * Indicates that all surfaces in this creation chain is additional primary surface. + * This flag will be set on primary surface chains which must present on the adapter + * id provided on dwCaps4. Typically this will be used to create secondary primary surface + * on DualView display adapter. + *) + DDSCAPS2_ADDITIONALPRIMARY = $80000000; + +(* + * This is a mask that indicates the set of bits that may be set + * at createsurface time to indicate number of samples per pixel + * when multisampling + *) + DDSCAPS3_MULTISAMPLE_MASK = $0000001F; + +(* + * This is a mask that indicates the set of bits that may be set + * at createsurface time to indicate the quality level of rendering + * for the current number of samples per pixel + *) + DDSCAPS3_MULTISAMPLE_QUALITY_MASK = $000000E0; + DDSCAPS3_MULTISAMPLE_QUALITY_SHIFT = 5; + +(* + * This bit is reserved for internal use + *) + DDSCAPS3_RESERVED1 = $00000100; + +(* + * This bit is reserved for internal use + *) + DDSCAPS3_RESERVED2 = $00000200; + +(* + * This indicates whether this surface has light-weight miplevels + *) + DDSCAPS3_LIGHTWEIGHTMIPMAP = $00000400; + +(* + * This indicates that the mipsublevels for this surface are auto-generated + *) + DDSCAPS3_AUTOGENMIPMAP = $00000800; + +(* + * This indicates that the mipsublevels for this surface are auto-generated + *) + DDSCAPS3_DMAP = $00001000; + + + (**************************************************************************** + * + * DIRECTDRAW DRIVER CAPABILITY FLAGS + * + ****************************************************************************) + +(* + * Display hardware has 3D acceleration. + *) + DDCAPS_3D = $00000001; + +(* + * Indicates that DirectDraw will support only dest rectangles that are aligned + * on DIRECTDRAWCAPS.dwAlignBoundaryDest boundaries of the surface, respectively. + * READ ONLY. + *) + DDCAPS_ALIGNBOUNDARYDEST = $00000002; + +(* + * Indicates that DirectDraw will support only source rectangles whose sizes in + * BYTEs are DIRECTDRAWCAPS.dwAlignSizeDest multiples, respectively. READ ONLY. + *) + DDCAPS_ALIGNSIZEDEST = $00000004; +(* + * Indicates that DirectDraw will support only source rectangles that are aligned + * on DIRECTDRAWCAPS.dwAlignBoundarySrc boundaries of the surface, respectively. + * READ ONLY. + *) + DDCAPS_ALIGNBOUNDARYSRC = $00000008; + +(* + * Indicates that DirectDraw will support only source rectangles whose sizes in + * BYTEs are DIRECTDRAWCAPS.dwAlignSizeSrc multiples, respectively. READ ONLY. + *) + DDCAPS_ALIGNSIZESRC = $00000010; + +(* + * Indicates that DirectDraw will create video memory surfaces that have a stride + * alignment equal to DIRECTDRAWCAPS.dwAlignStride. READ ONLY. + *) + DDCAPS_ALIGNSTRIDE = $00000020; + +(* + * Display hardware is capable of blt operations. + *) + DDCAPS_BLT = $00000040; + +(* + * Display hardware is capable of asynchronous blt operations. + *) + DDCAPS_BLTQUEUE = $00000080; + +(* + * Display hardware is capable of color space conversions during the blt operation. + *) + DDCAPS_BLTFOURCC = $00000100; + +(* + * Display hardware is capable of stretching during blt operations. + *) + DDCAPS_BLTSTRETCH = $00000200; + +(* + * Display hardware is shared with GDI. + *) + DDCAPS_GDI = $00000400; + +(* + * Display hardware can overlay. + *) + DDCAPS_OVERLAY = $00000800; + +(* + * Set if display hardware supports overlays but can not clip them. + *) + DDCAPS_OVERLAYCANTCLIP = $00001000; + +(* + * Indicates that overlay hardware is capable of color space conversions during + * the overlay operation. + *) + DDCAPS_OVERLAYFOURCC = $00002000; + +(* + * Indicates that stretching can be done by the overlay hardware. + *) + DDCAPS_OVERLAYSTRETCH = $00004000; + +(* + * Indicates that unique DirectDrawPalettes can be created for DirectDrawSurfaces + * other than the primary surface. + *) + DDCAPS_PALETTE = $00008000; + +(* + * Indicates that palette changes can be syncd with the veritcal refresh. + *) + DDCAPS_PALETTEVSYNC = $00010000; + +(* + * Display hardware can return the current scan line. + *) + DDCAPS_READSCANLINE = $00020000; + +(* + * This flag used to bo DDCAPS_STEREOVIEW, which is now obsolete + *) + DDCAPS_RESERVED1 = $00040000; + +(* + * Display hardware is capable of generating a vertical blank interrupt. + *) + DDCAPS_VBI = $00080000; + +(* + * Supports the use of z buffers with blt operations. + *) + DDCAPS_ZBLTS = $00100000; + +(* + * Supports Z Ordering of overlays. + *) + DDCAPS_ZOVERLAYS = $00200000; + +(* + * Supports color key + *) + DDCAPS_COLORKEY = $00400000; + +(* + * Supports alpha surfaces + *) + DDCAPS_ALPHA = $00800000; + +(* + * colorkey is hardware assisted(DDCAPS_COLORKEY will also be set) + *) + DDCAPS_COLORKEYHWASSIST = $01000000; + +(* + * no hardware support at all + *) + DDCAPS_NOHARDWARE = $02000000; + +(* + * Display hardware is capable of color fill with bltter + *) + DDCAPS_BLTCOLORFILL = $04000000; + +(* + * Display hardware is bank switched, and potentially very slow at + * random access to VRAM. + *) + DDCAPS_BANKSWITCHED = $08000000; + +(* + * Display hardware is capable of depth filling Z-buffers with bltter + *) + DDCAPS_BLTDEPTHFILL = $10000000; + +(* + * Display hardware is capable of clipping while bltting. + *) + DDCAPS_CANCLIP = $20000000; + +(* + * Display hardware is capable of clipping while stretch bltting. + *) + DDCAPS_CANCLIPSTRETCHED = $40000000; + +(* + * Display hardware is capable of bltting to or from system memory + *) + DDCAPS_CANBLTSYSMEM = $80000000; + + + (**************************************************************************** + * + * MORE DIRECTDRAW DRIVER CAPABILITY FLAGS (dwCaps2) + * + ****************************************************************************) + +(* + * Display hardware is certified + *) + DDCAPS2_CERTIFIED = $00000001; + +(* + * Driver cannot interleave 2D operations (lock and blt) to surfaces with + * Direct3D rendering operations between calls to BeginScene() and EndScene() + *) + DDCAPS2_NO2DDURING3DSCENE = $00000002; + +(* + * Display hardware contains a video port + *) + DDCAPS2_VIDEOPORT = $00000004; + +(* + * The overlay can be automatically flipped according to the video port + * VSYNCs, providing automatic doubled buffered display of video port + * data using an overlay + *) + DDCAPS2_AUTOFLIPOVERLAY = $00000008; + +(* + * Overlay can display each field of interlaced data individually while + * it is interleaved in memory without causing jittery artifacts. + *) + DDCAPS2_CANBOBINTERLEAVED = $00000010; + +(* + * Overlay can display each field of interlaced data individually while + * it is not interleaved in memory without causing jittery artifacts. + *) + DDCAPS2_CANBOBNONINTERLEAVED = $00000020; + +(* + * The overlay surface contains color controls (brightness, sharpness, etc.) + *) + DDCAPS2_COLORCONTROLOVERLAY = $00000040; + +(* + * The primary surface contains color controls (gamma, etc.) + *) + DDCAPS2_COLORCONTROLPRIMARY = $00000080; + +(* + * RGBZ -> RGB supported for 16:16 RGB:Z + *) + DDCAPS2_CANDROPZ16BIT = $00000100; + +(* + * Driver supports non-local video memory. + *) + DDCAPS2_NONLOCALVIDMEM = $00000200; + +(* + * Dirver supports non-local video memory but has different capabilities for + * non-local video memory surfaces. If this bit is set then so must + * DDCAPS2_NONLOCALVIDMEM. + *) + DDCAPS2_NONLOCALVIDMEMCAPS = $00000400; + +(* + * Driver neither requires nor prefers surfaces to be pagelocked when performing + * blts involving system memory surfaces + *) + DDCAPS2_NOPAGELOCKREQUIRED = $00000800; + +(* + * Driver can create surfaces which are wider than the primary surface + *) + DDCAPS2_WIDESURFACES = $00001000; + +(* + * Driver supports bob without using a video port by handling the + * DDFLIP_ODD and DDFLIP_EVEN flags specified in Flip. + *) + DDCAPS2_CANFLIPODDEVEN = $00002000; + +(* + * Driver supports bob using hardware + *) + DDCAPS2_CANBOBHARDWARE = $00004000; + +(* + * Driver supports bltting any FOURCC surface to another surface of the same FOURCC + *) + DDCAPS2_COPYFOURCC = $00008000; + + +(* + * Driver supports loadable gamma ramps for the primary surface + *) + DDCAPS2_PRIMARYGAMMA = $00020000; + +(* + * Driver can render in windowed mode. + *) + DDCAPS2_CANRENDERWINDOWED = $00080000; + +(* + * A calibrator is available to adjust the gamma ramp according to the + * physical display properties so that the result will be identical on + * all calibrated systems. + *) + DDCAPS2_CANCALIBRATEGAMMA = $00100000; + +(* + * Indicates that the driver will respond to DDFLIP_INTERVALn flags + *) + DDCAPS2_FLIPINTERVAL = $00200000; + +(* + * Indicates that the driver will respond to DDFLIP_NOVSYNC + *) + DDCAPS2_FLIPNOVSYNC = $00400000; + +(* + * Driver supports management of video memory, if this flag is ON, + * driver manages the texture if requested with DDSCAPS2_TEXTUREMANAGE on + * DirectX manages the texture if this flag is OFF and surface has DDSCAPS2_TEXTUREMANAGE on + *) + DDCAPS2_CANMANAGETEXTURE = $00800000; + +(* + * the direct3d texture manager uses this cap to decide whether to put managed + * surfaces in non-local video memory. if the cap is set, the texture manager will + * put managed surfaces in non-local vidmem. drivers that cannot texture from + * local vidmem should not set this cap. + *) + ddcaps2_texmaninnonlocalvidmem = $01000000; + +(* + * Indicates that the driver supports DX7 type of stereo in at least one mode (which may + * not necessarily be the current mode). Applications should use IDirectDraw7 (or higher) + * ::EnumDisplayModes and check the DDSURFACEDESC.ddsCaps.dwCaps2 field for the presence of + * DDSCAPS2_STEREOSURFACELEFT to check if a particular mode supports stereo. The application + * can also use IDirectDraw7(or higher)::GetDisplayMode to check the current mode. + *) + DDCAPS2_STEREO = $02000000; + +(* + * This caps bit is intended for internal DirectDraw use. + * -It is only valid if DDCAPS2_NONLOCALVIDMEMCAPS is set. + * -If this bit is set, then DDCAPS_CANBLTSYSMEM MUST be set by the driver (and + * all the assoicated system memory blt caps must be correct). + * -It implies that the system->video blt caps in DDCAPS also apply to system to + * nonlocal blts. I.e. the dwSVBCaps, dwSVBCKeyCaps, dwSVBFXCaps and dwSVBRops + * members of DDCAPS (DDCORECAPS) are filled in correctly. + * -Any blt from system to nonlocal memory that matches these caps bits will + * be passed to the driver. + * + * NOTE: This is intended to enable the driver itself to do efficient reordering + * of textures. This is NOT meant to imply that hardware can write into AGP memory. + * This operation is not currently supported. + *) + DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL = $04000000; + +(* + * was DDCAPS2_PUREHAL + *) + DDCAPS2_RESERVED1 = $08000000; + +(* + * Driver supports management of video memory, if this flag is ON, + * driver manages the resource if requested with DDSCAPS2_TEXTUREMANAGE on + * DirectX manages the resource if this flag is OFF and surface has DDSCAPS2_TEXTUREMANAGE on + *) + DDCAPS2_CANMANAGERESOURCE = $10000000; + +(* + * Driver supports dynamic textures. This will allow the application to set + * D3DUSAGE_DYNAMIC (DDSCAPS2_HINTDYNAMIC for drivers) at texture create time. + * Video memory dynamic textures WILL be lockable by applications. It is + * expected that these locks will be very efficient (which implies that the + * driver should always maintain a linear copy, a pointer to which can be + * quickly handed out to the application). + *) + DDCAPS2_DYNAMICTEXTURES = $20000000; + +(* + * Driver supports auto-generation of mipmaps. + *) + DDCAPS2_CANAUTOGENMIPMAP = $40000000; + + +(**************************************************************************** + * + * DIRECTDRAW FX ALPHA CAPABILITY FLAGS + * + ****************************************************************************) + +(* + * Supports alpha blending around the edge of a source color keyed surface. + * For Blt. + *) + DDFXALPHACAPS_BLTALPHAEDGEBLEND = $00000001; + +(* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value becomes + * more opaque as the alpha value increases. (0 is transparent.) + * For Blt. + *) + DDFXALPHACAPS_BLTALPHAPIXELS = $00000002; + +(* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value + * becomes more transparent as the alpha value increases. (0 is opaque.) + * This flag can only be set if DDCAPS_ALPHA is set. + * For Blt. + *) + DDFXALPHACAPS_BLTALPHAPIXELSNEG = $00000004; + +(* + * Supports alpha only surfaces. The bit depth of an alpha only surface can be + * 1,2,4, or 8. The alpha value becomes more opaque as the alpha value increases. + * (0 is transparent.) + * For Blt. + *) + DDFXALPHACAPS_BLTALPHASURFACES = $00000008; + +(* + * The depth of the alpha channel data can range can be 1,2,4, or 8. + * The NEG suffix indicates that this alpha channel becomes more transparent + * as the alpha value increases. (0 is opaque.) This flag can only be set if + * DDCAPS_ALPHA is set. + * For Blt. + *) + DDFXALPHACAPS_BLTALPHASURFACESNEG = $00000010; + +(* + * Supports alpha blending around the edge of a source color keyed surface. + * For Overlays. + *) + DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND = $00000020; + +(* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value becomes + * more opaque as the alpha value increases. (0 is transparent.) + * For Overlays. + *) + DDFXALPHACAPS_OVERLAYALPHAPIXELS = $00000040; + +(* + * Supports alpha information in the pixel format. The bit depth of alpha + * information in the pixel format can be 1,2,4, or 8. The alpha value + * becomes more transparent as the alpha value increases. (0 is opaque.) + * This flag can only be set if DDCAPS_ALPHA is set. + * For Overlays. + *) + DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG = $00000080; + +(* + * Supports alpha only surfaces. The bit depth of an alpha only surface can be + * 1,2,4, or 8. The alpha value becomes more opaque as the alpha value increases. + * (0 is transparent.) + * For Overlays. + *) + DDFXALPHACAPS_OVERLAYALPHASURFACES = $00000100; + +(* + * The depth of the alpha channel data can range can be 1,2,4, or 8. + * The NEG suffix indicates that this alpha channel becomes more transparent + * as the alpha value increases. (0 is opaque.) This flag can only be set if + * DDCAPS_ALPHA is set. + * For Overlays. + *) + DDFXALPHACAPS_OVERLAYALPHASURFACESNEG = $00000200; + +(**************************************************************************** + * + * DIRECTDRAW FX CAPABILITY FLAGS + * + ****************************************************************************) + +(* + * uses arithmetic operations to stretch and shrink surfaces during blt + * rather than pixel doubling techniques. along the y axis. + *) + ddfxcaps_bltarithstretchy = $00000020; + +(* + * uses arithmetic operations to stretch during blt + * rather than pixel doubling techniques. along the y axis. only + * works for x1, x2, etc. + *) + ddfxcaps_bltarithstretchyn = $00000010; + +(* + * Supports mirroring left to right in blt. + *) + DDFXCAPS_BLTMIRRORLEFTRIGHT = $00000040; + +(* + * Supports mirroring top to bottom in blt. + *) + DDFXCAPS_BLTMIRRORUPDOWN = $00000080; + +(* + * Supports arbitrary rotation for blts. + *) + DDFXCAPS_BLTROTATION = $00000100; + +(* + * Supports 90 degree rotations for blts. + *) + DDFXCAPS_BLTROTATION90 = $00000200; + +(* + * DirectDraw supports arbitrary shrinking of a surface along the + * x axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSHRINKX = $00000400; + +(* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the x axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSHRINKXN = $00000800; + +(* + * DirectDraw supports arbitrary shrinking of a surface along the + * y axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSHRINKY = $00001000; + +(* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the y axis (vertical direction) for blts. + *) + DDFXCAPS_BLTSHRINKYN = $00002000; + +(* + * DirectDraw supports arbitrary stretching of a surface along the + * x axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSTRETCHX = $00004000; + +(* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the x axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSTRETCHXN = $00008000; + +(* + * DirectDraw supports arbitrary stretching of a surface along the + * y axis (horizontal direction) for blts. + *) + DDFXCAPS_BLTSTRETCHY = $00010000; + +(* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the y axis (vertical direction) for blts. + *) + DDFXCAPS_BLTSTRETCHYN = $00020000; + +(* + * uses arithmetic operations to stretch and shrink surfaces during + * overlay rather than pixel doubling techniques. along the y axis + * for overlays. + *) + ddfxcaps_overlayarithstretchy = $00040000; + +(* + * uses arithmetic operations to stretch surfaces during + * overlay rather than pixel doubling techniques. along the y axis + * for overlays. only works for x1, x2, etc. + *) + ddfxcaps_overlayarithstretchyn = $00000008; + +(* + * DirectDraw supports arbitrary shrinking of a surface along the + * x axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSHRINKX = $00080000; + +(* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the x axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSHRINKXN = $00100000; + +(* + * DirectDraw supports arbitrary shrinking of a surface along the + * y axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSHRINKY = $00200000; + +(* + * DirectDraw supports integer shrinking (1x,2x,) of a surface + * along the y axis (vertical direction) for overlays. + *) + DDFXCAPS_OVERLAYSHRINKYN = $00400000; + +(* + * DirectDraw supports arbitrary stretching of a surface along the + * x axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSTRETCHX = $00800000; + +(* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the x axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSTRETCHXN = $01000000; + +(* + * DirectDraw supports arbitrary stretching of a surface along the + * y axis (horizontal direction) for overlays. + *) + DDFXCAPS_OVERLAYSTRETCHY = $02000000; + +(* + * DirectDraw supports integer stretching (1x,2x,) of a surface + * along the y axis (vertical direction) for overlays. + *) + DDFXCAPS_OVERLAYSTRETCHYN = $04000000; + +(* + * DirectDraw supports mirroring of overlays across the vertical axis + *) + DDFXCAPS_OVERLAYMIRRORLEFTRIGHT = $08000000; + +(* + * DirectDraw supports mirroring of overlays across the horizontal axis + *) + DDFXCAPS_OVERLAYMIRRORUPDOWN = $10000000; + +(* + * DirectDraw supports deinterlacing of overlay surfaces + *) + DDFXCAPS_OVERLAYDEINTERLACE = $20000000; + + +(* + * Driver can do alpha blending for blits. + *) + DDFXCAPS_BLTALPHA = $00000001; + +(* + * Driver can do geometric transformations (or warps) for blits. + *) + DDFXCAPS_BLTTRANSFORM = $00000002; + +(* + * Driver can do surface-reconstruction filtering for warped blits. + *) + DDFXCAPS_BLTFILTER = DDFXCAPS_BLTARITHSTRETCHY; + +(* + * Driver can do alpha blending for overlays. + *) + DDFXCAPS_OVERLAYALPHA = $00000004; + +(* + * Driver can do geometric transformations (or warps) for overlays. + *) + DDFXCAPS_OVERLAYTRANSFORM = $20000000; + +(* + * Driver can do surface-reconstruction filtering for warped overlays. + *) + DDFXCAPS_OVERLAYFILTER = DDFXCAPS_OVERLAYARITHSTRETCHY; + +(**************************************************************************** + * + * DIRECTDRAW STEREO VIEW CAPABILITIES + * + ****************************************************************************) + +(* + * This flag used to be DDSVCAPS_ENIGMA, which is now obsolete + *) + DDSVCAPS_RESERVED1 = $00000001; + +(* + * This flag used to be DDSVCAPS_FLICKER, which is now obsolete + *) + DDSVCAPS_RESERVED2 = $00000002; + +(* + * This flag used to be DDSVCAPS_REDBLUE, which is now obsolete + *) + DDSVCAPS_RESERVED3 = $00000004; + +(* + * This flag used to be DDSVCAPS_SPLIT, which is now obsolete + *) + DDSVCAPS_RESERVED4 = $00000008; + +(* + * The stereo view is accomplished with switching technology + *) + DDSVCAPS_STEREOSEQUENTIAL = $00000010; + +(**************************************************************************** + * + * DIRECTDRAWPALETTE CAPABILITIES + * + ****************************************************************************) + +(* + * Index is 4 bits. There are sixteen color entries in the palette table. + *) + DDPCAPS_4BIT = $00000001; + +(* + * Index is onto a 8 bit color index. This field is only valid with the + * DDPCAPS_1BIT, DDPCAPS_2BIT or DDPCAPS_4BIT capability and the target + * surface is in 8bpp. Each color entry is one byte long and is an index + * into destination surface's 8bpp palette. + *) + DDPCAPS_8BITENTRIES = $00000002; + +(* + * Index is 8 bits. There are 256 color entries in the palette table. + *) + DDPCAPS_8BIT = $00000004; + +(* + * Indicates that this DIRECTDRAWPALETTE should use the palette color array + * passed into the lpDDColorArray parameter to initialize the DIRECTDRAWPALETTE + * object. + * This flag is obsolete. DirectDraw always initializes the color array from + * the lpDDColorArray parameter. The definition remains for source-level + * compatibility. + *) + DDPCAPS_INITIALIZE = $00000008; + +(* + * This palette is the one attached to the primary surface. Changing this + * table has immediate effect on the display unless DDPSETPAL_VSYNC is specified + * and supported. + *) + DDPCAPS_PRIMARYSURFACE = $00000010; + +(* + * This palette is the one attached to the primary surface left. Changing + * this table has immediate effect on the display for the left eye unless + * DDPSETPAL_VSYNC is specified and supported. + *) + DDPCAPS_PRIMARYSURFACELEFT = $00000020; + +(* + * This palette can have all 256 entries defined + *) + DDPCAPS_ALLOW256 = $00000040; + +(* + * This palette can have modifications to it synced with the monitors + * refresh rate. + *) + DDPCAPS_VSYNC = $00000080; + +(* + * Index is 1 bit. There are two color entries in the palette table. + *) + DDPCAPS_1BIT = $00000100; + +(* + * Index is 2 bit. There are four color entries in the palette table. + *) + DDPCAPS_2BIT = $00000200; + +(* + * The peFlags member of PALETTEENTRY denotes an 8 bit alpha value + *) + DDPCAPS_ALPHA = $00000400; + + +(**************************************************************************** + * + * DIRECTDRAWPALETTE SETENTRY CONSTANTS + * + ****************************************************************************) + + +(**************************************************************************** + * + * DIRECTDRAWPALETTE GETENTRY CONSTANTS + * + ****************************************************************************) + +(* 0 is the only legal value *) + +(**************************************************************************** + * + * DIRECTDRAWSURFACE SETPRIVATEDATA CONSTANTS + * + ****************************************************************************) + +(* + * The passed pointer is an IUnknown ptr. The cbData argument to SetPrivateData + * must be set to SizeOf(IUnknown^). DirectDraw will call AddRef through this + * pointer and Release when the private data is destroyed. This includes when + * the surface or palette is destroyed before such priovate data is destroyed. + *) + DDSPD_IUNKNOWNPOINTER = $00000001; + +(* + * Private data is only valid for the current state of the object, + * as determined by the uniqueness value. + *) + DDSPD_VOLATILE = $00000002; + + +(**************************************************************************** + * + * DIRECTDRAWSURFACE SETPALETTE CONSTANTS + * + ****************************************************************************) + + +(**************************************************************************** + * + * DIRECTDRAW BITDEPTH CONSTANTS + * + * NOTE: These are only used to indicate supported bit depths. These + * are flags only, they are not to be used as an actual bit depth. The + * absolute numbers 1, 2, 4, 8, 16, 24 and 32 are used to indicate actual + * bit depths in a surface or for changing the display mode. + * + ****************************************************************************) + +(* + * 1 bit per pixel. + *) + DDBD_1 = $00004000; + +(* + * 2 bits per pixel. + *) + DDBD_2 = $00002000; + +(* + * 4 bits per pixel. + *) + DDBD_4 = $00001000; + +(* + * 8 bits per pixel. + *) + DDBD_8 = $00000800; + +(* + * 16 bits per pixel. + *) + DDBD_16 = $00000400; + +(* + * 24 bits per pixel. + *) + DDBD_24 = $00000200; + +(* + * 32 bits per pixel. + *) + DDBD_32 = $00000100; + +(**************************************************************************** + * + * DIRECTDRAWSURFACE SET/GET COLOR KEY FLAGS + * + ****************************************************************************) + +(* + * Set if the structure contains a color space. Not set if the structure + * contains a single color key. + *) + DDCKEY_COLORSPACE = $00000001; + +(* + * Set if the structure specifies a color key or color space which is to be + * used as a destination color key for blt operations. + *) + DDCKEY_DESTBLT = $00000002; + +(* + * Set if the structure specifies a color key or color space which is to be + * used as a destination color key for overlay operations. + *) + DDCKEY_DESTOVERLAY = $00000004; + +(* + * Set if the structure specifies a color key or color space which is to be + * used as a source color key for blt operations. + *) + DDCKEY_SRCBLT = $00000008; + +(* + * Set if the structure specifies a color key or color space which is to be + * used as a source color key for overlay operations. + *) + DDCKEY_SRCOVERLAY = $00000010; + + +(**************************************************************************** + * + * DIRECTDRAW COLOR KEY CAPABILITY FLAGS + * + ****************************************************************************) + +(* + * Supports transparent blting using a color key to identify the replaceable + * bits of the destination surface for RGB colors. + *) + DDCKEYCAPS_DESTBLT = $00000001; + +(* + * Supports transparent blting using a color space to identify the replaceable + * bits of the destination surface for RGB colors. + *) + DDCKEYCAPS_DESTBLTCLRSPACE = $00000002; + +(* + * Supports transparent blting using a color space to identify the replaceable + * bits of the destination surface for YUV colors. + *) + DDCKEYCAPS_DESTBLTCLRSPACEYUV = $00000004; + +(* + * Supports transparent blting using a color key to identify the replaceable + * bits of the destination surface for YUV colors. + *) + DDCKEYCAPS_DESTBLTYUV = $00000008; + +(* + * Supports overlaying using colorkeying of the replaceable bits of the surface + * being overlayed for RGB colors. + *) + DDCKEYCAPS_DESTOVERLAY = $00000010; + +(* + * Supports a color space as the color key for the destination for RGB colors. + *) + DDCKEYCAPS_DESTOVERLAYCLRSPACE = $00000020; + +(* + * Supports a color space as the color key for the destination for YUV colors. + *) + DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV = $00000040; + +(* + * Supports only one active destination color key value for visible overlay + * surfaces. + *) + DDCKEYCAPS_DESTOVERLAYONEACTIVE = $00000080; + +(* + * Supports overlaying using colorkeying of the replaceable bits of the + * surface being overlayed for YUV colors. + *) + DDCKEYCAPS_DESTOVERLAYYUV = $00000100; + +(* + * Supports transparent blting using the color key for the source with + * this surface for RGB colors. + *) + DDCKEYCAPS_SRCBLT = $00000200; + +(* + * Supports transparent blting using a color space for the source with + * this surface for RGB colors. + *) + DDCKEYCAPS_SRCBLTCLRSPACE = $00000400; + +(* + * Supports transparent blting using a color space for the source with + * this surface for YUV colors. + *) + DDCKEYCAPS_SRCBLTCLRSPACEYUV = $00000800; + +(* + * Supports transparent blting using the color key for the source with + * this surface for YUV colors. + *) + DDCKEYCAPS_SRCBLTYUV = $00001000; + +(* + * Supports overlays using the color key for the source with this + * overlay surface for RGB colors. + *) + DDCKEYCAPS_SRCOVERLAY = $00002000; + +(* + * Supports overlays using a color space as the source color key for + * the overlay surface for RGB colors. + *) + DDCKEYCAPS_SRCOVERLAYCLRSPACE = $00004000; + +(* + * Supports overlays using a color space as the source color key for + * the overlay surface for YUV colors. + *) + DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV = $00008000; + +(* + * Supports only one active source color key value for visible + * overlay surfaces. + *) + DDCKEYCAPS_SRCOVERLAYONEACTIVE = $00010000; + +(* + * Supports overlays using the color key for the source with this + * overlay surface for YUV colors. + *) + DDCKEYCAPS_SRCOVERLAYYUV = $00020000; + +(* + * there are no bandwidth trade-offs for using colorkey with an overlay + *) + DDCKEYCAPS_NOCOSTOVERLAY = $00040000; + + +(**************************************************************************** + * + * DIRECTDRAW PIXELFORMAT FLAGS + * + ****************************************************************************) + +(* + * The surface has alpha channel information in the pixel format. + *) + DDPF_ALPHAPIXELS = $00000001; + +(* + * The pixel format contains alpha only information + *) + DDPF_ALPHA = $00000002; + +(* + * The FourCC code is valid. + *) + DDPF_FOURCC = $00000004; + +(* + * The surface is 4-bit color indexed. + *) + DDPF_PALETTEINDEXED4 = $00000008; + +(* + * The surface is indexed into a palette which stores indices + * into the destination surface's 8-bit palette. + *) + DDPF_PALETTEINDEXEDTO8 = $00000010; + +(* + * The surface is 8-bit color indexed. + *) + DDPF_PALETTEINDEXED8 = $00000020; + +(* + * The RGB data in the pixel format structure is valid. + *) + DDPF_RGB = $00000040; + +(* + * The surface will accept pixel data in the format specified + * and compress it during the write. + *) + DDPF_COMPRESSED = $00000080; + +(* + * The surface will accept RGB data and translate it during + * the write to YUV data. The format of the data to be written + * will be contained in the pixel format structure. The DDPF_RGB + * flag will be set. + *) + DDPF_RGBTOYUV = $00000100; + +(* + * pixel format is YUV - YUV data in pixel format struct is valid + *) + DDPF_YUV = $00000200; + +(* + * pixel format is a z buffer only surface + *) + DDPF_ZBUFFER = $00000400; + +(* + * The surface is 1-bit color indexed. + *) + DDPF_PALETTEINDEXED1 = $00000800; + +(* + * The surface is 2-bit color indexed. + *) + DDPF_PALETTEINDEXED2 = $00001000; + +(* + * The surface contains Z information in the pixels + *) + DDPF_ZPIXELS = $00002000; + +(* + * The surface contains stencil information along with Z + *) + DDPF_STENCILBUFFER = $00004000; + +(* + * Premultiplied alpha format -- the color components have been + * premultiplied by the alpha component. + *) + DDPF_ALPHAPREMULT = $00008000; + + +(* + * Luminance data in the pixel format is valid. + * Use this flag for luminance-only or luminance+alpha surfaces, + * the bit depth is then ddpf.dwLuminanceBitCount. + *) + DDPF_LUMINANCE = $00020000; + +(* + * Luminance data in the pixel format is valid. + * Use this flag when hanging luminance off bumpmap surfaces, + * the bit mask for the luminance portion of the pixel is then + * ddpf.dwBumpLuminanceBitMask + *) + DDPF_BUMPLUMINANCE = $00040000; + +(* + * Bump map dUdV data in the pixel format is valid. + *) + DDPF_BUMPDUDV = $00080000; + + +(*=========================================================================== + * + * + * DIRECTDRAW CALLBACK FLAGS + * + * + *==========================================================================*) + +(**************************************************************************** + * + * DIRECTDRAW ENUMSURFACES FLAGS + * + ****************************************************************************) + +(* + * Enumerate all of the surfaces that meet the search criterion. + *) + DDENUMSURFACES_ALL = $00000001; + +(* + * A search hit is a surface that matches the surface description. + *) + DDENUMSURFACES_MATCH = $00000002; + +(* + * A search hit is a surface that does not match the surface description. + *) + DDENUMSURFACES_NOMATCH = $00000004; + +(* + * Enumerate the first surface that can be created which meets the search criterion. + *) + DDENUMSURFACES_CANBECREATED = $00000008; + +(* + * Enumerate the surfaces that already exist that meet the search criterion. + *) + DDENUMSURFACES_DOESEXIST = $00000010; + + +(**************************************************************************** + * + * DIRECTDRAW SETDISPLAYMODE FLAGS + * + ****************************************************************************) + +(* + * The desired mode is a standard VGA mode + *) + DDSDM_STANDARDVGAMODE = $00000001; + + +(**************************************************************************** + * + * DIRECTDRAW ENUMDISPLAYMODES FLAGS + * + ****************************************************************************) + +(* + * Enumerate Modes with different refresh rates. EnumDisplayModes guarantees + * that a particular mode will be enumerated only once. This flag specifies whether + * the refresh rate is taken into account when determining if a mode is unique. + *) + DDEDM_REFRESHRATES = $00000001; + +(* + * Enumerate VGA modes. Specify this flag if you wish to enumerate supported VGA + * modes such as mode 0x13 in addition to the usual ModeX modes (which are always + * enumerated if the application has previously called SetCooperativeLevel with the + * DDSCL_ALLOWMODEX flag set). + *) + DDEDM_STANDARDVGAMODES = $00000002; + + +(**************************************************************************** + * + * DIRECTDRAW SETCOOPERATIVELEVEL FLAGS + * + ****************************************************************************) + +(* + * Exclusive mode owner will be responsible for the entire primary surface. + * GDI can be ignored. used with DD + *) + DDSCL_FULLSCREEN = $00000001; + +(* + * allow CTRL_ALT_DEL to work while in fullscreen exclusive mode + *) + DDSCL_ALLOWREBOOT = $00000002; + +(* + * prevents DDRAW from modifying the application window. + * prevents DDRAW from minimize/restore the application window on activation. + *) + DDSCL_NOWINDOWCHANGES = $00000004; + +(* + * app wants to work as a regular Windows application + *) + DDSCL_NORMAL = $00000008; + +(* + * app wants exclusive access + *) + DDSCL_EXCLUSIVE = $00000010; + + +(* + * app can deal with non-windows display modes + *) + DDSCL_ALLOWMODEX = $00000040; + +(* + * this window will receive the focus messages + *) + DDSCL_SETFOCUSWINDOW = $00000080; + +(* + * this window is associated with the DDRAW object and will + * cover the screen in fullscreen mode + *) + DDSCL_SETDEVICEWINDOW = $00000100; + +(* + * app wants DDRAW to create a window to be associated with the + * DDRAW object + *) + DDSCL_CREATEDEVICEWINDOW = $00000200; + +(* + * App explicitly asks DDRAW/D3D to be multithread safe. This makes D3D + * take the global crtisec more frequently. + *) + DDSCL_MULTITHREADED = $00000400; + +(* + * App specifies that it would like to keep the FPU set up for optimal Direct3D + * performance (single precision and exceptions disabled) so Direct3D + * does not need to explicitly set the FPU each time. This is assumed by + * default in DirectX 7. See also DDSCL_FPUPRESERVE + *) + DDSCL_FPUSETUP = $00000800; + +(* + * App specifies that it needs either double precision FPU or FPU exceptions + * enabled. This makes Direct3D explicitly set the FPU state eah time it is + * called. Setting the flag will reduce Direct3D performance. The flag is + * assumed by default in DirectX 6 and earlier. See also DDSCL_FPUSETUP + *) + DDSCL_FPUPRESERVE = $00001000; + + +(**************************************************************************** + * + * DIRECTDRAW BLT FLAGS + * + ****************************************************************************) + +(* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the destination surface as the alpha channel for this blt. + *) + DDBLT_ALPHADEST = $00000001; + +(* + * Use the dwConstAlphaDest field in the DDBLTFX structure as the alpha channel + * for the destination surface for this blt. + *) + DDBLT_ALPHADESTCONSTOVERRIDE = $00000002; + +(* + * The NEG suffix indicates that the destination surface becomes more + * transparent as the alpha value increases. (0 is opaque) + *) + DDBLT_ALPHADESTNEG = $00000004; + +(* + * Use the lpDDSAlphaDest field in the DDBLTFX structure as the alpha + * channel for the destination for this blt. + *) + DDBLT_ALPHADESTSURFACEOVERRIDE = $00000008; + +(* + * Use the dwAlphaEdgeBlend field in the DDBLTFX structure as the alpha channel + * for the edges of the image that border the color key colors. + *) + DDBLT_ALPHAEDGEBLEND = $00000010; + +(* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the source surface as the alpha channel for this blt. + *) + DDBLT_ALPHASRC = $00000020; + +(* + * Use the dwConstAlphaSrc field in the DDBLTFX structure as the alpha channel + * for the source for this blt. + *) + DDBLT_ALPHASRCCONSTOVERRIDE = $00000040; + +(* + * The NEG suffix indicates that the source surface becomes more transparent + * as the alpha value increases. (0 is opaque) + *) + DDBLT_ALPHASRCNEG = $00000080; + +(* + * Use the lpDDSAlphaSrc field in the DDBLTFX structure as the alpha channel + * for the source for this blt. + *) + DDBLT_ALPHASRCSURFACEOVERRIDE = $00000100; + +(* + * Do this blt asynchronously through the FIFO in the order received. If + * there is no room in the hardware FIFO fail the call. + *) + DDBLT_ASYNC = $00000200; + +(* + * uses the dwfillcolor field in the ddbltfx structure as the rgb color + * to fill the destination rectangle on the destination surface with. + *) + ddblt_colorfill = $00000400; + +(* + * uses the dwddfx field in the ddbltfx structure to specify the effects + * to use for the blt. + *) + ddblt_ddfx = $00000800; + +(* + * uses the dwddrops field in the ddbltfx structure to specify the rops + * that are not part of the win32 api. + *) + ddblt_ddrops = $00001000; + +(* + * Use the color key associated with the destination surface. + *) + DDBLT_KEYDEST = $00002000; + +(* + * Use the dckDestColorkey field in the DDBLTFX structure as the color key + * for the destination surface. + *) + DDBLT_KEYDESTOVERRIDE = $00004000; + +(* + * Use the color key associated with the source surface. + *) + DDBLT_KEYSRC = $00008000; + +(* + * Use the dckSrcColorkey field in the DDBLTFX structure as the color key + * for the source surface. + *) + DDBLT_KEYSRCOVERRIDE = $00010000; + +(* + * Use the dwROP field in the DDBLTFX structure for the raster operation + * for this blt. These ROPs are the same as the ones defined in the Win32 API. + *) + DDBLT_ROP = $00020000; + +(* + * Use the dwRotationAngle field in the DDBLTFX structure as the angle + * (specified in 1/100th of a degree) to rotate the surface. + *) + DDBLT_ROTATIONANGLE = $00040000; + +(* + * Z-buffered blt using the z-buffers attached to the source and destination + * surfaces and the dwZBufferOpCode field in the DDBLTFX structure as the + * z-buffer opcode. + *) + DDBLT_ZBUFFER = $00080000; + +(* + * Z-buffered blt using the dwConstDest Zfield and the dwZBufferOpCode field + * in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively + * for the destination. + *) + DDBLT_ZBUFFERDESTCONSTOVERRIDE = $00100000; + +(* + * Z-buffered blt using the lpDDSDestZBuffer field and the dwZBufferOpCode + * field in the DDBLTFX structure as the z-buffer and z-buffer opcode + * respectively for the destination. + *) + DDBLT_ZBUFFERDESTOVERRIDE = $00200000; + +(* + * Z-buffered blt using the dwConstSrcZ field and the dwZBufferOpCode field + * in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively + * for the source. + *) + DDBLT_ZBUFFERSRCCONSTOVERRIDE = $00400000; + +(* + * Z-buffered blt using the lpDDSSrcZBuffer field and the dwZBufferOpCode + * field in the DDBLTFX structure as the z-buffer and z-buffer opcode + * respectively for the source. + *) + DDBLT_ZBUFFERSRCOVERRIDE = $00800000; + +(* + * wait until the device is ready to handle the blt + * this will cause blt to not return DDERR_WASSTILLDRAWING + *) + DDBLT_WAIT = $01000000; + +(* + * uses the dwfilldepth field in the ddbltfx structure as the depth value + * to fill the destination rectangle on the destination z-buffer surface + * with. + *) + ddblt_depthfill = $02000000; + + +(* + * Return immediately (with DDERR_WASSTILLDRAWING) if the device is not + * ready to schedule the blt at the time Blt() is called. + *) + DDBLT_DONOTWAIT = $08000000; + +(* + * These flags indicate a presentation blt (i.e. a blt + * that moves surface contents from an offscreen back buffer to the primary + * surface). The driver is not allowed to "queue" more than three such blts. + * The "end" of the presentation blt is indicated, since the + * blt may be clipped, in which case the runtime will call the driver with + * several blts. All blts (even if not clipped) are tagged with DDBLT_PRESENTATION + * and the last (even if not clipped) additionally with DDBLT_LAST_PRESENTATION. + * Thus the true rule is that the driver must not schedule a DDBLT_PRESENTATION + * blt if there are 3 or more DDBLT_PRESENTLAST blts in the hardware pipe. + * If there are such blts in the pipe, the driver should return DDERR_WASSTILLDRAWING + * until the oldest queued DDBLT_LAST_PRESENTATION blts has been retired (i.e. the + * pixels have been actually written to the primary surface). Once the oldest blt + * has been retired, the driver is free to schedule the current blt. + * The goal is to provide a mechanism whereby the device's hardware queue never + * gets more than 3 frames ahead of the frames being generated by the application. + * When excessive queueing occurs, applications become unusable because the application + * visibly lags user input, and such problems make windowed interactive applications impossible. + * Some drivers may not have sufficient knowledge of their hardware's FIFO to know + * when a certain blt has been retired. Such drivers should code cautiously, and + * simply not allow any frames to be queued at all. DDBLT_LAST_PRESENTATION should cause + * such drivers to return DDERR_WASSTILLDRAWING until the accelerator is completely + * finished- exactly as if the application had called Lock on the source surface + * before calling Blt. + * In other words, the driver is allowed and encouraged to + * generate as much latency as it can, but never more than 3 frames worth. + * Implementation detail: Drivers should count blts against the SOURCE surface, not + * against the primary surface. This enables multiple parallel windowed application + * to function more optimally. + * This flag is passed only to DX8 or higher drivers. + * + * APPLICATIONS DO NOT SET THESE FLAGS. THEY ARE SET BY THE DIRECTDRAW RUNTIME. + * + *) + DDBLT_PRESENTATION = $10000000; + DDBLT_LAST_PRESENTATION = $20000000; + +(* + * If DDBLT_EXTENDED_FLAGS is set, then the driver should re-interpret + * other flags according to the definitions that follow. + * For example, bit 0 (0x00000001L) means DDBLT_ALPHADEST, unless + * DDBLT_EXTENDED_FLAGS is also set, in which case bit 0 means + * DDBLT_EXTENDED_LINEAR_CONTENT. + * Only DirectX9 and higher drivers will be given extended blt flags. + * Only flags explicitly mentioned here should be re-interpreted. + * All other flags retain their original meanings. + * + * List of re-interpreted flags: + * + * Bit Hex value New meaning old meaning + * --------------------------------------------------------------- + * 2 0x00000004 DDBLT_EXTENDED_LINEAR_CONTENT DDBLT_ALPHADESTNEG + * 4 0x00000010 DDBLT_EXTENDED_PRESENTATION_STRETCHFACTOR DDBLT_ALPHAEDGEBLEND + * + * + * NOTE: APPLICATIONS SHOULD NOT SET THIS FLAG. THIS FLAG IS INTENDED + * FOR USE BY THE DIRECT3D RUNTIME. + *) + DDBLT_EXTENDED_FLAGS = $40000000; + +(* + * EXTENDED FLAG. SEE DEFINITION OF DDBLT_EXTENDED_FLAGS. + * This flag indidcates that the source surface contains content in a + * linear color space. The driver may perform gamma correction to the + * desktop color space (i.e. sRGB, gamma 2.2) as part of this blt. + * If the device can perform such a conversion as part of the copy, + * the driver should also set D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION + * + * NOTE: APPLICATIONS SHOULD NOT SET THIS FLAG. THIS FLAG IS INTENDED + * FOR USE BY THE DIRECT3D RUNTIME. Use IDirect3DSwapChain9::Present + * and specify D3DPRESENT_LINEAR_CONTENT in order to use this functionality. + *) + DDBLT_EXTENDED_LINEAR_CONTENT = $00000004; + + +(**************************************************************************** + * + * BLTFAST FLAGS + * + ****************************************************************************) + + DDBLTFAST_NOCOLORKEY = $00000000; + DDBLTFAST_SRCCOLORKEY = $00000001; + DDBLTFAST_DESTCOLORKEY = $00000002; + DDBLTFAST_WAIT = $00000010; + DDBLTFAST_DONOTWAIT = $00000020; + +(**************************************************************************** + * + * FLIP FLAGS + * + ****************************************************************************) + + DDFLIP_WAIT = $00000001; + +(* + * Indicates that the target surface contains the even field of video data. + * This flag is only valid with an overlay surface. + *) + DDFLIP_EVEN = $00000002; + +(* + * Indicates that the target surface contains the odd field of video data. + * This flag is only valid with an overlay surface. + *) + DDFLIP_ODD = $00000004; + +(* + * causes directdraw to perform the physical flip immediately and return + * to the application. typically, what was the front buffer but is now the back + * buffer will still be visible (depending on timing) until the next vertical + * retrace. subsequent operations involving the two flipped surfaces will + * not check to see if the physical flip has finished (i.e. will not return + * dderr_wasstilldrawing for that reason (but may for other reasons)). + * this allows an application to perform flips at a higher frequency than the + * monitor refresh rate, but may introduce visible artifacts. + * only effective if ddcaps2_flipnovsync is set. if that bit is not set, + * ddflip_novsync has no effect. + *) + ddflip_novsync = $00000008; + + +(* + * Flip Interval Flags. These flags indicate how many vertical retraces to wait between + * each flip. The default is one. DirectDraw will return DDERR_WASSTILLDRAWING for each + * surface involved in the flip until the specified number of vertical retraces has + * ocurred. Only effective if DDCAPS2_FLIPINTERVAL is set. If that bit is not set, + * DDFLIP_INTERVALn has no effect. + *) + +(* + * DirectDraw will flip on every other vertical sync + *) + DDFLIP_INTERVAL2 = $02000000; + + +(* + * DirectDraw will flip on every third vertical sync + *) + DDFLIP_INTERVAL3 = $03000000; + + +(* + * DirectDraw will flip on every fourth vertical sync + *) + DDFLIP_INTERVAL4 = $04000000; + +(* + * DirectDraw will flip and display a main stereo surface + *) + DDFLIP_STEREO = $00000010; + +(* + * On IDirectDrawSurface7 and higher interfaces, the default is DDFLIP_WAIT. If you wish + * to override the default and use time when the accelerator is busy (as denoted by + * the DDERR_WASSTILLDRAWING return code) then use DDFLIP_DONOTWAIT. + *) + DDFLIP_DONOTWAIT = $00000020; + + +(**************************************************************************** + * + * DIRECTDRAW SURFACE OVERLAY FLAGS + * + ****************************************************************************) + +(* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the destination surface as the alpha channel for the + * destination overlay. + *) + DDOVER_ALPHADEST = $00000001; + +(* + * Use the dwConstAlphaDest field in the DDOVERLAYFX structure as the + * destination alpha channel for this overlay. + *) + DDOVER_ALPHADESTCONSTOVERRIDE = $00000002; + +(* + * The NEG suffix indicates that the destination surface becomes more + * transparent as the alpha value increases. + *) + DDOVER_ALPHADESTNEG = $00000004; + +(* + * Use the lpDDSAlphaDest field in the DDOVERLAYFX structure as the alpha + * channel destination for this overlay. + *) + DDOVER_ALPHADESTSURFACEOVERRIDE = $00000008; + +(* + * Use the dwAlphaEdgeBlend field in the DDOVERLAYFX structure as the alpha + * channel for the edges of the image that border the color key colors. + *) + DDOVER_ALPHAEDGEBLEND = $00000010; + +(* + * Use the alpha information in the pixel format or the alpha channel surface + * attached to the source surface as the source alpha channel for this overlay. + *) + DDOVER_ALPHASRC = $00000020; + +(* + * Use the dwConstAlphaSrc field in the DDOVERLAYFX structure as the source + * alpha channel for this overlay. + *) + DDOVER_ALPHASRCCONSTOVERRIDE = $00000040; + +(* + * The NEG suffix indicates that the source surface becomes more transparent + * as the alpha value increases. + *) + DDOVER_ALPHASRCNEG = $00000080; + +(* + * Use the lpDDSAlphaSrc field in the DDOVERLAYFX structure as the alpha channel + * source for this overlay. + *) + DDOVER_ALPHASRCSURFACEOVERRIDE = $00000100; + +(* + * Turn this overlay off. + *) + DDOVER_HIDE = $00000200; + +(* + * Use the color key associated with the destination surface. + *) + DDOVER_KEYDEST = $00000400; + +(* + * Use the dckDestColorkey field in the DDOVERLAYFX structure as the color key + * for the destination surface + *) + DDOVER_KEYDESTOVERRIDE = $00000800; + +(* + * Use the color key associated with the source surface. + *) + DDOVER_KEYSRC = $00001000; + +(* + * Use the dckSrcColorkey field in the DDOVERLAYFX structure as the color key + * for the source surface. + *) + DDOVER_KEYSRCOVERRIDE = $00002000; + +(* + * Turn this overlay on. + *) + DDOVER_SHOW = $00004000; + +(* + * Add a dirty rect to an emulated overlayed surface. + *) + DDOVER_ADDDIRTYRECT = $00008000; + +(* + * Redraw all dirty rects on an emulated overlayed surface. + *) + DDOVER_REFRESHDIRTYRECTS = $00010000; + +(* + * Redraw the entire surface on an emulated overlayed surface. + *) + DDOVER_REFRESHALL = $00020000; + + +(* + * Use the overlay FX flags to define special overlay FX + *) + DDOVER_DDFX = $00080000; + +(* + * Autoflip the overlay when ever the video port autoflips + *) + DDOVER_AUTOFLIP = $00100000; + +(* + * Display each field of video port data individually without + * causing any jittery artifacts + *) + DDOVER_BOB = $00200000; + +(* + * Indicates that bob/weave decisions should not be overridden by other + * interfaces. + *) + DDOVER_OVERRIDEBOBWEAVE = $00400000; + +(* + * Indicates that the surface memory is composed of interleaved fields. + *) + DDOVER_INTERLEAVED = $00800000; + +(* + * Indicates that bob will be performed using hardware rather than + * software or emulated. + *) + DDOVER_BOBHARDWARE = $01000000; + +(* + * Indicates that overlay FX structure contains valid ARGB scaling factors. + *) + DDOVER_ARGBSCALEFACTORS = $02000000; + +(* + * Indicates that ARGB scaling factors can be degraded to fit driver capabilities. + *) + DDOVER_DEGRADEARGBSCALING = $04000000; + + +(**************************************************************************** + * + * DIRECTDRAWSURFACE LOCK FLAGS + * + ****************************************************************************) + +(* + * The default. Set to indicate that Lock should return a valid memory pointer + * to the top of the specified rectangle. If no rectangle is specified then a + * pointer to the top of the surface is returned. + *) + DDLOCK_SURFACEMEMORYPTR = $00000000; // = default + +(* + * Set to indicate that Lock should wait until it can obtain a valid memory + * pointer before returning. If this bit is set, Lock will never return + * DDERR_WASSTILLDRAWING. + *) + DDLOCK_WAIT = $00000001; + +(* + * Set if an event handle is being passed to Lock. Lock will trigger the event + * when it can return the surface memory pointer requested. + *) + DDLOCK_EVENT = $00000002; + +(* + * Indicates that the surface being locked will only be read from. + *) + DDLOCK_READONLY = $00000010; + +(* + * Indicates that the surface being locked will only be written to + *) + DDLOCK_WRITEONLY = $00000020; + + +(* + * Indicates that a system wide lock should not be taken when this surface + * is locked. This has several advantages (cursor responsiveness, ability + * to call more Windows functions, easier debugging) when locking video + * memory surfaces. However, an application specifying this flag must + * comply with a number of conditions documented in the help file. + * Furthermore, this flag cannot be specified when locking the primary. + *) + DDLOCK_NOSYSLOCK = $00000800; + +(* + * Used only with Direct3D Vertex Buffer Locks. Indicates that no vertices + * that were referred to in Draw*PrimtiveVB calls since the start of the + * frame (or the last lock without this flag) will be modified during the + * lock. This can be useful when one is only appending data to the vertex + * buffer + *) + DDLOCK_NOOVERWRITE = $00001000; + +(* + * Indicates that no assumptions will be made about the contents of the + * surface or vertex buffer during this lock. + * This enables two things: + * - Direct3D or the driver may provide an alternative memory + * area as the vertex buffer. This is useful when one plans to clear the + * contents of the vertex buffer and fill in new data. + * - Drivers sometimes store surface data in a re-ordered format. + * When the application locks the surface, the driver is forced to un-re-order + * the surface data before allowing the application to see the surface contents. + * This flag is a hint to the driver that it can skip the un-re-ordering process + * since the application plans to overwrite every single pixel in the surface + * or locked rectangle (and so erase any un-re-ordered pixels anyway). + * Applications should always set this flag when they intend to overwrite the entire + * surface or locked rectangle. + *) + DDLOCK_DISCARDCONTENTS = $00002000; + (* + * DDLOCK_OKTOSWAP is an older, less informative name for DDLOCK_DISCARDCONTENTS + *) + DDLOCK_OKTOSWAP = $00002000; + +(* + * On IDirectDrawSurface7 and higher interfaces, the default is DDLOCK_WAIT. If you wish + * to override the default and use time when the accelerator is busy (as denoted by + * the DDERR_WASSTILLDRAWING return code) then use DDLOCK_DONOTWAIT. + *) + DDLOCK_DONOTWAIT = $00004000; + +(* + * This indicates volume texture lock with front and back specified. + *) + DDLOCK_HASVOLUMETEXTUREBOXRECT = $00008000; + +(* + * This indicates that the driver should not update dirty rect information for this lock. + *) + DDLOCK_NODIRTYUPDATE = $00010000; + + +(**************************************************************************** + * + * DIRECTDRAWSURFACE PAGELOCK FLAGS + * + ****************************************************************************) + +(* + * No flags defined at present + *) + + +(**************************************************************************** + * + * DIRECTDRAWSURFACE PAGEUNLOCK FLAGS + * + ****************************************************************************) + +(* + * No flags defined at present + *) + + +(**************************************************************************** + * + * DIRECTDRAWSURFACE BLT FX FLAGS + * + ****************************************************************************) + +(* + * If stretching, use arithmetic stretching along the Y axis for this blt. + *) + DDBLTFX_ARITHSTRETCHY = $00000001; + +(* + * Do this blt mirroring the surface left to right. Spin the + * surface around its y-axis. + *) + DDBLTFX_MIRRORLEFTRIGHT = $00000002; + +(* + * Do this blt mirroring the surface up and down. Spin the surface + * around its x-axis. + *) + DDBLTFX_MIRRORUPDOWN = $00000004; + +(* + * Schedule this blt to avoid tearing. + *) + DDBLTFX_NOTEARING = $00000008; + +(* + * Do this blt rotating the surface one hundred and eighty degrees. + *) + DDBLTFX_ROTATE180 = $00000010; + +(* + * Do this blt rotating the surface two hundred and seventy degrees. + *) + DDBLTFX_ROTATE270 = $00000020; + +(* + * Do this blt rotating the surface ninety degrees. + *) + DDBLTFX_ROTATE90 = $00000040; + +(* + * Do this z blt using dwZBufferLow and dwZBufferHigh as range values + * specified to limit the bits copied from the source surface. + *) + DDBLTFX_ZBUFFERRANGE = $00000080; + +(* + * Do this z blt adding the dwZBufferBaseDest to each of the sources z values + * before comparing it with the desting z values. + *) + DDBLTFX_ZBUFFERBASEDEST = $00000100; + +(**************************************************************************** + * + * DIRECTDRAWSURFACE OVERLAY FX FLAGS + * + ****************************************************************************) + +(* + * If stretching, use arithmetic stretching along the Y axis for this overlay. + *) + DDOVERFX_ARITHSTRETCHY = $00000001; + +(* + * Mirror the overlay across the vertical axis + *) + DDOVERFX_MIRRORLEFTRIGHT = $00000002; + +(* + * Mirror the overlay across the horizontal axis + *) + DDOVERFX_MIRRORUPDOWN = $00000004; + +(* + * Deinterlace the overlay, if possible + *) + DDOVERFX_DEINTERLACE = $00000008; + + +(**************************************************************************** + * + * DIRECTDRAW WAITFORVERTICALBLANK FLAGS + * + ****************************************************************************) + +(* + * return when the vertical blank interval begins + *) + DDWAITVB_BLOCKBEGIN = $00000001; + +(* + * set up an event to trigger when the vertical blank begins + *) + DDWAITVB_BLOCKBEGINEVENT = $00000002; + +(* + * return when the vertical blank interval ends and display begins + *) + DDWAITVB_BLOCKEND = $00000004; + +(**************************************************************************** + * + * DIRECTDRAW GETFLIPSTATUS FLAGS + * + ****************************************************************************) + +(* + * is it OK to flip now? + *) + DDGFS_CANFLIP = $00000001; + +(* + * is the last flip finished? + *) + DDGFS_ISFLIPDONE = $00000002; + +(**************************************************************************** + * + * DIRECTDRAW GETBLTSTATUS FLAGS + * + ****************************************************************************) + +(* + * is it OK to blt now? + *) + DDGBS_CANBLT = $00000001; + +(* + * is the blt to the surface finished? + *) + DDGBS_ISBLTDONE = $00000002; + + +(**************************************************************************** + * + * DIRECTDRAW ENUMOVERLAYZORDER FLAGS + * + ****************************************************************************) + +(* + * Enumerate overlays back to front. + *) + DDENUMOVERLAYZ_BACKTOFRONT = $00000000; + +(* + * Enumerate overlays front to back + *) + DDENUMOVERLAYZ_FRONTTOBACK = $00000001; + +(**************************************************************************** + * + * DIRECTDRAW UPDATEOVERLAYZORDER FLAGS + * + ****************************************************************************) + +(* + * Send overlay to front + *) + DDOVERZ_SENDTOFRONT = $00000000; + +(* + * Send overlay to back + *) + DDOVERZ_SENDTOBACK = $00000001; + +(* + * Move Overlay forward + *) + DDOVERZ_MOVEFORWARD = $00000002; + +(* + * Move Overlay backward + *) + DDOVERZ_MOVEBACKWARD = $00000003; + +(* + * Move Overlay in front of relative surface + *) + DDOVERZ_INSERTINFRONTOF = $00000004; + +(* + * Move Overlay in back of relative surface + *) + DDOVERZ_INSERTINBACKOF = $00000005; + + +(**************************************************************************** + * + * DIRECTDRAW SETGAMMARAMP FLAGS + * + ****************************************************************************) + +(* + * Request calibrator to adjust the gamma ramp according to the physical + * properties of the display so that the result should appear identical + * on all systems. + *) + DDSGR_CALIBRATE = $00000001; + + +(**************************************************************************** + * + * DIRECTDRAW STARTMODETEST FLAGS + * + ****************************************************************************) + +(* + * Indicates that the mode being tested has passed + *) + DDSMT_ISTESTREQUIRED = $00000001; + + +(**************************************************************************** + * + * DIRECTDRAW EVALUATEMODE FLAGS + * + ****************************************************************************) + +(* + * Indicates that the mode being tested has passed + *) + DDEM_MODEPASSED = $00000001; + +(* + * Indicates that the mode being tested has failed + *) + DDEM_MODEFAILED = $00000002; + + +(*=========================================================================== + * + * + * DIRECTDRAW RETURN CODES + * + * The return values from DirectDraw Commands and Surface that return an HRESULT + * are codes from DirectDraw concerning the results of the action + * requested by DirectDraw. + * + *==========================================================================*) + +(* + * Status is OK + * + * Issued by: DirectDraw Commands and all callbacks + *) + DD_OK = 0; + DD_FALSE = S_FALSE; + +(**************************************************************************** + * + * DIRECTDRAW ENUMCALLBACK RETURN VALUES + * + * EnumCallback returns are used to control the flow of the DIRECTDRAW and + * DIRECTDRAWSURFACE object enumerations. They can only be returned by + * enumeration callback routines. + * + ****************************************************************************) + +(* + * stop the enumeration + *) + DDENUMRET_CANCEL = 0; + +(* + * continue the enumeration + *) + DDENUMRET_OK = 1; + +(**************************************************************************** + * + * DIRECTDRAW ERRORS + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************) + +const + _FACDD = $876; + _MAKE_DDHRESULT = HResult(1 shl 31) or HResult(_FACDD shl 16); + +//#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) +function MAKE_DDHRESULT(Code: DWORD): HResult; + +const +(* + * This object is already initialized + *) + DDERR_ALREADYINITIALIZED = HResult(_MAKE_DDHRESULT + 5); + +(* + * This surface can not be attached to the requested surface. + *) + DDERR_CANNOTATTACHSURFACE = HResult(_MAKE_DDHRESULT + 10); + +(* + * This surface can not be detached from the requested surface. + *) + DDERR_CANNOTDETACHSURFACE = HResult(_MAKE_DDHRESULT + 20); + +(* + * Support is currently not available. + *) + DDERR_CURRENTLYNOTAVAIL = HResult(_MAKE_DDHRESULT + 40); + +(* + * An exception was encountered while performing the requested operation + *) + DDERR_EXCEPTION = HResult(_MAKE_DDHRESULT + 55); + +(* + * Generic failure. + *) + DDERR_GENERIC = E_FAIL; + +(* + * Height of rectangle provided is not a multiple of reqd alignment + *) + DDERR_HEIGHTALIGN = HResult(_MAKE_DDHRESULT + 90); + +(* + * Unable to match primary surface creation request with existing + * primary surface. + *) + DDERR_INCOMPATIBLEPRIMARY = HResult(_MAKE_DDHRESULT + 95); + +(* + * One or more of the caps bits passed to the callback are incorrect. + *) + DDERR_INVALIDCAPS = HResult(_MAKE_DDHRESULT + 100); + +(* + * DirectDraw does not support provided Cliplist. + *) + DDERR_INVALIDCLIPLIST = HResult(_MAKE_DDHRESULT + 110); + +(* + * DirectDraw does not support the requested mode + *) + DDERR_INVALIDMODE = HResult(_MAKE_DDHRESULT + 120); + +(* + * DirectDraw received a pointer that was an invalid DIRECTDRAW object. + *) + DDERR_INVALIDOBJECT = HResult(_MAKE_DDHRESULT + 130); + +(* + * One or more of the parameters passed to the callback function are + * incorrect. + *) + DDERR_INVALIDPARAMS = E_INVALIDARG; + +(* + * pixel format was invalid as specified + *) + DDERR_INVALIDPIXELFORMAT = HResult(_MAKE_DDHRESULT + 145); + +(* + * Rectangle provided was invalid. + *) + DDERR_INVALIDRECT = HResult(_MAKE_DDHRESULT + 150); + +(* + * Operation could not be carried out because one or more surfaces are locked + *) + DDERR_LOCKEDSURFACES = HResult(_MAKE_DDHRESULT + 160); + +(* + * There is no 3D present. + *) + DDERR_NO3D = HResult(_MAKE_DDHRESULT + 170); + +(* + * Operation could not be carried out because there is no alpha accleration + * hardware present or available. + *) + DDERR_NOALPHAHW = HResult(_MAKE_DDHRESULT + 180); + +(* + * Operation could not be carried out because there is no stereo + * hardware present or available. + *) + DDERR_NOSTEREOHARDWARE = HResult(_MAKE_DDHRESULT + 181); + +(* + * Operation could not be carried out because there is no hardware + * present which supports stereo surfaces + *) + DDERR_NOSURFACELEFT = HResult(_MAKE_DDHRESULT + 182); + + + +(* + * no clip list available + *) + DDERR_NOCLIPLIST = HResult(_MAKE_DDHRESULT + 205); + +(* + * Operation could not be carried out because there is no color conversion + * hardware present or available. + *) + DDERR_NOCOLORCONVHW = HResult(_MAKE_DDHRESULT + 210); + +(* + * Create function called without DirectDraw object method SetCooperativeLevel + * being called. + *) + DDERR_NOCOOPERATIVELEVELSET = HResult(_MAKE_DDHRESULT + 212); + +(* + * Surface doesn't currently have a color key + *) + DDERR_NOCOLORKEY = HResult(_MAKE_DDHRESULT + 215); + +(* + * Operation could not be carried out because there is no hardware support + * of the dest color key. + *) + DDERR_NOCOLORKEYHW = HResult(_MAKE_DDHRESULT + 220); + +(* + * No DirectDraw support possible with current display driver + *) + DDERR_NODIRECTDRAWSUPPORT = HResult(_MAKE_DDHRESULT + 222); + +(* + * Operation requires the application to have exclusive mode but the + * application does not have exclusive mode. + *) + DDERR_NOEXCLUSIVEMODE = HResult(_MAKE_DDHRESULT + 225); + +(* + * Flipping visible surfaces is not supported. + *) + DDERR_NOFLIPHW = HResult(_MAKE_DDHRESULT + 230); + +(* + * There is no GDI present. + *) + DDERR_NOGDI = HResult(_MAKE_DDHRESULT + 240); + +(* + * Operation could not be carried out because there is no hardware present + * or available. + *) + DDERR_NOMIRRORHW = HResult(_MAKE_DDHRESULT + 250); + +(* + * Requested item was not found + *) + DDERR_NOTFOUND = HResult(_MAKE_DDHRESULT + 255); + +(* + * Operation could not be carried out because there is no overlay hardware + * present or available. + *) + DDERR_NOOVERLAYHW = HResult(_MAKE_DDHRESULT + 260); + +(* + * Operation could not be carried out because the source and destination + * rectangles are on the same surface and overlap each other. + *) + DDERR_OVERLAPPINGRECTS = HResult(_MAKE_DDHRESULT + 270); + +(* + * Operation could not be carried out because there is no appropriate raster + * op hardware present or available. + *) + DDERR_NORASTEROPHW = HResult(_MAKE_DDHRESULT + 280); + +(* + * Operation could not be carried out because there is no rotation hardware + * present or available. + *) + DDERR_NOROTATIONHW = HResult(_MAKE_DDHRESULT + 290); + +(* + * Operation could not be carried out because there is no hardware support + * for stretching + *) + DDERR_NOSTRETCHHW = HResult(_MAKE_DDHRESULT + 310); + +(* + * DirectDrawSurface is not in 4 bit color palette and the requested operation + * requires 4 bit color palette. + *) + DDERR_NOT4BITCOLOR = HResult(_MAKE_DDHRESULT + 316); + +(* + * DirectDrawSurface is not in 4 bit color index palette and the requested + * operation requires 4 bit color index palette. + *) + DDERR_NOT4BITCOLORINDEX = HResult(_MAKE_DDHRESULT + 317); + +(* + * DirectDraw Surface is not in 8 bit color mode and the requested operation + * requires 8 bit color. + *) + DDERR_NOT8BITCOLOR = HResult(_MAKE_DDHRESULT + 320); + +(* + * Operation could not be carried out because there is no texture mapping + * hardware present or available. + *) + DDERR_NOTEXTUREHW = HResult(_MAKE_DDHRESULT + 330); + +(* + * Operation could not be carried out because there is no hardware support + * for vertical blank synchronized operations. + *) + DDERR_NOVSYNCHW = HResult(_MAKE_DDHRESULT + 335); + +(* + * Operation could not be carried out because there is no hardware support + * for zbuffer blting. + *) + DDERR_NOZBUFFERHW = HResult(_MAKE_DDHRESULT + 340); + +(* + * Overlay surfaces could not be z layered based on their BltOrder because + * the hardware does not support z layering of overlays. + *) + DDERR_NOZOVERLAYHW = HResult(_MAKE_DDHRESULT + 350); + +(* + * The hardware needed for the requested operation has already been + * allocated. + *) + DDERR_OUTOFCAPS = HResult(_MAKE_DDHRESULT + 360); + +(* + * DirectDraw does not have enough memory to perform the operation. + *) + DDERR_OUTOFMEMORY = E_OUTOFMEMORY; + +(* + * DirectDraw does not have enough memory to perform the operation. + *) + DDERR_OUTOFVIDEOMEMORY = HResult(_MAKE_DDHRESULT + 380); + +(* + * hardware does not support clipped overlays + *) + DDERR_OVERLAYCANTCLIP = HResult(_MAKE_DDHRESULT + 382); + +(* + * Can only have ony color key active at one time for overlays + *) + DDERR_OVERLAYCOLORKEYONLYONEACTIVE = HResult(_MAKE_DDHRESULT + 384); + +(* + * Access to this palette is being refused because the palette is already + * locked by another thread. + *) + DDERR_PALETTEBUSY = HResult(_MAKE_DDHRESULT + 387); + +(* + * No src color key specified for this operation. + *) + DDERR_COLORKEYNOTSET = HResult(_MAKE_DDHRESULT + 400); + +(* + * This surface is already attached to the surface it is being attached to. + *) + DDERR_SURFACEALREADYATTACHED = HResult(_MAKE_DDHRESULT + 410); + +(* + * This surface is already a dependency of the surface it is being made a + * dependency of. + *) + DDERR_SURFACEALREADYDEPENDENT = HResult(_MAKE_DDHRESULT + 420); + +(* + * Access to this surface is being refused because the surface is already + * locked by another thread. + *) + DDERR_SURFACEBUSY = HResult(_MAKE_DDHRESULT + 430); + +(* + * Access to this surface is being refused because no driver exists + * which can supply a pointer to the surface. + * This is most likely to happen when attempting to lock the primary + * surface when no DCI provider is present. + * Will also happen on attempts to lock an optimized surface. + *) + DDERR_CANTLOCKSURFACE = HResult(_MAKE_DDHRESULT + 435); + +(* + * Access to Surface refused because Surface is obscured. + *) + DDERR_SURFACEISOBSCURED = HResult(_MAKE_DDHRESULT + 440); + +(* + * Access to this surface is being refused because the surface is gone. + * The DIRECTDRAWSURFACE object representing this surface should + * have Restore called on it. + *) + DDERR_SURFACELOST = HResult(_MAKE_DDHRESULT + 450); + +(* + * The requested surface is not attached. + *) + DDERR_SURFACENOTATTACHED = HResult(_MAKE_DDHRESULT + 460); + +(* + * Height requested by DirectDraw is too large. + *) + DDERR_TOOBIGHEIGHT = HResult(_MAKE_DDHRESULT + 470); + +(* + * Size requested by DirectDraw is too large -- The individual height and + * width are OK. + *) + DDERR_TOOBIGSIZE = HResult(_MAKE_DDHRESULT + 480); + +(* + * Width requested by DirectDraw is too large. + *) + DDERR_TOOBIGWIDTH = HResult(_MAKE_DDHRESULT + 490); + +(* + * Action not supported. + *) + DDERR_UNSUPPORTED = E_NOTIMPL; + +(* + * FOURCC format requested is unsupported by DirectDraw + *) + DDERR_UNSUPPORTEDFORMAT = HResult(_MAKE_DDHRESULT + 510); + +(* + * Bitmask in the pixel format requested is unsupported by DirectDraw + *) + DDERR_UNSUPPORTEDMASK = HResult(_MAKE_DDHRESULT + 520); + +(* + * The specified stream contains invalid data + *) + DDERR_INVALIDSTREAM = HResult(_MAKE_DDHRESULT + 521); + +(* + * vertical blank is in progress + *) + DDERR_VERTICALBLANKINPROGRESS = HResult(_MAKE_DDHRESULT + 537); + +(* + * Informs DirectDraw that the previous Blt which is transfering information + * to or from this Surface is incomplete. + *) + DDERR_WASSTILLDRAWING = HResult(_MAKE_DDHRESULT + 540); + + +(* + * The specified surface type requires specification of the COMPLEX flag + *) + DDERR_DDSCAPSCOMPLEXREQUIRED = HResult(_MAKE_DDHRESULT + 542); + + +(* + * Rectangle provided was not horizontally aligned on reqd. boundary + *) + DDERR_XALIGN = HResult(_MAKE_DDHRESULT + 560); + +(* + * The GUID passed to DirectDrawCreate is not a valid DirectDraw driver + * identifier. + *) + DDERR_INVALIDDIRECTDRAWGUID = HResult(_MAKE_DDHRESULT + 561); + +(* + * A DirectDraw object representing this driver has already been created + * for this process. + *) + DDERR_DIRECTDRAWALREADYCREATED = HResult(_MAKE_DDHRESULT + 562); + +(* + * A hardware only DirectDraw object creation was attempted but the driver + * did not support any hardware. + *) + DDERR_NODIRECTDRAWHW = HResult(_MAKE_DDHRESULT + 563); + +(* + * this process already has created a primary surface + *) + DDERR_PRIMARYSURFACEALREADYEXISTS = HResult(_MAKE_DDHRESULT + 564); + +(* + * software emulation not available. + *) + DDERR_NOEMULATION = HResult(_MAKE_DDHRESULT + 565); + +(* + * region passed to Clipper::GetClipList is too small. + *) + DDERR_REGIONTOOSMALL = HResult(_MAKE_DDHRESULT + 566); + +(* + * an attempt was made to set a clip list for a clipper objec that + * is already monitoring an hwnd. + *) + DDERR_CLIPPERISUSINGHWND = HResult(_MAKE_DDHRESULT + 567); + +(* + * No clipper object attached to surface object + *) + DDERR_NOCLIPPERATTACHED = HResult(_MAKE_DDHRESULT + 568); + +(* + * Clipper notification requires an HWND or + * no HWND has previously been set as the CooperativeLevel HWND. + *) + DDERR_NOHWND = HResult(_MAKE_DDHRESULT + 569); + +(* + * HWND used by DirectDraw CooperativeLevel has been subclassed, + * this prevents DirectDraw from restoring state. + *) + DDERR_HWNDSUBCLASSED = HResult(_MAKE_DDHRESULT + 570); + +(* + * The CooperativeLevel HWND has already been set. + * It can not be reset while the process has surfaces or palettes created. + *) + DDERR_HWNDALREADYSET = HResult(_MAKE_DDHRESULT + 571); + +(* + * No palette object attached to this surface. + *) + DDERR_NOPALETTEATTACHED = HResult(_MAKE_DDHRESULT + 572); + +(* + * No hardware support for 16 or 256 color palettes. + *) + DDERR_NOPALETTEHW = HResult(_MAKE_DDHRESULT + 573); + +(* + * If a clipper object is attached to the source surface passed into a + * BltFast call. + *) + DDERR_BLTFASTCANTCLIP = HResult(_MAKE_DDHRESULT + 574); + +(* + * No blter. + *) + DDERR_NOBLTHW = HResult(_MAKE_DDHRESULT + 575); + +(* + * No DirectDraw ROP hardware. + *) + DDERR_NODDROPSHW = HResult(_MAKE_DDHRESULT + 576); + +(* + * returned when GetOverlayPosition is called on a hidden overlay + *) + DDERR_OVERLAYNOTVISIBLE = HResult(_MAKE_DDHRESULT + 577); + +(* + * returned when GetOverlayPosition is called on a overlay that UpdateOverlay + * has never been called on to establish a destionation. + *) + DDERR_NOOVERLAYDEST = HResult(_MAKE_DDHRESULT + 578); + +(* + * returned when the position of the overlay on the destionation is no longer + * legal for that destionation. + *) + DDERR_INVALIDPOSITION = HResult(_MAKE_DDHRESULT + 579); + +(* + * returned when an overlay member is called for a non-overlay surface + *) + DDERR_NOTAOVERLAYSURFACE = HResult(_MAKE_DDHRESULT + 580); + +(* + * An attempt was made to set the cooperative level when it was already + * set to exclusive. + *) + DDERR_EXCLUSIVEMODEALREADYSET = HResult(_MAKE_DDHRESULT + 581); + +(* + * An attempt has been made to flip a surface that is not flippable. + *) + DDERR_NOTFLIPPABLE = HResult(_MAKE_DDHRESULT + 582); + +(* + * Can't duplicate primary & 3D surfaces, or surfaces that are implicitly + * created. + *) + DDERR_CANTDUPLICATE = HResult(_MAKE_DDHRESULT + 583); + +(* + * Surface was not locked. An attempt to unlock a surface that was not + * locked at all, or by this process, has been attempted. + *) + DDERR_NOTLOCKED = HResult(_MAKE_DDHRESULT + 584); + +(* + * Windows can not create any more DCs, or a DC was requested for a paltte-indexed + * surface when the surface had no palette AND the display mode was not palette-indexed + * (in this case DirectDraw cannot select a proper palette into the DC) + *) + DDERR_CANTCREATEDC = HResult(_MAKE_DDHRESULT + 585); + +(* + * No DC was ever created for this surface. + *) + DDERR_NODC = HResult(_MAKE_DDHRESULT + 586); + +(* + * This surface can not be restored because it was created in a different + * mode. + *) + DDERR_WRONGMODE = HResult(_MAKE_DDHRESULT + 587); + +(* + * This surface can not be restored because it is an implicitly created + * surface. + *) + DDERR_IMPLICITLYCREATED = HResult(_MAKE_DDHRESULT + 588); + +(* + * The surface being used is not a palette-based surface + *) + DDERR_NOTPALETTIZED = HResult(_MAKE_DDHRESULT + 589); + + +(* + * The display is currently in an unsupported mode + *) + DDERR_UNSUPPORTEDMODE = HResult(_MAKE_DDHRESULT + 590); + +(* + * Operation could not be carried out because there is no mip-map + * texture mapping hardware present or available. + *) + DDERR_NOMIPMAPHW = HResult(_MAKE_DDHRESULT + 591); + +(* + * The requested action could not be performed because the surface was of + * the wrong type. + *) + DDERR_INVALIDSURFACETYPE = HResult(_MAKE_DDHRESULT + 592); + + +(* + * Device does not support optimized surfaces, therefore no video memory optimized surfaces + *) + DDERR_NOOPTIMIZEHW = HResult(_MAKE_DDHRESULT + 600); + +(* + * Surface is an optimized surface, but has not yet been allocated any memory + *) + DDERR_NOTLOADED = HResult(_MAKE_DDHRESULT + 601); + +(* + * Attempt was made to create or set a device window without first setting + * the focus window + *) + DDERR_NOFOCUSWINDOW = HResult(_MAKE_DDHRESULT + 602); + +(* + * Attempt was made to set a palette on a mipmap sublevel + *) + DDERR_NOTONMIPMAPSUBLEVEL = HResult(_MAKE_DDHRESULT + 603); + +(* + * A DC has already been returned for this surface. Only one DC can be + * retrieved per surface. + *) + DDERR_DCALREADYCREATED = HResult(_MAKE_DDHRESULT + 620); + +(* + * An attempt was made to allocate non-local video memory from a device + * that does not support non-local video memory. + *) + DDERR_NONONLOCALVIDMEM = HResult(_MAKE_DDHRESULT + 630); + +(* + * The attempt to page lock a surface failed. + *) + DDERR_CANTPAGELOCK = HResult(_MAKE_DDHRESULT + 640); + + +(* + * The attempt to page unlock a surface failed. + *) + DDERR_CANTPAGEUNLOCK = HResult(_MAKE_DDHRESULT + 660); + +(* + * An attempt was made to page unlock a surface with no outstanding page locks. + *) + DDERR_NOTPAGELOCKED = HResult(_MAKE_DDHRESULT + 680); + +(* + * There is more data available than the specified buffer size could hold + *) + DDERR_MOREDATA = HResult(_MAKE_DDHRESULT + 690); + +(* + * The data has expired and is therefore no longer valid. + *) + DDERR_EXPIRED = HResult(_MAKE_DDHRESULT + 691); + +(* + * The mode test has finished executing. + *) + DDERR_TESTFINISHED = HResult(_MAKE_DDHRESULT + 692); + +(* + * The mode test has switched to a new mode. + *) + DDERR_NEWMODE = HResult(_MAKE_DDHRESULT + 693); + +(* + * D3D has not yet been initialized. + *) + DDERR_D3DNOTINITIALIZED = HResult(_MAKE_DDHRESULT + 694); + +(* + * The video port is not active + *) + DDERR_VIDEONOTACTIVE = HResult(_MAKE_DDHRESULT + 695); + +(* + * The monitor does not have EDID data. + *) + DDERR_NOMONITORINFORMATION = HResult(_MAKE_DDHRESULT + 696); + +(* + * The driver does not enumerate display mode refresh rates. + *) + DDERR_NODRIVERSUPPORT = HResult(_MAKE_DDHRESULT + 697); + +(* + * Surfaces created by one direct draw device cannot be used directly by + * another direct draw device. + *) + DDERR_DEVICEDOESNTOWNSURFACE = HResult(_MAKE_DDHRESULT + 699); + + + +(* + * An attempt was made to invoke an interface member of a DirectDraw object + * created by CoCreateInstance() before it was initialized. + *) + DDERR_NOTINITIALIZED = CO_E_NOTINITIALIZED; + +(* Alpha bit depth constants *) + + + +(* + * API's + *) + +const + DirectDrawDll = 'ddraw.dll'; + +type + HMonitor = THandle; + + TDDEnumCallbackA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar; + lpDriverName: PAnsiChar; lpContext: Pointer): BOOL; stdcall; + TDDEnumCallbackW = function (lpGUID: PGUID; lpDriverDescription: PWideChar; + lpDriverName: PWideChar; lpContext: Pointer): BOOL; stdcall; + TDDEnumCallback = function (lpGUID: PGUID; lpDriverDescription: PChar; + lpDriverName: PChar; lpContext: Pointer): BOOL; stdcall; + + TDDEnumCallbackExA = function (lpGUID: PGUID; lpDriverDescription: PAnsiChar; + lpDriverName: PAnsiChar; lpContext: Pointer; Monitor: HMonitor): BOOL; + stdcall; + TDDEnumCallbackExW = function (lpGUID: PGUID; lpDriverDescription: PWideChar; + lpDriverName: PWideChar; lpContext: Pointer; Monitor: HMonitor): BOOL; + stdcall; + TDDEnumCallbackEx = function (lpGUID: PGUID; lpDriverDescription: PChar; + lpDriverName: PChar; lpContext: Pointer; Monitor: HMonitor): BOOL; + stdcall; + +function DirectDrawLoaded: Boolean; +function UnLoadDirectDraw: Boolean; +function LoadDirectDraw: Boolean; + +{$IFDEF DIRECTDRAW_DYNAMIC_LINK} +var + DirectDrawEnumerateA : function (lpCallback: TDDEnumCallbackA; + lpContext: Pointer): HResult; stdcall; + DirectDrawEnumerateW : function (lpCallback: TDDEnumCallbackW; + lpContext: Pointer): HResult; stdcall; + DirectDrawEnumerate : function (lpCallback: TDDEnumCallback; + lpContext: Pointer): HResult; stdcall; + + DirectDrawEnumerateExA : function (lpCallback: TDDEnumCallbackExA; + lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; + DirectDrawEnumerateExW : function (lpCallback: TDDEnumCallbackExW; + lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; + DirectDrawEnumerateEx : function (lpCallback: TDDEnumCallbackEx; + lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; + + DirectDrawCreate : function (lpGUID: PGUID; + out lplpDD: IDirectDraw; + pUnkOuter: IUnknown): HResult; stdcall; + DirectDrawCreateEx : function (lpGUID: PGUID; + out lplpDD: IDirectDraw7; const iid: TGUID; + pUnkOuter: IUnknown): HResult; stdcall; + DirectDrawCreateClipper : function (dwFlags: DWORD; + out lplpDDClipper: IDirectDrawClipper; + pUnkOuter: IUnknown): HResult; stdcall; +{$ELSE} + +function DirectDrawEnumerateA(lpCallback: TDDEnumCallbackA; lpContext: Pointer): HResult; stdcall; external DirectDrawDll; +function DirectDrawEnumerateW(lpCallback: TDDEnumCallbackW; lpContext: Pointer): HResult; stdcall; external DirectDrawDll; +function DirectDrawEnumerate(lpCallback: TDDEnumCallback; lpContext: Pointer): HResult; stdcall; + external DirectDrawDll name {$IFDEF UNICODE}'DirectDrawEnumerateW'{$ELSE}'DirectDrawEnumerateA'{$ENDIF}; + +function DirectDrawEnumerateExA(lpCallback: TDDEnumCallbackExA; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; external DirectDrawDll; +function DirectDrawEnumerateExW(lpCallback: TDDEnumCallbackExW; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; external DirectDrawDll; +function DirectDrawEnumerateEx(lpCallback: TDDEnumCallbackEx; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall; + external DirectDrawDll name {$IFDEF UNICODE}'DirectDrawEnumerateExW'{$ELSE}'DirectDrawEnumerateExA'{$ENDIF}; + +function DirectDrawCreate(lpGUID: PGUID; out lplpDD: IDirectDraw; + pUnkOuter: IUnknown): HResult; stdcall; external DirectDrawDll; + +function DirectDrawCreateEx(lpGUID: PGUID; out lplpDD: IDirectDraw7; + const iid: TGUID; pUnkOuter: IUnknown): HResult; stdcall; external DirectDrawDll; + +function DirectDrawCreateClipper(dwFlags: DWORD; out lplpDDClipper: IDirectDrawClipper; + pUnkOuter: IUnknown): HResult; stdcall; external DirectDrawDll; + +{$ENDIF} + +const +(* + * Flags for DirectDrawEnumerateEx + * DirectDrawEnumerateEx supercedes DirectDrawEnumerate. You must use GetProcAddress to + * obtain a function pointer (of type LPDIRECTDRAWENUMERATEEX) to DirectDrawEnumerateEx. + * By default, only the primary display device is enumerated. + * DirectDrawEnumerate is equivalent to DirectDrawEnumerate(,,DDENUM_NONDISPLAYDEVICES) + *) + +(* + * this flag causes enumeration of any gdi display devices which are part of + * the windows desktop + *) + ddenum_attachedsecondarydevices = $00000001; + +(* + * this flag causes enumeration of any gdi display devices which are not + * part of the windows desktop + *) + ddenum_detachedsecondarydevices = $00000002; + +(* + * this flag causes enumeration of non-display devices + *) + ddenum_nondisplaydevices = $00000004; + + + REGSTR_KEY_DDHW_DESCRIPTION = 'Description'; + REGSTR_KEY_DDHW_DRIVERNAME = 'DriverName'; + REGSTR_PATH_DDHW = 'Hardware\DirectDrawDrivers'; + + DDCREATE_HARDWAREONLY = $00000001; + DDCREATE_EMULATIONONLY = $00000002; + +(* + * Flags for the IDirectDraw4::GetDeviceIdentifier method + *) + +(* + * this flag causes getdeviceidentifier to return information about the host (typically 2d) adapter in a system equipped + * with a stacked secondary 3d adapter. such an adapter appears to the application as if it were part of the + * host adapter, but is typically physcially located on a separate card. the stacked secondary's information is + * returned when getdeviceidentifier's dwflags field is zero, since this most accurately reflects the qualities + * of the directdraw object involved. + *) + ddgdi_gethostidentifier = $00000001; + +(* + * Macros for interpretting DDEVICEIDENTIFIER2.dwWHQLLevel + *) +function GET_WHQL_YEAR(dwWHQLLevel: DWORD): DWORD; +function GET_WHQL_MONTH(dwWHQLLevel: DWORD): DWORD; +function GET_WHQL_DAY(dwWHQLLevel: DWORD): DWORD; + + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: dvp.h + * Content: DirectDrawVideoPort include file + * + ***************************************************************************) + +const +(* + * GUIDS used by DirectDrawVideoPort objects + *) + +(* + IID_IDDVideoPortContainer, + IID_IDirectDrawVideoPort, + IID_IDirectDrawVideoPortNotify + - are defined later in Delphi header +*) + + DDVPTYPE_E_HREFH_VREFH: TGUID = (D1:$54F39980;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + DDVPTYPE_E_HREFH_VREFL: TGUID = (D1:$92783220;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + DDVPTYPE_E_HREFL_VREFH: TGUID = (D1:$A07A02E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + DDVPTYPE_E_HREFL_VREFL: TGUID = (D1:$E09C77E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + DDVPTYPE_CCIR656: TGUID = (D1:$FCA326A0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + DDVPTYPE_BROOKTREE: TGUID = (D1:$1352A560;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + DDVPTYPE_PHILIPS: TGUID = (D1:$332CF160;D2:$DA61;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + + +(* + * These definitions are required to allow polymorphic structure members (i.e. those + * that are referred to both as DWORDs and as pointers) to resolve into a type + * of correct size to hold the largest of those two types (i.e. pointer) on 64 bit + * systems. For 32 bit environments, ULONG_PTR resolves to a DWORD. + *) +type + ULONG_PTR = DWORD; + +(*============================================================================ + * + * DirectDraw Structures + * + * Various structures used to invoke DirectDraw. + * + *==========================================================================*) + +type + +(* + * DDVIDEOPORTCONNECT + *) + PDDVideoPortConnect = ^TDDVideoPortConnect; + _DDVIDEOPORTCONNECT = packed record + dwSize: DWORD; // size of the TDDVideoPortConnect structure + dwPortWidth: DWORD; // Width of the video port + guidTypeID: TGUID; // Description of video port connection + dwFlags: DWORD; // Connection flags + dwReserved1: ULONG_PTR; // Reserved, set to zero. + end; + DDVIDEOPORTCONNECT = _DDVIDEOPORTCONNECT; + TDDVideoPortConnect = _DDVIDEOPORTCONNECT; + +(* + * DDVIDEOPORTCAPS + *) + PDDVideoPortCaps = ^TDDVideoPortCaps; + _DDVIDEOPORTCAPS = packed record + dwSize: DWORD; // size of the TDDVideoPortCaps structure + dwFlags: DWORD; // indicates which fields contain data + dwMaxWidth: DWORD; // max width of the video port field + dwMaxVBIWidth: DWORD; // max width of the VBI data + dwMaxHeight: DWORD; // max height of the video port field + dwVideoPortID: DWORD; // Video port ID (0 - (dwMaxVideoPorts -1)) + dwCaps: DWORD; // Video port capabilities + dwFX: DWORD; // More video port capabilities + dwNumAutoFlipSurfaces: DWORD; // Number of autoflippable surfaces + dwAlignVideoPortBoundary: DWORD; // Byte restriction of placement within the surface + dwAlignVideoPortPrescaleWidth: DWORD; // Byte restriction of width after prescaling + dwAlignVideoPortCropBoundary: DWORD; // Byte restriction of left cropping + dwAlignVideoPortCropWidth: DWORD; // Byte restriction of cropping width + dwPreshrinkXStep: DWORD; // Width can be shrunk in steps of 1/x + dwPreshrinkYStep: DWORD; // Height can be shrunk in steps of 1/x + dwNumVBIAutoFlipSurfaces: DWORD; // Number of VBI autoflippable surfaces allowed + dwNumPreferredAutoflip: DWORD; // Optimal number of autoflippable surfaces for hardware + wnumfiltertapsx: word; // number of taps the prescaler uses in the x direction (0 - no prescale, 1 - replication, etc.) + wnumfiltertapsy: word; // number of taps the prescaler uses in the y direction (0 - no prescale, 1 - replication, etc.) + end; + ddvideoportcaps = _ddvideoportcaps; + tddvideoportcaps = _ddvideoportcaps; + +const +(* + * The dwMaxWidth and dwMaxVBIWidth members are valid + *) + DDVPD_WIDTH = $00000001; + +(* + * The dwMaxHeight member is valid + *) + DDVPD_HEIGHT = $00000002; + +(* + * The dwVideoPortID member is valid + *) + DDVPD_ID = $00000004; + +(* + * The dwCaps member is valid + *) + DDVPD_CAPS = $00000008; + +(* + * The dwFX member is valid + *) + DDVPD_FX = $00000010; + +(* + * The dwNumAutoFlipSurfaces member is valid + *) + DDVPD_AUTOFLIP = $00000020; + +(* + * All of the alignment members are valid + *) + DDVPD_ALIGN = $00000040; + +(* + * The dwNumPreferredAutoflip member is valid + *) + DDVPD_PREFERREDAUTOFLIP = $00000080; + +(* + * The wNumFilterTapsX and wNumFilterTapsY fields are valid + *) + DDVPD_FILTERQUALITY = $00000100; + +type +(* + * DDVIDEOPORTDESC + *) + PDDVideoPortDesc = ^TDDVideoPortDesc; + _DDVIDEOPORTDESC = packed record + dwSize: DWORD; // size of the TDDVideoPortDesc structure + dwFieldWidth: DWORD; // width of the video port field + dwVBIWidth: DWORD; // width of the VBI data + dwFieldHeight: DWORD; // height of the video port field + dwMicrosecondsPerField: DWORD; // Microseconds per video field + dwMaxPixelsPerSecond: DWORD; // Maximum pixel rate per second + dwVideoPortID: DWORD; // Video port ID (0 - (dwMaxVideoPorts -1)) + dwReserved1: DWORD; // Reserved for future use - set to zero (struct padding) + VideoPortType: TDDVideoPortConnect; // Description of video port connection + dwReserved2: DWORD; // Reserved for future use - set to zero + dwReserved3: DWORD; // Reserved for future use - set to zero + end; + DDVIDEOPORTDESC = _DDVIDEOPORTDESC; + TDDVideoPortDesc = _DDVIDEOPORTDESC; + +(* + * DDVIDEOPORTINFO + *) + PDDVideoPortInfo = ^TDDVideoPortInfo; + _DDVIDEOPORTINFO = packed record + dwSize: DWORD; // Size of the structure + dwOriginX: DWORD; // Placement of the video data within the surface. + dwOriginY: DWORD; // Placement of the video data within the surface. + dwVPFlags: DWORD; // Video port options + rCrop: TRect; // Cropping rectangle (optional). + dwPrescaleWidth: DWORD; // Determines pre-scaling/zooming in the X direction (optional). + dwPrescaleHeight: DWORD; // Determines pre-scaling/zooming in the Y direction (optional). + lpddpfInputFormat: PDDPixelFormat; // Video format written to the video port + lpddpfVBIInputFormat: PDDPixelFormat; // Input format of the VBI data + lpddpfVBIOutputFormat: PDDPixelFormat; // Output format of the data + dwVBIHeight: DWORD; // Specifies the number of lines of data within the vertical blanking interval. + dwReserved1: DWORD; // Reserved for future use - set to zero + dwReserved2: DWORD; // Reserved for future use - set to zero + end; + DDVIDEOPORTINFO = _DDVIDEOPORTINFO; + TDDVideoPortInfo = _DDVIDEOPORTINFO; + +(* + * DDVIDEOPORTBANDWIDTH + *) + PDDVideoPortBandWidth = ^TDDVideoPortBandWidth; + _DDVIDEOPORTBANDWIDTH = packed record + dwSize: DWORD; // Size of the structure + dwCaps: DWORD; + dwOverlay: DWORD; // Zoom factor at which overlay is supported + dwColorkey: DWORD; // Zoom factor at which overlay w/ colorkey is supported + dwYInterpolate: DWORD; // Zoom factor at which overlay w/ Y interpolation is supported + dwYInterpAndColorkey: DWORD; // Zoom factor at which ovelray w/ Y interpolation and colorkeying is supported + dwReserved1: DWORD; // Reserved for future use - set to zero + dwReserved2: DWORD; // Reserved for future use - set to zero + end; + DDVIDEOPORTBANDWIDTH = _DDVIDEOPORTBANDWIDTH; + TDDVideoPortBandWidth = _DDVIDEOPORTBANDWIDTH; + +(* + * DDVIDEOPORTSTATUS + *) + PDDVideoPortStatus = ^TDDVideoPortStatus; + _DDVIDEOPORTSTATUS = record + dwSize: DWORD; // Size of the structure + bInUse: BOOL; // TRUE if video port is currently being used + dwFlags: DWORD; // Currently not used + dwReserved1: DWORD; // Reserved for future use + VideoPortType: TDDVideoPortConnect; // Information about the connection + dwReserved2: DWORD; // Reserved for future use + dwReserved3: DWORD; // Reserved for future use + end; + DDVIDEOPORTSTATUS = _DDVIDEOPORTSTATUS; + TDDVideoPortStatus = _DDVIDEOPORTSTATUS; + +(* + * DDVIDEOPORTNOTIFY + *) + PDDVideoPortNotify = ^TDDVideoPortNotify; + _DDVIDEOPORTNOTIFY = packed record + ApproximateTimeStamp: Int64; // Timestamp in the event notification + lField: Longint; // 0 if even, 1 if odd, -1 if unknown + dwSurfaceIndex: Longword; // Index in the surface chain of the surface that received the sample + lDone: Longint; // Call InterlockedIncrement on this when done with sample + end; + DDVIDEOPORTNOTIFY = _DDVIDEOPORTNOTIFY; + TDDVideoPortNotify = _DDVIDEOPORTNOTIFY; + + +(*============================================================================ + * + * Video Port Flags + * + * All flags are bit flags. + * + *==========================================================================*) +const +(**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTCONNECT / TDDVideoPortConnect FLAGS + * + ****************************************************************************) + +(* + * When this is set by the driver and passed to the client, this + * indicates that the video port is capable of double clocking the data. + * When this is set by the client, this indicates that the video port + * should enable double clocking. This flag is only valid with external + * syncs. + *) + DDVPCONNECT_DOUBLECLOCK = $00000001; + +(* + * When this is set by the driver and passed to the client, this + * indicates that the video port is capable of using an external VACT + * signal. When this is set by the client, this indicates that the + * video port should use the external VACT signal. + *) + DDVPCONNECT_VACT = $00000002; + +(* + * When this is set by the driver and passed to the client, this + * indicates that the video port is capable of treating even fields + * like odd fields and visa versa. When this is set by the client, + * this indicates that the video port should treat even fields like odd + * fields. + *) + DDVPCONNECT_INVERTPOLARITY = $00000004; + +(* + * Indicates that any data written to the video port during the VREF + * period will not be written into the frame buffer. This flag is read only. + *) + DDVPCONNECT_DISCARDSVREFDATA = $00000008; + +(* + * When this is set be the driver and passed to the client, this + * indicates that the device will write half lines into the frame buffer + * if half lines are provided by the decoder. If this is set by the client, + * this indicates that the decoder will be supplying half lines. + *) + DDVPCONNECT_HALFLINE = $00000010; + +(* + * Indicates that the signal is interlaced. This flag is only + * set by the client. + *) + DDVPCONNECT_INTERLACED = $00000020; + +(* + * Indicates that video port is shareable and that this video port + * will use the even fields. This flag is only set by the client. + *) + DDVPCONNECT_SHAREEVEN = $00000040; + +(* + * Indicates that video port is shareable and that this video port + * will use the odd fields. This flag is only set by the client. + *) + DDVPCONNECT_SHAREODD = $00000080; + +(**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTDESC / TDDVideoPortDesc CAPS + * + ****************************************************************************) + +(* + * Flip can be performed automatically to avoid tearing. + *) + DDVPCAPS_AUTOFLIP = $00000001; + +(* + * Supports interlaced video + *) + DDVPCAPS_INTERLACED = $00000002; + +(* + * Supports non-interlaced video + *) + DDVPCAPS_NONINTERLACED = $00000004; + +(* + * Indicates that the device can return whether the current field + * of an interlaced signal is even or odd. + *) + DDVPCAPS_READBACKFIELD = $00000008; + +(* + * Indicates that the device can return the current line of video + * being written into the frame buffer. + *) + DDVPCAPS_READBACKLINE = $00000010; + +(* + * Allows two gen-locked video streams to share a single video port, + * where one stream uses the even fields and the other uses the odd + * fields. separate parameters (including address, scaling, + * cropping, etc.) are maintained for both fields.) + *) + ddvpcaps_shareable = $00000020; + +(* + * Even fields of video can be automatically discarded. + *) + DDVPCAPS_SKIPEVENFIELDS = $00000040; + +(* + * Odd fields of video can be automatically discarded. + *) + DDVPCAPS_SKIPODDFIELDS = $00000080; + +(* + * Indicates that the device is capable of driving the graphics + * VSYNC with the video port VSYNC. + *) + DDVPCAPS_SYNCMASTER = $00000100; + +(* + * Indicates that data within the vertical blanking interval can + * be written to a different surface. + *) + DDVPCAPS_VBISURFACE = $00000200; + +(* + * Indicates that the video port can perform color operations + * on the incoming data before it is written to the frame buffer. + *) + DDVPCAPS_COLORCONTROL = $00000400; + +(* + * Indicates that the video port can accept VBI data in a different + * width or format than the regular video data. + *) + DDVPCAPS_OVERSAMPLEDVBI = $00000800; + +(* + * Indicates that the video port can write data directly to system memory + *) + DDVPCAPS_SYSTEMMEMORY = $00001000; + +(* + * Indicates that the VBI and video portions of the video stream can + * be controlled by an independent processes. + *) + DDVPCAPS_VBIANDVIDEOINDEPENDENT = $00002000; + +(* + * Indicates that the video port contains high quality hardware + * de-interlacing hardware that should be used instead of the + * bob/weave algorithms. + *) + DDVPCAPS_HARDWAREDEINTERLACE = $00004000; + + +(**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTDESC / TDDVideoPortDesc FX + * + ****************************************************************************) + +(* + * Limited cropping is available to crop out the vertical interval data. + *) + DDVPFX_CROPTOPDATA = $00000001; + +(* + * Incoming data can be cropped in the X direction before it is written + * to the surface. + *) + DDVPFX_CROPX = $00000002; + +(* + * Incoming data can be cropped in the Y direction before it is written + * to the surface. + *) + DDVPFX_CROPY = $00000004; + +(* + * Supports interleaving interlaced fields in memory. + *) + DDVPFX_INTERLEAVE = $00000008; + +(* + * Supports mirroring left to right as the video data is written + * into the frame buffer. + *) + DDVPFX_MIRRORLEFTRIGHT = $00000010; + +(* + * Supports mirroring top to bottom as the video data is written + * into the frame buffer. + *) + DDVPFX_MIRRORUPDOWN = $00000020; + +(* + * Data can be arbitrarily shrunk in the X direction before it + * is written to the surface. + *) + DDVPFX_PRESHRINKX = $00000040; + +(* + * Data can be arbitrarily shrunk in the Y direction before it + * is written to the surface. + *) + DDVPFX_PRESHRINKY = $00000080; + +(* + * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the X + * direction before it is written to the surface. + *) + DDVPFX_PRESHRINKXB = $00000100; + +(* + * Data can be binary shrunk (1/2, 1/4, 1/8, etc.) in the Y + * direction before it is written to the surface. + *) + DDVPFX_PRESHRINKYB = $00000200; + +(* + * Data can be shrunk in increments of 1/x in the X direction + * (where X is specified in the TDDVideoPortCaps.dwPreshrinkXStep) + * before it is written to the surface. + *) + DDVPFX_PRESHRINKXS = $00000400; + +(* + * Data can be shrunk in increments of 1/x in the Y direction + * (where X is specified in the TDDVideoPortCaps.dwPreshrinkYStep) + * before it is written to the surface. + *) + DDVPFX_PRESHRINKYS = $00000800; + +(* + * Data can be arbitrarily stretched in the X direction before + * it is written to the surface. + *) + DDVPFX_PRESTRETCHX = $00001000; + +(* + * Data can be arbitrarily stretched in the Y direction before + * it is written to the surface. + *) + DDVPFX_PRESTRETCHY = $00002000; + +(* + * Data can be integer stretched in the X direction before it is + * written to the surface. + *) + DDVPFX_PRESTRETCHXN = $00004000; + +(* + * Data can be integer stretched in the Y direction before it is + * written to the surface. + *) + DDVPFX_PRESTRETCHYN = $00008000; + +(* + * Indicates that data within the vertical blanking interval can + * be converted independently of the remaining video data. + *) + DDVPFX_VBICONVERT = $00010000; + +(* + * Indicates that scaling can be disabled for data within the + * vertical blanking interval. + *) + DDVPFX_VBINOSCALE = $00020000; + +(* + * Indicates that the video data can ignore the left and right + * cropping coordinates when cropping oversampled VBI data. + *) + DDVPFX_IGNOREVBIXCROP = $00040000; + +(* + * Indicates that interleaving can be disabled for data within the + * vertical blanking interval. + *) + DDVPFX_VBINOINTERLEAVE = $00080000; + + +(**************************************************************************** + * + * VIDEOPORT DDVIDEOPORTINFO / TDDVideoPortInfo FLAGS + * + ****************************************************************************) + +(* + * Perform automatic flipping. Auto-flipping is performed between + * the overlay surface that was attached to the video port using + * IDirectDrawVideoPort::AttachSurface and the overlay surfaces that + * are attached to the surface via the IDirectDrawSurface::AttachSurface + * method. The flip order is the order in which the overlay surfaces + * were. attached. + *) + DDVP_AUTOFLIP = $00000001; + +(* + * Perform conversion using the ddpfOutputFormat information. + *) + DDVP_CONVERT = $00000002; + +(* + * Perform cropping using the specified rectangle. + *) + DDVP_CROP = $00000004; + +(* + * Indicates that interlaced fields should be interleaved in memory. + *) + DDVP_INTERLEAVE = $00000008; + +(* + * Indicates that the data should be mirrored left to right as it's + * written into the frame buffer. + *) + DDVP_MIRRORLEFTRIGHT = $00000010; + +(* + * Indicates that the data should be mirrored top to bottom as it's + * written into the frame buffer. + *) + DDVP_MIRRORUPDOWN = $00000020; + +(* + * Perform pre-scaling/zooming based on the pre-scale parameters. + *) + DDVP_PRESCALE = $00000040; + +(* + * Ignore input of even fields. + *) + DDVP_SKIPEVENFIELDS = $00000080; + +(* + * Ignore input of odd fields. + *) + DDVP_SKIPODDFIELDS = $00000100; + +(* + * Drive the graphics VSYNCs using the video port VYSNCs. + *) + DDVP_SYNCMASTER = $00000200; + +(* + * The ddpfVBIOutputFormatFormat member contains data that should be used + * to convert the data within the vertical blanking interval. + *) + DDVP_VBICONVERT = $00000400; + +(* + * Indicates that data within the vertical blanking interval + * should not be scaled. + *) + DDVP_VBINOSCALE = $00000800; + +(* + * Indicates that these bob/weave decisions should not be + * overriden by other interfaces. + *) + DDVP_OVERRIDEBOBWEAVE = $00001000; + +(* + * Indicates that the video data should ignore the left and right + * cropping coordinates when cropping the VBI data. + *) + DDVP_IGNOREVBIXCROP = $00002000; + +(* + * Indicates that interleaving can be disabled for data within the + * vertical blanking interval. + *) + DDVP_VBINOINTERLEAVE = $00004000; + +(* + * Indicates that the video port should use the hardware + * de-interlacing hardware. + *) + DDVP_HARDWAREDEINTERLACE = $00008000; + +(**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT GETINPUTFORMAT/GETOUTPUTFORMAT FLAGS + * + ****************************************************************************) + +(* + * Return formats for the video data + *) + DDVPFORMAT_VIDEO = $00000001; + +(* + * Return formats for the VBI data + *) + DDVPFORMAT_VBI = $00000002; + +(**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT SETTARGETSURFACE FLAGS + * + ****************************************************************************) + +(* + * Surface should receive video data (and VBI data if a surface + * is not explicitly attached for that purpose) + *) + DDVPTARGET_VIDEO = $00000001; + +(* + * Surface should receive VBI data + *) + DDVPTARGET_VBI = $00000002; + + +(**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT WAITFORSYNC FLAGS + * + ****************************************************************************) + +(* + * Waits until the beginning of the next VSYNC + *) + DDVPWAIT_BEGIN = $00000001; + +(* + * Waits until the end of the next/current VSYNC + *) + DDVPWAIT_END = $00000002; + +(* + * Waits until the beginning of the specified line + *) + DDVPWAIT_LINE = $00000003; + +(**************************************************************************** + * + * DIRECTDRAWVIDEOPORT FLIP FLAGS + * + ****************************************************************************) + +(* + * Flips the normal video surface + *) + DDVPFLIP_VIDEO = $00000001; + +(* + * Flips the VBI surface + *) + DDVPFLIP_VBI = $00000002; + +(**************************************************************************** + * + * DIRIRECTDRAWVIDEOPORT GETVIDEOSIGNALSTATUS VALUES + * + ****************************************************************************) + +(* + * No video signal is present at the video port + *) + DDVPSQ_NOSIGNAL = $00000001; + +(* + * A valid video signal is present at the video port + *) + DDVPSQ_SIGNALOK = $00000002; + +(**************************************************************************** + * + * VIDEOPORTBANDWIDTH Flags + * + ****************************************************************************) + +(* + * The specified height/width refer to the size of the video port data + * written into memory, after prescaling has occured. + *) + DDVPB_VIDEOPORT = $00000001; + +(* + * The specified height/width refer to the source size of the overlay. + *) + DDVPB_OVERLAY = $00000002; + +(* + * This is a query for the device to return which caps this device requires. + *) + DDVPB_TYPE = $00000004; + +(**************************************************************************** + * + * VIDEOPORTBANDWIDTH Caps + * + ****************************************************************************) + +(* + * The bandwidth for this device is dependant on the overlay source size. + *) + DDVPBCAPS_SOURCE = $00000001; + +(* + * The bandwidth for this device is dependant on the overlay destination + * size. + *) + DDVPBCAPS_DESTINATION = $00000002; + +(**************************************************************************** + * + * DDVIDEOPORTCONTAINER CreateVideoPort flags + * + ****************************************************************************) + +(* + * The process only wants to control the VBI portion of the video stream. + *) + DDVPCREATE_VBIONLY = $00000001; + +(* + * The process only wants to control the non-VBI (video) portion of + * the video stream. + *) + DDVPCREATE_VIDEOONLY = $00000002; + +(**************************************************************************** + * + * DDVIDEOPORTSTATUS flags + * + ****************************************************************************) + +(* + * The video port interface is only controlling the VBI portion of the + * video stream + *) + DDVPSTATUS_VBIONLY = $00000001; + +(* + * The video port interface is only controlling the video portion of the + * video stream + *) + DDVPSTATUS_VIDEOONLY = $00000002; + + +type +(* + * API's + *) + + TDDEnumVideoCallback = function (lpTDDVideoPortCaps: PDDVideoPortCaps; + lpContext: Pointer): HResult; stdcall; + +(* + * INTERACES FOLLOW: + * IDirectDrawVideoPort + * IVideoPort + *) + IDirectDrawVideoPort = interface; + +(* + * IDirectDrawVideoPortContainer + *) + IDDVideoPortContainer = interface(IUnknown) + ['{6C142760-A733-11CE-A521-0020AF0BE560}'] + (*** IDDVideoPortContainer methods ***) + function CreateVideoPort(dwFlags: DWORD; var lpTDDVideoPortDesc: + TDDVideoPortDesc; var lplpDDVideoPort: IDirectDrawVideoPort; + pUnkOuter: IUnknown): HResult; stdcall; + function EnumVideoPorts(dwFlags: DWORD; + lpTDDVideoPortCaps: PDDVideoPortCaps; lpContext: Pointer; + lpEnumVideoCallback: TDDEnumVideoCallback): HResult; stdcall; + function GetVideoPortConnectInfo(dwPortId: DWORD; var lpNumEntries: DWORD; + lpConnectInfo: PDDVideoPortConnect): HResult; stdcall; + function QueryVideoPortStatus(dwPortId: DWORD; + var lpVPStatus: TDDVideoPortStatus): HResult; stdcall; + end; + +(* + * IDirectDrawVideoPort + *) + IDirectDrawVideoPort = interface(IUnknown) + ['{B36D93E0-2B43-11CF-A2DE-00AA00B93356}'] + (*** IDirectDrawVideoPort methods ***) + function Flip(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD): HResult; stdcall; + function GetBandwidthInfo(var lpddpfFormat: TDDPixelFormat; + dwWidth: DWORD; dwHeight: DWORD; dwFlags: DWORD; + var lpBandwidth: TDDVideoPortBandWidth): HResult; stdcall; + function GetColorControls(var lpColorControl: TDDColorControl): HResult; stdcall; + function GetInputFormats(var lpNumFormats: DWORD; var lpFormats: + TDDPixelFormat; dwFlags: DWORD): HResult; stdcall; + function GetOutputFormats(var lpInputFormat: TDDPixelFormat; + var lpNumFormats: DWORD; lpFormats: PDDPixelFormat; dwFlags: DWORD): + HResult; stdcall; + function GetFieldPolarity(var lpbVideoField: BOOL): HResult; stdcall; + function GetVideoLine(var lpdwLine: DWORD): HResult; stdcall; + function GetVideoSignalStatus(varlpdwStatus: DWORD): HResult; stdcall; + function SetColorControls(var lpColorControl: TDDColorControl): HResult; stdcall; + function SetTargetSurface(lpDDSurface: IDirectDrawSurface; dwFlags: DWORD): + HResult; stdcall; + function StartVideo(var lpVideoInfo: TDDVideoPortInfo): HResult; stdcall; + function StopVideo: HResult; stdcall; + function UpdateVideo(var lpVideoInfo: TDDVideoPortInfo): HResult; stdcall; + function WaitForSync(dwFlags: DWORD; dwLine: DWORD; dwTimeout: DWORD): + HResult; stdcall; + end; + + IID_IDDVideoPortContainer = IDDVideoPortContainer; + IID_IDirectDrawVideoPort = IDirectDrawVideoPort; + +(* + * IDirectDrawVideoPort + *) + IDirectDrawVideoPortNotify = interface(IUnknown) + ['{6C142760-A733-11CE-A521-0020AF0BE560}'] + (*** IVideoPort methods ***) + function AcquireNotification(hEvent: THandle; const params: TDDVideoPortNotify): HResult; stdcall; + function ReleaseNotification(hEvent: THandle): HResult; stdcall; + end; + + +function DDErrorString(Value: HResult): String; + +implementation + +//#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) +function MAKE_DDHRESULT(Code: DWORD): HResult; +begin + Result:= MakeResult(1, _FACDD, code); +end; + +//#define GET_WHQL_YEAR( dwWHQLLevel ) \ +// ( (dwWHQLLevel) / 0x10000 ) +function GET_WHQL_YEAR(dwWHQLLevel: DWORD): DWORD; +begin + Result := (dwWHQLLevel) div $10000; +end; + +//#define GET_WHQL_MONTH( dwWHQLLevel ) \ +// ( ( (dwWHQLLevel) / 0x100 ) & 0x00ff ) +function GET_WHQL_MONTH(dwWHQLLevel: DWORD): DWORD; +begin + Result := ((dwWHQLLevel) div $100) and $00ff; +end; + +//#define GET_WHQL_DAY( dwWHQLLevel ) \ +// ( (dwWHQLLevel) & 0xff ) +function GET_WHQL_DAY(dwWHQLLevel: DWORD): DWORD; +begin + Result := (dwWHQLLevel) and $ff; +end; + + +function MAKEFOURCC(ch0, ch1, ch2, ch3: Char): DWORD; +begin + Result := DWORD(Byte(ch0) shl 0) or + DWORD(Byte(ch1) shl 8) or + DWORD(Byte(ch2) shl 16) or + DWORD(Byte(ch3) shl 24); +end; + +function DDErrorString(Value: HResult): String; +begin + case Value of + DD_OK: Result := 'The request completed successfully.'; + DDERR_ALREADYINITIALIZED: Result := 'This object is already initialized.'; + DDERR_BLTFASTCANTCLIP: Result := ' if a clipper object is attached to the source surface passed into a BltFast call.'; + DDERR_CANNOTATTACHSURFACE: Result := 'This surface can not be attached to the requested surface.'; + DDERR_CANNOTDETACHSURFACE: Result := 'This surface can not be detached from the requested surface.'; + DDERR_CANTCREATEDC: Result := 'Windows can not create any more DCs.'; + DDERR_CANTDUPLICATE: Result := 'Cannot duplicate primary & 3D surfaces, or surfaces that are implicitly created.'; + DDERR_CLIPPERISUSINGHWND: Result := 'An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd.'; + DDERR_COLORKEYNOTSET: Result := 'No src color key specified for this operation.'; + DDERR_CURRENTLYNOTAVAIL: Result := 'Support is currently not available.'; + DDERR_DIRECTDRAWALREADYCREATED: Result := 'A DirectDraw object representing this driver has already been created for this process.'; + DDERR_EXCEPTION: Result := 'An exception was encountered while performing the requested operation.'; + DDERR_EXCLUSIVEMODEALREADYSET: Result := 'An attempt was made to set the cooperative level when it was already set to exclusive.'; + DDERR_GENERIC: Result := 'Generic failure.'; + DDERR_HEIGHTALIGN: Result := 'Height of rectangle provided is not a multiple of reqd alignment.'; + DDERR_HWNDALREADYSET: Result := 'The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or palettes created.'; + DDERR_HWNDSUBCLASSED: Result := 'HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring state.'; + DDERR_IMPLICITLYCREATED: Result := 'This surface can not be restored because it is an implicitly created surface.'; + DDERR_INCOMPATIBLEPRIMARY: Result := 'Unable to match primary surface creation request with existing primary surface.'; + DDERR_INVALIDCAPS: Result := 'One or more of the caps bits passed to the callback are incorrect.'; + DDERR_INVALIDCLIPLIST: Result := 'DirectDraw does not support the provided cliplist.'; + DDERR_INVALIDDIRECTDRAWGUID: Result := 'The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier.'; + DDERR_INVALIDMODE: Result := 'DirectDraw does not support the requested mode.'; + DDERR_INVALIDOBJECT: Result := 'DirectDraw received a pointer that was an invalid DIRECTDRAW object.'; + DDERR_INVALIDPARAMS: Result := 'One or more of the parameters passed to the function are incorrect.'; + DDERR_INVALIDPIXELFORMAT: Result := 'The pixel format was invalid as specified.'; + DDERR_INVALIDPOSITION: Result := 'Returned when the position of the overlay on the destination is no longer legal for that destination.'; + DDERR_INVALIDRECT: Result := 'Rectangle provided was invalid.'; + DDERR_LOCKEDSURFACES: Result := 'Operation could not be carried out because one or more surfaces are locked.'; + DDERR_NO3D: Result := 'There is no 3D present.'; + DDERR_NOALPHAHW: Result := 'Operation could not be carried out because there is no alpha accleration hardware present or available.'; + DDERR_NOBLTHW: Result := 'No blitter hardware present.'; + DDERR_NOCLIPLIST: Result := 'No cliplist available.'; + DDERR_NOCLIPPERATTACHED: Result := 'No clipper object attached to surface object.'; + DDERR_NOCOLORCONVHW: Result := 'Operation could not be carried out because there is no color conversion hardware present or available.'; + DDERR_NOCOLORKEY: Result := 'Surface does not currently have a color key'; + DDERR_NOCOLORKEYHW: Result := 'Operation could not be carried out because there is no hardware support of the destination color key.'; + DDERR_NOCOOPERATIVELEVELSET: Result := 'Create function called without DirectDraw object method SetCooperativeLevel being called.'; + DDERR_NODC: Result := 'No DC was ever created for this surface.'; + DDERR_NODDROPSHW: Result := 'No DirectDraw ROP hardware.'; + DDERR_NODIRECTDRAWHW: Result := 'A hardware-only DirectDraw object creation was attempted but the driver did not support any hardware.'; + DDERR_NOEMULATION: Result := 'Software emulation not available.'; + DDERR_NOEXCLUSIVEMODE: Result := 'Operation requires the application to have exclusive mode but the application does not have exclusive mode.'; + DDERR_NOFLIPHW: Result := 'Flipping visible surfaces is not supported.'; + DDERR_NOGDI: Result := 'There is no GDI present.'; + DDERR_NOHWND: Result := 'Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel HWND.'; + DDERR_NOMIRRORHW: Result := 'Operation could not be carried out because there is no hardware present or available.'; + DDERR_NOOVERLAYDEST: Result := 'Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on to establish a destination.'; + DDERR_NOOVERLAYHW: Result := 'Operation could not be carried out because there is no overlay hardware present or available.'; + DDERR_NOPALETTEATTACHED: Result := 'No palette object attached to this surface.'; + DDERR_NOPALETTEHW: Result := 'No hardware support for 16 or 256 color palettes.'; + DDERR_NORASTEROPHW: Result := 'Operation could not be carried out because there is no appropriate raster op hardware present or available.'; + DDERR_NOROTATIONHW: Result := 'Operation could not be carried out because there is no rotation hardware present or available.'; + DDERR_NOSTRETCHHW: Result := 'Operation could not be carried out because there is no hardware support for stretching.'; + DDERR_NOT4BITCOLOR: Result := 'DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color palette.'; + DDERR_NOT4BITCOLORINDEX: Result := 'DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color index palette.'; + DDERR_NOT8BITCOLOR: Result := 'DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color.'; + DDERR_NOTAOVERLAYSURFACE: Result := 'Returned when an overlay member is called for a non-overlay surface.'; + DDERR_NOTEXTUREHW: Result := 'Operation could not be carried out because there is no texture mapping hardware present or available.'; + DDERR_NOTFLIPPABLE: Result := 'An attempt has been made to flip a surface that is not flippable.'; + DDERR_NOTFOUND: Result := 'Requested item was not found.'; + DDERR_NOTLOCKED: Result := 'Surface was not locked. An attempt to unlock a surface that was not locked at all, or by this process, has been attempted.'; + DDERR_NOTPALETTIZED: Result := 'The surface being used is not a palette-based surface.'; + DDERR_NOVSYNCHW: Result := 'Operation could not be carried out because there is no hardware support for vertical blank synchronized operations.'; + DDERR_NOZBUFFERHW: Result := 'Operation could not be carried out because there is no hardware support for zbuffer blitting.'; + DDERR_NOZOVERLAYHW: Result := 'Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support z layering of overlays.'; + DDERR_OUTOFCAPS: Result := 'The hardware needed for the requested operation has already been allocated.'; + DDERR_OUTOFMEMORY: Result := 'DirectDraw does not have enough memory to perform the operation.'; + DDERR_OUTOFVIDEOMEMORY: Result := 'DirectDraw does not have enough memory to perform the operation.'; + DDERR_OVERLAYCANTCLIP: Result := 'The hardware does not support clipped overlays.'; + DDERR_OVERLAYCOLORKEYONLYONEACTIVE: Result := 'Can only have ony color key active at one time for overlays.'; + DDERR_OVERLAYNOTVISIBLE: Result := 'Returned when GetOverlayPosition is called on a hidden overlay.'; + DDERR_PALETTEBUSY: Result := 'Access to this palette is being refused because the palette is already locked by another thread.'; + DDERR_PRIMARYSURFACEALREADYEXISTS: Result := 'This process already has created a primary surface.'; + DDERR_REGIONTOOSMALL: Result := 'Region passed to Clipper::GetClipList is too small.'; + DDERR_SURFACEALREADYATTACHED: Result := 'This surface is already attached to the surface it is being attached to.'; + DDERR_SURFACEALREADYDEPENDENT: Result := 'This surface is already a dependency of the surface it is being made a dependency of.'; + DDERR_SURFACEBUSY: Result := 'Access to this surface is being refused because the surface is already locked by another thread.'; + DDERR_SURFACEISOBSCURED: Result := 'Access to surface refused because the surface is obscured.'; + DDERR_SURFACELOST: Result := 'Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have Restore called on it.'; + DDERR_SURFACENOTATTACHED: Result := 'The requested surface is not attached.'; + DDERR_TOOBIGHEIGHT: Result := 'Height requested by DirectDraw is too large.'; + DDERR_TOOBIGSIZE: Result := 'Size requested by DirectDraw is too large, but the individual height and width are OK.'; + DDERR_TOOBIGWIDTH: Result := 'Width requested by DirectDraw is too large.'; + DDERR_UNSUPPORTED: Result := 'Action not supported.'; + DDERR_UNSUPPORTEDFORMAT: Result := 'FOURCC format requested is unsupported by DirectDraw.'; + DDERR_UNSUPPORTEDMASK: Result := 'Bitmask in the pixel format requested is unsupported by DirectDraw.'; + DDERR_VERTICALBLANKINPROGRESS: Result := 'Vertical blank is in progress.'; + DDERR_WASSTILLDRAWING: Result := 'Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is incomplete.'; + DDERR_WRONGMODE: Result := 'This surface can not be restored because it was created in a different mode.'; + DDERR_XALIGN: Result := 'Rectangle provided was not horizontally aligned on required boundary.'; + // new: + DDERR_OVERLAPPINGRECTS: Result := 'Operation could not be carried out because the source and destination rectangles are on the same surface and overlap each other.'; + DDERR_INVALIDSTREAM: Result := 'The specified stream contains invalid data'; + DDERR_UNSUPPORTEDMODE: Result := 'The display is currently in an unsupported mode'; + DDERR_NOMIPMAPHW: Result := 'Operation could not be carried out because there is no mip-map texture mapping hardware present or available.'; + DDERR_INVALIDSURFACETYPE: Result := 'The requested action could not be performed because the surface was of the wrong type.'; + DDERR_NOOPTIMIZEHW: Result := 'Device does not support optimized surfaces, therefore no video memory optimized surfaces'; + DDERR_NOTLOADED: Result := 'Surface is an optimized surface, but has not yet been allocated any memory'; + DDERR_NOFOCUSWINDOW: Result := 'Attempt was made to create or set a device window without first setting the focus window'; + DDERR_DCALREADYCREATED: Result := 'A DC has already been returned for this surface. Only one DC can be retrieved per surface.'; + DDERR_NONONLOCALVIDMEM: Result := 'An attempt was made to allocate non-local video memory from a device that does not support non-local video memory.'; + DDERR_CANTPAGELOCK: Result := 'The attempt to page lock a surface failed.'; + DDERR_CANTPAGEUNLOCK: Result := 'The attempt to page unlock a surface failed.'; + DDERR_NOTPAGELOCKED: Result := 'An attempt was made to page unlock a surface with no outstanding page locks.'; + DDERR_MOREDATA: Result := 'There is more data available than the specified buffer size could hold'; + DDERR_EXPIRED: Result := 'The data has expired and is therefore no longer valid.'; + DDERR_VIDEONOTACTIVE: Result := 'The video port is not active'; + DDERR_DEVICEDOESNTOWNSURFACE: Result := 'Surfaces created by one direct draw device cannot be used directly by another direct draw device.'; + DDERR_NOTINITIALIZED: Result := 'An attempt was made to invoke an interface member of a DirectDraw object created by CoCreateInstance() before it was initialized.'; + else Result := 'Unrecognized Error'; + end; +end; + +{$IFDEF DIRECTDRAW_DYNAMIC_LINK} +var + DirectDrawLib: THandle = 0; + +function DirectDrawLoaded: Boolean; +begin + Result:= DirectDrawLib <> 0; +end; + +function UnLoadDirectDraw: Boolean; +begin + Result:= True; + if DirectDrawLoaded then + begin + Result:= FreeLibrary(DirectDrawLib); + + DirectDrawEnumerateA := nil; + DirectDrawEnumerateW := nil; + DirectDrawEnumerate := nil; + + DirectDrawEnumerateExA := nil; + DirectDrawEnumerateExW := nil; + DirectDrawEnumerateEx := nil; + + DirectDrawCreate := nil; + DirectDrawCreateEx := nil; + DirectDrawCreateClipper := nil; + {$IFDEF WINNT} + NtDirectDrawCreate := nil; + {$ENDIF} + + DirectDrawLib:= 0; + end; +end; + +function LoadDirectDraw: Boolean; +begin + Result:= DirectDrawLoaded; + if (not Result) then + begin + DirectDrawLib:= LoadLibrary(DirectDrawDll); + if DirectDrawLoaded then + begin + DirectDrawEnumerateA := GetProcAddress(DirectDrawLib, 'DirectDrawEnumerateA'); + DirectDrawEnumerateW := GetProcAddress(DirectDrawLib, 'DirectDrawEnumerateW'); + {$IFDEF UNICODE} + DirectDrawEnumerate := GetProcAddress(DirectDrawLib, 'DirectDrawEnumerateW'); + {$ELSE} + DirectDrawEnumerate := GetProcAddress(DirectDrawLib, 'DirectDrawEnumerateA'); + {$ENDIF} + + DirectDrawEnumerateExA := GetProcAddress(DirectDrawLib, 'DirectDrawEnumerateExA'); + DirectDrawEnumerateExW := GetProcAddress(DirectDrawLib, 'DirectDrawEnumerateExW'); + {$IFDEF UNICODE} + DirectDrawEnumerateEx := GetProcAddress(DirectDrawLib, 'DirectDrawEnumerateExW'); + {$ELSE} + DirectDrawEnumerateEx := GetProcAddress(DirectDrawLib, 'DirectDrawEnumerateExA'); + {$ENDIF} + + DirectDrawCreate := GetProcAddress(DirectDrawLib,'DirectDrawCreate'); + DirectDrawCreateEx := GetProcAddress(DirectDrawLib,'DirectDrawCreateEx'); + DirectDrawCreateClipper := GetProcAddress(DirectDrawLib,'DirectDrawCreateClipper'); + {$IFDEF WINNT} + NtDirectDrawCreate := GetProcAddress(DirectDrawLib,'NtDirectDrawCreate'); + {$ENDIF} + + Result:= Assigned(DirectDrawCreate); // At least basic procedure is found! + if not Result then UnLoadDirectDraw; + end; + end; +end; +{$ELSE} +function DirectDrawLoaded: Boolean; +begin // Stub function for static linking + Result:= True; +end; + +function UnLoadDirectDraw: Boolean; +begin // Stub function for static linking + Result:= True; // should emulate "normal" behaviour +end; + +function LoadDirectDraw: Boolean; +begin // Stub function for static linking + Result:= True; +end; + +{$ENDIF} + +{$IFDEF DIRECTDRAW_DYNAMIC_LINK} +initialization +{$IFNDEF DIRECTDRAW_DYNAMIC_LINK_EXPLICIT} + LoadDirectDraw; +{$ENDIF} +finalization + UnLoadDirectDraw; +{$ENDIF} +end. diff --git a/components/acs/Src/fileformats/windows/directshow9.pas b/components/acs/Src/fileformats/windows/directshow9.pas new file mode 100644 index 000000000..a5283401c --- /dev/null +++ b/components/acs/Src/fileformats/windows/directshow9.pas @@ -0,0 +1,32049 @@ + + {###### #### ############################################################## + ## ### ### ## ,###### ## ## ###### ### ### ## ## + ## ### #### ## ## ## ## ## ## # ## ## ## + ## ## ### ###### ####### ## ## \## ### ##/ ########## + ## ## ##### ##### ####### ## ## ######### ## + ## ## ## ### ,## ## ## ## ## ### ### ### + ###### ### #### ####### ## ## ###### ## ## ########### + | | + | Borland Delphi 4,5,6,7 API for Direct Show | + | DirectX 9.0 Win 98, Me, 2000, XP | + | | + | Portions created by Microsoft are | + | Copyright (C) 1995-2002 Microsoft Corporation. | + | All Rights Reserved. | + | | + | The original files are: | + | comlite.h, errors.h, dv.h, strmif.h, mmstream.h, amstream.h, | + | ddstream.h, austream.h, mpconfig.h, control.h, qnetwork.h, | + | playlist.h, il21dec.h, amvideo.h, amaudio.h, vptype.h, | + | vpconfig.h, vpnotify.h, mpegtype.h, dvdevcod.h, dvdmedia.h, | + | bdatypes.h, activecf.h, vfwmsgs.h,(edevdefs.h, XPrtDefs.h), | + | aviriff.h, evcode.h, uuids.h, ksuuids.h, DXVA.h,AMVA.h, | + | videoacc.h, regbag.h, tuner.h, DXTrans.h, QEdit.h, mpeguids.h, | + | dshowasf.h, amparse.h, audevcod.h, atsmedia.h, MediaErr, | + | MedParam.h, mediaobj.h, dmodshow.h, dmoreg.h, DMORt.h, | + | dmoimpl.h, ks.h, ksproxy.h, ksmedia.h, dmksctrl.h, bdamedia.h, | + | BDATIF.idl, AMVPE.idl, Mixerocx.idl, Mpeg2Data.idl, | + | Mpeg2Structs.idl, Mpeg2Bits.h, Mpeg2Error.h, EDevCtrl.h, | + | sbe.idl, vmr9.idl, iwstdec.h | + | | + | The original Pascal code is: DirectShow9.pas, | + | released 01 Nov 2003. | + | | + | The initial developer of the Pascal code is Henri GOURVEST | + | Email : hgourvest@progdigy.com | + | WebSite : http://www.progdigy.com | + | | + | Portions created by Henri GOURVEST are | + | Copyright (C) 2002 Henri GOURVEST. | + | | + | Contributors: Ivo Steinmann | + | Peter NEUMANN | + | Alexey Barkovoy | + | Wayne Sherman | + | Peter J. Haas | + | Andriy Nevhasymyy | + | Milenko Mitrovic | + | Michael Andersen | + | Martin Offenwanger 0x0700)'} +{$HPPEMIT 'typedef struct IDirect3D *LPDIRECT3D;'} +{$HPPEMIT 'typedef struct IDirect3DDevice *LPDIRECT3DDEVICE;'} +{$HPPEMIT 'typedef struct IDirect3D2 *LPDIRECT3D2;'} +{$HPPEMIT 'typedef struct IDirect3DDevice2 *LPDIRECT3DDEVICE2;'} +{$HPPEMIT 'typedef struct IDirect3DViewport *LPDIRECT3DVIEWPORT;'} +{$HPPEMIT '#endif'} + +{$HPPEMIT '#define __KS__'} +{$HPPEMIT '#define __STREAMS__'} +{$HPPEMIT '#include "comlite.h"'} +{$HPPEMIT '#include "errors.h"'} +{$HPPEMIT '#include "dv.h"'} +{$HPPEMIT '#include "strmif.h"'} +{$HPPEMIT '#include "mmstream.h"'} +{$HPPEMIT '#include "amstream.h"'} +{$HPPEMIT '#include "ddstream.h"'} +{$HPPEMIT '#include "austream.h"'} +{$HPPEMIT '#include "mpconfig.h"'} +{$HPPEMIT '#include "control.h"'} +{$HPPEMIT '#include "qnetwork.h"'} +{$HPPEMIT '#include "playlist.h"'} +{$HPPEMIT '#include "il21dec.h"'} +{$HPPEMIT '#include "amvideo.h"'} +{$HPPEMIT '#include "amaudio.h"'} +{$HPPEMIT '#include "vptype.h"'} +{$HPPEMIT '#include "vpconfig.h"'} +{$HPPEMIT '#include "vpnotify.h"'} +{$HPPEMIT '#include "mmreg.h"'} +{$HPPEMIT '#include "mpegtype.h"'} +{$HPPEMIT '#include "dvdevcod.h"'} +{$HPPEMIT '#include "dvdmedia.h"'} +{$HPPEMIT '#include "bdatypes.h"'} +{$HPPEMIT '#include "activecf.h"'} +{$HPPEMIT '#include "vfwmsgs.h"'} +{$HPPEMIT '#include "edevdefs.h"'} +{$HPPEMIT '#include "XPrtDefs.h"'} +{$HPPEMIT '#include "aviriff.h"'} +{$HPPEMIT '#include "evcode.h"'} +{$HPPEMIT '#include "DXVA.h"'} +{$HPPEMIT '#include "AMVA.h"'} +{$HPPEMIT '#include "videoacc.h"'} +{$HPPEMIT '#include "regbag.h"'} +{$HPPEMIT '#include "tuner.h"'} +{$HPPEMIT '#include "DXTrans.h"'} +{$HPPEMIT '#include "QEdit.h"'} +{$HPPEMIT '#include "dshowasf.h"'} +{$HPPEMIT '#include "amparse.h"'} +{$HPPEMIT '#include "audevcod.h"'} +{$HPPEMIT '#include "MediaErr.h"'} +{$HPPEMIT '#include "MedParam.h"'} +{$HPPEMIT '#include "mediaobj.h"'} +{$HPPEMIT '#include "dmodshow.h"'} +{$HPPEMIT '#include "dmoreg.h"'} +{$HPPEMIT '#include "DMORt.h"'} +{$HPPEMIT '#include "dmoimpl.h"'} +{$HPPEMIT '#include "uuids.h"'} +{$HPPEMIT '#include "ks.h"'} +{$HPPEMIT '#include "ksproxy.h"'} +{$HPPEMIT '#include "ksmedia.h"'} +{$HPPEMIT '#include "bdamedia.h"'} +{$HPPEMIT '#include "Bdatif.h"'} +{$HPPEMIT '#include "atsmedia.h"'} +{$HPPEMIT '#include "dmksctrl.h"'} +{$HPPEMIT '#include "Mixerocx.h"'} +{$HPPEMIT '#include "Mpeg2Data.h"'} +{$HPPEMIT '#include "Mpeg2Bits.h"'} +{$HPPEMIT '#include "Mpeg2Error.h"'} +{$HPPEMIT '#include "sbe.h"'} +{$HPPEMIT '#include "vmr9.h"'} +{$HPPEMIT '#include "iwstdec.h"'} + +interface + +uses + Windows, + ActiveX, + DirectDraw, + DirectSound, + Direct3D9, + MMSystem, + SyncObjs, + ComObj; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: comlite.h + * + ***************************************************************************) + +function QzInitialize(pvReserved: Pointer): HResult; stdcall; +{$EXTERNALSYM QzInitialize} +procedure QzUninitialize; stdcall; +{$EXTERNALSYM QzUninitialize} +procedure QzFreeUnusedLibraries; stdcall; +{$EXTERNALSYM QzFreeUnusedLibraries} + +function QzGetMalloc(dwMemContext: Longint; out malloc: IMalloc): HResult; stdcall; +{$EXTERNALSYM QzGetMalloc} +function QzTaskMemAlloc(cb: Longint): Pointer; stdcall; +{$EXTERNALSYM QzTaskMemAlloc} +function QzTaskMemRealloc(pv: Pointer; cb: Longint): Pointer; stdcall; +{$EXTERNALSYM QzTaskMemRealloc} +procedure QzTaskMemFree(pv: Pointer); stdcall; +{$EXTERNALSYM QzTaskMemFree} +function QzCreateFilterObject(const clsid: TCLSID; unkOuter: IUnknown; +{$EXTERNALSYM QzCreateFilterObject} + dwClsContext: Longint; const iid: TIID; out pv): HResult; stdcall; +function QzCLSIDFromString(psz: POleStr; out clsid: TCLSID): HResult; stdcall; +{$EXTERNALSYM QzCLSIDFromString} +function QzStringFromGUID2(const guid: TGUID; psz: POleStr; cbMax: Integer): Integer; stdcall; +{$EXTERNALSYM QzStringFromGUID2} + + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: errors.h + * + ***************************************************************************) + +const + VFW_FIRST_CODE = $200; + {$EXTERNALSYM VFW_FIRST_CODE} + MAX_ERROR_TEXT_LEN = 160; + {$EXTERNALSYM MAX_ERROR_TEXT_LEN} + + function AMGetErrorTextA(hr: HResult; pbuffer: PChar; MaxLen: DWORD): DWORD; stdcall; + {$EXTERNALSYM AMGetErrorTextA} + function AMGetErrorTextW(hr: HResult; pbuffer: PWideChar; MaxLen: DWORD): DWORD; stdcall; + {$EXTERNALSYM AMGetErrorTextW} + + // [pjh, 2003-07-14] ANSI and UNICODE declaration exchange + {$IFDEF UNICODE} + function AMGetErrorText(hr: HResult; pbuffer: PWideChar; MaxLen: DWORD): DWORD; stdcall; + {$ELSE} + function AMGetErrorText(hr: HResult; pbuffer: PChar; MaxLen: DWORD): DWORD; stdcall; + {$ENDIF} + {$EXTERNALSYM AMGetErrorText} + + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: dv.h + * + ***************************************************************************) + +const + DV_DVSD_NTSC_FRAMESIZE = 120000; + {$EXTERNALSYM DV_DVSD_NTSC_FRAMESIZE} + DV_DVSD_PAL_FRAMESIZE = 144000; + {$EXTERNALSYM DV_DVSD_PAL_FRAMESIZE} + + DV_SMCHN = $0000e000; + {$EXTERNALSYM DV_SMCHN} + DV_AUDIOMODE = $00000f00; + {$EXTERNALSYM DV_AUDIOMODE} + DV_AUDIOSMP = $38000000; + {$EXTERNALSYM DV_AUDIOSMP} + + DV_AUDIOQU = $07000000; + {$EXTERNALSYM DV_AUDIOQU} + DV_NTSCPAL = $00200000; + {$EXTERNALSYM DV_NTSCPAL} + DV_STYPE = $001f0000; + {$EXTERNALSYM DV_STYPE} + + //There are NTSC or PAL DV camcorders + DV_NTSC = 0; + {$EXTERNALSYM DV_NTSC} + DV_PAL = 1; + {$EXTERNALSYM DV_PAL} + + //DV camcorder can output sd/hd/sl + DV_SD = $00; + {$EXTERNALSYM DV_SD} + DV_HD = $01; + {$EXTERNALSYM DV_HD} + DV_SL = $02; + {$EXTERNALSYM DV_SL} + + //user can choice 12 bits or 16 bits audio from DV camcorder + DV_CAP_AUD16Bits = $00; + {$EXTERNALSYM DV_CAP_AUD16Bits} + DV_CAP_AUD12Bits = $01; + {$EXTERNALSYM DV_CAP_AUD12Bits} + + SIZE_DVINFO = $20; + {$EXTERNALSYM SIZE_DVINFO} + +type + Tag_DVAudInfo = record + bAudStyle: array[0..1] of Byte; + //LSB 6 bits for starting DIF sequence number + //MSB 2 bits: 0 for mon. 1: stereo in one 5/6 DIF sequences, 2: stereo audio in both 5/6 DIF sequences + //example: 0x00: mon, audio in first 5/6 DIF sequence + // 0x05: mon, audio in 2nd 5 DIF sequence + // 0x15: stereo, audio only in 2nd 5 DIF sequence + // 0x10: stereo, audio only in 1st 5/6 DIF sequence + // 0x20: stereo, left ch in 1st 5/6 DIF sequence, right ch in 2nd 5/6 DIF sequence + // 0x26: stereo, rightch in 1st 6 DIF sequence, left ch in 2nd 6 DIF sequence + bAudQu: array[0..1] of Byte; //qbits, only support 12, 16, + + bNumAudPin: Byte; //how many pin + wAvgSamplesPerPinPerFrm: array[0..1] of WORD; //samples size for one audio pin in one frame(which has 10 or 12 DIF sequence) + wBlkMode : WORD; //45 for NTSC, 54 for PAL + wDIFMode : WORD; //5 for NTSC, 6 for PAL + wBlkDiv : WORD; //15 for NTSC, 18 for PAL + end; + {$EXTERNALSYM Tag_DVAudInfo} + DVAudInfo = Tag_DVAudInfo; + {$EXTERNALSYM DVAudInfo} + TDVAudInfo = Tag_DVAudInfo; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: strmif.h + * + ***************************************************************************) +const + IID_IPin : TGUID = '{56A86891-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IPin} + IID_IEnumPins : TGUID = '{56A86892-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IEnumPins} + IID_IEnumMediaTypes : TGUID = '{89C31040-846B-11CE-97D3-00AA0055595A}'; + {$EXTERNALSYM IID_IEnumMediaTypes} + IID_IFilterGraph : TGUID = '{56A8689F-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IFilterGraph} + IID_IEnumFilters : TGUID = '{56A86893-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IEnumFilters} + IID_IMediaFilter : TGUID = '{56A86899-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IMediaFilter} + IID_IBaseFilter : TGUID = '{56A86895-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IBaseFilter} + IID_IReferenceClock : TGUID = '{56A86897-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IReferenceClock} + IID_IReferenceClock2 : TGUID = '{36B73885-C2C8-11CF-8B46-00805F6CEF60}'; + {$EXTERNALSYM IID_IReferenceClock2} + IID_IMediaSample : TGUID = '{56A8689A-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IMediaSample} + IID_IMediaSample2 : TGUID = '{36B73884-C2C8-11CF-8B46-00805F6CEF60}'; + {$EXTERNALSYM IID_IMediaSample2} + IID_IMemAllocator : TGUID = '{56A8689C-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IMemAllocator} + IID_IMemInputPin : TGUID = '{56A8689D-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IMemInputPin} + IID_IAMovieSetup : TGUID = '{A3D8CEC0-7E5A-11CF-BBC5-00805F6CEF20}'; // deprecated; + {$EXTERNALSYM IID_IAMovieSetup} + IID_IMediaSeeking : TGUID = '{36B73880-C2C8-11CF-8B46-00805F6CEF60}'; + {$EXTERNALSYM IID_IMediaSeeking} + IID_IEnumRegFilters : TGUID = '{56A868A4-0AD4-11CE-B03A-0020AF0BA770}'; // deprecated; + {$EXTERNALSYM IID_IEnumRegFilters} + IID_IFilterMapper : TGUID = '{56A868A3-0AD4-11CE-B03A-0020AF0BA770}'; // deprecated; + {$EXTERNALSYM IID_IFilterMapper} + IID_IFilterMapper2 : TGUID = '{B79BB0B0-33C1-11D1-ABE1-00A0C905F375}'; + {$EXTERNALSYM IID_IFilterMapper2} + IID_IQualityControl : TGUID = '{56A868A5-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IQualityControl} + IID_IOverlayNotify : TGUID = '{56A868A0-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IOverlayNotify} + IID_IOverlay : TGUID = '{56A868A1-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IOverlay} + IID_IMediaEventSink : TGUID = '{56A868A2-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IMediaEventSink} + IID_IFileSourceFilter : TGUID = '{56A868A6-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IFileSourceFilter} + IID_IFileSinkFilter : TGUID = '{A2104830-7C70-11CF-8BCE-00AA00A3F1A6}'; + {$EXTERNALSYM IID_IFileSinkFilter} + IID_IFileSinkFilter2 : TGUID = '{00855B90-CE1B-11D0-BD4F-00A0C911CE86}'; + {$EXTERNALSYM IID_IFileSinkFilter2} + IID_IFileAsyncIO : TGUID = '{56A868A7-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IFileAsyncIO} + IID_IGraphBuilder : TGUID = '{56A868A9-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IGraphBuilder} + IID_ICaptureGraphBuilder : TGUID = '{BF87B6E0-8C27-11D0-B3F0-00AA003761C5}'; // deprecated; + {$EXTERNALSYM IID_ICaptureGraphBuilder} + IID_IAMCopyCaptureFileProgress : TGUID = '{670D1D20-A068-11D0-B3F0-00AA003761C5}'; + {$EXTERNALSYM IID_IAMCopyCaptureFileProgress} + IID_IFilterGraph2 : TGUID = '{36B73882-C2C8-11CF-8B46-00805F6CEF60}'; + {$EXTERNALSYM IID_IFilterGraph2} + IID_IStreamBuilder : TGUID = '{56A868BF-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IStreamBuilder} + IID_IAsyncReader : TGUID = '{56A868AA-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IAsyncReader} + IID_IGraphVersion : TGUID = '{56A868AB-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IGraphVersion} + IID_IResourceConsumer : TGUID = '{56A868AD-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IResourceConsumer} + IID_IResourceManager : TGUID = '{56A868AC-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IResourceManager} + IID_IDistributorNotify : TGUID = '{56A868AF-0AD4-11CE-B03A-0020AF0BA770}'; + {$EXTERNALSYM IID_IDistributorNotify} + IID_IAMStreamControl : TGUID = '{36b73881-c2c8-11cf-8b46-00805f6cef60}'; + {$EXTERNALSYM IID_IAMStreamControl} + IID_ISeekingPassThru : TGUID = '{36B73883-C2C8-11CF-8B46-00805F6CEF60}'; + {$EXTERNALSYM IID_ISeekingPassThru} + IID_IAMStreamConfig : TGUID = '{C6E13340-30AC-11d0-A18C-00A0C9118956}'; + {$EXTERNALSYM IID_IAMStreamConfig} + IID_IConfigInterleaving : TGUID = '{BEE3D220-157B-11d0-BD23-00A0C911CE86}'; + {$EXTERNALSYM IID_IConfigInterleaving} + IID_IConfigAviMux : TGUID = '{5ACD6AA0-F482-11ce-8B67-00AA00A3F1A6}'; + {$EXTERNALSYM IID_IConfigAviMux} + IID_IAMVideoCompression : TGUID = '{C6E13343-30AC-11d0-A18C-00A0C9118956}'; + {$EXTERNALSYM IID_IAMVideoCompression} + IID_IAMVfwCaptureDialogs : TGUID = '{D8D715A0-6E5E-11D0-B3F0-00AA003761C5}'; + {$EXTERNALSYM IID_IAMVfwCaptureDialogs} + IID_IAMVfwCompressDialogs : TGUID = '{D8D715A3-6E5E-11D0-B3F0-00AA003761C5}'; + {$EXTERNALSYM IID_IAMVfwCompressDialogs} + IID_IAMDroppedFrames : TGUID = '{C6E13344-30AC-11d0-A18C-00A0C9118956}'; + {$EXTERNALSYM IID_IAMDroppedFrames} + IID_IAMAudioInputMixer : TGUID = '{54C39221-8380-11d0-B3F0-00AA003761C5}'; + {$EXTERNALSYM IID_IAMAudioInputMixer} + IID_IAMAnalogVideoDecoder : TGUID = '{C6E13350-30AC-11d0-A18C-00A0C9118956}'; + {$EXTERNALSYM IID_IAMAnalogVideoDecoder} + IID_IAMVideoProcAmp : TGUID = '{C6E13360-30AC-11d0-A18C-00A0C9118956}'; + {$EXTERNALSYM IID_IAMVideoProcAmp} + IID_IAMCameraControl : TGUID = '{C6E13370-30AC-11d0-A18C-00A0C9118956}'; + {$EXTERNALSYM IID_IAMCameraControl} + IID_IAMCrossbar : TGUID = '{C6E13380-30AC-11d0-A18C-00A0C9118956}'; + {$EXTERNALSYM IID_IAMCrossbar} + IID_IAMTuner : TGUID = '{211A8761-03AC-11d1-8D13-00AA00BD8339}'; + {$EXTERNALSYM IID_IAMTuner} + IID_IAMTunerNotification : TGUID = '{211A8760-03AC-11d1-8D13-00AA00BD8339}'; + {$EXTERNALSYM IID_IAMTunerNotification} + IID_IAMTVTuner : TGUID = '{211A8766-03AC-11d1-8D13-00AA00BD8339}'; + {$EXTERNALSYM IID_IAMTVTuner} + IID_IBPCSatelliteTuner : TGUID = '{211A8765-03AC-11d1-8D13-00AA00BD8339}'; + {$EXTERNALSYM IID_IBPCSatelliteTuner} + IID_IAMTVAudio : TGUID = '{83EC1C30-23D1-11d1-99E6-00A0C9560266}'; + {$EXTERNALSYM IID_IAMTVAudio} + IID_IAMTVAudioNotification : TGUID = '{83EC1C33-23D1-11D1-99E6-00A0C9560266}'; + {$EXTERNALSYM IID_IAMTVAudioNotification} + IID_IAMAnalogVideoEncoder : TGUID = '{C6E133B0-30AC-11d0-A18C-00A0C9118956}'; // deprecated; + {$EXTERNALSYM IID_IAMAnalogVideoEncoder} + IID_IMediaPropertyBag : TGUID = '{6025A880-C0D5-11D0-BD4E-00A0C911CE86}'; + {$EXTERNALSYM IID_IMediaPropertyBag} + IID_IPersistMediaPropertyBag : TGUID = '{5738E040-B67F-11d0-BD4D-00A0C911CE86}'; + {$EXTERNALSYM IID_IPersistMediaPropertyBag} + IID_IAMPhysicalPinInfo : TGUID = '{F938C991-3029-11CF-8C44-00AA006B6814}'; // deprecated; + {$EXTERNALSYM IID_IAMPhysicalPinInfo} + IID_IAMExtDevice : TGUID = '{B5730A90-1A2C-11CF-8C23-00AA006B6814}'; + {$EXTERNALSYM IID_IAMExtDevice} + IID_IAMExtTransport : TGUID = '{A03CD5F0-3045-11CF-8C44-00AA006B6814}'; + {$EXTERNALSYM IID_IAMExtTransport} + IID_IAMTimecodeReader : TGUID = '{9B496CE1-811B-11CF-8C77-00AA006B6814}'; + {$EXTERNALSYM IID_IAMTimecodeReader} + IID_IAMTimecodeGenerator : TGUID = '{9B496CE0-811B-11CF-8C77-00AA006B6814}'; + {$EXTERNALSYM IID_IAMTimecodeGenerator} + IID_IAMTimecodeDisplay : TGUID = '{9B496CE2-811B-11CF-8C77-00AA006B6814}'; + {$EXTERNALSYM IID_IAMTimecodeDisplay} + IID_IAMDevMemoryAllocator : TGUID = '{C6545BF0-E76B-11D0-BD52-00A0C911CE86}'; // deprecated; + {$EXTERNALSYM IID_IAMDevMemoryAllocator} + IID_IAMDevMemoryControl : TGUID = '{C6545BF1-E76B-11D0-BD52-00A0C911CE86}'; // deprecated; + {$EXTERNALSYM IID_IAMDevMemoryControl} + IID_IAMStreamSelect : TGUID = '{C1960960-17F5-11D1-ABE1-00A0C905F375}'; + {$EXTERNALSYM IID_IAMStreamSelect} + IID_IAMovie : TGUID = '{359ACE10-7688-11CF-8B23-00805F6CEF60}'; + {$EXTERNALSYM IID_IAMovie} + IID_ICreateDevEnum : TGUID = '{29840822-5B84-11D0-BD3B-00A0C911CE86}'; + {$EXTERNALSYM IID_ICreateDevEnum} + IID_IDvdControl : TGUID = '{A70EFE61-E2A3-11D0-A9BE-00AA0061BE93}'; // deprecated; + {$EXTERNALSYM IID_IDvdControl} + IID_IDvdControl2 : TGUID = '{33BC7430-EEC0-11D2-8201-00A0C9D74842}'; + {$EXTERNALSYM IID_IDvdControl2} + IID_IDvdInfo : TGUID = '{A70EFE60-E2A3-11D0-A9BE-00AA0061BE93}'; // deprecated; + {$EXTERNALSYM IID_IDvdInfo} + IID_IDvdInfo2 : TGUID = '{34151510-EEC0-11D2-8201-00A0C9D74842}'; + {$EXTERNALSYM IID_IDvdInfo2} + IID_IDvdGraphBuilder : TGUID = '{FCC152B6-F372-11d0-8E00-00C04FD7C08B}'; + {$EXTERNALSYM IID_IDvdGraphBuilder} + IID_IDvdState : TGUID = '{86303d6d-1c4a-4087-ab42-f711167048ef}'; + {$EXTERNALSYM IID_IDvdState} + IID_IDvdCmd : TGUID = '{5a4a97e4-94ee-4a55-9751-74b5643aa27d}'; + {$EXTERNALSYM IID_IDvdCmd} + IID_IVideoFrameStep : TGUID = '{e46a9787-2b71-444d-a4b5-1fab7b708d6a}'; + {$EXTERNALSYM IID_IVideoFrameStep} + IID_IFilterMapper3 : TGUID = '{b79bb0b1-33c1-11d1-abe1-00a0c905f375}'; + {$EXTERNALSYM IID_IFilterMapper3} + IID_IOverlayNotify2 : TGUID = '{680EFA10-D535-11D1-87C8-00A0C9223196}'; + {$EXTERNALSYM IID_IOverlayNotify2} + IID_ICaptureGraphBuilder2 : TGUID = '{93E5A4E0-2D50-11d2-ABFA-00A0C9C6E38D}'; + {$EXTERNALSYM IID_ICaptureGraphBuilder2} + IID_IMemAllocatorCallbackTemp : TGUID = '{379a0cf0-c1de-11d2-abf5-00a0c905f375}'; + {$EXTERNALSYM IID_IMemAllocatorCallbackTemp} + IID_IMemAllocatorNotifyCallbackTemp : TGUID = '{92980b30-c1de-11d2-abf5-00a0c905f375}'; + {$EXTERNALSYM IID_IMemAllocatorNotifyCallbackTemp} + IID_IAMVideoControl : TGUID = '{6a2e0670-28e4-11d0-a18c-00a0c9118956}'; + {$EXTERNALSYM IID_IAMVideoControl} + + IID_IKsPropertySet : TGUID = '{31EFAC30-515C-11d0-A9AA-00AA0061BE93}'; + {$EXTERNALSYM IID_IKsPropertySet} + STATIC_IID_IKsPropertySet : TGUID = '{31EFAC30-515C-11d0-A9AA-00AA0061BE93}'; + {$EXTERNALSYM STATIC_IID_IKsPropertySet} + + IID_IAMResourceControl : TGUID = '{8389d2d0-77d7-11d1-abe6-00a0c905f375}'; + {$EXTERNALSYM IID_IAMResourceControl} + IID_IAMClockAdjust : TGUID = '{4d5466b0-a49c-11d1-abe8-00a0c905f375}'; + {$EXTERNALSYM IID_IAMClockAdjust} + IID_IAMFilterMiscFlags : TGUID = '{2dd74950-a890-11d1-abe8-00a0c905f375}'; + {$EXTERNALSYM IID_IAMFilterMiscFlags} + IID_IDrawVideoImage : TGUID = '{48efb120-ab49-11d2-aed2-00a0c995e8d5}'; + {$EXTERNALSYM IID_IDrawVideoImage} + IID_IDecimateVideoImage : TGUID = '{2e5ea3e0-e924-11d2-b6da-00a0c995e8df}'; + {$EXTERNALSYM IID_IDecimateVideoImage} + IID_IAMVideoDecimationProperties : TGUID = '{60d32930-13da-11d3-9ec6-c4fcaef5c7be}'; + {$EXTERNALSYM IID_IAMVideoDecimationProperties} + IID_IAMLatency : TGUID = '{62EA93BA-EC62-11d2-B770-00C04FB6BD3D}'; + {$EXTERNALSYM IID_IAMLatency} + IID_IAMPushSource : TGUID = '{F185FE76-E64E-11d2-B76E-00C04FB6BD3D}'; + {$EXTERNALSYM IID_IAMPushSource} + IID_IAMDeviceRemoval : TGUID = '{f90a6130-b658-11d2-ae49-0000f8754b99}'; + {$EXTERNALSYM IID_IAMDeviceRemoval} + IID_IDVEnc : TGUID = '{d18e17a0-aacb-11d0-afb0-00aa00b67a42}'; + {$EXTERNALSYM IID_IDVEnc} + IID_IIPDVDec : TGUID = '{b8e8bd60-0bfe-11d0-af91-00aa00b67a42}'; + {$EXTERNALSYM IID_IIPDVDec} + IID_IDVRGB219 : TGUID = '{58473A19-2BC8-4663-8012-25F81BABDDD1}'; // XP + {$EXTERNALSYM IID_IDVRGB219} + IID_IDVSplitter : TGUID = '{92a3a302-da7c-4a1f-ba7e-1802bb5d2d02}'; + {$EXTERNALSYM IID_IDVSplitter} + IID_IAMAudioRendererStats : TGUID = '{22320CB2-D41A-11d2-BF7C-D7CB9DF0BF93}'; + {$EXTERNALSYM IID_IAMAudioRendererStats} + IID_IAMGraphStreams : TGUID = '{632105FA-072E-11d3-8AF9-00C04FB6BD3D}'; + {$EXTERNALSYM IID_IAMGraphStreams} + IID_IAMOverlayFX : TGUID = '{62fae250-7e65-4460-bfc9-6398b322073c}'; + {$EXTERNALSYM IID_IAMOverlayFX} + IID_IAMOpenProgress : TGUID = '{8E1C39A1-DE53-11cf-AA63-0080C744528D}'; + {$EXTERNALSYM IID_IAMOpenProgress} + IID_IMpeg2Demultiplexer : TGUID = '{436eee9c-264f-4242-90e1-4e330c107512}'; + {$EXTERNALSYM IID_IMpeg2Demultiplexer} + IID_IEnumStreamIdMap : TGUID = '{945C1566-6202-46fc-96C7-D87F289C6534}'; + {$EXTERNALSYM IID_IEnumStreamIdMap} + IID_IMPEG2StreamIdMap : TGUID = '{D0E04C47-25B8-4369-925A-362A01D95444}'; + {$EXTERNALSYM IID_IMPEG2StreamIdMap} + IID_IRegisterServiceProvider : TGUID = '{7B3A2F01-0751-48DD-B556-004785171C54}'; // XP + {$EXTERNALSYM IID_IRegisterServiceProvider} + IID_IAMDecoderCaps : TGUID = '{c0dff467-d499-4986-972b-e1d9090fa941}'; // XP + {$EXTERNALSYM IID_IAMDecoderCaps} + IID_IAMCertifiedOutputProtection : TGUID = '{6FEDED3E-0FF1-4901-A2F1-43F7012C8515}'; + {$EXTERNALSYM IID_IAMCertifiedOutputProtection} + IID_IAMClockSlave : TGUID = '{9FD52741-176D-4b36-8F51-CA8F933223BE}'; // XP + {$EXTERNALSYM IID_IAMClockSlave} + IID_IAMGraphBuilderCallback : TGUID = '{4995f511-9ddb-4f12-bd3b-f04611807b79}'; // DX9 + {$EXTERNALSYM IID_IAMGraphBuilderCallback} + IID_IAMFilterGraphCallback : TGUID = '{56a868fd-0ad4-11ce-b0a3-0020af0ba770}'; // DX9 + {$EXTERNALSYM IID_IAMFilterGraphCallback} + IID_ICodecAPI : TGUID = '{901db4c7-31ce-41a2-85dc-8fa0bf41b8da}'; // DX9 + {$EXTERNALSYM IID_ICodecAPI} + IID_IEncoderAPI : TGUID = '{70423839-6ACC-4b23-B079-21DBF08156A5}'; // DX9 + {$EXTERNALSYM IID_IEncoderAPI} + IID_IVideoEncoder : TGUID = '{02997C3B-8E1B-460e-9270-545E0DE9563E}'; // DX9 + {$EXTERNALSYM IID_IVideoEncoder} + IID_IGetCapabilitiesKey : TGUID = '{a8809222-07bb-48ea-951c-33158100625b}'; // DX9 + {$EXTERNALSYM IID_IGetCapabilitiesKey} + IID_IDDrawExclModeVideo : TGUID = '{153ACC21-D83B-11d1-82BF-00A0C9696C8F}'; + {$EXTERNALSYM IID_IDDrawExclModeVideo} + IID_IDDrawExclModeVideoCallback : TGUID = '{913c24a0-20ab-11d2-9038-00a0c9697298}'; + {$EXTERNALSYM IID_IDDrawExclModeVideoCallback} + IID_IPinConnection : TGUID = '{4a9a62d3-27d4-403d-91e9-89f540e55534}'; + {$EXTERNALSYM IID_IPinConnection} + IID_IPinFlowControl : TGUID = '{c56e9858-dbf3-4f6b-8119-384af2060deb}'; + {$EXTERNALSYM IID_IPinFlowControl} + IID_IGraphConfig : TGUID = '{03A1EB8E-32BF-4245-8502-114D08A9CB88}'; + {$EXTERNALSYM IID_IGraphConfig} + IID_IGraphConfigCallback : TGUID = '{ade0fd60-d19d-11d2-abf6-00a0c905f375}'; + {$EXTERNALSYM IID_IGraphConfigCallback} + IID_IFilterChain : TGUID = '{DCFBDCF6-0DC2-45f5-9AB2-7C330EA09C29}'; + {$EXTERNALSYM IID_IFilterChain} + + IID_IVMRImagePresenter : TGUID = '{CE704FE7-E71E-41fb-BAA2-C4403E1182F5}'; // XP + {$EXTERNALSYM IID_IVMRImagePresenter} + IID_IVMRSurfaceAllocator : TGUID = '{31ce832e-4484-458b-8cca-f4d7e3db0b52}'; // XP + {$EXTERNALSYM IID_IVMRSurfaceAllocator} + IID_IVMRSurfaceAllocatorNotify : TGUID = '{aada05a8-5a4e-4729-af0b-cea27aed51e2}'; // XP + {$EXTERNALSYM IID_IVMRSurfaceAllocatorNotify} + IID_IVMRWindowlessControl : TGUID = '{0eb1088c-4dcd-46f0-878f-39dae86a51b7}'; // XP + {$EXTERNALSYM IID_IVMRWindowlessControl} + IID_IVMRMixerControl : TGUID = '{1c1a17b0-bed0-415d-974b-dc6696131599}'; // XP + {$EXTERNALSYM IID_IVMRMixerControl} + IID_IVMRMonitorConfig : TGUID = '{9cf0b1b6-fbaa-4b7f-88cf-cf1f130a0dce}'; // XP + {$EXTERNALSYM IID_IVMRMonitorConfig} + IID_IVMRFilterConfig : TGUID = '{9e5530c5-7034-48b4-bb46-0b8a6efc8e36}'; // XP + {$EXTERNALSYM IID_IVMRFilterConfig} + IID_IVMRMixerBitmap : TGUID = '{1E673275-0257-40aa-AF20-7C608D4A0428}'; // XP + {$EXTERNALSYM IID_IVMRMixerBitmap} + IID_IVMRImageCompositor : TGUID = '{7a4fb5af-479f-4074-bb40-ce6722e43c82}'; // XP + {$EXTERNALSYM IID_IVMRImageCompositor} + IID_IVMRVideoStreamControl : TGUID = '{058d1f11-2a54-4bef-bd54-df706626b727}'; // XP + {$EXTERNALSYM IID_IVMRVideoStreamControl} + IID_IVMRSurface : TGUID = '{a9849bbe-9ec8-4263-b764-62730f0d15d0}'; // XP + {$EXTERNALSYM IID_IVMRSurface} + IID_IVPManager : TGUID = '{aac18c18-e186-46d2-825d-a1f8dc8e395a}'; // XP + {$EXTERNALSYM IID_IVPManager} + IID_IVMRImagePresenterConfig : TGUID = '{9f3a1c85-8555-49ba-935f-be5b5b29d178}'; // XP + {$EXTERNALSYM IID_IVMRImagePresenterConfig} + IID_IVMRImagePresenterExclModeConfig: TGUID = '{e6f7ce40-4673-44f1-8f77-5499d68cb4ea}'; // XP + {$EXTERNALSYM IID_IVMRImagePresenterExclModeConfig} + + IID_IAMBufferNegotiation : TGUID = '{56ED71A0-AF5F-11D0-B3F0-00AA003761C5}'; + {$EXTERNALSYM IID_IAMBufferNegotiation} + +const + CHARS_IN_GUID = 39; + {$EXTERNALSYM CHARS_IN_GUID} + + MAX_PIN_NAME = 128; + {$EXTERNALSYM MAX_PIN_NAME} + MAX_FILTER_NAME = 128; + {$EXTERNALSYM MAX_FILTER_NAME} + +type + PAMMediaType = ^TAMMediaType; + _AMMediaType = record + majortype : TGUID; + subtype : TGUID; + bFixedSizeSamples : BOOL; + bTemporalCompression : BOOL; + lSampleSize : ULONG; + formattype : TGUID; + pUnk : IUnknown; + cbFormat : ULONG; + pbFormat : Pointer; + end; + {$EXTERNALSYM _AMMediaType} + AM_MEDIA_TYPE = _AMMediaType; + {$EXTERNALSYM AM_MEDIA_TYPE} + TAMMediaType = _AMMediaType; + + _PinDirection = ( + PINDIR_INPUT, + PINDIR_OUTPUT + ); + {$EXTERNALSYM _PinDirection} + PIN_DIRECTION = _PinDirection; + {$EXTERNALSYM PIN_DIRECTION} + TPinDirection = PIN_DIRECTION; + + REFERENCE_TIME = DirectSound.REFERENCE_TIME; + {$EXTERNALSYM REFERENCE_TIME} + TReferenceTime = DirectSound.TReferenceTime; + PReferenceTime = DirectSound.PReferenceTime; + + REFTIME = double; + {$EXTERNALSYM REFTIME} + TRefTime = REFTIME; + + HSEMAPHORE = Longint; + {$EXTERNALSYM HSEMAPHORE} + + PAllocatorProperties = ^TAllocatorProperties; + _AllocatorProperties = record + cBuffers: Longint; + cbBuffer: Longint; + cbAlign : Longint; + cbPrefix: Longint; + end; + {$EXTERNALSYM _AllocatorProperties} + ALLOCATOR_PROPERTIES = _AllocatorProperties; + {$EXTERNALSYM ALLOCATOR_PROPERTIES} + TAllocatorProperties = _AllocatorProperties; + + IBaseFilter = interface; + + _PinInfo = record + pFilter: IBaseFilter; + dir : PIN_DIRECTION; + achName: array[0..127] of WCHAR; + end; + {$EXTERNALSYM _PinInfo} + PIN_INFO = _PinInfo; + {$EXTERNALSYM PIN_INFO} + TPinInfo = _PinInfo; + + IEnumMediaTypes = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IPin;'} + {$EXTERNALSYM IPin} + IPin = interface(IUnknown) + ['{56A86891-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IPin methods ***) + function Connect(pReceivePin: IPin; const pmt: PAMMediaType): HResult; stdcall; + function ReceiveConnection(pConnector: IPin; const pmt: TAMMediaType): HResult; stdcall; + function Disconnect: HResult; stdcall; + function ConnectedTo(out pPin: IPin): HResult; stdcall; + function ConnectionMediaType(out pmt: TAMMediaType): HResult; stdcall; + function QueryPinInfo(out pInfo: TPinInfo): HResult; stdcall; + function QueryDirection(out pPinDir: TPinDirection): HResult; stdcall; + function QueryId(out Id: LPWSTR): HResult; stdcall; + function QueryAccept(const pmt: TAMMediaType): HResult; stdcall; + function EnumMediaTypes(out ppEnum: IEnumMediaTypes): HResult; stdcall; + function QueryInternalConnections(out apPin: IPin; var nPin: ULONG): HResult; stdcall; + function EndOfStream: HResult; stdcall; + function BeginFlush: HResult; stdcall; + function EndFlush: HResult; stdcall; + function NewSegment(tStart, tStop: TReferenceTime; dRate: double): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IEnumPins;'} + {$EXTERNALSYM IEnumPins} + IEnumPins = interface(IUnknown) + ['{56A86892-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IEnumPins methods ***) + function Next(cPins: ULONG; out ppPins: IPin; pcFetched: PULONG): HResult; stdcall; + function Skip(cPins: ULONG): HResult; stdcall; + function Reset: HResult; stdcall; + function Clone(out ppEnum: IEnumPins): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IEnumMediaTypes;'} + {$EXTERNALSYM IEnumMediaTypes} + IEnumMediaTypes = interface(IUnknown) + ['{89C31040-846B-11CE-97D3-00AA0055595A}'] + (*** IEnumMediaTypes methods ***) + function Next(cMediaTypes: ULONG; out ppMediaTypes: PAMMediaType; + pcFetched: PULONG): HResult; stdcall; + function Skip(cMediaTypes: ULONG): HResult; stdcall; + function Reset: HResult; stdcall; + function Clone(out ppEnum: IEnumMediaTypes): HResult; stdcall; + end; + + IEnumFilters = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IFilterGraph;'} + {$EXTERNALSYM IFilterGraph} + IFilterGraph = interface(IUnknown) + ['{56A8689F-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IFilterGraph methods ***) + function AddFilter(pFilter: IBaseFilter; pName: PWideChar): HResult; stdcall; + function RemoveFilter(pFilter: IBaseFilter): HResult; stdcall; + function EnumFilters(out ppEnum: IEnumFilters): HResult; stdcall; + function FindFilterByName(pName: PWideChar; out ppFilter: IBaseFilter): HResult; stdcall; + function ConnectDirect(ppinOut, ppinIn: IPin; pmt: PAMMediaType): HResult; stdcall; + function Reconnect(ppin: IPin): HResult; stdcall; + function Disconnect(ppin: IPin): HResult; stdcall; + function SetDefaultSyncSource: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IEnumFilters;'} + {$EXTERNALSYM IEnumFilters} + IEnumFilters = interface(IUnknown) + ['{56A86893-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IEnumFilters methods ***) + function Next(cFilters: ULONG; out ppFilter: IBaseFilter; + pcFetched: PULONG): HResult; stdcall; + function Skip(cFilters: ULONG): HResult; stdcall; + function Reset: HResult; stdcall; + function Clone(out ppEnum: IEnumFilters): HResult; stdcall; + end; + + _FilterState = ( + State_Stopped, + State_Paused, + State_Running + ); + {$EXTERNALSYM _FilterState} + FILTER_STATE = _FilterState; + {$EXTERNALSYM FILTER_STATE} + TFilterState = FILTER_STATE; + + {$NODEFINE IReferenceClock} + IReferenceClock = DirectSound.IReferenceClock; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaFilter;'} + {$EXTERNALSYM IMediaFilter} + IMediaFilter = interface(IPersist) + ['{56A86899-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IMediaFilter methods ***) + function Stop: HResult; stdcall; + function Pause: HResult; stdcall; + function Run(tStart: TReferenceTime): HResult; stdcall; + function GetState(dwMilliSecsTimeout: DWORD; out State: TFilterState): HResult; stdcall; + function SetSyncSource(pClock: IReferenceClock): HResult; stdcall; + function GetSyncSource(out pClock: IReferenceClock): HResult; stdcall; + end; + + _FilterInfo = record + achName : array[0..127] of WCHAR; + pGraph : IFilterGraph; + end; + {$EXTERNALSYM _FilterInfo} + FILTER_INFO = _FilterInfo; + {$EXTERNALSYM FILTER_INFO} + TFilterInfo = _FilterInfo; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBaseFilter;'} + {$EXTERNALSYM IBaseFilter} + IBaseFilter = interface(IMediaFilter) + ['{56A86895-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IBaseFilter methods ***) + function EnumPins(out ppEnum: IEnumPins): HResult; stdcall; + function FindPin(Id: PWideChar; out ppPin: IPin): HResult; stdcall; + function QueryFilterInfo(out pInfo: TFilterInfo): HResult; stdcall; + function JoinFilterGraph(pGraph: IFilterGraph; pName: PWideChar): HResult; stdcall; + function QueryVendorInfo(out pVendorInfo: PWideChar): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IReferenceClock2;'} + {$EXTERNALSYM IReferenceClock2} + IReferenceClock2 = interface(IReferenceClock) + ['{36B73885-C2C8-11CF-8B46-00805F6CEF60}'] + (*** IReferenceClock2 methods ***) + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaSample;'} + {$EXTERNALSYM IMediaSample} + IMediaSample = interface(IUnknown) + ['{56A8689A-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IMediaSample methods ***) + function GetPointer(out ppBuffer: PBYTE): HResult; stdcall; + function GetSize: Longint; stdcall; + function GetTime(out pTimeStart, pTimeEnd: TReferenceTime): HResult; stdcall; + function SetTime(pTimeStart, pTimeEnd: PReferenceTime): HResult; stdcall; + function IsSyncPoint: HResult; stdcall; + function SetSyncPoint(bIsSyncPoint: BOOL): HResult; stdcall; + function IsPreroll: HResult; stdcall; + function SetPreroll(bIsPreroll: BOOL): HResult; stdcall; + function GetActualDataLength: Longint; stdcall; + function SetActualDataLength(lLen: Longint): HResult; stdcall; + function GetMediaType(out ppMediaType: PAMMediaType): HResult; stdcall; + function SetMediaType(pMediaType: PAMMediaType): HResult; stdcall; + function IsDiscontinuity: HResult; stdcall; + function SetDiscontinuity(bDiscontinuity: BOOL): HResult; stdcall; + function GetMediaTime(out pTimeStart, pTimeEnd: int64): HResult; stdcall; + function SetMediaTime(pTimeStart, pTimeEnd: Pint64): HResult; stdcall; + end; + +const + AM_SAMPLE_SPLICEPOINT = $1; + {$EXTERNALSYM AM_SAMPLE_SPLICEPOINT} + AM_SAMPLE_PREROLL = $2; + {$EXTERNALSYM AM_SAMPLE_PREROLL} + AM_SAMPLE_DATADISCONTINUITY = $4; + {$EXTERNALSYM AM_SAMPLE_DATADISCONTINUITY} + AM_SAMPLE_TYPECHANGED = $8; + {$EXTERNALSYM AM_SAMPLE_TYPECHANGED} + AM_SAMPLE_TIMEVALID = $10; + {$EXTERNALSYM AM_SAMPLE_TIMEVALID} + AM_SAMPLE_TIMEDISCONTINUITY = $40; + {$EXTERNALSYM AM_SAMPLE_TIMEDISCONTINUITY} + AM_SAMPLE_FLUSH_ON_PAUSE = $80; + {$EXTERNALSYM AM_SAMPLE_FLUSH_ON_PAUSE} + AM_SAMPLE_STOPVALID = $100; + {$EXTERNALSYM AM_SAMPLE_STOPVALID} + AM_SAMPLE_ENDOFSTREAM = $200; + {$EXTERNALSYM AM_SAMPLE_ENDOFSTREAM} + AM_STREAM_MEDIA = 0; + {$EXTERNALSYM AM_STREAM_MEDIA} + AM_STREAM_CONTROL = 1; + {$EXTERNALSYM AM_STREAM_CONTROL} + +type + PAMSample2Properties = ^TAMSample2Properties; + tagAM_SAMPLE2_PROPERTIES = record + cbData: DWORD; + dwTypeSpecificFlags : DWORD; + dwSampleFlags : DWORD; + lActual : Longint; + tStart : Reference_Time; + tStop : Reference_Time; + dwStreamId : DWORD; + pMediaType : PAMMediaType; + pbBuffer : Pointer; + cbBuffer : Longint; + end; + {$EXTERNALSYM tagAM_SAMPLE2_PROPERTIES} + AM_SAMPLE2_PROPERTIES = tagAM_SAMPLE2_PROPERTIES; + {$EXTERNALSYM AM_SAMPLE2_PROPERTIES} + TAMSample2Properties = tagAM_SAMPLE2_PROPERTIES; + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaSample2;'} + {$EXTERNALSYM IMediaSample2} + IMediaSample2 = interface(IMediaSample) + ['{36B73884-C2C8-11CF-8B46-00805F6CEF60}'] + (*** IMediaSample2 methods ***) + function GetProperties(cbProperties: DWORD; out pbProperties): HResult; stdcall; + function SetProperties(cbProperties: DWORD; const pbProperties): HResult; stdcall; + end; + +const + AM_GBF_PREVFRAMESKIPPED = 1; + {$EXTERNALSYM AM_GBF_PREVFRAMESKIPPED} + AM_GBF_NOTASYNCPOINT = 2; + {$EXTERNALSYM AM_GBF_NOTASYNCPOINT} + AM_GBF_NOWAIT = 4; + {$EXTERNALSYM AM_GBF_NOWAIT} + AM_GBF_NODDSURFACELOCK = 8; + {$EXTERNALSYM AM_GBF_NODDSURFACELOCK} + +type + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMemAllocator;'} + {$EXTERNALSYM IMemAllocator} + IMemAllocator = interface(IUnknown) + ['{56A8689C-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IMemAllocator methods ***) + function SetProperties(var pRequest: TAllocatorProperties; + out pActual: TAllocatorProperties): HResult; stdcall; + function GetProperties(out pProps: TAllocatorProperties): HResult; stdcall; + function Commit: HResult; stdcall; + function Decommit: HResult; stdcall; + function GetBuffer(out ppBuffer: IMediaSample; + pStartTime, pEndTime: PReferenceTime; dwFlags: DWORD): HResult; stdcall; + function ReleaseBuffer(pBuffer: IMediaSample): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMemAllocatorNotifyCallbackTemp;'} + {$EXTERNALSYM IMemAllocatorNotifyCallbackTemp} + IMemAllocatorNotifyCallbackTemp = interface(IUnknown) + ['{92980b30-c1de-11d2-abf5-00a0c905f375}'] + (*** IMemAllocatorNotifyCallbackTemp methods ***) + function NotifyRelease: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMemAllocatorCallbackTemp;'} + {$EXTERNALSYM IMemAllocatorCallbackTemp} + IMemAllocatorCallbackTemp = interface(IMemAllocator) + ['{379a0cf0-c1de-11d2-abf5-00a0c905f375}'] + (*** IMemAllocatorCallbackTemp methods ***) + function SetNotify(pNotify: IMemAllocatorNotifyCallbackTemp): HResult; stdcall; + function GetFreeCount(out plBuffersFree: LongInt): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMemInputPin;'} + {$EXTERNALSYM IMemInputPin} + IMemInputPin = interface(IUnknown) + ['{56A8689D-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IMemInputPin methods ***) + function GetAllocator(out ppAllocator: IMemAllocator): HResult; stdcall; + function NotifyAllocator(pAllocator: IMemAllocator; bReadOnly: BOOL): HResult; stdcall; + function GetAllocatorRequirements(out pProps: TAllocatorProperties): HResult; stdcall; + function Receive(pSample: IMediaSample): HResult; stdcall; + function ReceiveMultiple(var pSamples: IMediaSample; nSamples: Longint; + out nSamplesProcessed: Longint): HResult; stdcall; + function ReceiveCanBlock: HResult; stdcall; + end; + + //Deprecated Interface + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMovieSetup;'} + {$EXTERNALSYM IAMovieSetup} + IAMovieSetup = interface(IUnknown) + ['{A3D8CEC0-7E5A-11CF-BBC5-00805F6CEF20}'] + (*** IAMovieSetup methods ***) + function Register: HResult; stdcall; + function Unregister: HResult; stdcall; + end; + +const + AM_SEEKING_NoPositioning = 0; + {$EXTERNALSYM AM_SEEKING_NoPositioning} + AM_SEEKING_AbsolutePositioning = $1; + {$EXTERNALSYM AM_SEEKING_AbsolutePositioning} + AM_SEEKING_RelativePositioning = $2; + {$EXTERNALSYM AM_SEEKING_RelativePositioning} + AM_SEEKING_IncrementalPositioning = $3; + {$EXTERNALSYM AM_SEEKING_IncrementalPositioning} + AM_SEEKING_PositioningBitsMask = $3; + {$EXTERNALSYM AM_SEEKING_PositioningBitsMask} + AM_SEEKING_SeekToKeyFrame = $4; + {$EXTERNALSYM AM_SEEKING_SeekToKeyFrame} + AM_SEEKING_ReturnTime = $8; + {$EXTERNALSYM AM_SEEKING_ReturnTime} + AM_SEEKING_Segment = $10; + {$EXTERNALSYM AM_SEEKING_Segment} + AM_SEEKING_NoFlush = $20; + {$EXTERNALSYM AM_SEEKING_NoFlush} + + AM_SEEKING_CanSeekAbsolute = $1; + {$EXTERNALSYM AM_SEEKING_CanSeekAbsolute} + AM_SEEKING_CanSeekForwards = $2; + {$EXTERNALSYM AM_SEEKING_CanSeekForwards} + AM_SEEKING_CanSeekBackwards = $4; + {$EXTERNALSYM AM_SEEKING_CanSeekBackwards} + AM_SEEKING_CanGetCurrentPos = $8; + {$EXTERNALSYM AM_SEEKING_CanGetCurrentPos} + AM_SEEKING_CanGetStopPos = $10; + {$EXTERNALSYM AM_SEEKING_CanGetStopPos} + AM_SEEKING_CanGetDuration = $20; + {$EXTERNALSYM AM_SEEKING_CanGetDuration} + AM_SEEKING_CanPlayBackwards = $40; + {$EXTERNALSYM AM_SEEKING_CanPlayBackwards} + AM_SEEKING_CanDoSegments = $80; + {$EXTERNALSYM AM_SEEKING_CanDoSegments} + AM_SEEKING_Source = $100; + {$EXTERNALSYM AM_SEEKING_Source} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaSeeking;'} + {$EXTERNALSYM IMediaSeeking} + IMediaSeeking = interface(IUnknown) + ['{36B73880-C2C8-11CF-8B46-00805F6CEF60}'] + (*** IMediaSeeking methods ***) + function GetCapabilities(out pCapabilities: DWORD): HResult; stdcall; + function CheckCapabilities(var pCapabilities: DWORD): HResult; stdcall; + function IsFormatSupported(const pFormat: TGUID): HResult; stdcall; + function QueryPreferredFormat(out pFormat: TGUID): HResult; stdcall; + function GetTimeFormat(out pFormat: TGUID): HResult; stdcall; + function IsUsingTimeFormat(const pFormat: TGUID): HResult; stdcall; + function SetTimeFormat(const pFormat: TGUID): HResult; stdcall; + function GetDuration(out pDuration: int64): HResult; stdcall; + function GetStopPosition(out pStop: int64): HResult; stdcall; + function GetCurrentPosition(out pCurrent: int64): HResult; stdcall; + function ConvertTimeFormat(out pTarget: int64; pTargetFormat: PGUID; + Source: int64; pSourceFormat: PGUID): HResult; stdcall; + function SetPositions(var pCurrent: int64; dwCurrentFlags: DWORD; + var pStop: int64; dwStopFlags: DWORD): HResult; stdcall; + function GetPositions(out pCurrent, pStop: int64): HResult; stdcall; + function GetAvailable(out pEarliest, pLatest: int64): HResult; stdcall; + function SetRate(dRate: double): HResult; stdcall; + function GetRate(out pdRate: double): HResult; stdcall; + function GetPreroll(out pllPreroll: int64): HResult; stdcall; + end; + +const + AM_MEDIAEVENT_NONOTIFY = $01; + {$EXTERNALSYM AM_MEDIAEVENT_NONOTIFY} + +type + PRegFilter = ^TRegFilter; + REGFILTER = record + Clsid: TGUID; + Name : LPWSTR; + end; + {$EXTERNALSYM REGFILTER} + TRegFilter = REGFILTER; + + //Deprecated Interface + {$HPPEMIT 'typedef System::DelphiInterface _di_IEnumRegFilters;'} + {$EXTERNALSYM IEnumRegFilters} + IEnumRegFilters = interface(IUnknown) + ['{56A868A4-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IEnumRegFilters methods ***) + function Next(cFilters: ULONG; out apRegFilter: TRegFilter; + out pcFetched: ULONG): HResult; stdcall; + function Skip(cFilters: ULONG): HResult; stdcall; + function Reset: HResult; stdcall; + function Clone(out ppEnum: IEnumRegFilters): HResult; stdcall; + end; + +const + MERIT_PREFERRED = $800000; + {$EXTERNALSYM MERIT_PREFERRED} + MERIT_NORMAL = $600000; + {$EXTERNALSYM MERIT_NORMAL} + MERIT_UNLIKELY = $400000; + {$EXTERNALSYM MERIT_UNLIKELY} + MERIT_DO_NOT_USE = $200000; + {$EXTERNALSYM MERIT_DO_NOT_USE} + MERIT_SW_COMPRESSOR = $100000; + {$EXTERNALSYM MERIT_SW_COMPRESSOR} + MERIT_HW_COMPRESSOR = $100050; + {$EXTERNALSYM MERIT_HW_COMPRESSOR} + +type + + //Deprecated Interface + {$HPPEMIT 'typedef System::DelphiInterface _di_IFilterMapper;'} + {$EXTERNALSYM IFilterMapper} + IFilterMapper = interface(IUnknown) + ['{56A868A3-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IFilterMapper methods ***) + function RegisterFilter(clsid: TGUID; Name: LPCWSTR; dwMerit: DWORD):HResult; stdcall; + function RegisterFilterInstance(clsid: TGUID; Name: LPCWSTR; out MRId: TGUID): HResult; stdcall; + function RegisterPin(Filter: TGUID; Name: LPCWSTR; + bRendered, bOutput, bZero, bMany: BOOL; ConnectsToFilter: TGUID; + ConnectsToPin: PWideChar): HResult; stdcall; + function RegisterPinType(clsFilter: TGUID; strName: LPCWSTR; + clsMajorType, clsSubType: TGUID): HResult; stdcall; + function UnregisterFilter(Filter: TGUID): HResult; stdcall; + function UnregisterFilterInstance(MRId: TGUID): HResult; stdcall; + function UnregisterPin(Filter: TGUID; Name: LPCWSTR): HResult; stdcall; + function EnumMatchingFilters(out ppEnum: IEnumRegFilters; dwMerit: DWORD; + bInputNeeded: BOOL; const clsInMaj, clsInSub: TGUID; + bRender, bOututNeeded: BOOL; const clsOutMaj, clsOutSub: TGUID): HResult; stdcall; + end; + + PRegPinTypes = ^TRegPinTypes; + REGPINTYPES = record + clsMajorType: PGUID; + clsMinorType: PGUID; + end; + {$EXTERNALSYM REGPINTYPES} + TRegPinTypes = REGPINTYPES; + + PRegFilterPins = ^TRegFilterPins; + REGFILTERPINS = record + strName : PWideChar; + bRendered : BOOL; + bOutput : BOOL; + bZero : BOOL; + bMany : BOOL; + oFilter : PGUID; + strConnectsToPin : PWideChar; + nMediaTypes : LongWord; + lpMediaType : PRegPinTypes; + end; + {$EXTERNALSYM REGFILTERPINS} + TRegFilterPins = REGFILTERPINS; + + PRegPinMedium = ^TRegPinMedium; + REGPINMEDIUM = record + clsMedium: TGUID; + dw1: DWORD; + dw2: DWORD; + end; + {$EXTERNALSYM REGPINMEDIUM} + TRegPinMedium = REGPINMEDIUM; + +const + REG_PINFLAG_B_ZERO = $1; + {$EXTERNALSYM REG_PINFLAG_B_ZERO} + REG_PINFLAG_B_RENDERER = $2; + {$EXTERNALSYM REG_PINFLAG_B_RENDERER} + REG_PINFLAG_B_MANY = $4; + {$EXTERNALSYM REG_PINFLAG_B_MANY} + REG_PINFLAG_B_OUTPUT = $8; + {$EXTERNALSYM REG_PINFLAG_B_OUTPUT} + +type + PRegFilterPins2 = ^TRegFilterPins2; + REGFILTERPINS2 = record + dwFlags : DWORD; + cInstances : UINT; + nMediaTypes : UINT; + lpMediaType : PRegPinTypes; + nMediums : UINT; + lpMedium : PRegPinMedium; + clsPinCategory : PGUID; + end; + {$EXTERNALSYM REGFILTERPINS2} + TRegFilterPins2 = REGFILTERPINS2; + + PRegFilter2 = ^TRegFilter2; + REGFILTER2 = record + dwVersion: DWORD; + dwMerit: DWORD; + case Integer of + 0: ( + cPins: ULONG; + rgPins: PRegFilterPins; + ); + 1: ( + cPins2: ULONG; + rgPins2: PRegFilterPins2; + ); + end; + {$EXTERNALSYM REGFILTER2} + TRegFilter2 = REGFILTER2; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IFilterMapper2;'} + {$EXTERNALSYM IFilterMapper2} + IFilterMapper2 = interface(IUnknown) + ['{B79BB0B0-33C1-11D1-ABE1-00A0C905F375}'] + (*** IFilterMapper2 methods ***) + function CreateCategory(const clsidCategory: TGUID; dwCategoryMerit: DWORD; + Description: PWideChar): HResult; stdcall; + function UnregisterFilter(const pclsidCategory: TGUID; + szInstance: PWideChar; const Filter: TGUID): HResult; stdcall; + function RegisterFilter(const clsidFilter: TGUID; Name: PWideChar; + ppMoniker: IMoniker; pclsidCategory: PGUID; + szInstance: PWideChar; const prf2: TRegFilter2): HResult; stdcall; + function EnumMatchingFilters(out ppEnum: IEnumMoniker; dwFlags: DWORD; bExactMatch: BOOL; + dwMerit: DWORD; bInputNeeded: BOOL; cInputTypes: DWORD; pInputTypes: PGUID; + pMedIn: PREGPINMEDIUM; pPinCategoryIn: PGUID; bRender, bOutputNeeded: BOOL; + cOutputTypes: DWORD; pOutputTypes: PGUID; pMedOut: PRegPinMedium; + pPinCategoryOut: PGUID): HResult; stdcall; + end; + + tagQualityMessageType = ( + Famine, + Flood + ); + {$EXTERNALSYM tagQualityMessageType} + QualityMessageType = tagQualityMessageType; + {$EXTERNALSYM QualityMessageType} + TQualityMessageType = QualityMessageType; + + PQuality = ^TQuality; + tagQuality = record + Typ : QualityMessageType; + Proportion : Longint; + Late : Reference_Time; + TimeStamp : Reference_Time; + end; + {$EXTERNALSYM tagQuality} + Quality = tagQuality; + {$EXTERNALSYM Quality} + TQuality = tagQuality; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IQualityControl;'} + {$EXTERNALSYM IQualityControl} + IQualityControl = interface(IUnknown) + ['{56A868A5-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IQualityControl methods ***) + function Notify(pSelf: IBaseFilter; q: TQuality): HResult; stdcall; + function SetSink(piqc: IQualityControl): HResult; stdcall; + end; + +const + CK_NOCOLORKEY = $0; + {$EXTERNALSYM CK_NOCOLORKEY} + CK_INDEX = $1; + {$EXTERNALSYM CK_INDEX} + CK_RGB = $2; + {$EXTERNALSYM CK_RGB} + +type + PColorKey = ^TColorKey; + tagCOLORKEY = record + KeyType : DWORD; + PaletteIndex : DWORD; + LowColorValue : COLORREF; + HighColorValue : COLORREF; + end; + {$EXTERNALSYM tagCOLORKEY} + COLORKEY = tagCOLORKEY; + {$EXTERNALSYM COLORKEY} + TColorKey = tagCOLORKEY; + +const + ADVISE_NONE = 0; + {$EXTERNALSYM ADVISE_NONE} + ADVISE_CLIPPING = $1; + {$EXTERNALSYM ADVISE_CLIPPING} + ADVISE_PALETTE = $2; + {$EXTERNALSYM ADVISE_PALETTE} + ADVISE_COLORKEY = $4; + {$EXTERNALSYM ADVISE_COLORKEY} + ADVISE_POSITION = $8; + {$EXTERNALSYM ADVISE_POSITION} + + ADVISE_ALL = ADVISE_CLIPPING or ADVISE_PALETTE or ADVISE_COLORKEY or ADVISE_POSITION; + {$EXTERNALSYM ADVISE_ALL} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IOverlayNotify;'} + {$EXTERNALSYM IOverlayNotify} + IOverlayNotify = interface(IUnknown) + ['{56A868A0-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IOverlayNotify methods ***) + function OnPaletteChange(dwColors: DWORD; const pPalette: PPALETTEENTRY): HResult; stdcall; + function OnClipChange(const pSourceRect, pDestinationRect: TRect; + const pRgnData: TRgnData): HResult; stdcall; + function OnColorKeyChange(const pColorKey: TColorKey): HResult; stdcall; + function OnPositionChange(const pSourceRect, pDestinationRect: TRect): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IOverlayNotify2;'} + {$EXTERNALSYM IOverlayNotify2} + IOverlayNotify2 = interface(IOverlayNotify) + ['{680EFA10-D535-11D1-87C8-00A0C9223196}'] + (*** IOverlayNotify2 methods ***) + function OnDisplayChange(var hMonitor: HMONITOR ): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IOverlay;'} + {$EXTERNALSYM IOverlay} + IOverlay = interface(IUnknown) + ['{56A868A1-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IOverlay methods ***) + function GetPalette(out pdwColors: DWORD; out ppPalette: PPALETTEENTRY): HResult; stdcall; + function SetPalette(dwColors: DWORD; var pPalette: PaletteEntry): HResult; stdcall; + function GetDefaultColorKey(out pColorKey: TColorKey): HResult; stdcall; + function GetColorKey(out pColorKey: TColorKey): HResult; stdcall; + function SetColorKey(var pColorKey: TColorKey): HResult; stdcall; + function GetWindowHandle(out pHwnd: HWND): HResult; stdcall; + function GetClipList(out pSourceRect, pDestinationRect: TRect; + out ppRgnData: PRgnData): HResult; stdcall; + function GetVideoPosition(out pSourceRect, pDestinationRect: TRect): HResult; stdcall; + function Advise(pOverlayNotify: IOverlayNotify; dwInterests: DWORD): HResult; stdcall; + function Unadvise: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaEventSink;'} + {$EXTERNALSYM IMediaEventSink} + IMediaEventSink = interface(IUnknown) + ['{56A868A2-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IMediaEventSink methods ***) + function Notify(EventCode, EventParam1, EventParam2: Longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IFileSourceFilter;'} + {$EXTERNALSYM IFileSourceFilter} + IFileSourceFilter = interface(IUnknown) + ['{56A868A6-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IFileSourceFilter methods ***) + function Load(pszFileName: PWCHAR; const pmt: PAMMediaType): HResult; stdcall; + function GetCurFile(out ppszFileName: PWideChar; pmt: PAMMediaType): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IFileSinkFilter;'} + {$EXTERNALSYM IFileSinkFilter} + IFileSinkFilter = interface(IUnknown) + ['{A2104830-7C70-11CF-8BCE-00AA00A3F1A6}'] + (*** IFileSinkFilter methods ***) + function SetFileName(pszFileName: PWideChar; pmt: PAMMediaType): HResult; stdcall; + function GetCurFile(out ppszFileName: PWideChar; pmt: PAMMediaType): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IFileSinkFilter2;'} + {$EXTERNALSYM IFileSinkFilter2} + IFileSinkFilter2 = interface(IFileSinkFilter) + ['{00855B90-CE1B-11D0-BD4F-00A0C911CE86}'] + (*** IFileSinkFilter2 methods ***) + function SetMode(dwFlags: DWORD): HResult; stdcall; + function GetMode(out pdwFlags: DWORD): HResult; stdcall; + end; + + AM_FILESINK_FLAGS = ( + {$IFNDEF COMPILER6_UP} + AM_FILE_INVALID_0 {= 0}, + AM_FILE_OVERWRITE {= 1} + {$ELSE} + AM_FILE_OVERWRITE = 1 + {$ENDIF} + ); + {$EXTERNALSYM AM_FILESINK_FLAGS} + TAMFileSinkFlags = AM_FILESINK_FLAGS; + + +// Very old !!!!! +// PAsyncIOReq = ^TAsyncIOReq; +// TAsyncIOReq = record +// engine: array[0..3] of DWORD; +// lpv: Pointer; +// cb: DWORD; +// dwError: DWORD; +// cbDone: DWORD; +// liPos: TLargeInteger; +// hEvent: DWORD; +// dwUser: DWORD; +// end; + +// IFileAsyncIO = interface(IUnknown) +// ['{56A868A7-0AD4-11CE-B03A-0020AF0BA770}'] +// function QueryAlignment(out pdwAlign: DWORD): HResult; stdcall; +// function Read(const pReq: TAsyncIOReq): HResult; stdcall; +// function Write(const pReq: TAsyncIOReq): HResult; stdcall; +// function WaitForNext(out ppReq: PAsyncIOReq; +// dwTimeout: DWORD): HResult; stdcall; +// function WaitForSpecific(out pReq: TAsyncIOReq; +// dwTimeout: DWORD): HResult; stdcall; +// function DiscardPending: HResult; stdcall; +// function Flush: HResult; stdcall; +// end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IGraphBuilder;'} + {$EXTERNALSYM IGraphBuilder} + IGraphBuilder = interface(IFilterGraph) + ['{56A868A9-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IGraphBuilder methods ***) + function Connect(ppinOut, ppinIn: IPin): HResult; stdcall; + function Render(ppinOut: IPin): HResult; stdcall; + function RenderFile(lpcwstrFile, lpcwstrPlayList: PWideChar): HResult; stdcall; + function AddSourceFilter(lpcwstrFileName, lpcwstrFilterName: LPCWSTR; + out ppFilter: IBaseFilter): HResult; stdcall; + function SetLogFile(hFile: THandle): HResult; stdcall; + function Abort: HResult; stdcall; + function ShouldOperationContinue: HResult; stdcall; + end; + + IAMCopyCaptureFileProgress = interface; + + //Deprecated Interface + {$HPPEMIT 'typedef System::DelphiInterface _di_ICaptureGraphBuilder;'} + {$EXTERNALSYM ICaptureGraphBuilder} + ICaptureGraphBuilder = interface(IUnknown) + ['{BF87B6E0-8C27-11D0-B3F0-00AA003761C5}'] + (*** ICaptureGraphBuilder methods ***) + function SetFiltergraph(pfg: IGraphBuilder): HResult; stdcall; + function GetFiltergraph(out ppfg: IGraphBuilder): HResult; stdcall; + function SetOutputFileName(const pType: TGUID; lpstrFile: PWCHAR; + out ppf: IBaseFilter; out ppSink: IFileSinkFilter): HResult; stdcall; + function FindInterface(pCategory: PGUID; pf: IBaseFilter; + const riid: TGUID; out ppint): HResult; stdcall; + function RenderStream(pCategory: PGUID; pSource: IUnknown; + pfCompressor, pfRenderer: IBaseFilter): HResult; stdcall; + function ControlStream(pCategory: PGUID; pFilter: IBaseFilter; + pstart, pstop: PReferenceTime; wStartCookie, wStopCookie: WORD): HResult; stdcall; + function AllocCapFile(lpstr: PWCHAR; dwlSize: int64): HResult; stdcall; + function CopyCaptureFile(lpwstrOld, lpwstrNew: PWCHAR; fAllowEscAbort: Integer; + pCallback: IAMCopyCaptureFileProgress): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_ICaptureGraphBuilder2;'} + {$EXTERNALSYM ICaptureGraphBuilder2} + ICaptureGraphBuilder2 = interface(IUnknown) + ['{93E5A4E0-2D50-11d2-ABFA-00A0C9C6E38D}'] + (*** ICaptureGraphBuilder2 methods ***) + function SetFiltergraph(pfg: IGraphBuilder): HResult; stdcall; + function GetFiltergraph(out ppfg: IGraphBuilder): HResult; stdcall; + function SetOutputFileName(const pType: TGUID; lpstrFile: PWCHAR; out ppf: IBaseFilter; out ppSink: IFileSinkFilter): HResult; stdcall; + function FindInterface(pCategory, pType: PGUID; pf: IBaseFilter; const riid: TGUID; out ppint): HResult; stdcall; + function RenderStream(pCategory, pType: PGUID; pSource: IUnknown; pfCompressor, pfRenderer: IBaseFilter): HResult; stdcall; + function ControlStream(pCategory, pType: PGUID; pFilter: IBaseFilter; pstart, pstop: PReferenceTime; wStartCookie, wStopCookie: WORD ): HResult; stdcall; + function AllocCapFile(lpstr: PWCHAR; dwlSize: int64): HResult; stdcall; + function CopyCaptureFile(lpwstrOld, lpwstrNew: PWCHAR; fAllowEscAbort: Integer; pCallback: IAMCopyCaptureFileProgress): HResult; stdcall; + function FindPin(pSource: IUnknown; pindir: TPINDIRECTION; const pCategory, pType: PGUID; fUnconnected: BOOL; num: integer; out ppPin: IPin): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMCopyCaptureFileProgress;'} + {$EXTERNALSYM IAMCopyCaptureFileProgress} + IAMCopyCaptureFileProgress = interface(IUnknown) + ['{670D1D20-A068-11D0-B3F0-00AA003761C5}'] + (*** IAMCopyCaptureFileProgress methods ***) + function Progress(iProgress: Integer): HResult; stdcall; + end; + +const + AM_RENDEREX_RENDERTOEXISTINGRENDERERS = $01; + {$EXTERNALSYM AM_RENDEREX_RENDERTOEXISTINGRENDERERS} + +type + + {$HPPEMIT 'typedef System::DelphiInterface _di_IFilterGraph2;'} + {$EXTERNALSYM IFilterGraph2} + IFilterGraph2 = interface(IGraphBuilder) + ['{36B73882-C2C8-11CF-8B46-00805F6CEF60}'] + (*** IFilterGraph2 methods ***) + function AddSourceFilterForMoniker(pMoniker: IMoniker; pCtx: IBindCtx; + lpcwstrFilterName: LPCWSTR; out ppFilter: IBaseFilter): HResult; stdcall; + function ReconnectEx(ppin: IPin; pmt: PAMMediaType): HResult; stdcall; + // Render a pin without adding any new renderers (pvContext = nil) + // not in the documentation ?? + function RenderEx(pPinOut: IPin; dwFlags: DWORD; pvContext: PDWORD): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IStreamBuilder;'} + {$EXTERNALSYM IStreamBuilder} + IStreamBuilder = interface(IUnknown) + ['{56A868BF-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IStreamBuilder methods ***) + function Render(ppinOut: IPin; pGraph: IGraphBuilder): HResult; stdcall; + function Backout(ppinOut: IPin; pGraph: IGraphBuilder): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAsyncReader;'} + {$EXTERNALSYM IAsyncReader} + IAsyncReader = interface(IUnknown) + ['{56A868AA-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IAsyncReader methods ***) + {nev: start} + function RequestAllocator(pPreferred: IMemAllocator; + pProps: PAllocatorProperties; out ppActual: IMemAllocator): HResult; stdcall; + {nev: end} + function Request(pSample: IMediaSample; dwUser: DWORD): HResult; stdcall; + function WaitForNext(dwTimeout: DWORD; out ppSample: IMediaSample; + out pdwUser: DWORD): HResult; stdcall; + function SyncReadAligned(pSample: IMediaSample): HResult; stdcall; + function SyncRead(llPosition: int64; lLength: Longint; pBuffer: Pbyte): HResult; stdcall; + function Length(out pTotal, pAvailable: int64): HResult; stdcall; + function BeginFlush: HResult; stdcall; + function EndFlush: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IGraphVersion;'} + {$EXTERNALSYM IGraphVersion} + IGraphVersion = interface(IUnknown) + ['{56A868AB-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IGraphVersion methods ***) + function QueryVersion(var pVersion: Longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IResourceConsumer;'} + {$EXTERNALSYM IResourceConsumer} + IResourceConsumer = interface(IUnknown) + ['{56A868AD-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IResourceConsumer methods ***) + function AcquireResource(idResource: Longint): HResult; stdcall; + function ReleaseResource(idResource: Longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IResourceManager;'} + {$EXTERNALSYM IResourceManager} + IResourceManager = interface(IUnknown) + ['{56A868AC-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IResourceManager methods ***) + function Register(pName: LPCWSTR; cResource: Longint; + out plToken: Longint): HResult; stdcall; + function RegisterGroup(pName: LPCWSTR; cResource: Longint; + palTokens: PLongint; out plToken: Longint): HResult; stdcall; + function RequestResource(idResource: Longint; pFocusObject: IUnknown; + pConsumer: IResourceConsumer): HResult; stdcall; + function NotifyAcquire(idResource: Longint; pConsumer: IResourceConsumer; + hr: HResult): HResult; stdcall; + function NotifyRelease(idResource: Longint; pConsumer: IResourceConsumer; + bStillWant: BOOL): HResult; stdcall; + function CancelRequest(idResource: Longint; pConsumer: IResourceConsumer): HResult; stdcall; + function SetFocus(pFocusObject: IUnknown): HResult; stdcall; + function ReleaseFocus(pFocusObject: IUnknown): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDistributorNotify;'} + {$EXTERNALSYM IDistributorNotify} + IDistributorNotify = interface(IUnknown) + ['{56A868AF-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IDistributorNotify methods ***) + function Stop: HResult; stdcall; + function Pause: HResult; stdcall; + function Run(tStart: TReferenceTime): HResult; stdcall; + function SetSyncSource(pClock: IReferenceClock): HResult; stdcall; + function NotifyGraphChange: HResult; stdcall; + end; + + AM_STREAM_INFO_FLAGS = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord; + {$EXTERNALSYM AM_STREAM_INFO_FLAGS} + const + AM_STREAM_INFO_START_DEFINED = $1; + {$EXTERNALSYM AM_STREAM_INFO_START_DEFINED} + AM_STREAM_INFO_STOP_DEFINED = $2; + {$EXTERNALSYM AM_STREAM_INFO_STOP_DEFINED} + AM_STREAM_INFO_DISCARDING = $4; + {$EXTERNALSYM AM_STREAM_INFO_DISCARDING} + AM_STREAM_INFO_STOP_SEND_EXTRA = $10; + {$EXTERNALSYM AM_STREAM_INFO_STOP_SEND_EXTRA} + +type + PAMStreamInfo = ^TAMStreamInfo; + AM_STREAM_INFO = record + tStart : Reference_Time; + tStop : Reference_Time; + dwStartCookie : DWORD; + dwStopCookie : DWORD; + dwFlags : DWORD; + end; + {$EXTERNALSYM AM_STREAM_INFO} + TAMStreamInfo = AM_STREAM_INFO; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMStreamControl;'} + {$EXTERNALSYM IAMStreamControl} + IAMStreamControl = interface(IUnknown) + ['{36b73881-c2c8-11cf-8b46-00805f6cef60}'] + (*** IAMStreamControl methods ***) + function StartAt(ptStart: PReferenceTime; dwCookie: DWORD): HResult; stdcall; + function StopAt(ptStop: PReferenceTime; bSendExtra: BOOL; + dwCookie: DWORD): HResult; stdcall; + function GetInfo(out pInfo: TAMStreamInfo): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_ISeekingPassThru;'} + {$EXTERNALSYM ISeekingPassThru} + ISeekingPassThru = interface(IUnknown) + ['{36B73883-C2C8-11CF-8B46-00805F6CEF60}'] + (*** ISeekingPassThru methods ***) + function Init(bSupportRendering: BOOL; pPin: IPin): HResult; stdcall; + end; + + PVideoStreamConfigCaps = ^TVideoStreamConfigCaps; + _VIDEO_STREAM_CONFIG_CAPS = record + guid: TGUID; + VideoStandard : ULONG; + InputSize : TSize; + MinCroppingSize : TSize; + MaxCroppingSize : TSize; + CropGranularityX : Integer; + CropGranularityY : Integer; + CropAlignX : Integer; + CropAlignY : Integer; + MinOutputSize : TSize; + MaxOutputSize : TSize; + OutputGranularityX : Integer; + OutputGranularityY : Integer; + StretchTapsX : Integer; + StretchTapsY : Integer; + ShrinkTapsX : Integer; + ShrinkTapsY : Integer; + MinFrameInterval : Int64; + MaxFrameInterval : Int64; + MinBitsPerSecond : Longint; + MaxBitsPerSecond : Longint; + end; + {$EXTERNALSYM _VIDEO_STREAM_CONFIG_CAPS} + VIDEO_STREAM_CONFIG_CAPS = _VIDEO_STREAM_CONFIG_CAPS; + {$EXTERNALSYM VIDEO_STREAM_CONFIG_CAPS} + TVideoStreamConfigCaps = _VIDEO_STREAM_CONFIG_CAPS; + + PAudioStreamConfigCaps = ^TAudioStreamConfigCaps; + _AUDIO_STREAM_CONFIG_CAPS = record + guid: TGUID; + MinimumChannels : ULONG; + MaximumChannels : ULONG; + ChannelsGranularity : ULONG; + MinimumBitsPerSample : ULONG; + MaximumBitsPerSample : ULONG; + BitsPerSampleGranularity : ULONG; + MinimumSampleFrequency : ULONG; + MaximumSampleFrequency : ULONG; + SampleFrequencyGranularity : ULONG; + end; + {$EXTERNALSYM _AUDIO_STREAM_CONFIG_CAPS} + AUDIO_STREAM_CONFIG_CAPS = _AUDIO_STREAM_CONFIG_CAPS; + {$EXTERNALSYM AUDIO_STREAM_CONFIG_CAPS} + TAudioStreamConfigCaps = _AUDIO_STREAM_CONFIG_CAPS; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMStreamConfig;'} + {$EXTERNALSYM IAMStreamConfig} + IAMStreamConfig = interface(IUnknown) + ['{C6E13340-30AC-11d0-A18C-00A0C9118956}'] + (*** IAMStreamConfig methods ***) + function SetFormat(const pmt: TAMMediaType): HResult; stdcall; + function GetFormat(out ppmt: PAMMediaType): HResult; stdcall; + function GetNumberOfCapabilities(out piCount, piSize: Integer): HResult; stdcall; + function GetStreamCaps(iIndex: Integer; out ppmt: PAMMediaType; + out pSCC): HResult; stdcall; + end; + + InterleavingMode = ( + INTERLEAVE_NONE, + INTERLEAVE_CAPTURE, + INTERLEAVE_FULL, + INTERLEAVE_NONE_BUFFERED + ); + {$EXTERNALSYM InterleavingMode} + TInterleavingMode = InterleavingMode; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IConfigInterleaving;'} + {$EXTERNALSYM IConfigInterleaving} + IConfigInterleaving = interface(IUnknown) + ['{BEE3D220-157B-11d0-BD23-00A0C911CE86}'] + (*** IConfigInterleaving methods ***) + function put_Mode(mode: TInterleavingMode): HResult; stdcall; + function get_Mode(out pMode: TInterleavingMode): HResult; stdcall; + function put_Interleaving(prtInterleave, prtPreroll: PReferenceTime): HResult; stdcall; + function get_Interleaving(out prtInterleave, prtPreroll: TReferenceTime): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IConfigAviMux;'} + {$EXTERNALSYM IConfigAviMux} + IConfigAviMux = interface(IUnknown) + ['{5ACD6AA0-F482-11ce-8B67-00AA00A3F1A6}'] + (*** IConfigAviMux methods ***) + function SetMasterStream(iStream: Longint): HResult; stdcall; + function GetMasterStream(out pStream: Longint): HResult; stdcall; + function SetOutputCompatibilityIndex(fOldIndex: BOOL): HResult; stdcall; + function GetOutputCompatibilityIndex(out pfOldIndex: BOOL): HResult; stdcall; + end; + +const + CompressionCaps_CanQuality = $1; + {$EXTERNALSYM CompressionCaps_CanQuality} + CompressionCaps_CanCrunch = $2; + {$EXTERNALSYM CompressionCaps_CanCrunch} + CompressionCaps_CanKeyFrame = $4; + {$EXTERNALSYM CompressionCaps_CanKeyFrame} + CompressionCaps_CanBFrame = $8; + {$EXTERNALSYM CompressionCaps_CanBFrame} + CompressionCaps_CanWindow = $10; + {$EXTERNALSYM CompressionCaps_CanWindow} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMVideoCompression;'} + {$EXTERNALSYM IAMVideoCompression} + IAMVideoCompression = interface(IUnknown) + ['{C6E13343-30AC-11d0-A18C-00A0C9118956}'] + (*** IAMVideoCompression methods ***) + function put_KeyFrameRate(KeyFrameRate: Longint): HResult; stdcall; + function get_KeyFrameRate(out pKeyFrameRate: Longint): HResult; stdcall; + function put_PFramesPerKeyFrame(PFramesPerKeyFrame: Longint): HResult; stdcall; + function get_PFramesPerKeyFrame(out pPFramesPerKeyFrame: Longint): HResult; stdcall; + function put_Quality(Quality: double): HResult; stdcall; + function get_Quality(out pQuality: double): HResult; stdcall; + function put_WindowSize(WindowSize: int64): HResult; stdcall; + function get_WindowSize(out pWindowSize: int64): HResult; stdcall; + function GetInfo(pszVersion: PWideChar; var pcbVersion: Integer; + pszDescription: PWideChar; var pcbDescription: Integer; + out pDefaultKeyFrameRate, pDefaultPFramesPerKey: Longint; + out pDefaultQuality: double; out pCapabilities: Longint): HResult; stdcall; + function OverrideKeyFrame(FrameNumber: Longint): HResult; stdcall; + function OverrideFrameSize(FrameNumber, Size: Longint): HResult; stdcall; + end; + +const + VfwCaptureDialog_Source = $1; + {$EXTERNALSYM VfwCaptureDialog_Source} + VfwCaptureDialog_Format = $2; + {$EXTERNALSYM VfwCaptureDialog_Format} + VfwCaptureDialog_Display = $4; + {$EXTERNALSYM VfwCaptureDialog_Display} + + VfwCompressDialog_Config = $1; + {$EXTERNALSYM VfwCompressDialog_Config} + VfwCompressDialog_About = $2; + {$EXTERNALSYM VfwCompressDialog_About} + + VfwCompressDialog_QueryConfig = $4; + {$EXTERNALSYM VfwCompressDialog_QueryConfig} + VfwCompressDialog_QueryAbout = $8; + {$EXTERNALSYM VfwCompressDialog_QueryAbout} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMVfwCaptureDialogs;'} + {$EXTERNALSYM IAMVfwCaptureDialogs} + IAMVfwCaptureDialogs = interface(IUnknown) + ['{D8D715A0-6E5E-11D0-B3F0-00AA003761C5}'] + (*** IAMVfwCaptureDialogs methods ***) + function HasDialog(iDialog: Integer): HResult; stdcall; + function ShowDialog(iDialog: Integer; hwnd: HWND): HResult; stdcall; + function SendDriverMessage(iDialog: Integer; uMsg: Integer; + dw1, dw2: Longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMVfwCompressDialogs;'} + {$EXTERNALSYM IAMVfwCompressDialogs} + IAMVfwCompressDialogs = interface(IUnknown) + ['{D8D715A3-6E5E-11D0-B3F0-00AA003761C5}'] + (*** IAMVfwCompressDialogs methods ***) + function ShowDialog(iDialog: Integer; hwnd: HWND): HResult; stdcall; + function GetState(out pState; var pcbState: Integer): HResult; stdcall; + function SetState(var pState; cbState: Integer): HResult; stdcall; + function SendDriverMessage(uMsg: Integer; dw1, dw2: Longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMDroppedFrames;'} + {$EXTERNALSYM IAMDroppedFrames} + IAMDroppedFrames = interface(IUnknown) + ['{C6E13344-30AC-11d0-A18C-00A0C9118956}'] + (*** IAMDroppedFrames methods ***) + function GetNumDropped(out plDropped: Longint): HResult; stdcall; + function GetNumNotDropped(out plNotDropped: Longint): HResult; stdcall; + function GetDroppedInfo(lSize: Longint; out plArray: Longint; + out plNumCopied: Longint): HResult; stdcall; + function GetAverageFrameSize(out plAverageSize: Longint): HResult; stdcall; + end; + +const + AMF_AUTOMATICGAIN = -1; + {$EXTERNALSYM AMF_AUTOMATICGAIN} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMAudioInputMixer;'} + {$EXTERNALSYM IAMAudioInputMixer} + IAMAudioInputMixer = interface(IUnknown) + ['{54C39221-8380-11d0-B3F0-00AA003761C5}'] + (*** IAMAudioInputMixer methods ***) + function put_Enable(fEnable: BOOL): HResult; stdcall; + function get_Enable(out pfEnable: BOOL): HResult; stdcall; + function put_Mono(fMono: BOOL): HResult; stdcall; + function get_Mono(out pfMono: BOOL): HResult; stdcall; + function put_MixLevel(Level: double): HResult; stdcall; + function get_MixLevel(out pLevel: double): HResult; stdcall; + function put_Pan(Pan: double): HResult; stdcall; + function get_Pan(out pPan: double): HResult; stdcall; + function put_Loudness(fLoudness: BOOL): HResult; stdcall; + function get_Loudness(out pfLoudness: BOOL): HResult; stdcall; + function put_Treble(Treble: double): HResult; stdcall; + function get_Treble(out pTreble: double): HResult; stdcall; + function get_TrebleRange(out pRange: double): HResult; stdcall; + function put_Bass(Bass: double): HResult; stdcall; + function get_Bass(out pBass: double): HResult; stdcall; + function get_BassRange(out pRange: double): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMBufferNegotiation;'} + {$EXTERNALSYM IAMBufferNegotiation} + IAMBufferNegotiation = interface(IUnknown) + ['{56ED71A0-AF5F-11D0-B3F0-00AA003761C5}'] + (*** IAMBufferNegotiation methods ***) + function SuggestAllocatorProperties(const pprop: TAllocatorProperties): HResult; stdcall; + function GetAllocatorProperties(var pprop: TAllocatorProperties): HResult; stdcall; + end; + +const + AnalogVideo_None = 0; + {$EXTERNALSYM AnalogVideo_None} + AnalogVideo_NTSC_M = $1; + {$EXTERNALSYM AnalogVideo_NTSC_M} + AnalogVideo_NTSC_M_J = $2; + {$EXTERNALSYM AnalogVideo_NTSC_M_J} + AnalogVideo_NTSC_433 = $4; + {$EXTERNALSYM AnalogVideo_NTSC_433} + AnalogVideo_PAL_B = $10; + {$EXTERNALSYM AnalogVideo_PAL_B} + AnalogVideo_PAL_D = $20; + {$EXTERNALSYM AnalogVideo_PAL_D} + AnalogVideo_PAL_G = $40; + {$EXTERNALSYM AnalogVideo_PAL_G} + AnalogVideo_PAL_H = $80; + {$EXTERNALSYM AnalogVideo_PAL_H} + AnalogVideo_PAL_I = $100; + {$EXTERNALSYM AnalogVideo_PAL_I} + AnalogVideo_PAL_M = $200; + {$EXTERNALSYM AnalogVideo_PAL_M} + AnalogVideo_PAL_N = $400; + {$EXTERNALSYM AnalogVideo_PAL_N} + AnalogVideo_PAL_60 = $800; + {$EXTERNALSYM AnalogVideo_PAL_60} + AnalogVideo_SECAM_B = $1000; + {$EXTERNALSYM AnalogVideo_SECAM_B} + AnalogVideo_SECAM_D = $2000; + {$EXTERNALSYM AnalogVideo_SECAM_D} + AnalogVideo_SECAM_G = $4000; + {$EXTERNALSYM AnalogVideo_SECAM_G} + AnalogVideo_SECAM_H = $8000; + {$EXTERNALSYM AnalogVideo_SECAM_H} + AnalogVideo_SECAM_K = $10000; + {$EXTERNALSYM AnalogVideo_SECAM_K} + AnalogVideo_SECAM_K1 = $20000; + {$EXTERNALSYM AnalogVideo_SECAM_K1} + AnalogVideo_SECAM_L = $40000; + {$EXTERNALSYM AnalogVideo_SECAM_L} + AnalogVideo_SECAM_L1 = $80000; + {$EXTERNALSYM AnalogVideo_SECAM_L1} + + AnalogVideo_NTSC_Mask = $00000007; + {$EXTERNALSYM AnalogVideo_NTSC_Mask} + AnalogVideo_PAL_Mask = $00000FF0; + {$EXTERNALSYM AnalogVideo_PAL_Mask} + AnalogVideo_SECAM_Mask = $000FF000; + {$EXTERNALSYM AnalogVideo_SECAM_Mask} + +type + tagTunerInputType =( + TunerInputCable, + TunerInputAntenna + ); + {$EXTERNALSYM tagTunerInputType} + TunerInputType = tagTunerInputType; + {$EXTERNALSYM TunerInputType} + TTunerInputType = TunerInputType; + + VideoCopyProtectionType = ( + VideoCopyProtectionMacrovisionBasic, + VideoCopyProtectionMacrovisionCBI + ); + {$EXTERNALSYM VideoCopyProtectionType} + TVideoCopyProtectionType = VideoCopyProtectionType; + + TPhysicalConnectorType = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + const + PhysConn_Video_Tuner = 1; + {$EXTERNALSYM PhysConn_Video_Tuner} + PhysConn_Video_Composite = PhysConn_Video_Tuner + 1; + {$EXTERNALSYM PhysConn_Video_Composite} + PhysConn_Video_SVideo = PhysConn_Video_Composite + 1; + {$EXTERNALSYM PhysConn_Video_SVideo} + PhysConn_Video_RGB = PhysConn_Video_SVideo + 1; + {$EXTERNALSYM PhysConn_Video_RGB} + PhysConn_Video_YRYBY = PhysConn_Video_RGB + 1; + {$EXTERNALSYM PhysConn_Video_YRYBY} + PhysConn_Video_SerialDigital = PhysConn_Video_YRYBY + 1; + {$EXTERNALSYM PhysConn_Video_SerialDigital} + PhysConn_Video_ParallelDigital = PhysConn_Video_SerialDigital + 1; + {$EXTERNALSYM PhysConn_Video_ParallelDigital} + PhysConn_Video_SCSI = PhysConn_Video_ParallelDigital + 1; + {$EXTERNALSYM PhysConn_Video_SCSI} + PhysConn_Video_AUX = PhysConn_Video_SCSI + 1; + {$EXTERNALSYM PhysConn_Video_AUX} + PhysConn_Video_1394 = PhysConn_Video_AUX + 1; + {$EXTERNALSYM PhysConn_Video_1394} + PhysConn_Video_USB = PhysConn_Video_1394 + 1; + {$EXTERNALSYM PhysConn_Video_USB} + PhysConn_Video_VideoDecoder = PhysConn_Video_USB + 1; + {$EXTERNALSYM PhysConn_Video_VideoDecoder} + PhysConn_Video_VideoEncoder = PhysConn_Video_VideoDecoder + 1; + {$EXTERNALSYM PhysConn_Video_VideoEncoder} + PhysConn_Video_SCART = PhysConn_Video_VideoEncoder + 1; + {$EXTERNALSYM PhysConn_Video_SCART} + PhysConn_Video_Black = PhysConn_Video_SCART + 1; + {$EXTERNALSYM PhysConn_Video_Black} + PhysConn_Audio_Tuner = $1000; + {$EXTERNALSYM PhysConn_Audio_Tuner} + PhysConn_Audio_Line = PhysConn_Audio_Tuner + 1; + {$EXTERNALSYM PhysConn_Audio_Line} + PhysConn_Audio_Mic = PhysConn_Audio_Line + 1; + {$EXTERNALSYM PhysConn_Audio_Mic} + PhysConn_Audio_AESDigital = PhysConn_Audio_Mic + 1; + {$EXTERNALSYM PhysConn_Audio_AESDigital} + PhysConn_Audio_SPDIFDigital = PhysConn_Audio_AESDigital + 1; + {$EXTERNALSYM PhysConn_Audio_SPDIFDigital} + PhysConn_Audio_SCSI = PhysConn_Audio_SPDIFDigital + 1; + {$EXTERNALSYM PhysConn_Audio_SCSI} + PhysConn_Audio_AUX = PhysConn_Audio_SCSI + 1; + {$EXTERNALSYM PhysConn_Audio_AUX} + PhysConn_Audio_1394 = PhysConn_Audio_AUX + 1; + {$EXTERNALSYM PhysConn_Audio_1394} + PhysConn_Audio_USB = PhysConn_Audio_1394 + 1; + {$EXTERNALSYM PhysConn_Audio_USB} + PhysConn_Audio_AudioDecoder = PhysConn_Audio_USB + 1; + {$EXTERNALSYM PhysConn_Audio_AudioDecoder} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMAnalogVideoDecoder;'} + {$EXTERNALSYM IAMAnalogVideoDecoder} + IAMAnalogVideoDecoder = interface(IUnknown) + ['{C6E13350-30AC-11d0-A18C-00A0C9118956}'] + (*** IAMAnalogVideoDecoder methods ***) + function get_AvailableTVFormats(out lAnalogVideoStandard: Longint): HResult; stdcall; + function put_TVFormat(lAnalogVideoStandard: Longint): HResult; stdcall; + function get_TVFormat(out plAnalogVideoStandard: Longint): HResult; stdcall; + function get_HorizontalLocked(out plLocked: Longint): HResult; stdcall; + function put_VCRHorizontalLocking(lVCRHorizontalLocking: Longint): HResult; stdcall; + function get_VCRHorizontalLocking(out plVCRHorizontalLocking: Longint): HResult; stdcall; + function get_NumberOfLines(out plNumberOfLines: Longint): HResult; stdcall; + function put_OutputEnable(lOutputEnable: LongBool): HResult; stdcall; + function get_OutputEnable(out plOutputEnable: LongBool): HResult; stdcall; + end; + + tagVideoProcAmpProperty = ( + VideoProcAmp_Brightness, + VideoProcAmp_Contrast, + VideoProcAmp_Hue, + VideoProcAmp_Saturation, + VideoProcAmp_Sharpness, + VideoProcAmp_Gamma, + VideoProcAmp_ColorEnable, + VideoProcAmp_WhiteBalance, + VideoProcAmp_BacklightCompensation, + VideoProcAmp_Gain + ); + {$EXTERNALSYM tagVideoProcAmpProperty} + VideoProcAmpProperty = tagVideoProcAmpProperty; + {$EXTERNALSYM VideoProcAmpProperty} + TVideoProcAmpProperty = VideoProcAmpProperty; + + tagVideoProcAmpFlags = ( + {$IFNDEF COMPILER6_UP} + VideoProcAmp_Flags_INVALID_0, + VideoProcAmp_Flags_Manual, + VideoProcAmp_Flags_Auto + {$ELSE} + VideoProcAmp_Flags_Manual = 1, + VideoProcAmp_Flags_Auto + {$ENDIF} + ); + {$EXTERNALSYM tagVideoProcAmpFlags} + VideoProcAmpFlags = tagVideoProcAmpFlags; + {$EXTERNALSYM VideoProcAmpFlags} + TVideoProcAmpFlags = VideoProcAmpFlags; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMVideoProcAmp;'} + {$EXTERNALSYM IAMVideoProcAmp} + IAMVideoProcAmp = interface(IUnknown) + ['{C6E13360-30AC-11d0-A18C-00A0C9118956}'] + (*** IAMVideoProcAmp methods ***) + function GetRange(Property_:TVideoProcAmpProperty; out pMin, pMax, pSteppingDelta, + pDefault: Longint; out pCapsFlags: TVideoProcAmpFlags): HResult; stdcall; + function Set_(Property_: TVideoProcAmpProperty; lValue: Longint; + Flags: TVideoProcAmpFlags): HResult; stdcall; + function Get(Property_: TVideoProcAmpProperty; out lValue: Longint; + out Flags: TVideoProcAmpFlags): HResult; stdcall; + end; + + tagCameraControlProperty = ( + CameraControl_Pan, + CameraControl_Tilt, + CameraControl_Roll, + CameraControl_Zoom, + CameraControl_Exposure, + CameraControl_Iris, + CameraControl_Focus + ); + {$EXTERNALSYM tagCameraControlProperty} + CameraControlProperty = tagCameraControlProperty; + {$EXTERNALSYM CameraControlProperty} + TCameraControlProperty = CameraControlProperty; + + tagCameraControlFlags = ( + {$IFNDEF COMPILER6_UP} + CameraControl_Flags_INVALID_0, + CameraControl_Flags_Manual, + CameraControl_Flags_Auto + {$ELSE} + CameraControl_Flags_Manual = 1, + CameraControl_Flags_Auto + {$ENDIF} + ); + {$EXTERNALSYM tagCameraControlFlags} + CameraControlFlags = tagCameraControlFlags; + {$EXTERNALSYM CameraControlFlags} + TCameraControlFlags = CameraControlFlags; + + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMCameraControl;'} + {$EXTERNALSYM IAMCameraControl} + IAMCameraControl = interface(IUnknown) + ['{C6E13370-30AC-11d0-A18C-00A0C9118956}'] + (*** IAMCameraControl methods ***) + function GetRange(Property_: TCameraControlProperty; + out pMin, pMax, pSteppingDelta, pDefault, pCapsFlags: Longint): HResult; stdcall; + function Set_(Property_: TCameraControlProperty; lValue: Longint; + Flags: TCameraControlFlags): HResult; stdcall; + function Get(Property_: TCameraControlProperty; out lValue: Longint; + out Flags: TCameraControlFlags): HResult; stdcall; + end; + +const + VideoControlFlag_FlipHorizontal = $1; + {$EXTERNALSYM VideoControlFlag_FlipHorizontal} + VideoControlFlag_FlipVertical = $2; + {$EXTERNALSYM VideoControlFlag_FlipVertical} + VideoControlFlag_ExternalTriggerEnable = $4; + {$EXTERNALSYM VideoControlFlag_ExternalTriggerEnable} + VideoControlFlag_Trigger = $8; + {$EXTERNALSYM VideoControlFlag_Trigger} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMVideoControl;'} + {$EXTERNALSYM IAMVideoControl} + IAMVideoControl = interface(IUnknown) + ['{6a2e0670-28e4-11d0-a18c-00a0c9118956}'] + (*** IAMVideoControl methods ***) + function GetCaps(pPin: IPin; out pCapsFlags: Longint): HResult; stdcall; + function SetMode(pPin: IPin; Mode: Longint): HResult; stdcall; + function GetMode(pPin: IPin; out Mode: Longint): HResult; stdcall; + function GetCurrentActualFrameRate(pPin: IPin; out ActualFrameRate: Int64): HResult; stdcall; + function GetMaxAvailableFrameRate(pPin: IPin; iIndex: Longint; Dimensions: TSize; out MaxAvailableFrameRate: Int64): HResult; stdcall; + function GetFrameRateList(pPin: IPin; iIndex: Longint; Dimensions: TSize; out ListSize: Longint; out FrameRates: PInt64): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMCrossbar;'} + {$EXTERNALSYM IAMCrossbar} + IAMCrossbar = interface(IUnknown) + ['{C6E13380-30AC-11d0-A18C-00A0C9118956}'] + (*** IAMCrossbar methods ***) + function get_PinCounts(out OutputPinCount, InputPinCount: Longint): HResult; stdcall; + function CanRoute(OutputPinIndex, InputPinIndex: Longint): HResult; stdcall; + function Route(OutputPinIndex, InputPinIndex: Longint): HResult; stdcall; + function get_IsRoutedTo(OutputPinIndex: Longint; + out InputPinIndex: Longint): HResult; stdcall; + function get_CrossbarPinInfo(IsInputPin: BOOL; PinIndex: Longint; + out PinIndexRelated : longint; out PhysicalType: TPhysicalConnectorType): HResult; stdcall; + end; + +type + {$IFNDEF COMPILER6_UP} + tagAMTunerSubChannel = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + const + AMTUNER_SUBCHAN_NO_TUNE = -2; + {$EXTERNALSYM AMTUNER_SUBCHAN_NO_TUNE} + AMTUNER_SUBCHAN_DEFAULT = -1; + {$EXTERNALSYM AMTUNER_SUBCHAN_DEFAULT} + {$ELSE} + tagAMTunerSubChannel = ( + AMTUNER_SUBCHAN_NO_TUNE = -2, + AMTUNER_SUBCHAN_DEFAULT = -1 + ); + {$ENDIF} +type + {$EXTERNALSYM tagAMTunerSubChannel} + AMTunerSubChannel = tagAMTunerSubChannel; + {$EXTERNALSYM AMTunerSubChannel} + TAMTunerSubChannel = AMTunerSubChannel; + +type + {$IFNDEF COMPILER6_UP} + tagAMTunerSignalStrength = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + const + AMTUNER_HASNOSIGNALSTRENGTH = -1; + {$EXTERNALSYM AMTUNER_HASNOSIGNALSTRENGTH} + AMTUNER_NOSIGNAL = 0; + {$EXTERNALSYM AMTUNER_NOSIGNAL} + AMTUNER_SIGNALPRESENT = 1; + {$EXTERNALSYM AMTUNER_SIGNALPRESENT} + {$ELSE} + tagAMTunerSignalStrength = ( + AMTUNER_HASNOSIGNALSTRENGTH = -1, + AMTUNER_NOSIGNAL = 0, + AMTUNER_SIGNALPRESENT = 1 + ); + {$ENDIF} +type + {$EXTERNALSYM tagAMTunerSignalStrength} + AMTunerSignalStrength = tagAMTunerSignalStrength; + {$EXTERNALSYM AMTunerSignalStrength} + TAMTunerSignalStrength = AMTunerSignalStrength; + +type + {$IFNDEF COMPILER6_UP} + tagAMTunerModeType = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + const + AMTUNER_MODE_DEFAULT = 0; + {$EXTERNALSYM AMTUNER_MODE_DEFAULT} + AMTUNER_MODE_TV = 1; + {$EXTERNALSYM AMTUNER_MODE_TV} + AMTUNER_MODE_FM_RADIO = 2; + {$EXTERNALSYM AMTUNER_MODE_FM_RADIO} + AMTUNER_MODE_AM_RADIO = 4; + {$EXTERNALSYM AMTUNER_MODE_AM_RADIO} + AMTUNER_MODE_DSS = 8; + {$EXTERNALSYM AMTUNER_MODE_DSS} + {$ELSE} + tagAMTunerModeType = ( + AMTUNER_MODE_DEFAULT = 0, + AMTUNER_MODE_TV = 1, + AMTUNER_MODE_FM_RADIO = 2, + AMTUNER_MODE_AM_RADIO = 4, + AMTUNER_MODE_DSS = 8 + ); + {$ENDIF} +type + {$EXTERNALSYM tagAMTunerModeType} + AMTunerModeType = tagAMTunerModeType; + {$EXTERNALSYM AMTunerModeType} + TAMTunerModeType = AMTunerModeType; + +type + tagAMTunerEventType = ( + {$IFNDEF COMPILER6_UP} + AMTUNER_EVENT_INVALID_0, + AMTUNER_EVENT_CHANGED + {$ELSE} + AMTUNER_EVENT_CHANGED = 1 + {$ENDIF} + ); + {$EXTERNALSYM tagAMTunerEventType} + AMTunerEventType = tagAMTunerEventType; + {$EXTERNALSYM AMTunerEventType} + TAMTunerEventType = AMTunerEventType; + + IAMTunerNotification = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTuner;'} + {$EXTERNALSYM IAMTuner} + IAMTuner = interface(IUnknown) + ['{211A8761-03AC-11d1-8D13-00AA00BD8339}'] + (*** IAMTuner methods ***) + function put_Channel(lChannel, lVideoSubChannel, lAudioSubChannel: Longint): HResult; stdcall; + function get_Channel(out lChannel, lVideoSubChannel, lAudioSubChannel: Longint): HResult; stdcall; + function ChannelMinMax(out lChannelMin, lChannelMax: Longint): HResult; stdcall; + function put_CountryCode(lCountryCode: Longint): HResult; stdcall; + function get_CountryCode(out lCountryCode: Longint): HResult; stdcall; + function put_TuningSpace(lTuningSpace: Longint): HResult; stdcall; + function get_TuningSpace(out lTuningSpace: Longint): HResult; stdcall; + function Logon(hCurrentUser: THandle): HResult; stdcall; + function Logout: HResult; stdcall; + function SignalPresent(out plSignalStrength: Longint): HResult; stdcall; + function put_Mode(lMode: TAMTunerModeType): HResult; stdcall; + function get_Mode(out plMode: TAMTunerModeType): HResult; stdcall; + function GetAvailableModes(out plModes: Longint): HResult; stdcall; + function RegisterNotificationCallBack(pNotify: IAMTunerNotification; + lEvents: Longint): HResult; stdcall; + function UnRegisterNotificationCallBack(pNotify: IAMTunerNotification): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTunerNotification;'} + {$EXTERNALSYM IAMTunerNotification} + IAMTunerNotification = interface(IUnknown) + ['{211A8760-03AC-11d1-8D13-00AA00BD8339}'] + (*** IAMTunerNotification methods ***) + function OnEvent(Event: TAMTunerEventType): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTVTuner;'} + {$EXTERNALSYM IAMTVTuner} + IAMTVTuner = interface(IAMTuner) + ['{211A8766-03AC-11d1-8D13-00AA00BD8339}'] + (*** IAMTVTuner methods ***) + function get_AvailableTVFormats(out lAnalogVideoStandard: Longint): HResult; stdcall; + function get_TVFormat(out plAnalogVideoStandard: Longint): HResult; stdcall; + function AutoTune(lChannel: Longint; out plFoundSignal: Longint): HResult; stdcall; + function StoreAutoTune: HResult; stdcall; + function get_NumInputConnections(out plNumInputConnections: Longint): HResult; stdcall; + function put_InputType(lIndex: Longint; InputType: TTunerInputType): HResult; stdcall; + function get_InputType(lIndex: Longint; out InputType: TTunerInputType): HResult; stdcall; + function put_ConnectInput(lIndex: Longint): HResult; stdcall; + function get_ConnectInput(out plIndex: Longint): HResult; stdcall; + function get_VideoFrequency(out lFreq: Longint): HResult; stdcall; + function get_AudioFrequency(out lFreq: Longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBPCSatelliteTuner;'} + {$EXTERNALSYM IBPCSatelliteTuner} + IBPCSatelliteTuner = interface(IAMTuner) + ['{211A8765-03AC-11d1-8D13-00AA00BD8339}'] + (*** IBPCSatelliteTuner methods ***) + function get_DefaultSubChannelTypes(out plDefaultVideoType, plDefaultAudioType: Longint): HResult; stdcall; + function put_DefaultSubChannelTypes(lDefaultVideoType, lDefaultAudioType: Longint): HResult; stdcall; + function IsTapingPermitted: HResult; stdcall; + end; + + {$IFNDEF COMPILER6_UP} + tagTVAudioMode = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + const + AMTVAUDIO_MODE_MONO = $1; + {$EXTERNALSYM AMTVAUDIO_MODE_MONO} + AMTVAUDIO_MODE_STEREO = $2; + {$EXTERNALSYM AMTVAUDIO_MODE_STEREO} + AMTVAUDIO_MODE_LANG_A = $10; + {$EXTERNALSYM AMTVAUDIO_MODE_LANG_A} + AMTVAUDIO_MODE_LANG_B = $20; + {$EXTERNALSYM AMTVAUDIO_MODE_LANG_B} + AMTVAUDIO_MODE_LANG_C = $40; + {$EXTERNALSYM AMTVAUDIO_MODE_LANG_C} + {$ELSE} + tagTVAudioMode = ( + AMTVAUDIO_MODE_MONO = $1, + AMTVAUDIO_MODE_STEREO = $2, + AMTVAUDIO_MODE_LANG_A = $10, + AMTVAUDIO_MODE_LANG_B = $20, + AMTVAUDIO_MODE_LANG_C = $40 + ); + {$ENDIF} +type + {$EXTERNALSYM tagTVAudioMode} + TVAudioMode = tagTVAudioMode; + {$EXTERNALSYM TVAudioMode} + TTVAudioMode = TVAudioMode; + +type + + tagAMTVAudioEventType = ( + {$IFNDEF COMPILER6_UP} + AMTVAUDIO_EVENT_INVALID_0, + AMTVAUDIO_EVENT_CHANGED + {$ELSE} + AMTVAUDIO_EVENT_CHANGED = 1 + {$ENDIF} + ); + {$EXTERNALSYM tagAMTVAudioEventType} + AMTVAudioEventType = tagAMTVAudioEventType; + {$EXTERNALSYM AMTVAudioEventType} + TAMTVAudioEventType = AMTVAudioEventType; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTVAudio;'} + {$EXTERNALSYM IAMTVAudio} + IAMTVAudio = interface(IUnknown) + ['{83EC1C30-23D1-11d1-99E6-00A0C9560266}'] + (*** IAMTVAudio methods ***) + function GetHardwareSupportedTVAudioModes(out plModes: Longint): HResult; stdcall; + function GetAvailableTVAudioModes(out plModes: Longint): HResult; stdcall; + function get_TVAudioMode(out plMode: Longint): HResult; stdcall; + function put_TVAudioMode(lMode: Longint): HResult; stdcall; + function RegisterNotificationCallBack(pNotify: IAMTunerNotification; + lEvents: Longint): HResult; stdcall; + function UnRegisterNotificationCallBack(pNotify: IAMTunerNotification): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTVAudioNotification;'} + {$EXTERNALSYM IAMTVAudioNotification} + IAMTVAudioNotification = interface(IUnknown) + ['{83EC1C33-23D1-11D1-99E6-00A0C9560266}'] + (*** IAMTVAudioNotification methods ***) + function OnEvent(Event: TAMTVAudioEventType): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMAnalogVideoEncoder;'} + {$EXTERNALSYM IAMAnalogVideoEncoder} + IAMAnalogVideoEncoder = interface(IUnknown) + ['{C6E133B0-30AC-11d0-A18C-00A0C9118956}'] + (*** IAMAnalogVideoEncoder methods ***) + function get_AvailableTVFormats(out lAnalogVideoStandard: Longint): HResult; stdcall; + function put_TVFormat(lAnalogVideoStandard: Longint): HResult; stdcall; + function get_TVFormat(out plAnalogVideoStandard: Longint): HResult; stdcall; + function put_CopyProtection(lVideoCopyProtection: Longint): HResult; stdcall; + function get_CopyProtection(out lVideoCopyProtection: Longint): HResult; stdcall; + function put_CCEnable(lCCEnable: LongBool): HResult; stdcall; + function get_CCEnable(out lCCEnable: LongBool): HResult; stdcall; + end ; + + AMPROPERTY_PIN = ( + AMPROPERTY_PIN_CATEGORY, + AMPROPERTY_PIN_MEDIUM + ); + {$EXTERNALSYM AMPROPERTY_PIN} + TAMPropertyPin = AMPROPERTY_PIN; + +const + KSPROPERTY_SUPPORT_GET = 1; + {$EXTERNALSYM KSPROPERTY_SUPPORT_GET} + KSPROPERTY_SUPPORT_SET = 2; + {$EXTERNALSYM KSPROPERTY_SUPPORT_SET} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsPropertySet;'} + {$EXTERNALSYM IKsPropertySet} + IKsPropertySet = interface(IUnknown) + ['{31EFAC30-515C-11d0-A9AA-00AA0061BE93}'] + (*** IKsPropertySet methods ***) + function Set_(const guidPropSet: TGUID; dwPropID: TAMPropertyPin; + pInstanceData: pointer; cbInstanceData: DWORD; pPropData: pointer; cbPropData: DWORD): HResult; stdcall; + function Get(const guidPropSet: TGUID; dwPropID: TAMPropertyPin; + pInstanceData: pointer; cbInstanceData: DWORD; out pPropData ; cbPropData: DWORD; + out pcbReturned: DWORD): HResult; stdcall; + function QuerySupported(const guidPropSet: TGUID; dwPropID: TAMPropertyPin; + out pTypeSupport: DWORD): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaPropertyBag;'} + {$EXTERNALSYM IMediaPropertyBag} + IMediaPropertyBag = interface(IPropertyBag) + ['{6025A880-C0D5-11D0-BD4E-00A0C911CE86}'] + (*** IMediaPropertyBag methods ***) + function EnumProperty(iProperty: ULONG; var pvarPropertyName, + pvarPropertyValue: OleVariant): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IPersistMediaPropertyBag;'} + {$EXTERNALSYM IPersistMediaPropertyBag} + IPersistMediaPropertyBag = interface(IPersist) + ['{5738E040-B67F-11d0-BD4D-00A0C911CE86}'] + (*** IPersistMediaPropertyBag methods ***) + function InitNew: HResult; stdcall; + function Load(pPropBag: IMediaPropertyBag; pErrorLog: IErrorLog): HResult; stdcall; + function Save(pPropBag: IMediaPropertyBag; fClearDirty, fSaveAllProperties: BOOL): HResult; stdcall; + end; + + //Deprecated Interface + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMPhysicalPinInfo;'} + {$EXTERNALSYM IAMPhysicalPinInfo} + IAMPhysicalPinInfo = interface(IUnknown) + ['{F938C991-3029-11CF-8C44-00AA006B6814}'] + (*** IAMPhysicalPinInfo methods ***) + function GetPhysicalType(out pType: Longint; out ppszType: PWideChar): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMExtDevice;'} + {$EXTERNALSYM IAMExtDevice} + IAMExtDevice = interface(IUnknown) + ['{B5730A90-1A2C-11CF-8C23-00AA006B6814}'] + (*** IAMExtDevice methods ***) + function GetCapability(Capability: Longint; out pValue: Longint; out pdblValue: double): HResult; stdcall; + function get_ExternalDeviceID(out ppszData: PWideChar): HResult; stdcall; + function get_ExternalDeviceVersion(out ppszData: PWideChar): HResult; stdcall; + function put_DevicePower(PowerMode: Longint): HResult; stdcall; + function get_DevicePower(out pPowerMode: Longint): HResult; stdcall; + function Calibrate(hEvent: THandle; Mode: Longint; out pStatus: Longint): HResult; stdcall; + function put_DevicePort(DevicePort: Longint): HResult; stdcall; + function get_DevicePort(out pDevicePort: Longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMExtTransport;'} + {$EXTERNALSYM IAMExtTransport} + IAMExtTransport = interface(IUnknown) + ['{A03CD5F0-3045-11CF-8C44-00AA006B6814}'] + (*** IAMExtTransport methods ***) + function GetCapability(Capability: Longint; out pValue: Longint; out pdblValue: double): HResult; stdcall; + function put_MediaState(State: Longint): HResult; stdcall; + function get_MediaState(out pState: Longint): HResult; stdcall; + function put_LocalControl(State: Longint): HResult; stdcall; + function get_LocalControl(out pState: Longint): HResult; stdcall; + function GetStatus(StatusItem: Longint; out pValue: Longint): HResult; stdcall; + function GetTransportBasicParameters(Param: Longint; var pValue: Longint; ppszData: pointer): HResult; stdcall; + function SetTransportBasicParameters(Param: Longint; Value: Longint; pszData: PWideChar): HResult; stdcall; + function GetTransportVideoParameters(Param: Longint; out pValue: Longint): HResult; stdcall; + function SetTransportVideoParameters(Param: Longint; Value: Longint): HResult; stdcall; + function GetTransportAudioParameters(Param: Longint; out pValue: Longint): HResult; stdcall; + function SetTransportAudioParameters(Param: Longint; Value: Longint): HResult; stdcall; + function put_Mode(Mode: Longint): HResult; stdcall; + function get_Mode(out pMode: Longint): HResult; stdcall; + function put_Rate(dblRate: double): HResult; stdcall; + function get_Rate(out pdblRate: double): HResult; stdcall; + function GetChase(out pEnabled, pOffset: Longint; var phEvent: THandle): HResult; stdcall; + function SetChase(Enable, Offset: Longint; hEvent: THandle): HResult; stdcall; + function GetBump(out pSpeed, pDuration: Longint): HResult; stdcall; + function SetBump(Speed, Duration: Longint): HResult; stdcall; + function get_AntiClogControl(out pEnabled: Longint): HResult; stdcall; + function put_AntiClogControl(Enable: Longint): HResult; stdcall; + function GetEditPropertySet(EditID: Longint; out pState: Longint): HResult; stdcall; + function SetEditPropertySet(var pEditID: Longint; State: Longint): HResult; stdcall; + function GetEditProperty(EditID, Param: Longint; out pValue: Longint): HResult; stdcall; + function SetEditProperty(EditID, Param, Value: Longint): HResult; stdcall; + function get_EditStart(out pValue: Longint): HResult; stdcall; + function put_EditStart(Value: Longint): HResult; stdcall; + end; + + PTimeCode = ^TTimeCode; + _timecode = record + wFrameRate : Word; + wFrameFract : Word; + dwFrames : DWORD; + end; + {$EXTERNALSYM _timecode} + TIMECODE = _timecode; + {$EXTERNALSYM TIMECODE} + TTimeCode = _timecode; + + PTimeCodeSample = ^TTimeCodeSample; + tagTIMECODE_SAMPLE = record + qwTick : Int64; + timecode : TIMECODE; + dwUser : DWORD; + dwFlags : DWORD; + end; + {$EXTERNALSYM tagTIMECODE_SAMPLE} + TIMECODE_SAMPLE = tagTIMECODE_SAMPLE; + {$EXTERNALSYM TIMECODE_SAMPLE} + TTimeCodeSample = tagTIMECODE_SAMPLE; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTimecodeReader;'} + {$EXTERNALSYM IAMTimecodeReader} + IAMTimecodeReader = interface(IUnknown) + ['{9B496CE1-811B-11CF-8C77-00AA006B6814}'] + (*** IAMTimecodeReader methods ***) + function GetTCRMode(Param: Longint; out pValue: Longint): HResult; stdcall; + function SetTCRMode(Param: Longint; Value: Longint): HResult; stdcall; + function put_VITCLine(Line: Longint): HResult; stdcall; + function get_VITCLine(out pLine: Longint): HResult; stdcall; + function GetTimecode(out pTimecodeSample: TTimeCodeSample): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTimecodeGenerator;'} + {$EXTERNALSYM IAMTimecodeGenerator} + IAMTimecodeGenerator = interface(IUnknown) + ['{9B496CE0-811B-11CF-8C77-00AA006B6814}'] + (*** IAMTimecodeGenerator methods ***) + function GetTCGMode(Param: Longint; out pValue: Longint): HResult; stdcall; + function SetTCGMode(Param: Longint; Value: Longint): HResult; stdcall; + function put_VITCLine(Line: Longint): HResult; stdcall; + function get_VITCLine(out Line: Longint): HResult; stdcall; + function SetTimecode(var pTimecodeSample: TTimeCodeSample): HResult; stdcall; + function GetTimecode(out pTimecodeSample: TTimeCodeSample): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTimecodeDisplay;'} + {$EXTERNALSYM IAMTimecodeDisplay} + IAMTimecodeDisplay = interface(IUnknown) + ['{9B496CE2-811B-11CF-8C77-00AA006B6814}'] + (*** IAMTimecodeDisplay methods ***) + function GetTCDisplayEnable(out pState: Longint): HResult; stdcall; + function SetTCDisplayEnable(State: Longint): HResult; stdcall; + function GetTCDisplay(Param: Longint; out pValue: Longint): HResult; stdcall; + function SetTCDisplay(Param, Value: Longint): HResult; stdcall; + end; + + //Deprecated Interface + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMDevMemoryAllocator;'} + {$EXTERNALSYM IAMDevMemoryAllocator} + IAMDevMemoryAllocator = interface(IUnknown) + ['{C6545BF0-E76B-11D0-BD52-00A0C911CE86}'] + (*** IAMDevMemoryAllocator methods ***) + function GetInfo(out pdwcbTotalFree, pdwcbLargestFree, pdwcbTotalMemory, pdwcbMinimumChunk: DWORD): HResult; stdcall; + function CheckMemory(pBuffer: Pointer): HResult; stdcall; + function Alloc(out ppBuffer: Pointer; var pdwcbBuffer: DWORD): HResult; stdcall; + function Free(pBuffer: Pointer): HResult; stdcall; + function GetDevMemoryObject(out ppUnkInnner: IUnknown; pUnkOuter: IUnknown): HResult; stdcall; + end; + + //Deprecated Interface + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMDevMemoryControl;'} + {$EXTERNALSYM IAMDevMemoryControl} + IAMDevMemoryControl = interface(IUnknown) + ['{C6545BF1-E76B-11D0-BD52-00A0C911CE86}'] + (*** IAMDevMemoryControl methods ***) + function QueryWriteSync: HResult; stdcall; + function WriteSync: HResult; stdcall; + function GetDevId(out pdwDevId: DWORD): HResult; stdcall; + end; + +const + AMSTREAMSELECTINFO_ENABLED = $1; + {$EXTERNALSYM AMSTREAMSELECTINFO_ENABLED} + AMSTREAMSELECTINFO_EXCLUSIVE = $2; + {$EXTERNALSYM AMSTREAMSELECTINFO_EXCLUSIVE} + + AMSTREAMSELECTENABLE_ENABLE = $1; + {$EXTERNALSYM AMSTREAMSELECTENABLE_ENABLE} + AMSTREAMSELECTENABLE_ENABLEALL = $2; + {$EXTERNALSYM AMSTREAMSELECTENABLE_ENABLEALL} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMStreamSelect;'} + {$EXTERNALSYM IAMStreamSelect} + IAMStreamSelect = interface(IUnknown) + ['{C1960960-17F5-11D1-ABE1-00A0C905F375}'] + (*** IAMStreamSelect methods ***) + function Count(out pcStreams: DWORD): HResult; stdcall; + function Info(lIndex: Longint; out ppmt: PAMMediaType; + out pdwFlags: DWORD; out plcid: LCID; out pdwGroup: DWORD; + out ppszName: PWCHAR; out ppObject: IUnknown; out ppUnk : IUnknown): HResult; stdcall; + function Enable(lIndex: Longint; dwFlags: DWORD): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMResourceControl;'} + {$EXTERNALSYM IAMResourceControl} + IAMResourceControl = interface(IUnknown) + ['{8389d2d0-77d7-11d1-abe6-00a0c905f375}'] + (*** IAMResourceControl methods ***) + function Reserve(dwFlags: DWORD; var pvReserved: pointer): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMClockAdjust;'} + {$EXTERNALSYM IAMClockAdjust} + IAMClockAdjust = interface(IUnknown) + ['{4d5466b0-a49c-11d1-abe8-00a0c905f375}'] + (*** IAMClockAdjust methods ***) + function SetClockDelta(rtDelta: TReferenceTime): HResult; stdcall; + end; + +const + AM_FILTER_MISC_FLAGS_IS_RENDERER = $1; + {$EXTERNALSYM AM_FILTER_MISC_FLAGS_IS_RENDERER} + AM_FILTER_MISC_FLAGS_IS_SOURCE = $2; + {$EXTERNALSYM AM_FILTER_MISC_FLAGS_IS_SOURCE} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMFilterMiscFlags;'} + {$EXTERNALSYM IAMFilterMiscFlags} + IAMFilterMiscFlags = interface(IUnknown) + ['{2dd74950-a890-11d1-abe8-00a0c905f375}'] + (*** IAMFilterMiscFlags methods ***) + function GetMiscFlags: ULONG; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDrawVideoImage;'} + {$EXTERNALSYM IDrawVideoImage} + IDrawVideoImage = interface(IUnknown) + ['{48efb120-ab49-11d2-aed2-00a0c995e8d5}'] + (*** IDrawVideoImage methods ***) + function DrawVideoImageBegin: HResult; stdcall; + function DrawVideoImageEnd: HResult; stdcall; + function DrawVideoImageDraw(hdc: HDC; lprcSrc, lprcDst: PRECT): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDecimateVideoImage;'} + {$EXTERNALSYM IDecimateVideoImage} + IDecimateVideoImage = interface(IUnknown) + ['{2e5ea3e0-e924-11d2-b6da-00a0c995e8df}'] + (*** IDecimateVideoImage methods ***) + function SetDecimationImageSize(lWidth, lHeight: Longint):HResult; stdcall; + function ResetDecimationImageSize: HResult; stdcall; + end; + + _DECIMATION_USAGE = ( + DECIMATION_LEGACY, + DECIMATION_USE_DECODER_ONLY, + DECIMATION_USE_VIDEOPORT_ONLY, + DECIMATION_USE_OVERLAY_ONLY, + DECIMATION_DEFAULT + ); + {$EXTERNALSYM _DECIMATION_USAGE} + DECIMATION_USAGE = _DECIMATION_USAGE; + {$EXTERNALSYM DECIMATION_USAGE} + TDecimationUsage = DECIMATION_USAGE; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMVideoDecimationProperties;'} + {$EXTERNALSYM IAMVideoDecimationProperties} + IAMVideoDecimationProperties = interface(IUnknown) + ['{60d32930-13da-11d3-9ec6-c4fcaef5c7be}'] + (*** IAMVideoDecimationProperties methods ***) + function QueryDecimationUsage(out lpUsage: TDecimationUsage):HResult; stdcall; + function SetDecimationUsage(Usage: TDecimationUsage):HResult; stdcall; + end; + +const + AM_PUSHSOURCECAPS_INTERNAL_RM = $1; + {$EXTERNALSYM AM_PUSHSOURCECAPS_INTERNAL_RM} + AM_PUSHSOURCECAPS_NOT_LIVE = $2; + {$EXTERNALSYM AM_PUSHSOURCECAPS_NOT_LIVE} + AM_PUSHSOURCECAPS_PRIVATE_CLOCK = $4; + {$EXTERNALSYM AM_PUSHSOURCECAPS_PRIVATE_CLOCK} + AM_PUSHSOURCEREQS_USE_STREAM_CLOCK = $10000; + {$EXTERNALSYM AM_PUSHSOURCEREQS_USE_STREAM_CLOCK} + AM_PUSHSOURCEREQS_USE_CLOCK_CHAIN = $20000; + {$EXTERNALSYM AM_PUSHSOURCEREQS_USE_CLOCK_CHAIN} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMLatency;'} + {$EXTERNALSYM IAMLatency} + IAMLatency = interface(IUnknown) + ['{62EA93BA-EC62-11d2-B770-00C04FB6BD3D}'] + (*** IAMLatency methods ***) + function GetLatency(var prtLatency: TReferenceTime): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMPushSource;'} + {$EXTERNALSYM IAMPushSource} + IAMPushSource = interface(IAMLatency) + ['{F185FE76-E64E-11d2-B76E-00C04FB6BD3D}'] + (*** IAMPushSource methods ***) + function GetPushSourceFlags(out pFlags: ULONG): HResult; stdcall; + function SetPushSourceFlags(Flags: ULONG): HResult; stdcall; + function SetStreamOffset(rtOffset: TReferenceTime): HResult; stdcall; + function GetStreamOffset(out prtOffset: TReferenceTime): HResult; stdcall; + function GetMaxStreamOffset(out prtMaxOffset: TReferenceTime): HResult; stdcall; + function SetMaxStreamOffset(rtMaxOffset: TReferenceTime): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMDeviceRemoval;'} + {$EXTERNALSYM IAMDeviceRemoval} + IAMDeviceRemoval = interface(IUnknown) + ['{f90a6130-b658-11d2-ae49-0000f8754b99}'] + (*** IAMDeviceRemoval methods ***) + function DeviceInfo(out pclsidInterfaceClass: TGUID; + out pwszSymbolicLink: PWideChar): HResult; stdcall; + function Reassociate: HResult; stdcall; + function Disassociate: HResult; stdcall; + end; + +type + PTDVInfo = ^TDVInfo; + DVINFO = record + //for 1st 5/6 DIF seq. + dwDVAAuxSrc : DWORD; + dwDVAAuxCtl : DWORD; + //for 2nd 5/6 DIF seq. + dwDVAAuxSrc1 : DWORD; + dwDVAAuxCtl1 : DWORD; + //for video information + dwDVVAuxSrc : DWORD; + dwDVVAuxCtl : DWORD; + dwDVReserved: array[0..1] of DWORD; + end; + {$EXTERNALSYM DVINFO} + TDVInfo = DVINFO; + +const + //DVENCODERRESOLUTION + DVENCODERRESOLUTION_720x480 = 2012; + {$EXTERNALSYM DVENCODERRESOLUTION_720x480} + DVENCODERRESOLUTION_360x240 = 2013; + {$EXTERNALSYM DVENCODERRESOLUTION_360x240} + DVENCODERRESOLUTION_180x120 = 2014; + {$EXTERNALSYM DVENCODERRESOLUTION_180x120} + DVENCODERRESOLUTION_88x60 = 2015; + {$EXTERNALSYM DVENCODERRESOLUTION_88x60} + + //DVENCODERVIDEOFORMAT + DVENCODERVIDEOFORMAT_NTSC = 2000; + {$EXTERNALSYM DVENCODERVIDEOFORMAT_NTSC} + DVENCODERVIDEOFORMAT_PAL = 2001; + {$EXTERNALSYM DVENCODERVIDEOFORMAT_PAL} + + //DVENCODERFORMAT + DVENCODERFORMAT_DVSD = 2007; + {$EXTERNALSYM DVENCODERFORMAT_DVSD} + DVENCODERFORMAT_DVHD = 2008; + {$EXTERNALSYM DVENCODERFORMAT_DVHD} + DVENCODERFORMAT_DVSL = 2009; + {$EXTERNALSYM DVENCODERFORMAT_DVSL} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IDVEnc;'} + {$EXTERNALSYM IDVEnc} + IDVEnc = interface(IUnknown) + ['{d18e17a0-aacb-11d0-afb0-00aa00b67a42}'] + (*** IDVEnc methods ***) + function get_IFormatResolution(out VideoFormat, DVFormat, Resolution: integer; + fDVInfo: ByteBool; out sDVInfo: TDVINFO): HResult; stdcall; + function put_IFormatResolution(VideoFormat, DVFormat, Resolution: integer; + fDVInfo: ByteBool; var sDVInfo: TDVINFO): HResult; stdcall; + end; + +const + //DVDECODERRESOLUTION + DVDECODERRESOLUTION_720x480 = 1000; + {$EXTERNALSYM DVDECODERRESOLUTION_720x480} + DVDECODERRESOLUTION_360x240 = 1001; + {$EXTERNALSYM DVDECODERRESOLUTION_360x240} + DVDECODERRESOLUTION_180x120 = 1002; + {$EXTERNALSYM DVDECODERRESOLUTION_180x120} + DVDECODERRESOLUTION_88x60 = 1003; + {$EXTERNALSYM DVDECODERRESOLUTION_88x60} + + //DVRESOLUTION + DVRESOLUTION_FULL = 1000; + {$EXTERNALSYM DVRESOLUTION_FULL} + DVRESOLUTION_HALF = 1001; + {$EXTERNALSYM DVRESOLUTION_HALF} + DVRESOLUTION_QUARTER = 1002; + {$EXTERNALSYM DVRESOLUTION_QUARTER} + DVRESOLUTION_DC = 1003; + {$EXTERNALSYM DVRESOLUTION_DC} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IIPDVDec;'} + {$EXTERNALSYM IIPDVDec} + IIPDVDec = interface(IUnknown) + ['{b8e8bd60-0bfe-11d0-af91-00aa00b67a42}'] + (*** IIPDVDec methods ***) + function get_IPDisplay(out displayPix : integer): HResult; stdcall; + function put_IPDisplay(displayPix: integer): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDVRGB219;'} + {$EXTERNALSYM IDVRGB219} + IDVRGB219 = interface(IUnknown) + ['{58473A19-2BC8-4663-8012-25F81BABDDD1}'] + (*** IDVRGB219 methods ***) + function SetRGB219(bState: BOOL): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDVSplitter;'} + {$EXTERNALSYM IDVSplitter} + IDVSplitter = interface(IUnknown) + ['{92a3a302-da7c-4a1f-ba7e-1802bb5d2d02}'] + (*** IDVSplitter methods ***) + function DiscardAlternateVideoFrames(nDiscard: integer): HResult; stdcall; + end; + +//_AM_AUDIO_RENDERER_STAT_PARAM +const + AM_AUDREND_STAT_PARAM_BREAK_COUNT = 1; + {$EXTERNALSYM AM_AUDREND_STAT_PARAM_BREAK_COUNT} + AM_AUDREND_STAT_PARAM_SLAVE_MODE = AM_AUDREND_STAT_PARAM_BREAK_COUNT + 1; + {$EXTERNALSYM AM_AUDREND_STAT_PARAM_SLAVE_MODE} + AM_AUDREND_STAT_PARAM_SILENCE_DUR = AM_AUDREND_STAT_PARAM_SLAVE_MODE + 1; + {$EXTERNALSYM AM_AUDREND_STAT_PARAM_SILENCE_DUR} + AM_AUDREND_STAT_PARAM_LAST_BUFFER_DUR = AM_AUDREND_STAT_PARAM_SILENCE_DUR + 1; + {$EXTERNALSYM AM_AUDREND_STAT_PARAM_LAST_BUFFER_DUR} + AM_AUDREND_STAT_PARAM_DISCONTINUITIES = AM_AUDREND_STAT_PARAM_LAST_BUFFER_DUR + 1; + {$EXTERNALSYM AM_AUDREND_STAT_PARAM_DISCONTINUITIES} + AM_AUDREND_STAT_PARAM_SLAVE_RATE = AM_AUDREND_STAT_PARAM_DISCONTINUITIES + 1; + {$EXTERNALSYM AM_AUDREND_STAT_PARAM_SLAVE_RATE} + AM_AUDREND_STAT_PARAM_SLAVE_DROPWRITE_DUR = AM_AUDREND_STAT_PARAM_SLAVE_RATE + 1; + {$EXTERNALSYM AM_AUDREND_STAT_PARAM_SLAVE_DROPWRITE_DUR} + AM_AUDREND_STAT_PARAM_SLAVE_HIGHLOWERROR = AM_AUDREND_STAT_PARAM_SLAVE_DROPWRITE_DUR + 1; + {$EXTERNALSYM AM_AUDREND_STAT_PARAM_SLAVE_HIGHLOWERROR} + AM_AUDREND_STAT_PARAM_SLAVE_LASTHIGHLOWERROR = AM_AUDREND_STAT_PARAM_SLAVE_HIGHLOWERROR + 1; + {$EXTERNALSYM AM_AUDREND_STAT_PARAM_SLAVE_LASTHIGHLOWERROR} + AM_AUDREND_STAT_PARAM_SLAVE_ACCUMERROR = AM_AUDREND_STAT_PARAM_SLAVE_LASTHIGHLOWERROR + 1; + {$EXTERNALSYM AM_AUDREND_STAT_PARAM_SLAVE_ACCUMERROR} + AM_AUDREND_STAT_PARAM_BUFFERFULLNESS = AM_AUDREND_STAT_PARAM_SLAVE_ACCUMERROR + 1; + {$EXTERNALSYM AM_AUDREND_STAT_PARAM_BUFFERFULLNESS} + AM_AUDREND_STAT_PARAM_JITTER = AM_AUDREND_STAT_PARAM_BUFFERFULLNESS + 1; + {$EXTERNALSYM AM_AUDREND_STAT_PARAM_JITTER} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMAudioRendererStats;'} + {$EXTERNALSYM IAMAudioRendererStats} + IAMAudioRendererStats = interface(IUnknown) + ['{22320CB2-D41A-11d2-BF7C-D7CB9DF0BF93}'] + (*** IAMAudioRendererStats methods ***) + function GetStatParam(dwParam: DWORD; out pdwParam1, pdwParam2: DWORD): HResult; stdcall; + end; + +//AM_INTF_SEARCH_FLAGS +const + AM_INTF_SEARCH_INPUT_PIN = $1; + {$EXTERNALSYM AM_INTF_SEARCH_INPUT_PIN} + AM_INTF_SEARCH_OUTPUT_PIN = $2; + {$EXTERNALSYM AM_INTF_SEARCH_OUTPUT_PIN} + AM_INTF_SEARCH_FILTER = $4; + {$EXTERNALSYM AM_INTF_SEARCH_FILTER} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMGraphStreams;'} + {$EXTERNALSYM IAMGraphStreams} + IAMGraphStreams = interface(IUnknown) + ['{632105FA-072E-11d3-8AF9-00C04FB6BD3D}'] + (*** IAMGraphStreams methods ***) + function FindUpstreamInterface(pPin: IPin; const riid: TGUID; out ppvInterface; + dwFlags: DWORD): HResult; stdcall; + function SyncUsingStreamOffset(bUseStreamOffset: BOOL): HResult; stdcall; + function SetMaxGraphLatency(rtMaxGraphLatency: TReferenceTime): HResult; stdcall; + end; + +//AMOVERLAYFX +const + AMOVERFX_NOFX = 0; + {$EXTERNALSYM AMOVERFX_NOFX} + AMOVERFX_MIRRORLEFTRIGHT = $2; + {$EXTERNALSYM AMOVERFX_MIRRORLEFTRIGHT} + AMOVERFX_MIRRORUPDOWN = $4; + {$EXTERNALSYM AMOVERFX_MIRRORUPDOWN} + AMOVERFX_DEINTERLACE = $8; + {$EXTERNALSYM AMOVERFX_DEINTERLACE} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMOverlayFX;'} + {$EXTERNALSYM IAMOverlayFX} + IAMOverlayFX = interface(IUnknown) + ['{62fae250-7e65-4460-bfc9-6398b322073c}'] + (*** IAMOverlayFX methods ***) + function QueryOverlayFXCaps(out lpdwOverlayFXCaps: DWORD): HResult; stdcall; + function SetOverlayFX(dwOverlayFX: DWORD): HResult; stdcall; + function GetOverlayFX(out lpdwOverlayFX: DWORD): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMOpenProgress;'} + {$EXTERNALSYM IAMOpenProgress} + IAMOpenProgress = interface(IUnknown) + ['{8E1C39A1-DE53-11cf-AA63-0080C744528D}'] + (*** IAMOpenProgress methods ***) + function QueryProgress(out pllTotal, pllCurrent: int64): HResult; stdcall; + function AbortOperation: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMpeg2Demultiplexer;'} + {$EXTERNALSYM IMpeg2Demultiplexer} + IMpeg2Demultiplexer = interface(IUnknown) + ['{436eee9c-264f-4242-90e1-4e330c107512}'] + (*** IMpeg2Demultiplexer methods ***) + function CreateOutputPin(var pMediaType: TAMMediaType; pszPinName: PWideChar; + out ppIPin: IPin): HResult; stdcall; + function SetOutputPinMediaType(pszPinName: PWideChar; var pMediaType: TAMMediaType): HResult; stdcall; + function DeleteOutputPin(pszPinName: PWideChar): HResult; stdcall; + end; + +const + MPEG2_PROGRAM_STREAM_MAP = $00000000; + {$EXTERNALSYM MPEG2_PROGRAM_STREAM_MAP} + MPEG2_PROGRAM_ELEMENTARY_STREAM = $00000001; + {$EXTERNALSYM MPEG2_PROGRAM_ELEMENTARY_STREAM} + MPEG2_PROGRAM_DIRECTORY_PES_PACKET = $00000002; + {$EXTERNALSYM MPEG2_PROGRAM_DIRECTORY_PES_PACKET} + MPEG2_PROGRAM_PACK_HEADER = $00000003; + {$EXTERNALSYM MPEG2_PROGRAM_PACK_HEADER} + MPEG2_PROGRAM_PES_STREAM = $00000004; + {$EXTERNALSYM MPEG2_PROGRAM_PES_STREAM} + MPEG2_PROGRAM_SYSTEM_HEADER = $00000005; + {$EXTERNALSYM MPEG2_PROGRAM_SYSTEM_HEADER} + SUBSTREAM_FILTER_VAL_NONE = $10000000; + {$EXTERNALSYM SUBSTREAM_FILTER_VAL_NONE} + +type + PStreamIDMap = ^TStreamIDMap; + STREAM_ID_MAP = record + stream_id : ULONG; + dwMediaSampleContent : DWORD; + ulSubstreamFilterValue: ULONG; + iDataOffset : integer; + end; + {$EXTERNALSYM STREAM_ID_MAP} + TStreamIDMap = STREAM_ID_MAP; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IEnumStreamIdMap;'} + {$EXTERNALSYM IEnumStreamIdMap} + IEnumStreamIdMap = interface(IUnknown) + ['{945C1566-6202-46fc-96C7-D87F289C6534}'] + (*** IEnumStreamIdMap methods ***) + function Next(cRequest: ULONG; pStreamIdMap: PStreamIDMap; + out pcReceived: ULONG): HResult; stdcall; + function Skip(cRecords: ULONG): HResult; stdcall; + function Reset: HResult; stdcall; + function Clone(out ppIEnumStreamIdMap: IEnumStreamIdMap): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMPEG2StreamIdMap;'} + {$EXTERNALSYM IMPEG2StreamIdMap} + IMPEG2StreamIdMap = interface(IUnknown) + ['{D0E04C47-25B8-4369-925A-362A01D95444}'] + (*** IMPEG2StreamIdMap methods ***) + function MapStreamId(ulStreamId: ULONG; MediaSampleContent: DWORD; + ulSubstreamFilterValue: ULONG; iDataOffset: integer): HResult; stdcall; + function UnmapStreamId(culStreamId: ULONG; var pulStreamId: ULONG): HResult; stdcall; + function EnumStreamIdMap(out ppIEnumStreamIdMap: IEnumStreamIdMap): HResult; stdcall; + end; + + {$NODEFINE IAMovie} // deprecated + IAMovie = interface(IFilterGraph) + ['{359ACE10-7688-11CF-8B23-00805F6CEF60}'] + (*** IAMovie methods ***) + function Connect(ppinOut, ppinIn: IPin): HResult; stdcall; + function Render(ppinOut: IPin): HResult; stdcall; + function Run: HResult; stdcall; + function Pause: HResult; stdcall; + function Stop: HResult; stdcall; + function GetState(msTimeout: DWORD; out pfs: TFilterState): HResult; stdcall; + function RenderFile(strFilename: PWideChar): HResult; stdcall; + function AddSourceFilter(strFilename: PWideChar; out ppUnk: IBaseFilter): HResult; stdcall; + function GetEventHandle(out hEvent: THandle): HResult; stdcall; + function GetEvent(out lEventCode, lParam1, lParam2: Longint; msTimeout: DWORD): HResult; stdcall; + function WaitForCompletion(msTimeout: DWORD; out pEvCode: Longint): HResult; stdcall; + function CancelDefaultHandling(lEvCode: Longint): HResult; stdcall; + function RestoreDefaultHandling(lEvCode: Longint): HResult; stdcall; + function get_Duration(out plength: TRefTime): HResult; stdcall; + function put_CurrentPosition(llTime: TRefTime): HResult; stdcall; + function get_CurrentPosition(out pllTime: TRefTime): HResult; stdcall; + function get_StopTime(out pllTime: TRefTime): HResult; stdcall; + function put_StopTime(llTime: TRefTime): HResult; stdcall; + function get_PrerollTime(out pllTime: TRefTime): HResult; stdcall; + function put_PrerollTime(llTime: TRefTime): HResult; stdcall; + function put_Rate(dRate: double): HResult; stdcall; + function get_Rate(out pdRate: double): HResult; stdcall; + function RemoveAllFilters: HResult; stdcall; + function Play: HResult; stdcall; + function PlayFile(strFilename: PWideChar): HResult; stdcall; + function EnumFiltersByInterface(const riid: TGUID; + out ppEnum: IEnumFilters): HResult; stdcall; + function EnumPins(out ppEnum: IEnumPins): HResult; stdcall; + function EnumPinsIn(out ppEnum: IEnumPins): HResult; stdcall; + function EnumPinsOut(out ppEnum: IEnumPins): HResult; stdcall; + function RenderAll: HResult; stdcall; + function RenderNewFile(strFilename: PWideChar): HResult; stdcall; + function FreeEventParams(lEvCode, lParam1, lParam2: Longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IRegisterServiceProvider;'} + {$EXTERNALSYM IRegisterServiceProvider} + IRegisterServiceProvider = interface(IUnknown) + ['{7B3A2F01-0751-48DD-B556-004785171C54}'] + (*** IRegisterServiceProvider methods ***) + function RegisterService(const guidService: TGUID; pUnkObject: IUnknown): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMClockSlave;'} + {$EXTERNALSYM IAMClockSlave} + IAMClockSlave = interface(IUnknown) + ['{9FD52741-176D-4b36-8F51-CA8F933223BE}'] + (*** IAMClockSlave methods ***) + function SetErrorTolerance(dwTolerance: DWORD): HResult; stdcall; + function GetErrorTolerance(out dwTolerance: DWORD): HResult; stdcall; + end; + +//--------------------------------------------------------------------- +// +// IAMGraphBuilderCallback interface +// +// Interface which gives the app a chance to configure filters +// before a connection is attempted. +// +// If this interface is supported by the site passed in to the graph +// via IObjectWithSite::SetSite, the graph will call back with each +// filter it creates as part of the Render or Connect process. Does +// not call back for source filters. Filter may be discarded and not +// used in graph or may be connected and disconnected more than once +// +// The callback occurs with the graph lock held, so do not call into +// the graph again and do not wait on other threads calling into the +// graph. +// +//--------------------------------------------------------------------- + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMGraphBuilderCallback;'} + {$EXTERNALSYM IAMGraphBuilderCallback} + IAMGraphBuilderCallback = interface(IUnknown) + ['{4995f511-9ddb-4f12-bd3b-f04611807b79}'] + (*** IAMGraphBuilderCallback methods ***) + // graph builder selected a filter to create and attempt to + // connect. failure indicates filter should be rejected. + function SelectedFilter(pMon: IMoniker): HResult; stdcall; + // app configures filter during this call. failure indicates + // filter should be rejected. + function CreatedFilter(pFil: IBaseFilter): HResult; stdcall; + end; + +// Note: Because this interface was not defined as a proper interface it is") +// supported under C++ only. Methods aren't stdcall.") + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMFilterGraphCallback;'} + {$EXTERNALSYM IAMFilterGraphCallback} + IAMFilterGraphCallback = interface(IUnknown) + ['{56a868fd-0ad4-11ce-b0a3-0020af0ba770}'] + (*** IAMFilterGraphCallback methods ***) + // S_OK means rendering complete, S_FALSE means retry now.") + // DCoder: thiscall fix. DON'T use ph1 and ph2, these are just placeholders + // to get the real address of pPin !!! + function UnableToRender(ph1, ph2: integer; pPin: IPin): HResult; // thiscall + end; + +//------------------------------------------------------------------------------ +// File: EncAPI.idl +// +// Desc: Encoder (and future decoder) interface definitions. +// +// Copyright (c) 1992 - 2002, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + CodecAPIEventData = record + guid : TGUID; + dataLength : DWORD; + reserved : array[0..2] of DWORD; + // data: array[0..dataLength-1] of Byte; + end; + {$EXTERNALSYM CodecAPIEventData} + TCodecAPIEventData = CodecAPIEventData; + +// Applications can pass the CODECAPI_VIDEO_ENCODER to IsSupported to test for video encoders +// Similarly, the GUIDs for audio encoders, video decoders, audio decoders and muxes can be +// used to test for the codec classification +// +// See uuids.h for a more detailed list. + {$HPPEMIT 'typedef System::DelphiInterface _di_ICodecAPI;'} + {$EXTERNALSYM ICodecAPI} + ICodecAPI = interface(IUnknown) + ['{901db4c7-31ce-41a2-85dc-8fa0bf41b8da}'] + (*** ICodecAPI methods ***) + // Query whether a given parameter is supported. + function IsSupported(const Api: TGUID): HResult; stdcall; + // Query whether a given parameter can be changed given the codec selection + // and other parameter selections. + function IsModifiable(const Api: TGUID): HResult; stdcall; + // Returns the valid range of values that the parameter supports should + // the parameter support a stepped range as opposed to a list of specific + // values. The support is [ValueMin .. ValueMax] by SteppingDelta. + // + // Ranged variant types must fall into one of the below types. Each + // parameter will, by definition, return a specific type. + // + // If the range has no stepping delta (any delta will do), the Stepping + // delta will be empty (VT_EMPTY). + function GetParameterRange(const Api: TGUID; out ValueMin, ValueMax, + SteppingDelta: OleVariant): HResult; stdcall; + // Returns the list of values supported by the given parameter as a + // COM allocated array. The total number of values will be placed in + // the ValuesCount parameter and the Values array will contain the + // individual values. This array must be freed by the caller through + // CoTaskMemFree(). + function GetParameterValues(const Api: TGUID; out Values: POleVariant; + out ValuesCount: ULONG): HResult; stdcall; + // Get the default value for a parameter, if one exists. Otherwise, + // an error will be returned. + function GetDefaultValue(const Aoi: TGUID; out Value: OleVariant): HResult; stdcall; + // Get the current value of a parameter. + function GetValue(const Api: TGUID; out Value: OleVariant): HResult; + // Set the current value of a parameter. + function SetValue(const Api: TGUID; var Value: OleVariant): HResult; stdcall; + // new methods beyond IEncoderAPI + + // Enable events to be reported for the given event GUID. For DShow + // events, the event is returned as + // (EC_CODECAPI_EVENT, lParam=userData, lParam2=CodecAPIEventData* Data) + // where + // - the CodecAPIEventData is COM allocated memory and must be handled and freed + // by the application using CoTaskMemFree(). + // - the userData is the same pointer passed to RegisterForEvent + // + // Each data block starts with the following structure: + // struct CodecAPIEventData + // { + // GUID guid; + // DWORD dataLength; + // DWORD reserved[3]; // pad to 16 byte alignment + // BYTE data[dataLength]; + // } + // The guid parameter identifies the event. The data associated with the event follows the + // structure (represented by the variable length BYTE data[dataLength] array). + // + // If guid is equal to CODECAPI_CHANGELISTS, then data is an array of GUIDs that changed as + // a result of setting the parameter, as follows: + // GUID changedGuids[ header.dataLength / sizeof(GUID) ] + // + // The current array is limited, so a driver may send multiple messages if the array size is + // exceeded. + // + function RegisterForEvent(const Api: TGUID; userData: Pointer): HResult; stdcall; + // Disable event reporting for the given event GUID. + function UnregisterForEvent(const Api: TGUID): HResult; stdcall; + // SetAllDefaults + function SetAllDefaults: HResult; stdcall; + // Extended SetValue & SetAllDefaults: + // Changes the current value of a parameter and returns back an alteration list + // The secondary arguments return back a list of other settings + // that changed as a result of the SetValue() call (for UI updates etc) + // The client must free the buffer. + function SetValueWithNotify(const Api: TGUID; var Value: Olevariant; + out ChangedParam: PGUID; out ChangedParamCount: ULONG): HResult; stdcall; + function SetAllDefaultsWithNotify(out ChangedParam: PGUID; + out ChangedParamCount: ULONG): HResult; stdcall; + // Load the current settings from a stream + function GetAllSettings(Stream: IStream): HResult; stdcall; + // Save the current settings to a stream + function SetAllSettings(Stream: IStream): HResult; stdcall; + function SetAllSettingsWithNotify(Stream: IStream; out ChangedParam: PGUID; + out ChangedParamCount: ULONG): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IGetCapabilitiesKey;'} + {$EXTERNALSYM IGetCapabilitiesKey} + IGetCapabilitiesKey = interface(IUnknown) + ['{a8809222-07bb-48ea-951c-33158100625b}'] + (*** IGetCapabilitiesKey methods ***) + function GetCapabilitiesKey(out pHKey: HKEY): HResult; stdcall; + end; + +// ----------------------------------------------------------------------------------------- +// From this point on, this is retained for backwards compatiblity only +// Do not use this for future encoders +// ----------------------------------------------------------------------------------------- + {$HPPEMIT 'typedef System::DelphiInterface _di_IEncoderAPI;'} + {$EXTERNALSYM IEncoderAPI} + IEncoderAPI = interface(IUnknown) + ['{70423839-6ACC-4b23-B079-21DBF08156A5}'] + (*** IEncoderAPI methods ***) + function IsSupported(const Api: TGUID): HResult; stdcall; + function IsAvailable(const Api: TGUID): HResult; stdcall; + function GetParameterRange(const Api: TGUID; out ValueMin, ValueMax, + SteppingDelta: OleVariant): HResult; stdcall; + function GetParameterValues(const Api: TGUID; out Values: POleVariant; + out ValuesCount: ULONG): HResult; stdcall; + function GetDefaultValue (const Api: TGUID; out Value: OleVariant): HResult; stdcall; + function GetValue(const Api: TGUID; out Value: OleVariant): HResult; stdcall; + function SetValue(const Api: TGUID; var Value: OleVariant): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVideoEncoder;'} + {$EXTERNALSYM IVideoEncoder} + IVideoEncoder = interface(IEncoderAPI) + ['{02997C3B-8E1B-460e-9270-545E0DE9563E}'] + (*** IVideoEncoder methods ***) + end; + +//--------------------------------------------------------------------- +// +// Old Encoder API Interfaces +// +//--------------------------------------------------------------------- + + VIDEOENCODER_BITRATE_MODE = ( + // Bit rate used for encoding is constant + ConstantBitRate, + // Bit rate used for encoding is variable with the specified bitrate used + // as a guaranteed average over a specified window. The default window + // size is considered to be 5 minutes. + VariableBitRateAverage, + // Bit rate used for encoding is variable with the specified bitrate used + // as a peak rate over a specified window. The default window size + // is considered to be 500ms (classically one GOP). + VariableBitRatePeak + ); + {$EXTERNALSYM VIDEOENCODER_BITRATE_MODE} + TVideoEncoderBitrateMode = VIDEOENCODER_BITRATE_MODE; + +const + AM_GETDECODERCAP_QUERY_VMR_SUPPORT = $00000001; + {$EXTERNALSYM AM_GETDECODERCAP_QUERY_VMR_SUPPORT} + VMR_NOTSUPPORTED = $00000000; + {$EXTERNALSYM VMR_NOTSUPPORTED} + VMR_SUPPORTED = $00000001; + {$EXTERNALSYM VMR_SUPPORTED} + + AM_QUERY_DECODER_VMR_SUPPORT = $00000001; + {$EXTERNALSYM AM_QUERY_DECODER_VMR_SUPPORT} + AM_QUERY_DECODER_DXVA_1_SUPPORT = $00000002; + {$EXTERNALSYM AM_QUERY_DECODER_DXVA_1_SUPPORT} + + AM_QUERY_DECODER_DVD_SUPPORT = $00000003; + {$EXTERNALSYM AM_QUERY_DECODER_DVD_SUPPORT} + AM_QUERY_DECODER_ATSC_SD_SUPPORT = $00000004; + {$EXTERNALSYM AM_QUERY_DECODER_ATSC_SD_SUPPORT} + AM_QUERY_DECODER_ATSC_HD_SUPPORT = $00000005; + {$EXTERNALSYM AM_QUERY_DECODER_ATSC_HD_SUPPORT} + AM_GETDECODERCAP_QUERY_VMR9_SUPPORT = $00000006; + {$EXTERNALSYM AM_GETDECODERCAP_QUERY_VMR9_SUPPORT} + + DECODER_CAP_NOTSUPPORTED = $00000000; + {$EXTERNALSYM DECODER_CAP_NOTSUPPORTED} + DECODER_CAP_SUPPORTED = $00000001; + {$EXTERNALSYM DECODER_CAP_SUPPORTED} + + CDEF_CLASS_DEFAULT = $0001; + {$EXTERNALSYM CDEF_CLASS_DEFAULT} + CDEF_BYPASS_CLASS_MANAGER = $0002; + {$EXTERNALSYM CDEF_BYPASS_CLASS_MANAGER} + //CDEF_CLASS_LEGACY = $0004; + CDEF_MERIT_ABOVE_DO_NOT_USE = $0008; + {$EXTERNALSYM CDEF_MERIT_ABOVE_DO_NOT_USE} + CDEF_DEVMON_CMGR_DEVICE = $0010; + {$EXTERNALSYM CDEF_DEVMON_CMGR_DEVICE} + CDEF_DEVMON_DMO = $0020; + {$EXTERNALSYM CDEF_DEVMON_DMO} + CDEF_DEVMON_PNP_DEVICE = $0040; + {$EXTERNALSYM CDEF_DEVMON_PNP_DEVICE} + CDEF_DEVMON_FILTER = $0080; + {$EXTERNALSYM CDEF_DEVMON_FILTER} + CDEF_DEVMON_SELECTIVE_MASK = $00f0; + {$EXTERNALSYM CDEF_DEVMON_SELECTIVE_MASK} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMDecoderCaps;'} + {$EXTERNALSYM IAMDecoderCaps} + IAMDecoderCaps = interface(IUnknown) + ['{c0dff467-d499-4986-972b-e1d9090fa941}'] + (*** IAMDecoderCaps methods ***) + function GetDecoderCaps(dwCapIndex: DWORD; out lpdwCap: DWORD): HResult; stdcall; + end; + +/////////////////////////////////////////////////////////////////////////////// +// +// IAMCertifiedOutputProtection +// +/////////////////////////////////////////////////////////////////////////////// + + PAMCOPPSignature = ^TAMCOPPSignature; + AMCOPPSignature = packed record + Signature: array[0..255] of byte; + end; + {$EXTERNALSYM AMCOPPSignature} + TAMCOPPSignature = AMCOPPSignature; + + AMCOPPCommand = packed record + macKDI: TGUID; // 16 bytes + guidCommandID: TGUID; // 16 bytes + dwSequence: DWORD; // 4 bytes + cbSizeData: DWORD; // 4 bytes + CommandData: array[0..4055] of byte; // 4056 bytes (4056+4+4+16+16 = 4096) + end; + {$EXTERNALSYM AMCOPPCommand} + TAMCOPPCommand = AMCOPPCommand; + LPAMCOPPCommand = ^AMCOPPCommand; + {$EXTERNALSYM LPAMCOPPCommand} + PAMCOPPCommand = LPAMCOPPCommand; + + AMCOPPStatusInput = packed record + rApp: TGUID; // 16 bytes + guidStatusRequestID: TGUID;// 16 bytes + dwSequence: DWORD; // 4 bytes + cbSizeData: DWORD; // 4 bytes + StatusData: array[0..4055] of byte; // 4056 bytes (4056+4+4+16+16 = 4096) + end; + {$EXTERNALSYM AMCOPPStatusInput} + TAMCOPPStatusInput = AMCOPPStatusInput; + LPAMCOPPStatusInput = ^AMCOPPStatusInput; + {$EXTERNALSYM LPAMCOPPStatusInput} + PAMCOPPStatusInput = LPAMCOPPStatusInput; + + AMCOPPStatusOutput = packed record + macKDI: TGUID; // 16 bytes + cbSizeData: DWORD; // 4 bytes + COPPStatus: array[0..4075] of byte; // 4076 bytes (4076+16+4 = 4096) + end; + {$EXTERNALSYM AMCOPPStatusOutput} + TAMCOPPStatusOutput = AMCOPPStatusOutput; + LPAMCOPPStatusOutput = ^AMCOPPStatusOutput; + {$EXTERNALSYM LPAMCOPPStatusOutput} + PAMCOPPStatusOutput = LPAMCOPPStatusOutput; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMCertifiedOutputProtection;'} + {$EXTERNALSYM IAMCertifiedOutputProtection} + IAMCertifiedOutputProtection = interface(IUnknown) + ['{6FEDED3E-0FF1-4901-A2F1-43F7012C8515}'] + function KeyExchange( + pRandom: PGUID; // 128-bit random number generated by Graphics Driver + var VarLenCertGH: PByte; // Graphics Hardware certificate, memory released by CoTaskMemFree + pdwLengthCertGH: PDWORD // Length of Graphics Hardware certificate + ): HRESULT; stdcall; + + // Concatenation of 128-bit random data security session key, + // 128-bit random data integrity session key, 32-bit random + // starting status sequence number and 32-bit random starting + // command sequence number encrypted with the public key of + // the graphic hardware. This value is 2048 bits long. + function SessionSequenceStart(pSig: PAMCOPPSignature): HRESULT; stdcall; + + function ProtectionCommand(cmd: PAMCOPPCommand): HRESULT; stdcall; // Encrypted command + + function ProtectionStatus( + pStatusInput: PAMCOPPStatusInput; // Encrypted Status request + pStatusOutput: PAMCOPPStatusOutput): HRESULT; stdcall; // Encrypted Status results + end; + +//////////////////////////////////////////////////////////////////////////////// + + {$HPPEMIT 'typedef System::DelphiInterface _di_ICreateDevEnum;'} + {$EXTERNALSYM ICreateDevEnum} + ICreateDevEnum = interface(IUnknown) + ['{29840822-5B84-11D0-BD3B-00A0C911CE86}'] + (*** ICreateDevEnum methods ***) + function CreateClassEnumerator(const clsidDeviceClass: TGUID; + out ppEnumMoniker: IEnumMoniker; dwFlags: DWORD): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IFilterMapper3;'} + {$EXTERNALSYM IFilterMapper3} + IFilterMapper3 = interface(IFilterMapper2) + ['{b79bb0b1-33c1-11d1-abe1-00a0c905f375}'] + (*** IFilterMapper3 methods ***) + function GetICreateDevEnum(out ppEnum: ICreateDevEnum): HResult; stdcall; + end; + +//replacement for DVD_TextStringType in GetDVDTextStringAsNative, GetDVDTextStringAsUnicode + +{$IFNDEF COMPILER6_UP} +type + DVD_TextStringType = {$IFDEF TYPE_IDENTITY}type {$ENDIF}LongWord; +const + DVD_Struct_Volume = $00000001; + DVD_Struct_Title = $00000002; + DVD_Struct_ParentalID = $00000003; + DVD_Struct_PartOfTitle = $00000004; + DVD_Struct_Cell = $00000005; + DVD_Stream_Audio = $00000010; + DVD_Stream_Subpicture = $00000011; + DVD_Stream_Angle = $00000012; + DVD_Channel_Audio = $00000020; + DVD_General_Name = $00000030; + DVD_General_Comments = $00000031; + DVD_Title_Series = $00000038; + DVD_Title_Movie = $00000039; + DVD_Title_Video = $0000003A; + DVD_Title_Album = $0000003B; + DVD_Title_Song = $0000003C; + DVD_Title_Other = $0000003F; + DVD_Title_Sub_Series = $00000040; + DVD_Title_Sub_Movie = $00000041; + DVD_Title_Sub_Video = $00000042; + DVD_Title_Sub_Album = $00000043; + DVD_Title_Sub_Song = $00000044; + DVD_Title_Sub_Other = $00000047; + DVD_Title_Orig_Series = $00000048; + DVD_Title_Orig_Movie = $00000049; + DVD_Title_Orig_Video = $0000004A; + DVD_Title_Orig_Album = $0000004B; + DVD_Title_Orig_Song = $0000004C; + DVD_Title_Orig_Other = $0000004F; + DVD_Other_Scene = $00000050; + DVD_Other_Cut = $00000051; + DVD_Other_Take = $00000052; +{$ELSE} +type + DVD_TextStringType = ( + DVD_Struct_Volume = $00000001, + DVD_Struct_Title = $00000002, + DVD_Struct_ParentalID = $00000003, + DVD_Struct_PartOfTitle = $00000004, + DVD_Struct_Cell = $00000005, + DVD_Stream_Audio = $00000010, + DVD_Stream_Subpicture = $00000011, + DVD_Stream_Angle = $00000012, + DVD_Channel_Audio = $00000020, + DVD_General_Name = $00000030, + DVD_General_Comments = $00000031, + DVD_Title_Series = $00000038, + DVD_Title_Movie = $00000039, + DVD_Title_Video = $0000003A, + DVD_Title_Album = $0000003B, + DVD_Title_Song = $0000003C, + DVD_Title_Other = $0000003F, + DVD_Title_Sub_Series = $00000040, + DVD_Title_Sub_Movie = $00000041, + DVD_Title_Sub_Video = $00000042, + DVD_Title_Sub_Album = $00000043, + DVD_Title_Sub_Song = $00000044, + DVD_Title_Sub_Other = $00000047, + DVD_Title_Orig_Series = $00000048, + DVD_Title_Orig_Movie = $00000049, + DVD_Title_Orig_Video = $0000004A, + DVD_Title_Orig_Album = $0000004B, + DVD_Title_Orig_Song = $0000004C, + DVD_Title_Orig_Other = $0000004F, + DVD_Other_Scene = $00000050, + DVD_Other_Cut = $00000051, + DVD_Other_Take = $00000052 + ); +{$ENDIF} +{$EXTERNALSYM DVD_TextStringType} +type + TDVDTextStringType = DVD_TextStringType; + + // For IDVDControl2.SetOption flags + DVD_OPTION_FLAG = ( + {$IFNDEF COMPILER6_UP} + DVD_Option_INVALID_0, + DVD_ResetOnStop, + {$ELSE} + DVD_ResetOnStop = 1, + {$ENDIF} + DVD_NotifyParentalLevelChange, + DVD_HMSF_TimeCodeEvents, + DVD_AudioDuringFFwdRew // default FALSE (or by reg) // DirectX9 Specific + ); + {$EXTERNALSYM DVD_OPTION_FLAG} + TDVDOptionFlag = DVD_OPTION_FLAG; + + tagDVD_DOMAIN = ( + {$IFNDEF COMPILER6_UP} + DVD_DOMAIN_INVALID_0, + DVD_DOMAIN_FirstPlay, + {$ELSE} + DVD_DOMAIN_FirstPlay = 1, + {$ENDIF} + DVD_DOMAIN_VideoManagerMenu, + DVD_DOMAIN_VideoTitleSetMenu, + DVD_DOMAIN_Title, + DVD_DOMAIN_Stop + ); + {$EXTERNALSYM tagDVD_DOMAIN} + DVD_DOMAIN = tagDVD_DOMAIN; + {$EXTERNALSYM DVD_DOMAIN} + TDVDDomain = DVD_DOMAIN; + + + tagDVD_MENU_ID = ( + {$EXTERNALSYM tagDVD_MENU_ID} + {$IFNDEF COMPILER6_UP} + DVD_MENU_INVALID_0, + DVD_MENU_INVALID_1, + DVD_MENU_Title, + {$ELSE} + DVD_MENU_Title = 2, + {$ENDIF} + DVD_MENU_Root, + DVD_MENU_Subpicture, + DVD_MENU_Audio, + DVD_MENU_Angle, + DVD_MENU_Chapter + ); + DVD_MENU_ID = tagDVD_MENU_ID; + {$EXTERNALSYM DVD_MENU_ID} + TDVDMenuID = DVD_MENU_ID; + + tagDVD_DISC_SIDE = ( + {$IFNDEF COMPILER6_UP} + DVD_SIDE_INVALID_0, + DVD_SIDE_A, + DVD_SIDE_B + {$ELSE} + DVD_SIDE_A = 1, + DVD_SIDE_B = 2 + {$ENDIF} + ); + {$EXTERNALSYM tagDVD_DISC_SIDE} + DVD_DISC_SIDE = tagDVD_DISC_SIDE; + {$EXTERNALSYM DVD_DISC_SIDE} + TDVDDiscSide = DVD_DISC_SIDE; + + tagDVD_PREFERRED_DISPLAY_MODE = ( + DISPLAY_CONTENT_DEFAULT, + DISPLAY_16x9, + DISPLAY_4x3_PANSCAN_PREFERRED, + DISPLAY_4x3_LETTERBOX_PREFERRED + ); + {$EXTERNALSYM tagDVD_PREFERRED_DISPLAY_MODE} + DVD_PREFERRED_DISPLAY_MODE = tagDVD_PREFERRED_DISPLAY_MODE; + {$EXTERNALSYM DVD_PREFERRED_DISPLAY_MODE} + TDVDPreferredDisplayMode = DVD_PREFERRED_DISPLAY_MODE; + + tagDVD_VIDEO_COMPRESSION = ( + DVD_VideoCompression_Other, + DVD_VideoCompression_MPEG1, + DVD_VideoCompression_MPEG22 + ); + {$EXTERNALSYM tagDVD_VIDEO_COMPRESSION} + DVD_VIDEO_COMPRESSION = tagDVD_VIDEO_COMPRESSION; + {$EXTERNALSYM DVD_VIDEO_COMPRESSION} + TDVDVideoCompression = DVD_VIDEO_COMPRESSION; + + tagDVD_AUDIO_APPMODE = ( + DVD_AudioMode_None, + DVD_AudioMode_Karaoke, + DVD_AudioMode_Surround, + DVD_AudioMode_Other + ); + {$EXTERNALSYM tagDVD_AUDIO_APPMODE} + DVD_AUDIO_APPMODE = tagDVD_AUDIO_APPMODE; + {$EXTERNALSYM DVD_AUDIO_APPMODE} + TDVDAudioAPPMode = DVD_AUDIO_APPMODE; + + tagDVD_AUDIO_FORMAT = ( + DVD_AudioFormat_AC3, + DVD_AudioFormat_MPEG1, + DVD_AudioFormat_MPEG1_DRC, + DVD_AudioFormat_MPEG2, + DVD_AudioFormat_MPEG2_DRC, + DVD_AudioFormat_LPCM, + DVD_AudioFormat_DTS, + DVD_AudioFormat_SDDS, + DVD_AudioFormat_Other + ); + {$EXTERNALSYM tagDVD_AUDIO_FORMAT} + DVD_AUDIO_FORMAT = tagDVD_AUDIO_FORMAT; + {$EXTERNALSYM DVD_AUDIO_FORMAT} + TDVDAudioFormat = DVD_AUDIO_FORMAT; + + +// DVD_KARAOKE_DOWNMIX +const + DVD_Mix_0to0 = $1 ; + {$EXTERNALSYM DVD_Mix_0to0} + DVD_Mix_1to0 = $2 ; + {$EXTERNALSYM DVD_Mix_1to0} + DVD_Mix_2to0 = $4 ; + {$EXTERNALSYM DVD_Mix_2to0} + DVD_Mix_3to0 = $8 ; + {$EXTERNALSYM DVD_Mix_3to0} + DVD_Mix_4to0 = $10 ; + {$EXTERNALSYM DVD_Mix_4to0} + DVD_Mix_Lto0 = $20 ; + {$EXTERNALSYM DVD_Mix_Lto0} + DVD_Mix_Rto0 = $40 ; + {$EXTERNALSYM DVD_Mix_Rto0} + DVD_Mix_0to1 = $100 ; + {$EXTERNALSYM DVD_Mix_0to1} + DVD_Mix_1to1 = $200 ; + {$EXTERNALSYM DVD_Mix_1to1} + DVD_Mix_2to1 = $400 ; + {$EXTERNALSYM DVD_Mix_2to1} + DVD_Mix_3to1 = $800 ; + {$EXTERNALSYM DVD_Mix_3to1} + DVD_Mix_4to1 = $1000; + {$EXTERNALSYM DVD_Mix_4to1} + DVD_Mix_Lto1 = $2000; + {$EXTERNALSYM DVD_Mix_Lto1} + DVD_Mix_Rto1 = $4000; + {$EXTERNALSYM DVD_Mix_Rto1} + +type + tagDVD_AUDIO_LANG_EXT = ( + DVD_AUD_EXT_NotSpecified, + DVD_AUD_EXT_Captions, + DVD_AUD_EXT_VisuallyImpaired, + DVD_AUD_EXT_DirectorComments1, + DVD_AUD_EXT_DirectorComments2 + ); + {$EXTERNALSYM tagDVD_AUDIO_LANG_EXT} + DVD_AUDIO_LANG_EXT = tagDVD_AUDIO_LANG_EXT; + {$EXTERNALSYM DVD_AUDIO_LANG_EXT} + TDVDAudioLangExt = DVD_AUDIO_LANG_EXT; + + tagDVD_SUBPICTURE_TYPE = ( + DVD_SPType_NotSpecified, + DVD_SPType_Language, + DVD_SPType_Other + ); + {$EXTERNALSYM tagDVD_SUBPICTURE_TYPE} + DVD_SUBPICTURE_TYPE = tagDVD_SUBPICTURE_TYPE; + {$EXTERNALSYM DVD_SUBPICTURE_TYPE} + TDVDSubpictureType = DVD_SUBPICTURE_TYPE; + + tagDVD_SUBPICTURE_CODING = ( + DVD_SPCoding_RunLength, + DVD_SPCoding_Extended, + DVD_SPCoding_Other + ); + {$EXTERNALSYM tagDVD_SUBPICTURE_CODING} + DVD_SUBPICTURE_CODING = tagDVD_SUBPICTURE_CODING; + {$EXTERNALSYM DVD_SUBPICTURE_CODING} + TDVDSubpictureCoding = DVD_SUBPICTURE_CODING; + + {$IFNDEF COMPILER6_UP} + tagDVD_SUBPICTURE_LANG_EXT = {$IFDEF TYPE_IDENTITY}type {$ENDIF}LongWord; + const + DVD_SP_EXT_NotSpecified = 0; + DVD_SP_EXT_Caption_Normal = 1; + DVD_SP_EXT_Caption_Big = 2; + DVD_SP_EXT_Caption_Children = 3; + DVD_SP_EXT_CC_Normal = 5; + DVD_SP_EXT_CC_Big = 6; + DVD_SP_EXT_CC_Children = 7; + DVD_SP_EXT_Forced = 9; + DVD_SP_EXT_DirectorComments_Normal = 13; + DVD_SP_EXT_DirectorComments_Big = 14; + DVD_SP_EXT_DirectorComments_Children = 15; + {$ELSE} + tagDVD_SUBPICTURE_LANG_EXT = ( + DVD_SP_EXT_NotSpecified = 0, + DVD_SP_EXT_Caption_Normal = 1, + DVD_SP_EXT_Caption_Big = 2, + DVD_SP_EXT_Caption_Children = 3, + DVD_SP_EXT_CC_Normal = 5, + DVD_SP_EXT_CC_Big = 6, + DVD_SP_EXT_CC_Children = 7, + DVD_SP_EXT_Forced = 9, + DVD_SP_EXT_DirectorComments_Normal = 13, + DVD_SP_EXT_DirectorComments_Big = 14, + DVD_SP_EXT_DirectorComments_Children = 15 + ); + {$ENDIF} +type + {$EXTERNALSYM tagDVD_SUBPICTURE_LANG_EXT} + DVD_SUBPICTURE_LANG_EXT = tagDVD_SUBPICTURE_LANG_EXT; + {$EXTERNALSYM DVD_SUBPICTURE_LANG_EXT} + TDVDSubpictureLangExt = DVD_SUBPICTURE_LANG_EXT; + +type + tagDVD_KARAOKE_ASSIGNMENT = ( + DVD_Assignment_reserved0, + DVD_Assignment_reserved1, + DVD_Assignment_LR, + DVD_Assignment_LRM, + DVD_Assignment_LR1, + DVD_Assignment_LRM1, + DVD_Assignment_LR12, + DVD_Assignment_LRM12 + ); + {$EXTERNALSYM tagDVD_KARAOKE_ASSIGNMENT} + DVD_KARAOKE_ASSIGNMENT = tagDVD_KARAOKE_ASSIGNMENT; + {$EXTERNALSYM DVD_KARAOKE_ASSIGNMENT} + TDVDKaraokeAssignment = DVD_KARAOKE_ASSIGNMENT; + + DVD_RELATIVE_BUTTON = ( + {$IFNDEF COMPILER6_UP} + DVD_Relative_INVALID_0, + DVD_Relative_Upper, + DVD_Relative_Lower, + DVD_Relative_Left, + DVD_Relative_Right + {$ELSE} + DVD_Relative_Upper = 1, + DVD_Relative_Lower = 2, + DVD_Relative_Left = 3, + DVD_Relative_Right = 4 + {$ENDIF} + ); + {$EXTERNALSYM DVD_RELATIVE_BUTTON} + TDVDRelativeButton = DVD_RELATIVE_BUTTON; + + DVD_REGISTER = {$IFDEF TYPE_IDENTITY}type {$ENDIF}Word; + {$EXTERNALSYM DVD_REGISTER} + GPRMArray = array[0..15] of DVD_REGISTER; + {$EXTERNALSYM GPRMArray} + + SPRMArray = array[0..23] of DVD_REGISTER; + {$EXTERNALSYM SPRMArray} + TSPRMArray = SPRMArray; + + tagDVD_ATR = record + ulCAT : ULONG; + pbATRI: array[0..767] of Byte; + end; + {$EXTERNALSYM tagDVD_ATR} + DVD_ATR = tagDVD_ATR; + {$EXTERNALSYM DVD_ATR} + TDVDAtr = tagDVD_ATR; + + DVD_VideoATR = array[0..1] of Byte; + {$EXTERNALSYM DVD_VideoATR} + DVD_AudioATR = array[0..7] of Byte; + {$EXTERNALSYM DVD_AudioATR} + DVD_SubpictureATR = array[0..5] of Byte; + {$EXTERNALSYM DVD_SubpictureATR} + + (*** DVD_SubpictureATR methods ***) + tagDVD_FRAMERATE = ( + {$IFNDEF COMPILER6_UP} + DVD_FPS_INVALID_0, + DVD_FPS_25, + DVD_FPS_INVALID_2, + DVD_FPS_30NonDrop + {$ELSE} + DVD_FPS_25 = 1, + DVD_FPS_30NonDrop = 3 + {$ENDIF} + ); + + {$EXTERNALSYM tagDVD_FRAMERATE} + DVD_FRAMERATE = tagDVD_FRAMERATE; + {$EXTERNALSYM DVD_FRAMERATE} + TDVDFramerate = DVD_FRAMERATE; + + +//typedef struct tagDVD_TIMECODE +//{ +// ULONG Hours1 :4; // Hours +// ULONG Hours10 :4; // Tens of Hours +// +// ULONG Minutes1 :4; // Minutes +// ULONG Minutes10:4; // Tens of Minutes +// +// ULONG Seconds1 :4; // Seconds +// ULONG Seconds10:4; // Tens of Seconds +// +// ULONG Frames1 :4; // Frames +// ULONG Frames10 :2; // Tens of Frames +// +// ULONG FrameRateCode: 2; // use DVD_FRAMERATE to indicate frames/sec and drop/non-drop +//} DVD_TIMECODE; + + tagDVD_TIMECODE = record + Hours1 : byte; + Hours10 : byte; + Minutes1 : byte; + Minutes10 : byte; + Seconds1 : byte; + Seconds10 : byte; + Frames1 : byte; + Frames10 : byte; + FrameRateCode: byte; + end; + {$EXTERNALSYM tagDVD_TIMECODE} + DVD_TIMECODE = tagDVD_TIMECODE; + {$EXTERNALSYM DVD_TIMECODE} + TDVDTimeCode = tagDVD_TIMECODE; + +//DVD_TIMECODE_FLAGS +const + DVD_TC_FLAG_25fps = $1; + {$EXTERNALSYM DVD_TC_FLAG_25fps} + DVD_TC_FLAG_30fps = $2; + {$EXTERNALSYM DVD_TC_FLAG_30fps} + DVD_TC_FLAG_DropFrame = $4; + {$EXTERNALSYM DVD_TC_FLAG_DropFrame} + DVD_TC_FLAG_Interpolated = $8; + {$EXTERNALSYM DVD_TC_FLAG_Interpolated} + +type + PDVDHMSFTimeCode = ^TDVDHMSFTimeCode; + tagDVD_HMSF_TIMECODE = record + {$EXTERNALSYM tagDVD_HMSF_TIMECODE} + bHours : BYTE; + bMinutes : BYTE; + bSeconds : BYTE; + bFrames : BYTE; + end; + DVD_HMSF_TIMECODE = tagDVD_HMSF_TIMECODE; + {$EXTERNALSYM DVD_HMSF_TIMECODE} + TDVDHMSFTimeCode = tagDVD_HMSF_TIMECODE; + + tagDVD_PLAYBACK_LOCATION2 = record + TitleNum : ULONG; + ChapterNum : ULONG; + TimeCode : DVD_HMSF_TIMECODE; + TimeCodeFlags : ULONG; + end; + {$EXTERNALSYM tagDVD_PLAYBACK_LOCATION2} + DVD_PLAYBACK_LOCATION2 = tagDVD_PLAYBACK_LOCATION2; + {$EXTERNALSYM DVD_PLAYBACK_LOCATION2} + TDVDPlayBackLocation2 = tagDVD_PLAYBACK_LOCATION2; + + tagDVD_PLAYBACK_LOCATION = record + TitleNum : ULONG; + ChapterNum : ULONG; + TimeCode : ULONG; + end; + {$EXTERNALSYM tagDVD_PLAYBACK_LOCATION} + DVD_PLAYBACK_LOCATION = tagDVD_PLAYBACK_LOCATION; + {$EXTERNALSYM DVD_PLAYBACK_LOCATION} + TDVDPlaybackLocation = tagDVD_PLAYBACK_LOCATION; + + VALID_UOP_SOMTHING_OR_OTHER = {$IFDEF TYPE_IDENTITY}type {$ENDIF} DWord; + {$EXTERNALSYM VALID_UOP_SOMTHING_OR_OTHER} + +VALID_UOP_FLAG = {$IFDEF TYPE_IDENTITY}type {$ENDIF} DWord; +{$EXTERNALSYM VALID_UOP_FLAG} + const + UOP_FLAG_Play_Title_Or_AtTime = $1; + {$EXTERNALSYM UOP_FLAG_Play_Title_Or_AtTime} + UOP_FLAG_Play_Chapter = $2; + {$EXTERNALSYM UOP_FLAG_Play_Chapter} + UOP_FLAG_Play_Title = $4; + {$EXTERNALSYM UOP_FLAG_Play_Title} + UOP_FLAG_Stop = $8; + {$EXTERNALSYM UOP_FLAG_Stop} + UOP_FLAG_ReturnFromSubMenu = $10; + {$EXTERNALSYM UOP_FLAG_ReturnFromSubMenu} + UOP_FLAG_Play_Chapter_Or_AtTime = $20; + {$EXTERNALSYM UOP_FLAG_Play_Chapter_Or_AtTime} + UOP_FLAG_PlayPrev_Or_Replay_Chapter = $40; + {$EXTERNALSYM UOP_FLAG_PlayPrev_Or_Replay_Chapter} + UOP_FLAG_PlayNext_Chapter = $80; + {$EXTERNALSYM UOP_FLAG_PlayNext_Chapter} + UOP_FLAG_Play_Forwards = $100; + {$EXTERNALSYM UOP_FLAG_Play_Forwards} + UOP_FLAG_Play_Backwards = $200; + {$EXTERNALSYM UOP_FLAG_Play_Backwards} + UOP_FLAG_ShowMenu_Title = $400; + {$EXTERNALSYM UOP_FLAG_ShowMenu_Title} + UOP_FLAG_ShowMenu_Root = $800; + {$EXTERNALSYM UOP_FLAG_ShowMenu_Root} + UOP_FLAG_ShowMenu_SubPic = $1000; + {$EXTERNALSYM UOP_FLAG_ShowMenu_SubPic} + UOP_FLAG_ShowMenu_Audio = $2000; + {$EXTERNALSYM UOP_FLAG_ShowMenu_Audio} + UOP_FLAG_ShowMenu_Angle = $4000; + {$EXTERNALSYM UOP_FLAG_ShowMenu_Angle} + UOP_FLAG_ShowMenu_Chapter = $8000; + {$EXTERNALSYM UOP_FLAG_ShowMenu_Chapter} + UOP_FLAG_Resume = $10000; + {$EXTERNALSYM UOP_FLAG_Resume} + UOP_FLAG_Select_Or_Activate_Button = $20000; + {$EXTERNALSYM UOP_FLAG_Select_Or_Activate_Button} + UOP_FLAG_Still_Off = $40000; + {$EXTERNALSYM UOP_FLAG_Still_Off} + UOP_FLAG_Pause_On = $80000; + {$EXTERNALSYM UOP_FLAG_Pause_On} + UOP_FLAG_Select_Audio_Stream = $100000; + {$EXTERNALSYM UOP_FLAG_Select_Audio_Stream} + UOP_FLAG_Select_SubPic_Stream = $200000; + {$EXTERNALSYM UOP_FLAG_Select_SubPic_Stream} + UOP_FLAG_Select_Angle = $400000; + {$EXTERNALSYM UOP_FLAG_Select_Angle} + UOP_FLAG_Select_Karaoke_Audio_Presentation_Mode = $800000; + {$EXTERNALSYM UOP_FLAG_Select_Karaoke_Audio_Presentation_Mode} + UOP_FLAG_Select_Video_Mode_Preference = $1000000; + {$EXTERNALSYM UOP_FLAG_Select_Video_Mode_Preference} + +type + DVD_TextCharSet = ( + DVD_CharSet_Unicode, + DVD_CharSet_ISO646, + DVD_CharSet_JIS_Roman_Kanji, + DVD_CharSet_ISO8859_1, + DVD_CharSet_ShiftJIS_Kanji_Roman_Katakana + ); + {$EXTERNALSYM DVD_TextCharSet} + TDVDTextCharSet = DVD_TextCharSet; + +const + DVD_TITLE_MENU = $000; + {$EXTERNALSYM DVD_TITLE_MENU} + DVD_STREAM_DATA_CURRENT = $800; + {$EXTERNALSYM DVD_STREAM_DATA_CURRENT} + DVD_STREAM_DATA_VMGM = $400; + {$EXTERNALSYM DVD_STREAM_DATA_VMGM} + DVD_STREAM_DATA_VTSM = $401; + {$EXTERNALSYM DVD_STREAM_DATA_VTSM} + DVD_DEFAULT_AUDIO_STREAM = $0f ; + {$EXTERNALSYM DVD_DEFAULT_AUDIO_STREAM} + +type + tagDVD_DECODER_CAPS = record + dwSize : DWORD; + dwAudioCaps : DWORD; + dFwdMaxRateVideo : double; + dFwdMaxRateAudio : double; + dFwdMaxRateSP : double; + dBwdMaxRateVideo : double; + dBwdMaxRateAudio : double; + dBwdMaxRateSP : double; + dwRes1 : DWORD; + dwRes2 : DWORD; + dwRes3 : DWORD; + dwRes4 : DWORD; + end; + {$EXTERNALSYM tagDVD_DECODER_CAPS} + DVD_DECODER_CAPS = tagDVD_DECODER_CAPS; + {$EXTERNALSYM DVD_DECODER_CAPS} + TDVDDecoderCaps = tagDVD_DECODER_CAPS; + +const + DVD_AUDIO_CAPS_AC3 = $00000001; + {$EXTERNALSYM DVD_AUDIO_CAPS_AC3} + DVD_AUDIO_CAPS_MPEG2 = $00000002; + {$EXTERNALSYM DVD_AUDIO_CAPS_MPEG2} + DVD_AUDIO_CAPS_LPCM = $00000004; + {$EXTERNALSYM DVD_AUDIO_CAPS_LPCM} + DVD_AUDIO_CAPS_DTS = $00000008; + {$EXTERNALSYM DVD_AUDIO_CAPS_DTS} + DVD_AUDIO_CAPS_SDDS = $00000010; + {$EXTERNALSYM DVD_AUDIO_CAPS_SDDS} + +type + tagDVD_VideoAttributes = record + fPanscanPermitted : BOOL; + fLetterboxPermitted : BOOL; + ulAspectX : ULONG; + ulAspectY : ULONG; + ulFrameRate : ULONG; + ulFrameHeight : ULONG; + Compression : DVD_VIDEO_COMPRESSION; + fLine21Field1InGOP : BOOL; + fLine21Field2InGOP : BOOL; + ulSourceResolutionX : ULONG; + ulSourceResolutionY : ULONG; + fIsSourceLetterboxed : BOOL; + fIsFilmMode : BOOL; + end; + {$EXTERNALSYM tagDVD_VideoAttributes} + DVD_VideoAttributes = tagDVD_VideoAttributes; + {$EXTERNALSYM DVD_VideoAttributes} + TDVDVideoAttributes = tagDVD_VideoAttributes; + + tagDVD_SubpictureAttributes = record + Type_ : DVD_SUBPICTURE_TYPE ; + CodingMode : DVD_SUBPICTURE_CODING ; + Language : LCID ; + LanguageExtension : DVD_SUBPICTURE_LANG_EXT ; + end; + {$EXTERNALSYM tagDVD_SubpictureAttributes} + DVD_SubpictureAttributes = tagDVD_SubpictureAttributes; + {$EXTERNALSYM DVD_SubpictureAttributes} + TDVDSubpictureAttributes = tagDVD_SubpictureAttributes; + + tagDVD_TITLE_APPMODE = ( + {$IFNDEF COMPILER6_UP} + DVD_AppMode_Not_Specified, + DVD_AppMode_Karaoke, + DVD_AppMode_INVALID_2, + DVD_AppMode_Other + {$ELSE} + DVD_AppMode_Not_Specified = 0, + DVD_AppMode_Karaoke = 1, + DVD_AppMode_Other = 3 + {$ENDIF} + ); + {$EXTERNALSYM tagDVD_TITLE_APPMODE} + DVD_TITLE_APPMODE = tagDVD_TITLE_APPMODE; + {$EXTERNALSYM DVD_TITLE_APPMODE} + TDVDTitleAPPMode = DVD_TITLE_APPMODE; + + tagDVD_MUA_MixingInfo = record + fMixTo0 : BOOL; + fMixTo1 : BOOL; + fMix0InPhase : BOOL; + fMix1InPhase : BOOL; + dwSpeakerPosition : DWORD; + end; + {$EXTERNALSYM tagDVD_MUA_MixingInfo} + DVD_MUA_MixingInfo = tagDVD_MUA_MixingInfo; + {$EXTERNALSYM DVD_MUA_MixingInfo} + TDVDMUAMixingInfo = tagDVD_MUA_MixingInfo; + + tagDVD_MUA_Coeff = record + log2_alpha : Double; + log2_beta : Double; + end; + {$EXTERNALSYM tagDVD_MUA_Coeff} + DVD_MUA_Coeff = tagDVD_MUA_Coeff; + {$EXTERNALSYM DVD_MUA_Coeff} + TDVDMUACoeff = tagDVD_MUA_Coeff; + + tagDVD_MultichannelAudioAttributes = record + Info : array[0..7] of DVD_MUA_MixingInfo; + Coeff : array[0..7] of DVD_MUA_Coeff; + end; + {$EXTERNALSYM tagDVD_MultichannelAudioAttributes} + DVD_MultichannelAudioAttributes = tagDVD_MultichannelAudioAttributes; + {$EXTERNALSYM DVD_MultichannelAudioAttributes} + TDVDMultichannelAudioAttributes = tagDVD_MultichannelAudioAttributes; + +// DVD_KARAOKE_CONTENTS +const + DVD_Karaoke_GuideVocal1 = $1; + {$EXTERNALSYM DVD_Karaoke_GuideVocal1} + DVD_Karaoke_GuideVocal2 = $2; + {$EXTERNALSYM DVD_Karaoke_GuideVocal2} + DVD_Karaoke_GuideMelody1 = $4; + {$EXTERNALSYM DVD_Karaoke_GuideMelody1} + DVD_Karaoke_GuideMelody2 = $8; + {$EXTERNALSYM DVD_Karaoke_GuideMelody2} + DVD_Karaoke_GuideMelodyA = $10; + {$EXTERNALSYM DVD_Karaoke_GuideMelodyA} + DVD_Karaoke_GuideMelodyB = $20; + {$EXTERNALSYM DVD_Karaoke_GuideMelodyB} + DVD_Karaoke_SoundEffectA = $40; + {$EXTERNALSYM DVD_Karaoke_SoundEffectA} + DVD_Karaoke_SoundEffectB = $80; + {$EXTERNALSYM DVD_Karaoke_SoundEffectB} + +type + + tagDVD_AudioAttributes = record + AppMode : DVD_AUDIO_APPMODE; + AppModeData : BYTE; + AudioFormat : DVD_AUDIO_FORMAT; + Language : LCID; + LanguageExtension : DVD_AUDIO_LANG_EXT; + fHasMultichannelInfo : BOOL; + dwFrequency : DWORD; + bQuantization : BYTE; + bNumberOfChannels : BYTE; + dwReserved : array[0..1] of DWORD; + end; + {$EXTERNALSYM tagDVD_AudioAttributes} + DVD_AudioAttributes = tagDVD_AudioAttributes; + {$EXTERNALSYM DVD_AudioAttributes} + TDVDAudioAttributes = tagDVD_AudioAttributes; + + tagDVD_TitleMainAttributes = record + AppMode: DVD_TITLE_APPMODE ; + VideoAttributes : DVD_VideoAttributes; + ulNumberOfAudioStreams : ULONG ; + AudioAttributes : array[0..7] of DVD_AudioAttributes; + MultichannelAudioAttributes : array[0..7] of DVD_MultichannelAudioAttributes; + ulNumberOfSubpictureStreams : ULONG ; + SubpictureAttributes : array[0..31] of DVD_SubpictureAttributes; + end; + {$EXTERNALSYM tagDVD_TitleMainAttributes} + DVD_TitleAttributes = tagDVD_TitleMainAttributes; + {$EXTERNALSYM DVD_TitleAttributes} + TDVDTitleAttributes = tagDVD_TitleMainAttributes; + + tagDVD_MenuAttributes = record + fCompatibleRegion : array[0..7] of BOOL; + VideoAttributes : DVD_VideoAttributes; + fAudioPresent : BOOL; + AudioAttributes : DVD_AudioAttributes; + fSubpicturePresent : BOOL; + SubpictureAttributes : DVD_SubpictureAttributes; + end; + {$EXTERNALSYM tagDVD_MenuAttributes} + DVD_MenuAttributes = tagDVD_MenuAttributes; + {$EXTERNALSYM DVD_MenuAttributes} + TDVDMenuAttributes = tagDVD_MenuAttributes; + + tagDVD_KaraokeAttributes = record + bVersion : BYTE; + fMasterOfCeremoniesInGuideVocal1 : BOOL; + fDuet : BOOL; + ChannelAssignment : TDVDKaraokeAssignment; + wChannelContents : array[0..7] of WORD; + end; + {$EXTERNALSYM tagDVD_KaraokeAttributes} + DVD_KaraokeAttributes = tagDVD_KaraokeAttributes; + {$EXTERNALSYM DVD_KaraokeAttributes} + TDVDKaraokeAttributes = tagDVD_KaraokeAttributes; + + +const + DVD_PARENTAL_LEVEL_8 = $8000; + {$EXTERNALSYM DVD_PARENTAL_LEVEL_8} + DVD_PARENTAL_LEVEL_7 = $4000; + {$EXTERNALSYM DVD_PARENTAL_LEVEL_7} + DVD_PARENTAL_LEVEL_6 = $2000; + {$EXTERNALSYM DVD_PARENTAL_LEVEL_6} + DVD_PARENTAL_LEVEL_5 = $1000; + {$EXTERNALSYM DVD_PARENTAL_LEVEL_5} + DVD_PARENTAL_LEVEL_4 = $0800; + {$EXTERNALSYM DVD_PARENTAL_LEVEL_4} + DVD_PARENTAL_LEVEL_3 = $0400; + {$EXTERNALSYM DVD_PARENTAL_LEVEL_3} + DVD_PARENTAL_LEVEL_2 = $0200; + {$EXTERNALSYM DVD_PARENTAL_LEVEL_2} + DVD_PARENTAL_LEVEL_1 = $0100; + {$EXTERNALSYM DVD_PARENTAL_LEVEL_1} + +type + DVD_CMD_FLAGS = {$IFDEF TYPE_IDENTITY}type {$ENDIF} DWORD; + {$EXTERNALSYM DVD_CMD_FLAGS} + +const + DVD_CMD_FLAG_None = $00000000; + {$EXTERNALSYM DVD_CMD_FLAG_None} + DVD_CMD_FLAG_Flush = $00000001; + {$EXTERNALSYM DVD_CMD_FLAG_Flush} + DVD_CMD_FLAG_SendEvents = $00000002; + {$EXTERNALSYM DVD_CMD_FLAG_SendEvents} + DVD_CMD_FLAG_Block = $00000004; + {$EXTERNALSYM DVD_CMD_FLAG_Block} + DVD_CMD_FLAG_StartWhenRendered = $00000008; + {$EXTERNALSYM DVD_CMD_FLAG_StartWhenRendered} + DVD_CMD_FLAG_EndAfterRendered = $00000010; + {$EXTERNALSYM DVD_CMD_FLAG_EndAfterRendered} + +type + CountryCode = array[0..1] of BYTE; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDvdState;'} + {$EXTERNALSYM IDvdState} + IDvdState = interface(IUnknown) + ['{86303d6d-1c4a-4087-ab42-f711167048ef}'] + (*** IDvdState methods ***) + function GetDiscID(out pullUniqueID: Double): HResult; stdcall; + function GetParentalLevel(out pulParentalLevel: ULONG): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDvdCmd;'} + {$EXTERNALSYM IDvdCmd} + IDvdCmd = interface(IUnknown) + ['{5A4A97E4-94EE-4A55-9751-74B5643AA27D}'] + (*** IDvdCmd methods ***) + function WaitForStart: HResult; stdcall; + function WaitForEnd: HResult; stdcall; + end; + + //Deprecated Interface + {$HPPEMIT 'typedef System::DelphiInterface _di_IDvdControl;'} + {$EXTERNALSYM IDvdControl} + IDvdControl = interface(IUnknown) + ['{A70EFE61-E2A3-11D0-A9BE-00AA0061BE93}'] + (*** IDvdControl methods ***) + function TitlePlay(uiTitle: ULONG): HResult; stdcall; + function ChapterPlay(uiTitle: ULONG; uiChapter: ULONG): HResult; stdcall; + function TimePlay(uiTitle: ULONG; bcdTime: ULONG): HResult; stdcall; + function StopForResume: HResult; stdcall; + function GoUp: HResult; stdcall; + function TimeSearch(bcdTime: ULONG): HResult; stdcall; + function ChapterSearch(Chapter: ULONG): HResult; stdcall; + function PrevPGSearch: HResult; stdcall; + function TopPGSearch: HResult; stdcall; + function NextPGSearch: HResult; stdcall; + function ForwardScan(dwSpeed: double): HResult; stdcall; + function BackwardScan(dwSpeed: double): HResult; stdcall; + function MenuCall(MenuID: TDVDMenuID): HResult; stdcall; + function Resume: HResult; stdcall; + function UpperButtonSelect: HResult; stdcall; + function LowerButtonSelect: HResult; stdcall; + function LeftButtonSelect: HResult; stdcall; + function RightButtonSelect: HResult; stdcall; + function ButtonActivate: HResult; stdcall; + function ButtonSelectAndActivate(uiButton: ULONG): HResult; stdcall; + function StillOff: HResult; stdcall; + function PauseOn: HResult; stdcall; + function PauseOff: HResult; stdcall; + function MenuLanguageSelect(Language: LCID): HResult; stdcall; + function AudioStreamChange(nAudio: ULONG): HResult; stdcall; + function SubpictureStreamChange(nSubPicture: ULONG; bDisplay: BOOL): HResult; stdcall; + function AngleChange(ulAngle: ULONG): HResult; stdcall; + function ParentalLevelSelect(ulParentalLevel: ULONG): HResult; stdcall; + function ParentalCountrySelect(wCountry: Word): HResult; stdcall; + function KaraokeAudioPresentationModeChange(ulMode: ULONG): HResult; stdcall; + function VideoModePreferrence(ulPreferredDisplayMode: ULONG): HResult; stdcall; + function SetRoot(pszPath: LPCWSTR): HResult; stdcall; + function MouseActivate(point: TPoint): HResult; stdcall; + function MouseSelect(point: TPoint): HResult; stdcall; + function ChapterPlayAutoStop(ulTitle, ulChapter, ulChaptersToPlay: ULONG): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDvdControl2;'} + {$EXTERNALSYM IDvdControl2} + IDvdControl2 = interface(IUnknown) + ['{33BC7430-EEC0-11D2-8201-00A0C9D74842}'] + (*** IDvdControl2 methods ***) + function PlayTitle(ulTitle, dwFlags: ULONG; var ppCmd: IDvdCmd): HResult; stdcall; + function PlayChapterInTitle(ulTitle, ulChapter: ULONG; dwFlags: DWORD; var ppCmd: IDvdCmd): HResult; stdcall; + function PlayAtTimeInTitle(ulTitle: ULONG; var pStartTime: TDVDHMSFTimeCode; dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function Stop: HResult; stdcall; + function ReturnFromSubmenu(dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function PlayAtTime(pTime: PDVDHMSFTimeCode; dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function PlayChapter(ulChapter: ULONG; dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function PlayPrevChapter(dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function ReplayChapter(dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function PlayNextChapter(dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function PlayForwards(dSpeed: double; dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function PlayBackwards(dSpeed: double; dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function ShowMenu(MenuID: TDVDMenuID; dwFlags: DVD_CMD_FLAGS;out ppCmd: IDvdCmd): HResult; stdcall; + function Resume(dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function SelectRelativeButton(buttonDir: TDVDRelativeButton): HResult; stdcall; + function ActivateButton: HResult; stdcall; + function SelectButton(ulButton: ULONG): HResult; stdcall; + function SelectAndActivateButton(ulButton: ULONG): HResult; stdcall; + function StillOff: HResult; stdcall; + function Pause(bState: BOOL): HResult; stdcall; + function SelectAudioStream(ulAudio: ULONG; dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function SelectSubpictureStream(ulSubPicture: ULONG; dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function SetSubpictureState(bState: BOOL; dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function SelectAngle(ulAngle: ULONG; dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function SelectParentalLevel(ulParentalLevel: ULONG): HResult; stdcall; + function SelectParentalCountry(bCountry: CountryCode): HResult; stdcall; + function SelectKaraokeAudioPresentationMode(ulMode: ULONG): HResult; stdcall; + function SelectVideoModePreference(ulPreferredDisplayMode: ULONG): HResult; stdcall; + function SetDVDDirectory(pszwPath: LPCWSTR): HResult; stdcall; + function ActivateAtPosition(point: TPoint): HResult; stdcall; + function SelectAtPosition(point : TPoint): HResult; stdcall; + function PlayChaptersAutoStop(ulTitle, ulChapter, ulChaptersToPlay: ULONG; dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function AcceptParentalLevelChange(bAccept: BOOL): HResult; stdcall; + function SetOption(flag: TDVDOptionFlag; fState: BOOL): HResult; stdcall; + function SetState(pState: IDvdState; dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function PlayPeriodInTitleAutoStop(ulTitle: ULONG; var pStartTime, pEndTime: TDVDHMSFTimeCode; dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function SetGPRM(ulIndex: ULONG; wValue: WORD; dwFlags: DWORD; out ppCmd: IDvdCmd): HResult; stdcall; + function SelectDefaultMenuLanguage(Language: LCID): HResult; stdcall; + function SelectDefaultAudioLanguage(Language: LCID; audioExtension: TDVDAudioLangExt): HResult; stdcall; + function SelectDefaultSubpictureLanguage(Language: LCID; subpictureExtension: TDVDSubpictureLangExt): HResult; stdcall; + end; + + //Deprecated Interface + {$HPPEMIT 'typedef System::DelphiInterface _di_IDvdInfo;'} + {$EXTERNALSYM IDvdInfo} + IDvdInfo = interface(IUnknown) + ['{A70EFE60-E2A3-11D0-A9BE-00AA0061BE93}'] + (*** IDvdInfo methods ***) + function GetCurrentDomain(out pDomain: TDVDDomain): HResult; stdcall; + function GetCurrentLocation(out pLocation: TDVDPlaybackLocation): HResult; stdcall; + function GetTotalTitleTime(out pTotalTime: ULONG): HResult; stdcall; + function GetCurrentButton(out pnButtonsAvailable, pnCurrentButton: ULONG): HResult; stdcall; + function GetCurrentAngle(out pnAnglesAvailable, pnCurrentAngle: ULONG): HResult; stdcall; + function GetCurrentAudio(out pnStreamsAvailable, pnCurrentStream: ULONG): HResult; stdcall; + function GetCurrentSubpicture(out pnStreamsAvailable, pnCurrentStream: ULONG; + out pIsDisabled: BOOL): HResult; stdcall; + function GetCurrentUOPS(out pUOP: VALID_UOP_SOMTHING_OR_OTHER): HResult; stdcall; + function GetAllSPRMs(var pRegisterArray: TSPRMArray): HResult; stdcall; + function GetAllGPRMs(var pRegisterArray: GPRMArray): HResult; stdcall; + function GetAudioLanguage(nStream: ULONG; out pLanguage: LCID): HResult; stdcall; + function GetSubpictureLanguage(nStream: ULONG; out pLanguage: LCID): HResult; stdcall; + function GetTitleAttributes(nTitle: ULONG; out pATR: TDVDAtr): HResult; stdcall; + function GetVMGAttributes(out pATR: TDVDAtr): HResult; stdcall; + function GetCurrentVideoAttributes(out pATR: DVD_VideoATR): HResult; stdcall; + function GetCurrentAudioAttributes(out pATR: DVD_AudioATR): HResult; stdcall; + function GetCurrentSubpictureAttributes(out pATR: DVD_SubpictureATR): HResult; stdcall; + function GetCurrentVolumeInfo(out pNumOfVol, pThisVolNum: ULONG; + out pSide: TDVDDiscSide; out pNumOfTitles: ULONG): HResult; stdcall; + function GetDVDTextInfo(out pTextManager: Byte; cbBufSize: ULONG; + out pcbActualSize: ULONG): HResult; stdcall; + function GetPlayerParentalLevel(out pParentalLevel, pCountryCode: ULONG): HResult; stdcall; + function GetNumberOfChapters(ulTitle: ULONG; out pNumberOfChapters: ULONG): HResult; stdcall; + function GetTitleParentalLevels(ulTitle: ULONG; out pParentalLevels: ULONG): HResult; stdcall; + function GetRoot(pRoot: PChar; cbBufSize: ULONG; out pcbActualSize: ULONG): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDvdInfo2;'} + {$EXTERNALSYM IDvdInfo2} + IDvdInfo2 = interface(IUnknown) + ['{34151510-EEC0-11D2-8201-00A0C9D74842}'] + (*** IDvdInfo2 methods ***) + function GetCurrentDomain(out pDomain: TDVDDomain): HResult; stdcall; + function GetCurrentLocation(out pLocation: TDVDPlaybackLocation2): HResult; stdcall; + function GetTotalTitleTime(out pTotalTime: TDVDHMSFTimeCode; out ulTimeCodeFlags: ULONG): HResult; stdcall; + function GetCurrentButton(out pulButtonsAvailable, pulCurrentButton: ULONG): HResult; stdcall; + function GetCurrentAngle(out pulAnglesAvailable, pulCurrentAngle: ULONG): HResult; stdcall; + function GetCurrentAudio(out pulStreamsAvailable, pulCurrentStream: ULONG): HResult; stdcall; + function GetCurrentSubpicture(out pulStreamsAvailable, pulCurrentStream: ULONG; out pbIsDisabled: BOOL): HResult; stdcall; + function GetCurrentUOPS(out pulUOPs: ULONG): HResult; stdcall; + function GetAllSPRMs(out pRegisterArray: TSPRMArray): HResult; stdcall; + function GetAllGPRMs(out pRegisterArray: GPRMArray): HResult; stdcall; + function GetAudioLanguage(ulStream: ULONG; out pLanguage: LCID): HResult; stdcall; + function GetSubpictureLanguage(ulStream: ULONG; out pLanguage: LCID): HResult; stdcall; + function GetTitleAttributes(ulTitle: ULONG; out pMenu: TDVDMenuAttributes; out pTitle: TDVDTitleAttributes): HResult; stdcall; + function GetVMGAttributes(out pATR: TDVDMenuAttributes): HResult; stdcall; + function GetCurrentVideoAttributes(out pATR: TDVDVideoAttributes): HResult; stdcall; + function GetAudioAttributes(ulStream: ULONG; out pATR: TDVDAudioAttributes): HResult; stdcall; + function GetKaraokeAttributes(ulStream: ULONG; out pAttributes: TDVDKaraokeAttributes): HResult; stdcall; + function GetSubpictureAttributes(ulStream :ULONG; out pATR: TDVDSubpictureAttributes): HResult; stdcall; + function GetDVDVolumeInfo(out pulNumOfVolumes, pulVolume: ULONG; out pSide: TDVDDiscSide; out pulNumOfTitles: ULONG): HResult; stdcall; + function GetDVDTextNumberOfLanguages(out pulNumOfLangs: ULONG): HResult; stdcall; + function GetDVDTextLanguageInfo(ulLangIndex: ULONG; out pulNumOfStrings: ULONG; out pLangCode: LCID; out pbCharacterSet: TDVDTextCharSet): HResult; stdcall; + function GetDVDTextStringAsNative(ulLangIndex, ulStringIndex: ULONG; out pbBuffer; ulMaxBufferSize: ULONG; out pulActualSize: ULONG; out pType: TDVDTextStringType): HResult; stdcall; + function GetDVDTextStringAsUnicode(ulLangIndex, ulStringIndex: ULONG; out pchwBuffer; ulMaxBufferSize: ULONG; out pulActualSize: ULONG; out pType: TDVDTextStringType): HResult; stdcall; + function GetPlayerParentalLevel(out pulParentalLevel: ULONG; out pbCountryCode: CountryCode): HResult; stdcall; + function GetNumberOfChapters(ulTitle: ULONG; out pulNumOfChapters: ULONG): HResult; stdcall; + function GetTitleParentalLevels(ulTitle: ULONG; out pulParentalLevels: ULONG): HResult; stdcall; + function GetDVDDirectory(out pszwPath; ulMaxSize: ULONG; out pulActualSize: ULONG): HResult; stdcall; + function IsAudioStreamEnabled(ulStreamNum: ULONG; out pbEnabled: BOOL): HResult; stdcall; + function GetDiscID(pszwPath: LPCWSTR; out pullDiscID: Int64): HResult; stdcall; + function GetState(out pStateData: IDvdState): HResult; stdcall; + function GetMenuLanguages(out pLanguages: LCID; ulMaxLanguages: ULONG; out pulActualLanguages: ULONG): HResult; stdcall; + function GetButtonAtPosition(point: Tpoint;out pulButtonIndex: ULONG): HResult; stdcall; + function GetCmdFromEvent(lParam1: integer; out pCmdObj: IDvdCmd): HResult; stdcall; + function GetDefaultMenuLanguage(out pLanguage: LCID): HResult; stdcall; + function GetDefaultAudioLanguage(out pLanguage: LCID; out pAudioExtension: TDVDAudioLangExt): HResult; stdcall; + function GetDefaultSubpictureLanguage(out pLanguage: LCID; out pSubpictureExtension: TDVDSubpictureLangExt): HResult; stdcall; + function GetDecoderCaps(out pCaps: TDVDDecoderCaps): HResult; stdcall; + function GetButtonRect(ulButton: ULONG; out pRect: TRect): HResult; stdcall; + function IsSubpictureStreamEnabled(ulStreamNum: ULONG; out pbEnabled: BOOL): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVideoFrameStep;'} + {$EXTERNALSYM IVideoFrameStep} + IVideoFrameStep = interface(IUnknown) + ['{e46a9787-2b71-444d-a4b5-1fab7b708d6a}'] + (*** IVideoFrameStep methods ***) + function Step(dwFrames: DWORD; pStepObject: IUnKnown): HResult; stdcall; + function CanStep(bMultiple: longint; pStepObject: IUnknown): HResult; stdcall; + function CancelStep: HResult; stdcall; + end; + + + +const + AM_DVD_HWDEC_PREFER = $01; // default + {$EXTERNALSYM AM_DVD_HWDEC_PREFER} + AM_DVD_HWDEC_ONLY = $02; + {$EXTERNALSYM AM_DVD_HWDEC_ONLY} + AM_DVD_SWDEC_PREFER = $04; + {$EXTERNALSYM AM_DVD_SWDEC_PREFER} + AM_DVD_SWDEC_ONLY = $08; + {$EXTERNALSYM AM_DVD_SWDEC_ONLY} + AM_DVD_NOVPE = $100; + {$EXTERNALSYM AM_DVD_NOVPE} + // DirectX9 Specific + AM_DVD_VMR9_ONLY = $800; // only use VMR9 (otherwise fail) for rendering + {$EXTERNALSYM AM_DVD_VMR9_ONLY} + + AM_DVD_STREAM_VIDEO = $1; + {$EXTERNALSYM AM_DVD_STREAM_VIDEO} + AM_DVD_STREAM_AUDIO = $2; + {$EXTERNALSYM AM_DVD_STREAM_AUDIO} + AM_DVD_STREAM_SUBPIC = $4; + {$EXTERNALSYM AM_DVD_STREAM_SUBPIC} + +type + AM_DVD_RENDERSTATUS = record + hrVPEStatus: HResult; + bDvdVolInvalid: BOOL; + bDvdVolUnknown: BOOL; + bNoLine21In: BOOL; + bNoLine21Out: BOOL; + iNumStreams: Integer; + iNumStreamsFailed: Integer; + dwFailedStreamsFlag: DWORD; + end; + {$EXTERNALSYM AM_DVD_RENDERSTATUS} + TAMDVDRenderStatus = AM_DVD_RENDERSTATUS; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDvdGraphBuilder;'} + {$EXTERNALSYM IDvdGraphBuilder} + IDvdGraphBuilder = interface(IUnknown) + ['{FCC152B6-F372-11d0-8E00-00C04FD7C08B}'] + (*** IDvdGraphBuilder methods ***) + function GetFiltergraph(out ppGB: IGraphBuilder): HResult; stdcall; + function GetDvdInterface(const riid: TGUID; out ppvIF): HResult; stdcall; + function RenderDvdVideoVolume(lpcwszPathName: PWideChar; dwFlags: DWORD; + out pStatus: TAMDVDRenderStatus): HResult; stdcall; + end; + +//_AM_OVERLAY_NOTIFY_FLAGS +const + AM_OVERLAY_NOTIFY_VISIBLE_CHANGE = $1; + {$EXTERNALSYM AM_OVERLAY_NOTIFY_VISIBLE_CHANGE} + AM_OVERLAY_NOTIFY_SOURCE_CHANGE = $2; + {$EXTERNALSYM AM_OVERLAY_NOTIFY_SOURCE_CHANGE} + AM_OVERLAY_NOTIFY_DEST_CHANGE = $4; + {$EXTERNALSYM AM_OVERLAY_NOTIFY_DEST_CHANGE} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IDDrawExclModeVideoCallback;'} + {$EXTERNALSYM IDDrawExclModeVideoCallback} + IDDrawExclModeVideoCallback = interface(IUnknown) + ['{913c24a0-20ab-11d2-9038-00a0c9697298}'] + (*** IDDrawExclModeVideoCallback methods ***) + function OnUpdateOverlay(bBefore: BOOL; dwFlags: DWORD; bOldVisible: BOOL; + var prcOldSrc, prcOldDest: TRECT; bNewVisible: BOOL; var prcNewSrc, prcNewDest: TRECT): HResult; stdcall; + function OnUpdateColorKey(var pKey: TCOLORKEY; dwColor: DWORD): HResult; stdcall; + function OnUpdateSize(dwWidth, dwHeight, dwARWidth, dwARHeight: DWORD): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDDrawExclModeVideo;'} + {$EXTERNALSYM IDDrawExclModeVideo} + IDDrawExclModeVideo = interface(IUnknown) + ['{153ACC21-D83B-11d1-82BF-00A0C9696C8F}'] + (*** IDDrawExclModeVideo methods ***) + function SetDDrawObject(pDDrawObject: IDirectDraw): HResult; stdcall; + function GetDDrawObject(out ppDDrawObject: IDirectDraw; out pbUsingExternal: BOOL): HResult; stdcall; + function SetDDrawSurface(pDDrawSurface: IDirectDrawSurface): HResult; stdcall; + function GetDDrawSurface(out ppDDrawSurface: IDirectDrawSurface; out pbUsingExternal: BOOL): HResult; stdcall; + function SetDrawParameters(prcSource, prcTarget: PRECT): HResult; stdcall; + function GetNativeVideoProps(out pdwVideoWidth, pdwVideoHeight, pdwPictAspectRatioX,pdwPictAspectRatioY: DWORD): HResult; stdcall; + function SetCallbackInterface(pCallback: IDDrawExclModeVideoCallback; dwFlags: DWORD): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IPinConnection;'} + {$EXTERNALSYM IPinConnection} + IPinConnection = interface(IUnknown) + ['{4a9a62d3-27d4-403d-91e9-89f540e55534}'] + (*** IPinConnection methods ***) + function DynamicQueryAccept(var pmt: TAMMediaType): HResult; stdcall; + function NotifyEndOfStream(hNotifyEvent: THandle): HResult; stdcall; + function IsEndPin: HResult; stdcall; + function DynamicDisconnect: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IPinFlowControl;'} + {$EXTERNALSYM IPinFlowControl} + IPinFlowControl = interface(IUnknown) + ['{c56e9858-dbf3-4f6b-8119-384af2060deb}'] + (*** IPinFlowControl methods ***) + function Block(dwBlockFlags: DWORD; hEvent: THandle): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IGraphConfigCallback;'} + {$EXTERNALSYM IGraphConfigCallback} + IGraphConfigCallback = interface(IUnknown) + ['{ade0fd60-d19d-11d2-abf6-00a0c905f375}'] + (*** IGraphConfigCallback methods ***) + function Reconfigure(var pvContext; dwFlags: DWORD): HResult; stdcall; + end; + +const + //_AM_PIN_FLOW_CONTROL_BLOCK_FLAGS + AM_PIN_FLOW_CONTROL_BLOCK = $1; + {$EXTERNALSYM AM_PIN_FLOW_CONTROL_BLOCK} + + //_AM_GRAPH_CONFIG_RECONNECT_FLAGS + AM_GRAPH_CONFIG_RECONNECT_DIRECTCONNECT = $1; + {$EXTERNALSYM AM_GRAPH_CONFIG_RECONNECT_DIRECTCONNECT} + AM_GRAPH_CONFIG_RECONNECT_CACHE_REMOVED_FILTERS = $2; + {$EXTERNALSYM AM_GRAPH_CONFIG_RECONNECT_CACHE_REMOVED_FILTERS} + AM_GRAPH_CONFIG_RECONNECT_USE_ONLY_CACHED_FILTERS = $4; + {$EXTERNALSYM AM_GRAPH_CONFIG_RECONNECT_USE_ONLY_CACHED_FILTERS} + + //_AM_FILTER_FLAGS + AM_FILTER_FLAGS_REMOVABLE = $1; + {$EXTERNALSYM AM_FILTER_FLAGS_REMOVABLE} + + //_REM_FILTER_FLAGS + REMFILTERF_LEAVECONNECTED = $1; + {$EXTERNALSYM REMFILTERF_LEAVECONNECTED} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IGraphConfig;'} + {$EXTERNALSYM IGraphConfig} + IGraphConfig = interface(IUnknown) + ['{03A1EB8E-32BF-4245-8502-114D08A9CB88}'] + (*** IGraphConfig methods ***) + function Reconnect(pOutputPin, pInputPin: IPin; pmtFirstConnection: PAMMediaType; + pUsingFilter: IBaseFilter; hAbortEvent: THandle; dwFlags: DWORD): HResult; stdcall; + function Reconfigure(pCallback: IGraphConfigCallback; var pvContext; + dwFlags: DWORD; hAbortEvent: THandle): HResult; stdcall; + function AddFilterToCache(pFilter: IBaseFilter): HResult; stdcall; + function EnumCacheFilter(out pEnum: IEnumFilters): HResult; stdcall; + function RemoveFilterFromCache(pFilter: IBaseFilter): HResult; stdcall; + function GetStartTime(out prtStart: TReferenceTime): HResult; stdcall; + function PushThroughData(pOutputPin: IPin; pConnection: IPinConnection; hEventAbort: PHANDLE): HResult; stdcall; + function SetFilterFlags(pFilter: IBaseFilter; dwFlags: DWORD): HResult; stdcall; + function GetFilterFlags(pFilter: IBaseFilter; out pdwFlags: DWORD): HResult; stdcall; + function RemoveFilterEx(pFilter: IBaseFilter; Flags: DWORD): HResult; stdcall; + end; + +// Filter Chain Definition +// +// Filter chains have the following properties: +// +// - Each filter chain has one or more filters. +// +// - Each filter in a filter chain has at most one connected input pin and one +// connected output pin. For example, filters A, C, D, F, G, H, I, J and K +// (see the diagram below) can be in a filter chain because each one has at +// most one connected input pin and one connected output pin. +// +// - Any filter in a chain is reachable by any other filter in the chain. +// For example, in the filter chain F-G-H, F can reach H by following the F- +// G connection to G and then following the G-H connection to H. Filters F +// and J cannot be in the same filter chain because J is not reachable from +// F. Anotherwords, there no sequence of connected filters between F and J. +// +// - The start filter is the only filter in the filter chain who's input +// pin is not connected to another filter in the chain. For instance, F is +// the start filter in F-G-H because F's input pin is connected to E and E +// is not in the filter chain. G's input pin is connected to F and H's is +// connected to G. Both F and G are in the filter chain. +// +// - The end filter is the only filter in the filter chain who's output pin +// is not connected to another filter in the chain. For example, in the +// filter chain J-K, K is the end filter because K's output pin is +// connected to L. J's output pin is connected to K and K is in the J-K +// filter chain. +// +// +// --->|---| |---|---> +// | C |--->| D | +// |---| |---|--->|---| |---|--->|---| |---| |---| |---| +// | A |--->| B | | E |--->| F |--->| G |--->| H | +// |---| |---|--->|---|------------>|---| |---| |---| |---| +// | I |---> +// --->|---|---> +// +// |---| |---| |---| +// | J |--->| K |--->| L | +// |---| |---| |---| +// +// Example Filter Graph +// +// +// +// IFilterChain Methods Documentation +// +// HResult StartChain( [in] IBaseFilter *pStartFilter, [in] IBaseFilter *pEndFilter ); +// +// StartChain() switches all the filters in the chain into the running state +// If one of the filters will not switch to the running state, then all the filters +// in the chain are stopped. This method can only be called if the filter graph is +// running. +// +// Parameters: +// - pStartFilter [in] +// The first filter in the filter chain. Note that this can be the same +// filter as pEndFilter . +// +// - pEndFilter [in] +// The last filter in the filter chain. Note that this can be the same +// filter as pStartFilter. If pEndFilter is NULL then the filter chain extends +// from pStartFilter to the last downstream filter which can be in a filter chain. +// For example, IFilterChain::StartChain( A, NULL ) would start filter A. +// IFilterChain::StartChain( G, NULL ) would start filters G and H. +// IFilterChain::StartChain( C, NULL ) would start filters C and D. Finally, +// IFilterChain::StartChain( E, NULL ) would fail because E cannot be in a +// filter chain (see the Filter Chain Definition section for more information). +// +// Return Value: +// An HResult. See the Direct Show SDK and COM SDK documentation for more +// information on interpreting HRESULTs. +// +// +// +// +// HResult PauseChain( [in] IBaseFilter *pStartFilter, [in] IBaseFilter *pEndFilter ); +// +// PauseChain() switches all the filters in a chain to the paused state. If it cannot +// switch one of the filtres into the paused state, all the filters in the chain are +// stopped. This method can only be called if the filter graph is paused. +// +// Parameters: +// - pStartFilter [in] +// The first filter in the filter chain. Note that this can be the same +// filter as pEndFilter . +// +// - pEndFilter [in] +// The last filter in the filter chain. Note that this can be the same +// filter as pStartFilter. If pEndFilter is NULL then the filter chain extends +// from pStartFilter to the last downstream filter which can be in a filter chain. +// For example, IFilterChain::StopChain( A, NULL ) would stop filter A. +// IFilterChain::StopChain( G, NULL ) would stop filters G and H. +// IFilterChain::StopChain( C, NULL ) would stop filters C and D. Finally, +// IFilterChain::StopChain( E, NULL ) would fail because E cannot be in a filter +// chain (see the Filter Chain Definition section for more information). +// +// +// Return Value: +// An HResult. See the Direct Show SDK and COM SDK documentation for more +// information on interpreting HRESULTs. +// +// +// +// HResult StopChain( [in] IBaseFilter *pStartFilter, [in] IBaseFilter *pEndFilter ); +// +// StopChain() switches all the filters in chain to the stopped state. +// +// Parameters: +// - pStartFilter [in] +// The first filter in the filter chain. Note that this can be the same +// filter as pEndFilter . +// +// - pEndFilter [in] +// The last filter in the filter chain. Note that this can be the same +// filter as pStartFilter. If pEndFilter is NULL then the filter chain extends +// from pStartFilter to the last downstream filter which can be in a filter chain. +// For example, IFilterChain::StopChain( A, NULL ) would stop filter A. +// IFilterChain::StopChain( G, NULL ) would stop filters G and H. +// IFilterChain::StopChain( C, NULL ) would stop filters C and D. Finally, +// IFilterChain::StopChain( E, NULL ) would fail because E cannot be in a filter +// chain (see the Filter Chain Definition section for more information). +// +// +// Return Value: +// An HResult. See the Direct Show SDK and COM SDK documentation for more +// information on interpreting HRESULTs. +// +// +// +// +// +// HResult RemoveChain( [in] IBaseFilter *pStartFilter, [in] IBaseFilter *pEndFilter ); +// +// RemoveChain() removes every filter in a chain from the filter graph. +// The filters can be removed while the graph is running. +// +// Parameters: +// - pStartFilter [in] +// The first filter in the filter chain. Note that this can be the same +// filter as pEndFilter . +// +// - pEndFilter [in] +// The last filter in the filter chain. Note that this can be the same +// filter as pStartFilter. If pEndFilter is NULL then the filter chain +// extends from pStartFilter to the last downstream filter which can be in a +// filter chain. For example, IFilterChain::RemoveChain( A, NULL ) would remove +// filter A from the filter graph. IFilterChain::RemoveChain( G, NULL ) would +// remove filters G and H. IFilterChain::RemoveChain( C, NULL ) would remove +// filters C and D. Finally, IFilterChain::RemoveChain( E, NULL ) would fail +// because E cannot be in a filter chain (see the Filter Chain Definition +// section for more information). +// +// +// Return Value: +// An HResult. See the Direct Show SDK and COM SDK documentation for more +// information on interpreting HRESULTs. +// +// + + {$HPPEMIT 'typedef System::DelphiInterface _di_IFilterChain;'} + {$EXTERNALSYM IFilterChain} + IFilterChain = interface(IUnknown) + ['{DCFBDCF6-0DC2-45f5-9AB2-7C330EA09C29}'] + (*** IFilterChain methods ***) + function StartChain(pStartFilter, pEndFilter: IBaseFilter): HResult; stdcall; + function PauseChain(pStartFilter, pEndFilter: IBaseFilter): HResult; stdcall; + function StopChain(pStartFilter, pEndFilter: IBaseFilter): HResult; stdcall; + function RemoveChain(pStartFilter, pEndFilter: IBaseFilter): HResult; stdcall; + end; + +/////////////////////////////////////////////////////////////////////////////// +// +// Allocator Presenter interfaces +// +/////////////////////////////////////////////////////////////////////////////// +{$IFDEF ENABLEVMR7} +//===================================================================== +// +// IVMRImagePresenter +// +//===================================================================== +type + VMRPresentationFlags = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM VMRPresentationFlags} + const + VMRSample_SyncPoint = $00000001; + {$EXTERNALSYM VMRSample_SyncPoint} + VMRSample_Preroll = $00000002; + {$EXTERNALSYM VMRSample_Preroll} + VMRSample_Discontinuity = $00000004; + {$EXTERNALSYM VMRSample_Discontinuity} + VMRSample_TimeValid = $00000008; + {$EXTERNALSYM VMRSample_TimeValid} + VMRSample_SrcDstRectsValid = $00000010; + {$EXTERNALSYM VMRSample_SrcDstRectsValid} + + +type + PVMRPresentationInfo = ^TVMRPresentationInfo; + tagVMRPRESENTATIONINFO = record + dwFlags : DWORD; + lpSurf : IDIRECTDRAWSURFACE7; + rtStart : TReferenceTime; + rtEnd : TReferenceTime; + szAspectRatio : TSIZE; + rcSrc : TRECT; + rcDst : TRECT; + dwTypeSpecificFlags : DWORD; + dwInterlaceFlags : DWORD; + end; + {$EXTERNALSYM tagVMRPRESENTATIONINFO} + VMRPRESENTATIONINFO = tagVMRPRESENTATIONINFO; + {$EXTERNALSYM VMRPRESENTATIONINFO} + TVMRPresentationInfo = tagVMRPRESENTATIONINFO; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRImagePresenter;'} + {$EXTERNALSYM IVMRImagePresenter} + IVMRImagePresenter = interface(IUnknown) + ['{CE704FE7-E71E-41fb-BAA2-C4403E1182F5}'] + (*** IVMRImagePresenter methods ***) + function StartPresenting(dwUserID: DWORD): HResult; stdcall; + function StopPresenting(dwUserID: DWORD): HResult; stdcall; + function PresentImage(dwUserID: DWORD; lpPresInfo: PVMRPRESENTATIONINFO): HResult; stdcall; + end; +{$ENDIF} + +{$IFDEF ENABLEVMR7} +//===================================================================== +// +// IVMRSurfaceAllocator +// +//===================================================================== + +const + AMAP_PIXELFORMAT_VALID = $01; + {$EXTERNALSYM AMAP_PIXELFORMAT_VALID} + AMAP_3D_TARGET = $02; + {$EXTERNALSYM AMAP_3D_TARGET} + AMAP_ALLOW_SYSMEM = $04; + {$EXTERNALSYM AMAP_ALLOW_SYSMEM} + AMAP_FORCE_SYSMEM = $08; + {$EXTERNALSYM AMAP_FORCE_SYSMEM} + AMAP_DIRECTED_FLIP = $10; + {$EXTERNALSYM AMAP_DIRECTED_FLIP} + AMAP_NO_EXTRA_BUFFERS = $20; + {$EXTERNALSYM AMAP_NO_EXTRA_BUFFERS} + +type + PVMRAllocationInfo = ^TVMRAllocationInfo; + tagVMRALLOCATIONINFO = record + dwFlags : DWORD; + lpHdr : PBITMAPINFOHEADER; + lpPixFmt : PDDPIXELFORMAT; + szAspectRatio : TSIZE; + dwMinBuffers : DWORD; + dwMaxBuffers : DWORD; + dwInterlaceFlags : DWORD; + szNativeSize : TSIZE ; + end; + {$EXTERNALSYM tagVMRALLOCATIONINFO} + VMRALLOCATIONINFO = tagVMRALLOCATIONINFO; + {$EXTERNALSYM VMRALLOCATIONINFO} + TVMRAllocationInfo = tagVMRALLOCATIONINFO; + + IVMRSurfaceAllocatorNotify = interface; + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRSurfaceAllocator;'} + {$EXTERNALSYM IVMRSurfaceAllocator} + IVMRSurfaceAllocator = interface(IUnknown) + ['{31ce832e-4484-458b-8cca-f4d7e3db0b52}'] + (*** IVMRSurfaceAllocator methods ***) + function AllocateSurface(dwUserID: DWORD; lpAllocInfo: PVMRALLOCATIONINFO; + var lpdwActualBuffers: DWORD; out lplpSurface: IDIRECTDRAWSURFACE7): HResult; stdcall; + function FreeSurface(dwID: DWORD): HResult; stdcall; + function PrepareSurface(dwUserID: DWORD; lpSurface: IDIRECTDRAWSURFACE7; + dwSurfaceFlags: DWORD): HResult; stdcall; + function AdviseNotify(lpIVMRSurfAllocNotify: IVMRSurfaceAllocatorNotify): HResult; stdcall; + end; +{$ENDIF} + +{$IFDEF ENABLEVMR7} +//===================================================================== +// +// IVMRSurfaceAllocatorNotify +// +//===================================================================== + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRSurfaceAllocatorNotify;'} + {$EXTERNALSYM IVMRSurfaceAllocatorNotify} + IVMRSurfaceAllocatorNotify = interface(IUnknown) + ['{aada05a8-5a4e-4729-af0b-cea27aed51e2}'] + (*** IVMRSurfaceAllocatorNotify methods ***) + function AdviseSurfaceAllocator(dwUserID: DWORD; lpIVRMSurfaceAllocator: IVMRSurfaceAllocator): HResult; stdcall; + function SetDDrawDevice(lpDDrawDevice: IDirectDraw7; hMonitor: HMONITOR): HResult; stdcall; + function ChangeDDrawDevice(lpDDrawDevice: IDIRECTDRAW7; hMonitor: HMONITOR): HResult; stdcall; + function RestoreDDrawSurfaces: HResult; stdcall; + function NotifyEvent(EventCode: LongInt; Param1, Param2: LongInt): HResult; stdcall; + function SetBorderColor(clrBorder: COLORREF): HResult; stdcall; + end; +{$ENDIF} +/////////////////////////////////////////////////////////////////////////////// +// +// Application control and configuration interfaces +// +/////////////////////////////////////////////////////////////////////////////// + +//===================================================================== +// +// IVMRWindowlessControl +// +//===================================================================== + VMR_ASPECT_RATIO_MODE = ( + VMR_ARMODE_NONE, + VMR_ARMODE_LETTER_BOX + ); + {$EXTERNALSYM VMR_ASPECT_RATIO_MODE} + TVMRAspectRatioMode = VMR_ASPECT_RATIO_MODE; + +{$IFDEF ENABLEVMR7} + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRWindowlessControl;'} + {$EXTERNALSYM IVMRWindowlessControl} + IVMRWindowlessControl = interface(IUnknown) + ['{0eb1088c-4dcd-46f0-878f-39dae86a51b7}'] + (*** IVMRWindowlessControl methods ***) + ////////////////////////////////////////////////////////// + // Video size and position information + ////////////////////////////////////////////////////////// + function GetNativeVideoSize(out lpWidth, lpHeight, lpARWidth, lpARHeight: LongInt): HResult; stdcall; + function GetMinIdealVideoSize(out lpWidth, lpHeight: longint): HResult; stdcall; + function GetMaxIdealVideoSize(out lpWidth, lpHeight: longint): HResult; stdcall; + function SetVideoPosition(lpSRCRect, lpDSTRect: PRECT): HResult; stdcall; + function GetVideoPosition(out lpSRCRect, lpDSTRect: TRECT): HResult; stdcall; + function GetAspectRatioMode(out lpAspectRatioMode: DWORD): HResult; stdcall; + function SetAspectRatioMode(AspectRatioMode: TVMRAspectRatioMode): HResult; stdcall; + ////////////////////////////////////////////////////////// + // Display and clipping management + ////////////////////////////////////////////////////////// + function SetVideoClippingWindow(hwnd: HWND): HResult; stdcall; + function RepaintVideo(hwnd: HWND; hdc: HDC): HResult; stdcall; + function DisplayModeChanged: HResult; stdcall; + ////////////////////////////////////////////////////////// + // GetCurrentImage + // + // Returns the current image being displayed. This images + // is returned in the form of packed Windows DIB. + // + // GetCurrentImage can be called at any time, also + // the caller is responsible for free the returned memory + // by calling CoTaskMemFree. + // + // Excessive use of this function will degrade video + // playback performed. + ////////////////////////////////////////////////////////// + function GetCurrentImage(out lpDib): HResult; stdcall; + ////////////////////////////////////////////////////////// + // Border Color control + // + // The border color is color used to fill any area of the + // the destination rectangle that does not contain video. + // It is typically used in two instances. When the video + // straddles two monitors and when the VMR is trying + // to maintain the aspect ratio of the movies by letter + // boxing the video to fit within the specified destination + // rectangle. See SetAspectRatioMode above. + ////////////////////////////////////////////////////////// + function SetBorderColor(Clr: COLORREF): HResult; stdcall; + function GetBorderColor(out lpClr: COLORREF): HResult; stdcall; + ////////////////////////////////////////////////////////// + // Color key control only meaningful when the VMR is using + // and overlay + ////////////////////////////////////////////////////////// + function SetColorKey(Clr: COLORREF): HResult; stdcall; + function GetColorKey(out lpClr: COLORREF): HResult; stdcall; + end; +{$ENDIF} +{$IFDEF ENABLEVMR7} +//===================================================================== +// +// IVMRMixerControl +// +//===================================================================== + +// +// Normalized relative rectangle +// Coordinate ranges: x=[0...1) y=[0...1) +// Where the output window goes from 0,0 (closed inclusive lower bound) +// to 1,1 (open exclusive upper bound) +// + +const + MixerPref_NoDecimation = $1; + {$EXTERNALSYM MixerPref_NoDecimation} + MixerPref_DecimateOutput = $2; + {$EXTERNALSYM MixerPref_DecimateOutput} + MixerPref_ARAdjustXorY = $4; // adjust the aspect ratio in x or y + {$EXTERNALSYM MixerPref_ARAdjustXorY} + MixerPref_DecimationReserved = $8; // bits reserved for future use. + {$EXTERNALSYM MixerPref_DecimationReserved} + MixerPref_DecimateMask = $f; + {$EXTERNALSYM MixerPref_DecimateMask} + MixerPref_BiLinearFiltering = $10; + {$EXTERNALSYM MixerPref_BiLinearFiltering} + MixerPref_PointFiltering = $20; + {$EXTERNALSYM MixerPref_PointFiltering} + MixerPref_FilteringMask = $f0; + {$EXTERNALSYM MixerPref_FilteringMask} + mixerpref_rendertargetrgb = $00000100; // uses d3d to perform mixing + {$externalsym mixerpref_rendertargetrgb} + mixerpref_rendertargetyuv = $00001000; // uses dxva to perform mixing + {$externalsym mixerpref_rendertargetyuv} + mixerpref_rendertargetyuv420 = $00000200; // deprecated render target + {$externalsym mixerpref_rendertargetyuv420} + mixerpref_rendertargetyuv422 = $00000400; // deprecated render target + {$externalsym mixerpref_rendertargetyuv422} + mixerpref_rendertargetyuv444 = $00000800; // deprecated render target + {$externalsym mixerpref_rendertargetyuv444} + mixerpref_rendertargetreserved = $0000e000; // 3 bits reserved for future use. + {$externalsym mixerpref_rendertargetreserved} + mixerpref_rendertargetmask = $ff00; + {$externalsym mixerpref_rendertargetmask} + + // + // Dynamic changes that can be performed when the VMR's mixer is + // configured to use the YUV Render target (see MixerPref_RenderTargetYUV) + // These preferences can be applied while the graph is running and take effect + // when the next frame is composed by the mixer. + // + MixerPref_DynamicSwitchToBOB = $00010000; + {$EXTERNALSYM MixerPref_DynamicSwitchToBOB} + MixerPref_DynamicDecimateBy2 = $00020000; + {$EXTERNALSYM MixerPref_DynamicDecimateBy2} + + MixerPref_DynamicReserved = $000C0000; + {$EXTERNALSYM MixerPref_DynamicReserved} + MixerPref_DynamicMask = $000F0000; + {$EXTERNALSYM MixerPref_DynamicMask} + + +type + PNormalizedRect = ^TNormalizedRect; + _NORMALIZEDRECT = record + left : Single; + top : Single; + right : Single; + bottom : Single; + end; + {$EXTERNALSYM _NORMALIZEDRECT} + NORMALIZEDRECT = _NORMALIZEDRECT; + {$EXTERNALSYM NORMALIZEDRECT} + TNormalizedRect = _NORMALIZEDRECT; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRMixerControl;'} + {$EXTERNALSYM IVMRMixerControl} + IVMRMixerControl = interface(IUnknown) + ['{1c1a17b0-bed0-415d-974b-dc6696131599}'] + (*** IVMRMixerControl methods ***) + //Alpha = Source alpha premultication factor (global alpha for source) + function SetAlpha(dwStreamID: DWORD; Alpha: single): HResult; stdcall; + function GetAlpha(dwStreamID: DWORD; out pAlpha: single): HResult; stdcall; + function SetZOrder(dwStreamID, dwZ: DWORD): HResult; stdcall; + function GetZOrder(dwStreamID: DWORD; out pZ: DWORD): HResult; stdcall; + function SetOutputRect(dwStreamID: DWORD; const pRect: TNORMALIZEDRECT): HResult; stdcall; + function GetOutputRect(dwStreamID: DWORD; out pRect: TNORMALIZEDRECT): HResult; stdcall; + function SetBackgroundClr(ClrBkg: COLORREF): HResult; stdcall; + function GetBackgroundClr(out lpClrBkg: COLORREF): HResult; stdcall; + function SetMixingPrefs(dwMixerPrefs: DWORD): HResult; stdcall; + function GetMixingPrefs(pdwMixerPrefs: DWORD): HResult; stdcall; + end; +{$ENDIF} + +{$IFDEF ENABLEVMR7} +/////////////////////////////////////////////////////////////////////////////// +// +// VMR Multimon configuration interface +// +/////////////////////////////////////////////////////////////////////////////// + tagVMRGUID = record + pGUID : PGUID; // is NULL if the default DDraw device + GUID : TGUID; // otherwise points to this GUID + end; + {$EXTERNALSYM tagVMRGUID} + VMRGUID = tagVMRGUID; + {$EXTERNALSYM VMRGUID} + TVMRGuid = tagVMRGUID; + + tagVMRMONITORINFO = record + guid : VMRGUID; + rcMonitor : TRECT; + hMon : HMONITOR; + dwFlags : DWORD; // described in MONITORINFOEX, currently only MONITORINFOF_PRIMARY + szDevice : array[0..31] of wchar; + szDescription : array[0..255] of wchar; + liDriverVersion : int64; + dwVendorId : DWORD; + dwDeviceId : DWORD; + dwSubSysId : DWORD; + dwRevision : DWORD; + end; + {$EXTERNALSYM tagVMRMONITORINFO} + VMRMONITORINFO = tagVMRMONITORINFO; + {$EXTERNALSYM VMRMONITORINFO} + TVMRMonitorInfo = tagVMRMONITORINFO; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRMonitorConfig;'} + {$EXTERNALSYM IVMRMonitorConfig} + IVMRMonitorConfig = interface(IUnknown) + ['{9cf0b1b6-fbaa-4b7f-88cf-cf1f130a0dce}'] + (*** IVMRMonitorConfig methods ***) + // Use this method on a Multi-Monitor system to specify to the + // mixer filter which Direct Draw driver should be used when connecting + // to an upstream decoder filter. + function SetMonitor(const pGUID: TVMRGUID): HResult; stdcall; + // Use this method to determine the direct draw object that will be used when + // connecting the mixer filter to an upstream decoder filter. + function GetMonitor(out pGUID: TVMRGUID): HResult; stdcall; + // Use this method on a multi-monitor system to specify to the + // mixer filter the default Direct Draw device to use when + // connecting to an upstream filter. The default direct draw device + // can be overriden for a particular connection by SetMonitor method + // described above. + function SetDefaultMonitor(const pGUID: TVMRGUID): HResult; stdcall; + // Use this method on a multi-monitor system to determine which + // is the default direct draw device the overlay mixer filter + // will use when connecting to an upstream filter. + function GetDefaultMonitor(out pGUID: TVMRGUID): HResult; stdcall; + // Use this method to get a list of Direct Draw device GUIDs and thier + // associated monitor information that the mixer can use when + // connecting to an upstream decoder filter. Passing down a NULL pInfo + // parameter allows the app to determine the required array size (returned + // in pdwNumDevices). Otherwise, dwNumDevices returns the actual + // number of devices retrieved. + function GetAvailableMonitors(out pInfo: TVMRMONITORINFO; //if it fail try : "out pInfo" only /hg + dwMaxInfoArraySize: DWORD; // in array members + out pdwNumDevices: DWORD): HResult; stdcall; // actual number of devices retrieved + end; +{$ENDIF} + +{$IFDEF ENABLEVMR7} +//===================================================================== +// +// IVMRImageCompositor +// +//===================================================================== + +type + PVMRVideoStreamInfo = ^TVMRVideoStreamInfo; + _VMRVIDEOSTREAMINFO = record + pddsVideoSurface : IDIRECTDRAWSURFACE7; + dwWidth : DWORD; + dwHeight : DWORD; + dwStrmID : DWORD; + fAlpha : single; + ddClrKey : TDDCOLORKEY; + rNormal : TNORMALIZEDRECT; + end; + {$EXTERNALSYM _VMRVIDEOSTREAMINFO} + VMRVIDEOSTREAMINFO = _VMRVIDEOSTREAMINFO; + {$EXTERNALSYM VMRVIDEOSTREAMINFO} + TVMRVideoStreamInfo = _VMRVIDEOSTREAMINFO; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRImageCompositor;'} + {$EXTERNALSYM IVMRImageCompositor} + IVMRImageCompositor = interface(IUnknown) + ['{7a4fb5af-479f-4074-bb40-ce6722e43c82}'] + (*** IVMRImageCompositor methods ***) + function InitCompositionTarget(pD3DDevice: IUnknown; pddsRenderTarget: IDIRECTDRAWSURFACE7): HResult; stdcall; + function TermCompositionTarget(pD3DDevice: IUnknown; pddsRenderTarget: IDIRECTDRAWSURFACE7): HResult; stdcall; + function SetStreamMediaType(dwStrmID: DWORD; pmt: PAMMediaType; fTexture: BOOL): HResult; stdcall; + function CompositeImage(pD3DDevice: IUnknown; pddsRenderTarget: IDIRECTDRAWSURFACE7; + pmtRenderTarget: PAMMediaType; rtStart, rtEnd: TReferenceTime; + dwClrBkGnd: DWORD; pVideoStreamInfo: PVMRVIDEOSTREAMINFO; cStreams: cardinal): HResult; stdcall; + end; +{$ENDIF} + +{$IFDEF ENABLEVMR7} +/////////////////////////////////////////////////////////////////////////////// +// +// VMR Filter configuration interfaces +// +/////////////////////////////////////////////////////////////////////////////// + +const + RenderPrefs_RestrictToInitialMonitor = $00000000; // not implemented do not use + {$EXTERNALSYM RenderPrefs_RestrictToInitialMonitor} + RenderPrefs_ForceOffscreen = $00000001; + {$EXTERNALSYM RenderPrefs_ForceOffscreen} + RenderPrefs_ForceOverlays = $00000002; // fail if no overlays + {$EXTERNALSYM RenderPrefs_ForceOverlays} + RenderPrefs_AllowOverlays = $00000000; // overlay used by default + {$EXTERNALSYM RenderPrefs_AllowOverlays} + RenderPrefs_AllowOffscreen = $00000000; // offscreen used if no overlay + {$EXTERNALSYM RenderPrefs_AllowOffscreen} + RenderPrefs_DoNotRenderColorKeyAndBorder = $00000008; // app paints color keys + {$EXTERNALSYM RenderPrefs_DoNotRenderColorKeyAndBorder} + RenderPrefs_Reserved = $00000010; // note: used to be RestrictToInitialMonitor + {$EXTERNALSYM RenderPrefs_Reserved} + RenderPrefs_PreferAGPMemWhenMixing = $00000020; + {$EXTERNALSYM RenderPrefs_PreferAGPMemWhenMixing} + RenderPrefs_Mask = $0000003f; // OR of all above flags + {$EXTERNALSYM RenderPrefs_Mask} + + VMRMode_Windowed = $00000001; + {$EXTERNALSYM VMRMode_Windowed} + VMRMode_Windowless = $00000002; + {$EXTERNALSYM VMRMode_Windowless} + VMRMode_Renderless = $00000004; + {$EXTERNALSYM VMRMode_Renderless} + VMRMode_Mask = $00000007; // OR of all above flags + {$EXTERNALSYM VMRMode_Mask} + // not a valid value to pass to SetRenderMode + + MAX_NUMBER_OF_STREAMS = 16; + {$EXTERNALSYM MAX_NUMBER_OF_STREAMS} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRFilterConfig;'} + {$EXTERNALSYM IVMRFilterConfig} + IVMRFilterConfig = interface(IUnknown) + ['{9e5530c5-7034-48b4-bb46-0b8a6efc8e36}'] + (*** IVMRFilterConfig methods ***) + function SetImageCompositor(lpVMRImgCompositor: IVMRImageCompositor): HResult; stdcall; + function SetNumberOfStreams(dwMaxStreams: DWORD): HResult; stdcall; + function GetNumberOfStreams(out pdwMaxStreams: DWORD): HResult; stdcall; + function SetRenderingPrefs(dwRenderFlags: DWORD): HResult; stdcall; // a combination of VMRRenderingPrefFlags + function GetRenderingPrefs(out pdwRenderFlags: DWORD): HResult; stdcall; + function SetRenderingMode(Mode: DWORD): HResult; stdcall; // a combination of VMRMode + function GetRenderingMode(out pMode: DWORD): HResult; stdcall; + end; +{$ENDIF} + +{$IFDEF ENABLEVMR7} +//===================================================================== +// +// IVMRAspectRatioControl +// +//===================================================================== + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRAspectRatioControl;'} + {$EXTERNALSYM IVMRAspectRatioControl} + IVMRAspectRatioControl = interface(IUnknown) + ['{ede80b5c-bad6-4623-b537-65586c9f8dfd}'] + (*** IVMRAspectRatioControl methods ***) + function GetAspectRatioMode(out lpdwARMode: TVMRAspectRatioMode): HResult; stdcall; + function SetAspectRatioMode(dwARMode: TVMRAspectRatioMode): HResult; stdcall; + end; +{$ENDIF} + +{$IFDEF ENABLEVMR7} +//===================================================================== +// +// IVMRDeinterlaceControl +// +// New interfaced introduced into the WindowsXP SP1 release of the VMR. +// This interface allows applications to control the DX-VA deinterlacing +// support provided by the VMR. +// +// The VMR needs to be set into "mixing" mode for this interface to work. +// +// SetDeinterlaceMode is only effective for new connections made to the +// VMR. It should be noted that the graphics device driver may refuse +// to use the specified deinterlace mode, in which case 3 fallback +// policies are offered by the VMR, these being: +// +// 1. Fallback to the next best mode offered by the driver. +// 2. Fallback to the BOB deinterlace mode. +// 3. Fallback to the WEAVE deinterlace mode (ie. turn deinterlacing off). +// +//===================================================================== +type + VMRDeinterlacePrefs = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM VMRDeinterlacePrefs} + +const + DeinterlacePref_NextBest = $01; + {$EXTERNALSYM DeinterlacePref_NextBest} + DeinterlacePref_BOB = $02; + {$EXTERNALSYM DeinterlacePref_BOB} + DeinterlacePref_Weave = $04; + {$EXTERNALSYM DeinterlacePref_Weave} + DeinterlacePref_Mask = $07; + {$EXTERNALSYM DeinterlacePref_Mask} + +type + VMRDeinterlaceTech = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM VMRDeinterlaceTech} + +const + // the algorithm is unknown or proprietary + DeinterlaceTech_Unknown = $0000; + {$EXTERNALSYM DeinterlaceTech_Unknown} + + // the algorithm creates the missing lines by repeating + // the line either above or below it - this method will look very jaggy and + // isn't recommended + DeinterlaceTech_BOBLineReplicate = $0001; + {$EXTERNALSYM DeinterlaceTech_BOBLineReplicate} + + + // the algorithm creates the missing lines by vertically stretching each + // video field by a factor of two, for example by averaging two lines or + // using a [-1, 9, 9, -1]/16 filter across four lines. + // Slight vertical adjustments are made to ensure that the resulting image + // does not "bob" up and down. + DeinterlaceTech_BOBVerticalStretch = $0002; + {$EXTERNALSYM DeinterlaceTech_BOBVerticalStretch} + + // the pixels in the missing line are recreated by a median filtering operation + DeinterlaceTech_MedianFiltering = $0004; + {$EXTERNALSYM DeinterlaceTech_MedianFiltering} + + // the pixels in the missing line are recreated by an edge filter. + // In this process, spatial directional filters are applied to determine + // the orientation of edges in the picture content, and missing + // pixels are created by filtering along (rather than across) the + // detected edges. + DeinterlaceTech_EdgeFiltering = $0010; + {$EXTERNALSYM DeinterlaceTech_EdgeFiltering} + + // the pixels in the missing line are recreated by switching on a field by + // field basis between using either spatial or temporal interpolation + // depending on the amount of motion. + DeinterlaceTech_FieldAdaptive = $0020; + {$EXTERNALSYM DeinterlaceTech_FieldAdaptive} + + // the pixels in the missing line are recreated by switching on a pixel by pixel + // basis between using either spatial or temporal interpolation depending on + // the amount of motion.. + DeinterlaceTech_PixelAdaptive = $0040; + {$EXTERNALSYM DeinterlaceTech_PixelAdaptive} + + // Motion Vector Steering identifies objects within a sequence of video + // fields. The missing pixels are recreated after first aligning the + // movement axes of the individual objects in the scene to make them + // parallel with the time axis. + DeinterlaceTech_MotionVectorSteered = $0080; + {$EXTERNALSYM DeinterlaceTech_MotionVectorSteered} + +type + PVMRFrequency = ^TVMRFrequency; + _VMRFrequency = record + dwNumerator : DWORD; + dwDenominator : DWORD; + end; + {$EXTERNALSYM _VMRFrequency} + VMRFrequency = _VMRFrequency; + {$EXTERNALSYM VMRFrequency} + TVMRFrequency = _VMRFrequency; + + PVMRVideoDesc = ^TVMRVideoDesc; + _VMRVideoDesc = record + dwSize : DWORD; + dwSampleWidth : DWORD; + dwSampleHeight : DWORD; + SingleFieldPerSample : BOOL; + dwFourCC : DWORD; + InputSampleFreq : VMRFrequency; + OutputFrameFreq : VMRFrequency; + end; + {$EXTERNALSYM _VMRVideoDesc} + VMRVideoDesc = _VMRVideoDesc; + {$EXTERNALSYM VMRVideoDesc} + TVMRVideoDesc = _VMRVideoDesc; + + PVMRDeinterlaceCaps = ^TVMRDeinterlaceCaps; + _VMRDeinterlaceCaps = record + dwSize : DWORD; + dwNumPreviousOutputFrames : DWORD; + dwNumForwardRefSamples : DWORD; + dwNumBackwardRefSamples : DWORD; + DeinterlaceTechnology : VMRDeinterlaceTech; + end; + {$EXTERNALSYM _VMRDeinterlaceCaps} + VMRDeinterlaceCaps = _VMRDeinterlaceCaps; + {$EXTERNALSYM VMRDeinterlaceCaps} + TVMRDeinterlaceCaps = _VMRDeinterlaceCaps; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRDeinterlaceControl;'} + {$EXTERNALSYM IVMRDeinterlaceControl} + IVMRDeinterlaceControl = interface(IUnknown) + ['{bb057577-0db8-4e6a-87a7-1a8c9a505a0f}'] + (*** IVMRDeinterlaceControl methods ***) + // For the specified video description returns the + // number of deinterlacing modes available to the VMR. + // The deinterlacing modes are returned in descending + // quality order ie. the best quality mode is at + // lpdwNumDeinterlaceModes[0], the next best at + // lpdwNumDeinterlaceModes[1] and so on. + // + // To determine how big an array of guids to pass to the + // GetNumberOfDeinterlaceModes method call + // GetNumberOfDeinterlaceModes(lpVideoDescription, &dwNumModes, NULL); + // + function GetNumberOfDeinterlaceModes(lpVideoDescription: PVMRVideoDesc; + var lpdwNumDeinterlaceModes: DWORD; lpDeinterlaceModes: PGUID): HResult; stdcall; + // For the given video description get the capabilities of the + // specified de-interlace mode. + function GetDeinterlaceModeCaps(const lpDeinterlaceMode: TGUID; + lpVideoDescription: PVMRVideoDesc; lpDeinterlaceCaps: PVMRDeinterlaceCaps): HResult; stdcall; + // Get/Set the deinterlace mode that you would like the + // VMR to use when de-interlacing the specified stream. + // It should be noted that the VMR may not actually be able + // to use the requested deinterlace mode, in which case the + // the VMR will fall back to other de-interlace modes as specified + // by the de-interlace preferences (see SetDeinterlacePrefs below). + function GetDeinterlaceMode( + dwStreamID: DWORD; + out lpDeinterlaceMode: TGUID // returns GUID_NULL if SetDeinterlaceMode + ): HResult; stdcall; // has not been called yet. + + function SetDeinterlaceMode( + dwStreamID: DWORD; // use $FFFFFFFF to set mode for all streams + const lpDeinterlaceMode: TGUID // GUID_NULL == turn deinterlacing off + ): HResult; stdcall; + + function GetDeinterlacePrefs(out lpdwDeinterlacePrefs: VMRDeinterlacePrefs): HResult; stdcall; + function SetDeinterlacePrefs(dwDeinterlacePrefs: VMRDeinterlacePrefs): HResult; stdcall; + + // Get the DeinterlaceMode currently in use for the specified + // video stream (ie. pin). The returned GUID will be NULL if + // the de-interlacing h/w has not been created by the VMR at the + // time the function is called, or if the VMR determines that + // this stream should not or can be de-interlaced. + function GetActualDeinterlaceMode( + dwStreamID: DWORD; out lpDeinterlaceMode: TGUID): HResult; stdcall; + end; +{$ENDIF} + +{$IFDEF ENABLEVMR7} +//===================================================================== +// +// IVMRMixerBitmap +// +//===================================================================== + PVMRAlphaBitmap = ^TVMRAlphaBitmap; + _VMRALPHABITMAP = record + dwFlags : DWORD; // flags word + hdc : HDC; // DC for the bitmap to copy + pDDS : IDIRECTDRAWSURFACE7; // DirectDraw surface to copy + rSrc : TRECT; // rectangle to copy from the DC/DDS + rDest : NORMALIZEDRECT; // output rectangle in composition space + fAlpha : single; // opacity of the bitmap + clrSrcKey : COLORREF; // src color key + end; + {$EXTERNALSYM _VMRALPHABITMAP} + VMRALPHABITMAP = _VMRALPHABITMAP; + {$EXTERNALSYM VMRALPHABITMAP} + TVMRAlphaBitmap = _VMRALPHABITMAP; + +const + // Disable the alpha bitmap for now + VMRBITMAP_DISABLE = $00000001; + {$EXTERNALSYM VMRBITMAP_DISABLE} + + // Take the bitmap from the HDC rather than the DirectDraw surface + VMRBITMAP_HDC = $00000002; + {$EXTERNALSYM VMRBITMAP_HDC} + + // Take the entire DDraw surface - rSrc is ignored + VMRBITMAP_ENTIREDDS = $00000004; + {$EXTERNALSYM VMRBITMAP_ENTIREDDS} + + // Indicates that the clrTrans value is valid and should be + // used when blending + VMRBITMAP_SRCCOLORKEY = $00000008; + {$EXTERNALSYM VMRBITMAP_SRCCOLORKEY} + + VMRBITMAP_SRCRECT = $00000010; + {$EXTERNALSYM VMRBITMAP_SRCRECT} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRMixerBitmap;'} + {$EXTERNALSYM IVMRMixerBitmap} + IVMRMixerBitmap = interface(IUnknown) + ['{1E673275-0257-40aa-AF20-7C608D4A0428}'] + (*** IVMRMixerBitmap methods ***) + // Set bitmap, location to blend it, and blending value + function SetAlphaBitmap(var pBmpParms: TVMRALPHABITMAP): HResult; stdcall; + // Change bitmap location, size and blending value, + // graph must be running for change to take effect. + function UpdateAlphaBitmapParameters(pBmpParms: PVMRALPHABITMAP): HResult; stdcall; + // Get bitmap, location to blend it, and blending value + function GetAlphaBitmapParameters(out pBmpParms: TVMRALPHABITMAP): HResult; stdcall; + end; +{$ENDIF} +{$IFDEF ENABLEVMR7} +//===================================================================== +// +// IVMRVideoStreamControl +// +//===================================================================== + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRVideoStreamControl;'} + {$EXTERNALSYM IVMRVideoStreamControl} + IVMRVideoStreamControl = interface(IUnknown) + ['{058d1f11-2a54-4bef-bd54-df706626b727}'] + (*** IVMRVideoStreamControl methods ***) + function SetColorKey(clr: PDDCOLORKEY): HResult; stdcall; // Source color key, set to 0xFFFFFFFF to disable + function GetColorKey(out pclr: TDDCOLORKEY): HResult; stdcall; + function SetStreamActiveState(fActive: BOOL): HResult; stdcall; + function GetStreamActiveState(out lpfActive: BOOL): HResult; stdcall; + end; +{$ENDIF} +{$IFDEF ENABLEVMR7} +//===================================================================== +// +// IVMRSurface +// +//===================================================================== + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRSurface;'} + {$EXTERNALSYM IVMRSurface} + IVMRSurface = interface(IUnknown) + ['{a9849bbe-9ec8-4263-b764-62730f0d15d0}'] + (*** IVMRSurface methods ***) + function IsSurfaceLocked: HResult; stdcall; + function LockSurface(out lpSurface: PBYTE): HResult; stdcall; + function UnlockSurface: HResult; stdcall; + function GetSurface(lplpSurface: IDIRECTDRAWSURFACE7): HResult; stdcall; + end; +{$ENDIF} + +{$IFDEF ENABLEVMR7} +//===================================================================== +// +// IVMRImagePresenterConfig +// +//===================================================================== + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRImagePresenterConfig;'} + {$EXTERNALSYM IVMRImagePresenterConfig} + IVMRImagePresenterConfig = interface(IUnknown) + ['{9f3a1c85-8555-49ba-935f-be5b5b29d178}'] + (*** IVMRImagePresenterConfig methods ***) + function SetRenderingPrefs(dwRenderFlags: DWORD): HResult; stdcall; + function GetRenderingPrefs(out dwRenderFlags: DWORD): HResult; stdcall; + end; +//===================================================================== +// +// IVMRImagePresenterExclModeConfig +// +//===================================================================== + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRImagePresenterExclModeConfig;'} + {$EXTERNALSYM IVMRImagePresenterExclModeConfig} + IVMRImagePresenterExclModeConfig = interface(IVMRImagePresenterConfig) + ['{e6f7ce40-4673-44f1-8f77-5499d68cb4ea}'] + (*** IVMRImagePresenterExclModeConfig methods ***) + function SetXlcModeDDObjAndPrimarySurface(lpDDObj: IDIRECTDRAW7; lpPrimarySurf: IDIRECTDRAWSURFACE7): HResult; stdcall; + function GetXlcModeDDObjAndPrimarySurface(lpDDObj: IDIRECTDRAW7; lpPrimarySurf: IDIRECTDRAWSURFACE7): HResult; stdcall; + end; +{$ENDIF} + +//===================================================================== +// +// IVPManager +// +//===================================================================== + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVPManager;'} + {$EXTERNALSYM IVPManager} + IVPManager = interface(IUnknown) + ['{aac18c18-e186-46d2-825d-a1f8dc8e395a}'] + (*** IVPManager methods ***) + // Use this method on a Multi-Monitor system to specify to the + // video port manager filter which videoport index is used + // to an upstream decoder filter. + function SetVideoPortIndex(dwVideoPortIndex: DWORD): HResult; stdcall; // the video port number that this is connected to + // This method returns the current video port index being used by the VPM. + function GetVideoPortIndex(out pdwVideoPortIndex: DWORD): HResult; stdcall; // the video port number that this is connected to + end; + + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: mmstream.h + * + ***************************************************************************) + +const + IID_IMultiMediaStream: TGUID = '{B502D1BC-9A57-11d0-8FDE-00C04FD9189D}'; + {$EXTERNALSYM IID_IMultiMediaStream} + IID_IMediaStream: TGUID = '{B502D1BD-9A57-11d0-8FDE-00C04FD9189D}'; + {$EXTERNALSYM IID_IMediaStream} + IID_IStreamSample: TGUID = '{B502D1BE-9A57-11d0-8FDE-00C04FD9189D}'; + {$EXTERNALSYM IID_IStreamSample} + +const + MS_S_PENDING = $00040001; + {$EXTERNALSYM MS_S_PENDING} + MS_S_NOUPDATE = $00040002; + {$EXTERNALSYM MS_S_NOUPDATE} + MS_S_ENDOFSTREAM = $00040003; + {$EXTERNALSYM MS_S_ENDOFSTREAM} + MS_E_SAMPLEALLOC = $80040401; + {$EXTERNALSYM MS_E_SAMPLEALLOC} + MS_E_PURPOSEID = $80040402; + {$EXTERNALSYM MS_E_PURPOSEID} + MS_E_NOSTREAM = $80040403; + {$EXTERNALSYM MS_E_NOSTREAM} + MS_E_NOSEEKING = $80040404; + {$EXTERNALSYM MS_E_NOSEEKING} + MS_E_INCOMPATIBLE = $80040405; + {$EXTERNALSYM MS_E_INCOMPATIBLE} + MS_E_BUSY = $80040406; + {$EXTERNALSYM MS_E_BUSY} + MS_E_NOTINIT = $80040407; + {$EXTERNALSYM MS_E_NOTINIT} + MS_E_SOURCEALREADYDEFINED = $80040408; + {$EXTERNALSYM MS_E_SOURCEALREADYDEFINED} + MS_E_INVALIDSTREAMTYPE = $80040409; + {$EXTERNALSYM MS_E_INVALIDSTREAMTYPE} + MS_E_NOTRUNNING = $8004040A; + {$EXTERNALSYM MS_E_NOTRUNNING} + + MSPID_PrimaryVideo: TGUID = (D1:$A35FF56A;D2:$9FDA;D3:$11D0;D4:($8F,$DF,$00,$C0,$4F,$D9,$18,$9D)); + {$EXTERNALSYM MSPID_PrimaryVideo} + MSPID_PrimaryAudio: TGUID = (D1:$A35FF56B;D2:$9FDA;D3:$11D0;D4:($8F,$DF,$00,$C0,$4F,$D9,$18,$9D)); + {$EXTERNALSYM MSPID_PrimaryAudio} + +type + PAPCFUNC = procedure(dwParam: DWORD); stdcall; + {$EXTERNALSYM PAPCFUNC} + + STREAM_TIME = {$IFDEF TYPE_IDENTITY}type {$ENDIF} int64; + {$EXTERNALSYM STREAM_TIME} + + PStreamType = ^TStreamType; + STREAM_TYPE = ( + STREAMTYPE_READ, + STREAMTYPE_WRITE, + STREAMTYPE_TRANSFORM + ); + {$EXTERNALSYM STREAM_TYPE} + TStreamType = STREAM_TYPE; + + STREAM_STATE = ( + STREAMSTATE_STOP, + STREAMSTATE_RUN + ); + {$EXTERNALSYM STREAM_STATE} + TStreamState = STREAM_STATE; + +const + COMPSTAT_NOUPDATEOK = 1; + {$EXTERNALSYM COMPSTAT_NOUPDATEOK} + COMPSTAT_WAIT = 2; + {$EXTERNALSYM COMPSTAT_WAIT} + COMPSTAT_ABORT = 4; + {$EXTERNALSYM COMPSTAT_ABORT} + + MMSSF_HASCLOCK = $1; + {$EXTERNALSYM MMSSF_HASCLOCK} + MMSSF_SUPPORTSEEK = $2; + {$EXTERNALSYM MMSSF_SUPPORTSEEK} + MMSSF_ASYNCHRONOUS = $4; + {$EXTERNALSYM MMSSF_ASYNCHRONOUS} + + SSUPDATE_ASYNC = $1; + {$EXTERNALSYM SSUPDATE_ASYNC} + SSUPDATE_CONTINUOUS = $2; + {$EXTERNALSYM SSUPDATE_CONTINUOUS} + +type + IMediaStream = interface; + IStreamSample = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMultiMediaStream;'} + {$EXTERNALSYM IMultiMediaStream} + IMultiMediaStream = interface(IUnknown) + ['{B502D1BC-9A57-11d0-8FDE-00C04FD9189D}'] + (*** IMultiMediaStream methods ***) + function GetInformation(pdwFlags: PDWORD; pStreamType: PStreamType): + HResult; stdcall; + function GetMediaStream(const idPurpose: TGUID; + out ppMediaStream: IMediaStream): HResult; stdcall; + function EnumMediaStreams(Index: Longint; out ppMediaStream: IMediaStream): + HResult; stdcall; + function GetState(out pCurrentState: TStreamState): HResult; stdcall; + function SetState(NewState: TStreamState): HResult; stdcall; + function GetTime(out pCurrentTime: STREAM_TIME): HResult; stdcall; + function GetDuration(out pDuration: STREAM_TIME): HResult; stdcall; + function Seek(SeekTime: STREAM_TIME): HResult; stdcall; + function GetEndOfStreamEventHandle(out phEOS: THandle): HResult; stdcall; + end; + + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaStream;'} + {$EXTERNALSYM IMediaStream} + IMediaStream = interface(IUnknown) + ['{B502D1BD-9A57-11d0-8FDE-00C04FD9189D}'] + (*** IMediaStream methods ***) + function GetMultiMediaStream(out ppMultiMediaStream: IMultiMediaStream): + HResult; stdcall; + function GetInformation(pPurposeId: PGUID; pType: PStreamType): HResult; stdcall; + function SetSameFormat(pStreamThatHasDesiredFormat: IMediaStream; + dwFlags: DWORD): HResult; stdcall; + function AllocateSample(dwFlags: DWORD; out ppSample: IStreamSample): HResult; stdcall; + function CreateSharedSample(pExistingSample: IStreamSample; dwFlags: DWORD; + out ppNewSample: IStreamSample): HResult; stdcall; + function SendEndOfStream(dwFlags: DWORD): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IStreamSample;'} + {$EXTERNALSYM IStreamSample} + IStreamSample = interface(IUnknown) + ['{B502D1BE-9A57-11d0-8FDE-00C04FD9189D}'] + (*** IStreamSample methods ***) + function GetMediaStream(out ppMediaStream: IMediaStream): HResult; stdcall; + function GetSampleTimes(out pStartTime, pEndTime, + pCurrentTime: STREAM_TIME): HResult; stdcall; + function SetSampleTimes(var pStartTime, pEndTime: STREAM_TIME): HResult; stdcall; + function Update(dwFlags: DWORD; hEvent: THandle; pfnAPC: PAPCFUNC; + dwAPCData: DWORD): HResult; stdcall; + function CompletionStatus(dwFlags: DWORD; dwMilliseconds: DWORD): HResult; stdcall; + end; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: amstream.h + * + ***************************************************************************) + +const + IID_IDirectShowStream: TGUID = '{7DB01C96-C0C3-11D0-8FF1-00C04FD9189D}'; + {$EXTERNALSYM IID_IDirectShowStream} + IID_IAMMultiMediaStream: TGUID = '{BEBE595C-9A6F-11D0-8FDE-00C04FD9189D}'; + {$EXTERNALSYM IID_IAMMultiMediaStream} + IID_IAMMediaStream: TGUID = '{BEBE595D-9A6F-11D0-8FDE-00C04FD9189D}'; + {$EXTERNALSYM IID_IAMMediaStream} + IID_IMediaStreamFilter: TGUID = '{BEBE595E-9A6F-11D0-8FDE-00C04FD9189D}'; + {$EXTERNALSYM IID_IMediaStreamFilter} + IID_IDirectDrawMediaSampleAllocator: TGUID = '{AB6B4AFC-F6E4-11D0-900D-00C04FD9189D}'; + {$EXTERNALSYM IID_IDirectDrawMediaSampleAllocator} + IID_IDirectDrawMediaSample: TGUID = '{AB6B4AFE-F6E4-11D0-900D-00C04FD9189D}'; + {$EXTERNALSYM IID_IDirectDrawMediaSample} + IID_IAMMediaTypeStream: TGUID = '{AB6B4AFA-F6E4-11D0-900D-00C04FD9189D}'; + {$EXTERNALSYM IID_IAMMediaTypeStream} + IID_IAMMediaTypeSample: TGUID = '{AB6B4AFB-F6E4-11D0-900D-00C04FD9189D}'; + {$EXTERNALSYM IID_IAMMediaTypeSample} + +const + AMMSF_NOGRAPHTHREAD = $1; + {$EXTERNALSYM AMMSF_NOGRAPHTHREAD} + + AMMSF_ADDDEFAULTRENDERER = $1; + {$EXTERNALSYM AMMSF_ADDDEFAULTRENDERER} + AMMSF_CREATEPEER = $2; + {$EXTERNALSYM AMMSF_CREATEPEER} + AMMSF_STOPIFNOSAMPLES = $4; + {$EXTERNALSYM AMMSF_STOPIFNOSAMPLES} + AMMSF_NOSTALL = $8; + {$EXTERNALSYM AMMSF_NOSTALL} + + AMMSF_RENDERTYPEMASK = $3; + {$EXTERNALSYM AMMSF_RENDERTYPEMASK} + AMMSF_RENDERTOEXISTING = 0; + {$EXTERNALSYM AMMSF_RENDERTOEXISTING} + AMMSF_RENDERALLSTREAMS = $1; + {$EXTERNALSYM AMMSF_RENDERALLSTREAMS} + AMMSF_NORENDER = $2; + {$EXTERNALSYM AMMSF_NORENDER} + AMMSF_NOCLOCK = $4; + {$EXTERNALSYM AMMSF_NOCLOCK} + AMMSF_RUN = $8; + {$EXTERNALSYM AMMSF_RUN} + +type + OUTPUT_STATE = ( + Disabled, + ReadData, + RenderData + ); + {$EXTERNALSYM OUTPUT_STATE} + TOutputState = OUTPUT_STATE; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectShowStream;'} + {$EXTERNALSYM IDirectShowStream} + IDirectShowStream = interface(IDispatch) + ['{7DB01C96-C0C3-11D0-8FF1-00C04FD9189D}'] + (*** IDirectShowStream methods ***) + function get_FileName(out pVal: WideString): HResult; stdcall; + function put_FileName(newVal: WideString): HResult; stdcall; + function get_Video(out pVal: TOutputState): HResult; stdcall; + function put_Video(newVal: TOutputState): HResult; stdcall; + function get_Audio(out pVal: TOutputState): HResult; stdcall; + function put_Audio(newVal: TOutputState): HResult; stdcall; + end; + + IMediaStreamFilter = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMMultiMediaStream;'} + {$EXTERNALSYM IAMMultiMediaStream} + IAMMultiMediaStream = interface(IMultiMediaStream) + ['{BEBE595C-9A6F-11D0-8FDE-00C04FD9189D}'] + (*** IAMMultiMediaStream methods ***) + function Initialize(StreamType: TStreamType; dwFlags: DWORD; + pFilterGraph: IGraphBuilder): HResult; stdcall; + function GetFilterGraph(out ppGraphBuilder: IGraphBuilder): HResult; stdcall; + function GetFilter(out ppFilter: IMediaStreamFilter): HResult; stdcall; + function AddMediaStream(pStreamObject: IUnknown; PurposeId: PGUID; + dwFlags: DWORD; out ppNewStream: IMediaStream): HResult; stdcall; + function OpenFile(pszFileName: PWideChar; dwFlags: DWORD): HResult; stdcall; + function OpenMoniker(pCtx: IBindCtx; pMoniker: IMoniker; dwFlags: DWORD): HResult; stdcall; + function Render(dwFlags: DWORD): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMMediaStream;'} + {$EXTERNALSYM IAMMediaStream} + IAMMediaStream = interface(IMediaStream) + ['{BEBE595D-9A6F-11D0-8FDE-00C04FD9189D}'] + (*** IAMMediaStream methods ***) + function Initialize(pSourceObject: IUnknown; dwFlags: DWORD; + PurposeId: PGUID; StreamType: TStreamType): HResult; stdcall; + function SetState(State: TFilterState): HResult; stdcall; + function JoinAMMultiMediaStream(pAMMultiMediaStream: IAMMultiMediaStream): HResult; stdcall; + function JoinFilter(pMediaStreamFilter: IMediaStreamFilter): HResult; stdcall; + function JoinFilterGraph(pFilterGraph: IFilterGraph): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaStreamFilter;'} + {$EXTERNALSYM IMediaStreamFilter} + IMediaStreamFilter = interface(IBaseFilter) + ['{BEBE595E-9A6F-11D0-8FDE-00C04FD9189D}'] + (*** IMediaStreamFilter methods ***) + function AddMediaStream(pAMMediaStream: IAMMediaStream): HResult; stdcall; + function GetMediaStream( var idPurpose: TGUID; + out ppMediaStream: IMediaStream): HResult; stdcall; + function EnumMediaStreams(Index: Longint; out ppMediaStream: IMediaStream): HResult; stdcall; + function SupportSeeking(bRenderer: BOOL): HResult; stdcall; + function ReferenceTimeToStreamTime( var pTime: TReferenceTime): HResult; stdcall; + function GetCurrentStreamTime(out pCurrentStreamTime: TReferenceTime): HResult; stdcall; + function WaitUntil(WaitStreamTime: TReferenceTime): HResult; stdcall; + function Flush(bCancelEOS: BOOL): HResult; stdcall; + function EndOfStream: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDrawMediaSampleAllocator;'} + {$EXTERNALSYM IDirectDrawMediaSampleAllocator} + IDirectDrawMediaSampleAllocator = interface(IUnknown) + ['{AB6B4AFC-F6E4-11D0-900D-00C04FD9189D}'] + (*** IDirectDrawMediaSampleAllocator methods ***) + function GetDirectDraw(out ppDirectDraw: IDirectDraw): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDrawMediaSample;'} + {$EXTERNALSYM IDirectDrawMediaSample} + IDirectDrawMediaSample = interface(IUnknown) + ['{AB6B4AFE-F6E4-11D0-900D-00C04FD9189D}'] + (*** IDirectDrawMediaSample methods ***) + function GetSurfaceAndReleaseLock(out ppDirectDrawSurface: IDirectDrawSurface; + out pRect: TRect): HResult; stdcall; + function LockMediaSamplePointer: HResult; stdcall; + end; + + IAMMediaTypeSample = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMMediaTypeStream;'} + {$EXTERNALSYM IAMMediaTypeStream} + IAMMediaTypeStream = interface(IMediaStream) + ['{AB6B4AFA-F6E4-11D0-900D-00C04FD9189D}'] + (*** IAMMediaTypeStream methods ***) + function GetFormat(out pMediaType: TAMMediaType; dwFlags: DWORD): HResult; stdcall; + function SetFormat(const pMediaType: TAMMediaType; dwFlags: DWORD): HResult; stdcall; + function CreateSample(lSampleSize: Longint; pbBuffer: Pointer; + dwFlags: DWORD; pUnkOuter: IUnknown; out ppAMMediaTypeSample: IAMMediaTypeSample): HResult; stdcall; + function GetStreamAllocatorRequirements(var pProps: TAllocatorProperties): HResult; stdcall; + function SetStreamAllocatorRequirements(const pProps: TAllocatorProperties): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMMediaTypeSample;'} + {$EXTERNALSYM IAMMediaTypeSample} + IAMMediaTypeSample = interface(IStreamSample) + ['{AB6B4AFB-F6E4-11D0-900D-00C04FD9189D}'] + (*** IAMMediaTypeSample methods ***) + function SetPointer(pBuffer: Pointer; lSize: Longint): HResult; stdcall; + function GetPointer(out ppBuffer: Pointer): HResult; stdcall; + function GetSize: Longint; stdcall; + function GetTime(out pTimeStart, pTimeEnd: TReferenceTime): HResult; stdcall; + function SetTime(pTimeStart, pTimeEnd: PReferenceTime): HResult; stdcall; + function IsSyncPoint: HResult; stdcall; + function SetSyncPoint(bIsSyncPoint: BOOL): HResult; stdcall; + function IsPreroll: HResult; stdcall; + function SetPreroll(bIsPreroll: BOOL): HResult; stdcall; + function GetActualDataLength: Longint; stdcall; + function SetActualDataLength(l: Longint): HResult; stdcall; + function GetMediaType(var ppMediaType: PAMMediaType): HResult; stdcall; + function SetMediaType(var pMediaType: TAMMediaType): HResult; stdcall; + function IsDiscontinuity: HResult; stdcall; + function SetDiscontinuity(bDiscontinuity: BOOL): HResult; stdcall; + function GetMediaTime(out pTimeStart, pTimeEnd: int64): HResult; stdcall; + function SetMediaTime(var pTimeStart, pTimeEnd: int64): HResult; stdcall; + end; + +const +{ +EXTERN_C const IID LIBID_DirectShowStreamLib; + +EXTERN_C const CLSID CLSID_AMMultiMediaStream; +} + CLSID_AMMultiMediaStream: TGUID = '{49C47CE5-9BA4-11D0-8212-00C04FC32C45}'; + {$EXTERNALSYM CLSID_AMMultiMediaStream} + + CLSID_AMDirectDrawStream: TGUID = (D1:$49C47CE4;D2:$9BA4;D3:$11D0;D4:($82,$12,$00,$C0,$4F,$C3,$2C,$45)); + {$EXTERNALSYM CLSID_AMDirectDrawStream} + CLSID_AMAudioStream: TGUID = (D1:$8496E040;D2:$AF4C;D3:$11D0;D4:($82,$12,$00,$C0,$4F,$C3,$2C,$45)); + {$EXTERNALSYM CLSID_AMAudioStream} + CLSID_AMAudioData: TGUID = (D1:$F2468580;D2:$AF8A;D3:$11D0;D4:($82,$12,$00,$C0,$4F,$C3,$2C,$45)); + {$EXTERNALSYM CLSID_AMAudioData} + CLSID_AMMediaTypeStream: TGUID = (D1:$CF0F2F7C;D2:$F7BF;D3:$11D0;D4:($90,$0D,$00,$C0,$4F,$D9,$18,$9D)); + {$EXTERNALSYM CLSID_AMMediaTypeStream} + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: ddstream.h + * + ***************************************************************************) + +const + DDSFF_PROGRESSIVERENDER = $1; + {$EXTERNALSYM DDSFF_PROGRESSIVERENDER} + + IID_IDirectDrawMediaStream: TGUID = '{F4104FCE-9A70-11d0-8FDE-00C04FD9189D}'; + {$EXTERNALSYM IID_IDirectDrawMediaStream} + IID_IDirectDrawStreamSample: TGUID = '{F4104FCF-9A70-11d0-8FDE-00C04FD9189D}'; + {$EXTERNALSYM IID_IDirectDrawStreamSample} + +type + IDirectDrawStreamSample = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDrawMediaStream;'} + {$EXTERNALSYM IDirectDrawMediaStream} + IDirectDrawMediaStream = interface(IMediaStream) + ['{F4104FCE-9A70-11d0-8FDE-00C04FD9189D}'] + (*** IDirectDrawMediaStream methods ***) + function GetFormat(out pDDSDCurrent: TDDSurfaceDesc; + out ppDirectDrawPalette: IDirectDrawPalette; + out pDDSDDesired: TDDSurfaceDesc; out pdwFlags: DWORD): HResult; stdcall; + function SetFormat(const pTDDSurfaceDesc: TDDSurfaceDesc; + pDirectDrawPalette: IDirectDrawPalette): HResult; stdcall; + function GetDirectDraw(out ppDirectDraw: IDirectDraw): HResult; stdcall; + function SetDirectDraw(pDirectDraw: IDirectDraw): HResult; stdcall; + function CreateSample(pSurface: IDirectDrawSurface; const pRect: TRect; + dwFlags: DWORD; out ppSample: IDirectDrawStreamSample): HResult; + stdcall; + function GetTimePerFrame(var pFrameTime: STREAM_TIME): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDrawStreamSample;'} + {$EXTERNALSYM IDirectDrawStreamSample} + IDirectDrawStreamSample = interface(IStreamSample) + ['{F4104FCF-9A70-11d0-8FDE-00C04FD9189D}'] + (*** IDirectDrawStreamSample methods ***) + function GetSurface(out ppDirectDrawSurface: IDirectDrawSurface; + out pRect: TRect): HResult; stdcall; + function SetRect(const pRect: TRect): HResult; stdcall; + end; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: austream.h + * + ***************************************************************************) + +const + IID_IAudioMediaStream: TGUID = '{F7537560-A3BE-11D0-8212-00C04FC32C45}'; + {$EXTERNALSYM IID_IAudioMediaStream} + IID_IAudioStreamSample: TGUID = '{345FEE00-ABA5-11D0-8212-00C04FC32C45}'; + {$EXTERNALSYM IID_IAudioStreamSample} + IID_IMemoryData: TGUID = '{327FC560-AF60-11D0-8212-00C04FC32C45}'; + {$EXTERNALSYM IID_IMemoryData} + IID_IAudioData: TGUID = '{54C719C0-AF60-11D0-8212-00C04FC32C45}'; + {$EXTERNALSYM IID_IAudioData} + +type + IAudioStreamSample = interface; + IAudioData = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAudioMediaStream;'} + {$EXTERNALSYM IAudioMediaStream} + IAudioMediaStream = interface(IMediaStream) + ['{F7537560-A3BE-11D0-8212-00C04FC32C45}'] + (*** IAudioMediaStream methods ***) + function GetFormat(out pWaveFormatCurrent: TWaveFormatEx): HResult; stdcall; + function SetFormat(const lpWaveFormat: TWaveFormatEx): HResult; stdcall; + function CreateSample(pAudioData: IAudioData; dwFlags: DWORD; + out ppSample: IAudioStreamSample): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAudioStreamSample;'} + {$EXTERNALSYM IAudioStreamSample} + IAudioStreamSample = interface(IStreamSample) + ['{345FEE00-ABA5-11D0-8212-00C04FC32C45}'] + (*** IAudioStreamSample methods ***) + function GetAudioData(out ppAudio: IAudioData): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMemoryData;'} + {$EXTERNALSYM IMemoryData} + IMemoryData = interface(IUnknown) + ['{327FC560-AF60-11D0-8212-00C04FC32C45}'] + (*** IMemoryData methods ***) + function SetBuffer(cbSize: DWORD; pbData: pointer; dwFlags: DWORD): HResult; + stdcall; + function GetInfo(out pdwLength: DWORD; out ppbData: pointer; + out pcbActualData: DWORD): HResult; stdcall; + function SetActual(cbDataValid: DWORD): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAudioData;'} + {$EXTERNALSYM IAudioData} + IAudioData = interface(IMemoryData) + ['{54C719C0-AF60-11D0-8212-00C04FC32C45}'] + (*** IAudioData methods ***) + function GetFormat(out pWaveFormatCurrent: TWaveFormatEx): HResult; stdcall; + function SetFormat(const lpWaveFormat: TWaveFormatEx): HResult; stdcall; + end; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: mpconfig.h + * + ***************************************************************************) + +const + IID_IMixerPinConfig : TGUID = (D1:$593CDDE1;D2:$0759;D3:$11D1;D4:($9E,$69,$00,$C0,$4F,$D7,$C1,$5B)); + {$EXTERNALSYM IID_IMixerPinConfig} + IID_IMixerPinConfig2: TGUID = (D1:$ebf47182;D2:$8764;D3:$11d1;D4:($9e,$69,$00,$c0,$4f,$d7,$c1,$5b)); + {$EXTERNALSYM IID_IMixerPinConfig2} + +type + _AM_ASPECT_RATIO_MODE = ( + AM_ARMODE_STRETCHED, // don't do any aspect ratio correction + AM_ARMODE_LETTER_BOX, // letter box the video, paint background color in the excess region + AM_ARMODE_CROP, // crop the video to the right aspect ratio + AM_ARMODE_STRETCHED_AS_PRIMARY + ); + {$EXTERNALSYM _AM_ASPECT_RATIO_MODE} + AM_ASPECT_RATIO_MODE = _AM_ASPECT_RATIO_MODE; + {$EXTERNALSYM AM_ASPECT_RATIO_MODE} + TAMAspectRatioMode = AM_ASPECT_RATIO_MODE; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMixerPinConfig;'} + {$EXTERNALSYM IMixerPinConfig} + IMixerPinConfig = interface(IUnknown) + ['{593CDDE1-0759-11D1-9E69-00C04FD7C15B}'] + (*** IMixerPinConfig methods ***) + function SetRelativePosition(dwLeft, dwTop, dwRight, dwBottom: DWORD): HResult; stdcall; + function GetRelativePosition(out dwLeft, dwTop, dwRight, dwBottom: DWORD): HResult; stdcall; + function SetZOrder(dwZOrder: DWORD): HResult; stdcall; + function GetZOrder(out dwZOrder: DWORD): HResult; stdcall; + function SetColorKey(var pColorKey: TColorKey): HResult; stdcall; + function GetColorKey(out pColorKey: TColorKey; out pColor: DWORD): HResult; stdcall; + function SetBlendingParameter(dwBlendingParameter: DWORD): HResult; stdcall; + function GetBlendingParameter(out dwBlendingParameter: DWORD): HResult; stdcall; + function SetAspectRatioMode(amAspectRatioMode: TAMAspectRatioMode): HResult; stdcall; + function GetAspectRatioMode(out amAspectRatioMode: TAMAspectRatioMode): HResult; stdcall; + function SetStreamTransparent(bStreamTransparent: BOOL): HResult; stdcall; + function GetStreamTransparent(out bStreamTransparent: BOOL): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMixerPinConfig2;'} + {$EXTERNALSYM IMixerPinConfig2} + IMixerPinConfig2 = interface(IMixerPinConfig) + ['{EBF47182-8764-11d1-9E69-00C04FD7C15B}'] + (*** IMixerPinConfig2 methods ***) + function SetOverlaySurfaceColorControls(pColorControl: PDDColorControl): HResult; stdcall; + function GetOverlaySurfaceColorControls(out pColorControl: TDDColorControl): HResult; stdcall; + end; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: control.h + * + ***************************************************************************) + +const + LIBID_QuartzTypeLib: TGUID = (D1:$56A868B0;D2:$0AD4;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM LIBID_QuartzTypeLib} + + IID_IAMCollection: TGUID = (D1:$56A868B9;D2:$0AD4;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM IID_IAMCollection} + IID_IMediaControl: TGUID = (D1:$56A868B1;D2:$0AD4;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM IID_IMediaControl} + IID_IMediaEvent: TGUID = (D1:$56A868B6;D2:$0AD4;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM IID_IMediaEvent} + IID_IMediaEventEx: TGUID = (D1:$56A868C0;D2:$0AD4;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM IID_IMediaEventEx} + IID_IMediaPosition: TGUID = (D1:$56A868B2;D2:$0AD4;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM IID_IMediaPosition} + IID_IBasicAudio: TGUID = (D1:$56A868B3;D2:$0AD4;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM IID_IBasicAudio} + IID_IVideoWindow: TGUID = (D1:$56A868B4;D2:$0AD4;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM IID_IVideoWindow} + IID_IBasicVideo: TGUID = (D1:$56A868B5;D2:$0AD4;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM IID_IBasicVideo} + IID_IBasicVideo2: TGUID = (D1:$329bb360;D2:$f6ea;D3:$11d1;D4:($90,$38,$00,$a0,$c9,$69,$72,$98)); + {$EXTERNALSYM IID_IBasicVideo2} + IID_IDeferredCommand: TGUID = (D1:$56A868B8;D2:$0AD4;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM IID_IDeferredCommand} + IID_IQueueCommand: TGUID = (D1:$56A868B7;D2:$0AD4;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM IID_IQueueCommand} + + CLSID_FilgraphManager: TGUID = (D1:$E436EBB3;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM CLSID_FilgraphManager} + + IID_IFilterInfo: TGUID = (D1:$56A868BA;D2:$0AD4;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM IID_IFilterInfo} + IID_IRegFilterInfo: TGUID = (D1:$56A868BB;D2:$0AD4;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM IID_IRegFilterInfo} + IID_IMediaTypeInfo: TGUID = (D1:$56A868BC;D2:$0AD4;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM IID_IMediaTypeInfo} + IID_IPinInfo: TGUID = (D1:$56A868BD;D2:$0AD4;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM IID_IPinInfo} + IID_IAMStats: TGUID = (D1:$bc9bcf80;D2:$dcd2;D3:$11d2;D4:($ab,$f6,$00,$a0,$c9,$05,$f3,$75)); + {$EXTERNALSYM IID_IAMStats} +type + OAEVENT = {$IFDEF TYPE_IDENTITY}type {$ENDIF} Longint; + {$EXTERNALSYM OAEVENT} + OAHWND = {$IFDEF TYPE_IDENTITY}type {$ENDIF} Longint; + {$EXTERNALSYM OAHWND} + OAFilterState = {$IFDEF TYPE_IDENTITY}type {$ENDIF} Longint; + {$EXTERNALSYM OAFilterState} + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMCollection;'} + {$EXTERNALSYM IAMCollection} + IAMCollection = interface(IDispatch) + ['{56A868B9-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IAMCollection methods ***) + function get_Count(out plCount: Longint): HResult; stdcall; + function Item(lItem: Longint; out ppUnk: IUnknown): HResult; stdcall; + function get__NewEnum(out ppUnk: IUnknown): HResult; stdcall; + + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaControl;'} + {$EXTERNALSYM IMediaControl} + IMediaControl = interface(IDispatch) + ['{56A868B1-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IMediaControl methods ***) + function Run: HResult; stdcall; + function Pause: HResult; stdcall; + function Stop: HResult; stdcall; + function GetState(msTimeout: DWORD; out pfs: TFilterState): HResult; stdcall; + function RenderFile(strFilename: WideString): HResult; stdcall; + function AddSourceFilter(strFilename: WideString; out ppUnk: IDispatch): HResult; stdcall; + function get_FilterCollection(out ppUnk: IDispatch): HResult; stdcall; + function get_RegFilterCollection(out ppUnk: IDispatch): HResult; stdcall; + function StopWhenReady: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaEvent;'} + {$EXTERNALSYM IMediaEvent} + IMediaEvent = interface(IDispatch) + ['{56A868B6-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IMediaEvent methods ***) + function GetEventHandle(out hEvent: OAEVENT): HResult; stdcall; + function GetEvent(out lEventCode: Longint; out lParam1, lParam2: Longint; + msTimeout: DWORD): HResult; stdcall; + function WaitForCompletion(msTimeout: DWORD; out pEvCode: Longint): + HResult; stdcall; + function CancelDefaultHandling(lEvCode: Longint): HResult; stdcall; + function RestoreDefaultHandling(lEvCode: Longint): HResult; stdcall; + function FreeEventParams(lEvCode: Longint; lParam1, lParam2: Longint): + HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaEventEx;'} + {$EXTERNALSYM IMediaEventEx} + IMediaEventEx = interface(IMediaEvent) + ['{56A868C0-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IMediaEventEx methods ***) + function SetNotifyWindow(hwnd: OAHWND; lMsg: Longint; + lInstanceData: Longint): HResult; stdcall; + function SetNotifyFlags(lNoNotifyFlags: Longint): HResult; stdcall; + function GetNotifyFlags(out lplNoNotifyFlags): HResult; stdcall; //longint + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaPosition;'} + {$EXTERNALSYM IMediaPosition} + IMediaPosition = interface(IDispatch) + ['{56A868B2-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IMediaPosition methods ***) + function get_Duration(out plength: TRefTime): HResult; stdcall; + function put_CurrentPosition(llTime: TRefTime): HResult; stdcall; + function get_CurrentPosition(out pllTime: TRefTime): HResult; stdcall; + function get_StopTime(out pllTime: TRefTime): HResult; stdcall; + function put_StopTime(llTime: TRefTime): HResult; stdcall; + function get_PrerollTime(out pllTime: TRefTime): HResult; stdcall; + function put_PrerollTime(llTime: TRefTime): HResult; stdcall; + function put_Rate(dRate: double): HResult; stdcall; + function get_Rate(out pdRate: double): HResult; stdcall; + function CanSeekForward(out pCanSeekForward: Longint): HResult; stdcall; + function CanSeekBackward(out pCanSeekBackward: Longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBasicAudio;'} + {$EXTERNALSYM IBasicAudio} + IBasicAudio = interface(IDispatch) + ['{56A868B3-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IBasicAudio methods ***) + function put_Volume(lVolume: Longint): HResult; stdcall; + function get_Volume(out plVolume: Longint): HResult; stdcall; + function put_Balance(lBalance: Longint): HResult; stdcall; + function get_Balance(out plBalance: Longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVideoWindow;'} + {$EXTERNALSYM IVideoWindow} + IVideoWindow = interface(IDispatch) + ['{56A868B4-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IVideoWindow methods ***) + function put_Caption(strCaption: WideString): HResult; stdcall; + function get_Caption(out strCaption: WideString): HResult; stdcall; + function put_WindowStyle(WindowStyle: Longint): HResult; stdcall; + function get_WindowStyle(out WindowStyle: Longint): HResult; stdcall; + function put_WindowStyleEx(WindowStyleEx: Longint): HResult; stdcall; + function get_WindowStyleEx(out WindowStyleEx: Longint): HResult; stdcall; + function put_AutoShow(AutoShow: LongBool): HResult; stdcall; + function get_AutoShow(out AutoShow: LongBool): HResult; stdcall; + function put_WindowState(WindowState: Longint): HResult; stdcall; + function get_WindowState(out WindowState: Longint): HResult; stdcall; + function put_BackgroundPalette(BackgroundPalette: Longint): HResult; stdcall; + function get_BackgroundPalette(out pBackgroundPalette: Longint): HResult; stdcall; + function put_Visible(Visible: LongBool): HResult; stdcall; + function get_Visible(out pVisible: LongBool): HResult; stdcall; + function put_Left(Left: Longint): HResult; stdcall; + function get_Left(out pLeft: Longint): HResult; stdcall; + function put_Width(Width: Longint): HResult; stdcall; + function get_Width(out pWidth: Longint): HResult; stdcall; + function put_Top(Top: Longint): HResult; stdcall; + function get_Top(out pTop: Longint): HResult; stdcall; + function put_Height(Height: Longint): HResult; stdcall; + function get_Height(out pHeight: Longint): HResult; stdcall; + function put_Owner(Owner: OAHWND): HResult; stdcall; + function get_Owner(out Owner: OAHWND): HResult; stdcall; + function put_MessageDrain(Drain: OAHWND): HResult; stdcall; + function get_MessageDrain(out Drain: OAHWND): HResult; stdcall; + function get_BorderColor(out Color: Longint): HResult; stdcall; + function put_BorderColor(Color: Longint): HResult; stdcall; + function get_FullScreenMode(out FullScreenMode: LongBool): HResult; stdcall; + function put_FullScreenMode(FullScreenMode: LongBool): HResult; stdcall; + function SetWindowForeground(Focus: Longint): HResult; stdcall; + function NotifyOwnerMessage(hwnd: Longint; uMsg, wParam, lParam: Longint): HResult; stdcall; + function SetWindowPosition(Left, Top, Width, Height: Longint): HResult; stdcall; + function GetWindowPosition(out pLeft, pTop, pWidth, pHeight: Longint): HResult; stdcall; + function GetMinIdealImageSize(out pWidth, pHeight: Longint): HResult; stdcall; + function GetMaxIdealImageSize(out pWidth, pHeight: Longint): HResult; stdcall; + function GetRestorePosition(out pLeft, pTop, pWidth, pHeight: Longint): HResult; stdcall; + function HideCursor(HideCursor: LongBool): HResult; stdcall; + function IsCursorHidden(out CursorHidden: LongBool): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBasicVideo;'} + {$EXTERNALSYM IBasicVideo} + IBasicVideo = interface(IDispatch) + ['{56A868B5-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IBasicVideo methods ***) + function get_AvgTimePerFrame(out pAvgTimePerFrame: TRefTime): HResult; stdcall; + function get_BitRate(out pBitRate: Longint): HResult; stdcall; + function get_BitErrorRate(out pBitErrorRate: Longint): HResult; stdcall; + function get_VideoWidth(out pVideoWidth: Longint): HResult; stdcall; + function get_VideoHeight(out pVideoHeight: Longint): HResult; stdcall; + function put_SourceLeft(SourceLeft: Longint): HResult; stdcall; + function get_SourceLeft(out pSourceLeft: Longint): HResult; stdcall; + function put_SourceWidth(SourceWidth: Longint): HResult; stdcall; + function get_SourceWidth(out pSourceWidth: Longint): HResult; stdcall; + function put_SourceTop(SourceTop: Longint): HResult; stdcall; + function get_SourceTop(out pSourceTop: Longint): HResult; stdcall; + function put_SourceHeight(SourceHeight: Longint): HResult; stdcall; + function get_SourceHeight(out pSourceHeight: Longint): HResult; stdcall; + function put_DestinationLeft(DestinationLeft: Longint): HResult; stdcall; + function get_DestinationLeft(out pDestinationLeft: Longint): HResult; stdcall; + function put_DestinationWidth(DestinationWidth: Longint): HResult; stdcall; + function get_DestinationWidth(out pDestinationWidth: Longint): HResult; stdcall; + function put_DestinationTop(DestinationTop: Longint): HResult; stdcall; + function get_DestinationTop(out pDestinationTop: Longint): HResult; stdcall; + function put_DestinationHeight(DestinationHeight: Longint): HResult; stdcall; + function get_DestinationHeight(out pDestinationHeight: Longint): HResult; stdcall; + function SetSourcePosition(Left, Top, Width, Height: Longint): HResult; stdcall; + function GetSourcePosition(out pLeft, pTop, pWidth, pHeight: Longint): HResult; stdcall; + function SetDefaultSourcePosition: HResult; stdcall; + function SetDestinationPosition(Left, Top, Width, Height: Longint): HResult; stdcall; + function GetDestinationPosition(out pLeft, pTop, pWidth, pHeight: Longint): HResult; stdcall; + function SetDefaultDestinationPosition: HResult; stdcall; + function GetVideoSize(out pWidth, Height: Longint): HResult; stdcall; + function GetVideoPaletteEntries(StartIndex, Entries: Longint; + out pRetrieved: Longint; out pPalette): HResult; stdcall; + function GetCurrentImage(var BufferSize: Longint; var pDIBImage): HResult; stdcall; + function IsUsingDefaultSource: HResult; stdcall; + function IsUsingDefaultDestination: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBasicVideo2;'} + {$EXTERNALSYM IBasicVideo2} + IBasicVideo2 = interface(IBasicVideo) + ['{329bb360-f6ea-11d1-9038-00a0c9697298}'] + (*** IBasicVideo2 methods ***) + function GetPreferredAspectRatio(out plAspectX, plAspectY: Longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDeferredCommand;'} + {$EXTERNALSYM IDeferredCommand} + IDeferredCommand = interface(IDispatch) + ['{56A868B8-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IDeferredCommand methods ***) + function Cancel: HResult; stdcall; + function Confidence(out pConfidence: Longint): HResult; stdcall; + function Postpone(newtime: TRefTime): HResult; stdcall; + function GetHResult(out phrResult: HResult): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IQueueCommand;'} + {$EXTERNALSYM IQueueCommand} + IQueueCommand = interface(IUnknown) + ['{56A868B7-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IQueueCommand methods ***) + function InvokeAtStreamTime(out pCmd: IDeferredCommand; time: TRefTime; + const iid: TGUID; dispidMethod: Longint; wFlags: SmallInt; + cArgs: Longint; const pDispParams: OleVariant; var pvarResult: OleVariant; + out puArgErr: SmallInt): HResult; stdcall; + function InvokeAtPresentationTime(out pCmd: IDeferredCommand; + time: TRefTime; const iid: TGUID; dispidMethod: Longint; + wFlags: SmallInt; cArgs: Longint; const pDispParams: OleVariant; + var pvarResult: OleVariant; out puArgErr: SmallInt): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IFilterInfo;'} + {$EXTERNALSYM IFilterInfo} + IFilterInfo = interface(IDispatch) + ['{56A868BA-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IFilterInfo methods ***) + function FindPin(strPinID: WideString; out ppUnk: IDispatch): HResult; stdcall; + function get_Name(out strName: WideString): HResult; stdcall; + function get_VendorInfo(out strVendorInfo: WideString): HResult; stdcall; + function get_Filter(out ppUnk: IUnknown): HResult; stdcall; + function get_Pins(out ppUnk: IDispatch): HResult; stdcall; + function get_IsFileSource(out pbIsSource: LongBool): HResult; stdcall; + function get_Filename(out pstrFilename: WideString): HResult; stdcall; + function put_Filename(strFilename: WideString): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IRegFilterInfo;'} + {$EXTERNALSYM IRegFilterInfo} + IRegFilterInfo = interface(IDispatch) + ['{56A868BB-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IRegFilterInfo methods ***) + function get_Name(out strName: WideString): HResult; stdcall; + function Filter(out ppUnk: IDispatch): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaTypeInfo;'} + {$EXTERNALSYM IMediaTypeInfo} + IMediaTypeInfo = interface(IDispatch) + ['{56A868BC-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IMediaTypeInfo methods ***) + function Get_Type(out strType: WideString): HResult; stdcall; + function Get_Subtype(out strType: WideString): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IPinInfo;'} + {$EXTERNALSYM IPinInfo} + IPinInfo = interface(IDispatch) + ['{56A868BD-0AD4-11CE-B03A-0020AF0BA770}'] + (*** IPinInfo methods ***) + function get_Pin(out ppUnk: IUnknown): HResult; stdcall; + function get_ConnectedTo(out ppUnk: IDispatch): HResult; stdcall; + function get_ConnectionMediaType(out ppUnk: IDispatch): HResult; stdcall; + function get_FilterInfo(out ppUnk: IDispatch): HResult; stdcall; + function get_Name(out ppUnk: WideString): HResult; stdcall; + function get_Direction(out ppDirection: Longint): HResult; stdcall; + function get_PinID(out strPinID: WideString): HResult; stdcall; + function get_MediaTypes(out ppUnk: IDispatch): HResult; stdcall; + function Connect(pPin: IUnknown): HResult; stdcall; + function ConnectDirect(pPin: IUnknown): HResult; stdcall; + function ConnectWithType(pPin: IUnknown; pMediaType: IDispatch): HResult; stdcall; + function Disconnect: HResult; stdcall; + function Render: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMStats;'} + {$EXTERNALSYM IAMStats} + IAMStats = interface(IDispatch) + ['{bc9bcf80-dcd2-11d2-abf6-00a0c905f375}'] + (*** IAMStats methods ***) + function Reset: HResult; stdcall; + function get_Count(out plCount: Longint): HResult; stdcall; + function GetValueByIndex(lIndex: longint; out szName: WideString; out lCount: longint; + out dLast, dAverage, dStdDev, dMin, dMax: double): HResult; stdcall; + function GetValueByName(szName: WideString; out lIndex, lCount: Longint; + out dLast, dAverage, dStdDev, dMin, dMax: double): HResult; stdcall; + function GetIndex(szName: WideString; lCreate: longint; out plIndex: longint): HResult; stdcall; + function AddValue(lIndex: longint; dValue: double): HResult; stdcall; + end; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: qnetwork.h + * + ***************************************************************************) + +const + LIBID_QuartzNetTypeLib: TGUID = (D1:$56A868B1;D2:$0AD4;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM LIBID_QuartzNetTypeLib} + + IID_IAMNetShowConfig: TGUID = (D1:$FA2AA8F1;D2:$8B62;D3:$11D0;D4:($A5,$20,$00,$00,$00,$00,$00,$00)); + {$EXTERNALSYM IID_IAMNetShowConfig} + IID_IAMChannelInfo: TGUID = (D1:$FA2AA8F2;D2:$8B62;D3:$11D0;D4:($A5,$20,$00,$00,$00,$00,$00,$00)); + {$EXTERNALSYM IID_IAMChannelInfo} + IID_IAMNetworkStatus: TGUID = (D1:$FA2AA8F3;D2:$8B62;D3:$11D0;D4:($A5,$20,$00,$00,$00,$00,$00,$00)); + {$EXTERNALSYM IID_IAMNetworkStatus} + IID_IAMExtendedSeeking: TGUID = (D1:$FA2AA8F9;D2:$8B62;D3:$11D0;D4:($A5,$20,$00,$00,$00,$00,$00,$00)); + {$EXTERNALSYM IID_IAMExtendedSeeking} + IID_IAMNetShowExProps: TGUID = (D1:$FA2AA8F5;D2:$8B62;D3:$11D0;D4:($A5,$20,$00,$00,$00,$00,$00,$00)); + {$EXTERNALSYM IID_IAMNetShowExProps} + IID_IAMExtendedErrorInfo: TGUID = (D1:$FA2AA8F6;D2:$8B62;D3:$11D0;D4:($A5,$20,$00,$00,$00,$00,$00,$00)); + {$EXTERNALSYM IID_IAMExtendedErrorInfo} + IID_IAMMediaContent: TGUID = (D1:$FA2AA8F4;D2:$8B62;D3:$11D0;D4:($A5,$20,$00,$00,$00,$00,$00,$00)); + {$EXTERNALSYM IID_IAMMediaContent} + IID_IAMMediaContent2 : TGUID = (D1:$CE8F78C1;D2:$74D9;D3:$11D2;D4:($B0,$9D,$00,$A0,$C9,$A8,$11,$17)); + {$EXTERNALSYM IID_IAMMediaContent2} + IID_IAMNetShowPreroll: TGUID = (D1:$AAE7E4E2;D2:$6388;D3:$11D1;D4:($8D,$93,$00,$60,$97,$C9,$A2,$B2)); + {$EXTERNALSYM IID_IAMNetShowPreroll} + IID_IDShowPlugin : TGUID = (D1:$4746B7C8;D2:$700E;D3:$11D1;D4:($BE,$CC,$00,$C0,$4F,$B6,$E9,$37)); + {$EXTERNALSYM IID_IDShowPlugin} + +//AMExtendedSeekingCapabilities +const + AM_EXSEEK_CANSEEK = 1; + {$EXTERNALSYM AM_EXSEEK_CANSEEK} + AM_EXSEEK_CANSCAN = 2; + {$EXTERNALSYM AM_EXSEEK_CANSCAN} + AM_EXSEEK_MARKERSEEK = 4; + {$EXTERNALSYM AM_EXSEEK_MARKERSEEK} + AM_EXSEEK_SCANWITHOUTCLOCK = 8; + {$EXTERNALSYM AM_EXSEEK_SCANWITHOUTCLOCK} + AM_EXSEEK_NOSTANDARDREPAINT = 16; + {$EXTERNALSYM AM_EXSEEK_NOSTANDARDREPAINT} + AM_EXSEEK_BUFFERING = 32; + {$EXTERNALSYM AM_EXSEEK_BUFFERING} + AM_EXSEEK_SENDS_VIDEOFRAMEREADY = 64; + {$EXTERNALSYM AM_EXSEEK_SENDS_VIDEOFRAMEREADY} + +type + DATE = record + da_year: Integer; // Year - 1980 + da_day : Byte; // Day of the month + da_mon : Byte; // Month (1 = Jan) + end; + {$EXTERNALSYM DATE} + //TDate = DATE; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMNetShowConfig;'} + {$EXTERNALSYM IAMNetShowConfig} + IAMNetShowConfig = interface(IDispatch) + ['{FA2AA8F1-8B62-11D0-A520-000000000000}'] + (*** IAMNetShowConfig methods ***) + function get_BufferingTime(var pBufferingTime: double): HResult; stdcall; + function put_BufferingTime(BufferingTime: double): HResult; stdcall; + function get_UseFixedUDPPort(var pUseFixedUDPPort: WordBool): HResult; stdcall; + function put_UseFixedUDPPort(UseFixedUDPPort: WordBool): HResult; stdcall; + function get_FixedUDPPort(var pFixedUDPPort: Longint): HResult; stdcall; + function put_FixedUDPPort(FixedUDPPort: Longint): HResult; stdcall; + function get_UseHTTPProxy(var pUseHTTPProxy: WordBool): HResult; stdcall; + function put_UseHTTPProxy(UseHTTPProxy: WordBool): HResult; stdcall; + function get_EnableAutoProxy(var pEnableAutoProxy: WordBool): HResult; stdcall; + function put_EnableAutoProxy(EnableAutoProxy: WordBool): HResult; stdcall; + function get_HTTPProxyHost(var pbstrHTTPProxyHost: TBSTR): HResult; stdcall; + function put_HTTPProxyHost(bstrHTTPProxyHost: TBSTR): HResult; stdcall; + function get_HTTPProxyPort(var pHTTPProxyPort: Longint): HResult; stdcall; + function put_HTTPProxyPort(HTTPProxyPort: Longint): HResult; stdcall; + function get_EnableMulticast(var pEnableMulticast: WordBool): HResult; stdcall; + function put_EnableMulticast(EnableMulticast: WordBool): HResult; stdcall; + function get_EnableUDP(var pEnableUDP: WordBool): HResult; stdcall; + function put_EnableUDP(EnableUDP: WordBool): HResult; stdcall; + function get_EnableTCP(var pEnableTCP: WordBool): HResult; stdcall; + function put_EnableTCP(EnableTCP: WordBool): HResult; stdcall; + function get_EnableHTTP(var pEnableHTTP: WordBool): HResult; stdcall; + function put_EnableHTTP(EnableHTTP: WordBool): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMChannelInfo;'} + {$EXTERNALSYM IAMChannelInfo} + IAMChannelInfo = interface(IDispatch) + ['{FA2AA8F2-8B62-11D0-A520-000000000000}'] + (*** IAMChannelInfo methods ***) + function get_ChannelName(var pbstrChannelName: TBSTR): HResult; stdcall; + function get_ChannelDescription(var pbstrChannelDescription: TBSTR): HResult; stdcall; + function get_ChannelURL(var pbstrChannelURL: TBSTR): HResult; stdcall; + function get_ContactAddress(var pbstrContactAddress: TBSTR): HResult; stdcall; + function get_ContactPhone(var pbstrContactPhone: TBSTR): HResult; stdcall; + function get_ContactEmail(var pbstrContactEmail: TBSTR): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMNetworkStatus;'} + {$EXTERNALSYM IAMNetworkStatus} + IAMNetworkStatus = interface(IDispatch) + ['{FA2AA8F3-8B62-11D0-A520-000000000000}'] + (*** IAMNetworkStatus methods ***) + function get_ReceivedPackets(var pReceivedPackets: Longint): HResult; stdcall; + function get_RecoveredPackets(var pRecoveredPackets: Longint): HResult; stdcall; + function get_LostPackets(var pLostPackets: Longint): HResult; stdcall; + function get_ReceptionQuality(var pReceptionQuality: Longint): HResult; stdcall; + function get_BufferingCount(var pBufferingCount: Longint): HResult; stdcall; + function get_IsBroadcast(var pIsBroadcast: WordBool): HResult; stdcall; + function get_BufferingProgress(var pBufferingProgress: Longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMExtendedSeeking;'} + {$EXTERNALSYM IAMExtendedSeeking} + IAMExtendedSeeking = interface(IDispatch) + ['{FA2AA8F9-8B62-11D0-A520-000000000000}'] + (*** IAMExtendedSeeking methods ***) + function get_ExSeekCapabilities(var pExCapabilities: Longint): HResult; stdcall; + function get_MarkerCount(var pMarkerCount: Longint): HResult; stdcall; + function get_CurrentMarker(var pCurrentMarker: Longint): HResult; stdcall; + function GetMarkerTime(MarkerNum: Longint; var pMarkerTime: double): HResult; stdcall; + function GetMarkerName(MarkerNum: Longint; var pbstrMarkerName: TBSTR): HResult; stdcall; + function put_PlaybackSpeed(Speed: double): HResult; stdcall; + function get_PlaybackSpeed(var pSpeed: double): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMNetShowExProps;'} + {$EXTERNALSYM IAMNetShowExProps} + IAMNetShowExProps = interface(IDispatch) + ['{FA2AA8F5-8B62-11D0-A520-000000000000}'] + (*** IAMNetShowExProps methods ***) + function get_SourceProtocol(var pSourceProtocol: Longint): HResult; stdcall; + function get_Bandwidth(var pBandwidth: Longint): HResult; stdcall; + function get_ErrorCorrection(var pbstrErrorCorrection: TBSTR): HResult; stdcall; + function get_CodecCount(var pCodecCount: Longint): HResult; stdcall; + function GetCodecInstalled(CodecNum: Longint; var pCodecInstalled: WordBool): HResult; stdcall; + function GetCodecDescription(CodecNum: Longint; var pbstrCodecDescription: TBSTR): HResult; stdcall; + function GetCodecURL(CodecNum: Longint; var pbstrCodecURL: TBSTR): HResult; stdcall; + function get_CreationDate(var pCreationDate: Date): HResult; stdcall; + function get_SourceLink(var pbstrSourceLink: TBSTR): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMExtendedErrorInfo;'} + {$EXTERNALSYM IAMExtendedErrorInfo} + IAMExtendedErrorInfo = interface(IDispatch) + ['{FA2AA8F6-8B62-11D0-A520-000000000000}'] + (*** IAMExtendedErrorInfo methods ***) + function get_HasError(var pHasError: WordBool): HResult; stdcall; + function get_ErrorDescription(var pbstrErrorDescription: TBSTR): HResult; stdcall; + function get_ErrorCode(var pErrorCode: Longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMMediaContent;'} + {$EXTERNALSYM IAMMediaContent} + IAMMediaContent = interface(IDispatch) + ['{FA2AA8F4-8B62-11D0-A520-000000000000}'] + (*** IAMMediaContent methods ***) + function get_AuthorName(var pbstrAuthorName: TBSTR): HResult; stdcall; + function get_Title(var pbstrTitle: TBSTR): HResult; stdcall; + function get_Rating(var pbstrRating: TBSTR): HResult; stdcall; + function get_Description(var pbstrDescription: TBSTR): HResult; stdcall; + function get_Copyright(var pbstrCopyright: TBSTR): HResult; stdcall; + function get_BaseURL(var pbstrBaseURL: TBSTR): HResult; stdcall; + function get_LogoURL(var pbstrLogoURL: TBSTR): HResult; stdcall; + function get_LogoIconURL(var pbstrLogoURL: TBSTR): HResult; stdcall; + function get_WatermarkURL(var pbstrWatermarkURL: TBSTR): HResult; stdcall; + function get_MoreInfoURL(var pbstrMoreInfoURL: TBSTR): HResult; stdcall; + function get_MoreInfoBannerImage(var pbstrMoreInfoBannerImage: TBSTR): HResult; stdcall; + function get_MoreInfoBannerURL(var pbstrMoreInfoBannerURL: TBSTR): HResult; stdcall; + function get_MoreInfoText(var pbstrMoreInfoText: TBSTR): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMMediaContent2;'} + {$EXTERNALSYM IAMMediaContent2} + IAMMediaContent2 = interface(IDispatch) + ['{CE8F78C1-74D9-11D2-B09D-00A0C9A81117}'] + (*** IAMMediaContent2 methods ***) + function get_MediaParameter(var EntryNum: longint; var bstrName, pbstrValue: TBSTR): HResult; stdcall; + function get_MediaParameterName(var EntryNum, Index: longint; var pbstrName: TBSTR): HResult; stdcall; + function get_PlaylistCount(var pNumberEntries: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMNetShowPreroll;'} + {$EXTERNALSYM IAMNetShowPreroll} + IAMNetShowPreroll = interface(IDispatch) + ['{AAE7E4E2-6388-11D1-8D93-006097C9A2B2}'] + (*** IAMNetShowPreroll methods ***) + function put_Preroll(var fPreroll : WordBool): HResult; stdcall; + function get_Preroll(var pfPreroll: WordBool): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDShowPlugin;'} + {$EXTERNALSYM IDShowPlugin} + IDShowPlugin = interface(IUnknown) + ['{4746B7C8-700E-11D1-BECC-00C04FB6E937}'] + (*** IDShowPlugin methods ***) + function get_URL(var pURL: TBSTR): HResult; stdcall; + function get_UserAgent(var pUserAgent: TBSTR): HResult; stdcall; + end; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: playlist.h + * + ***************************************************************************) + +const + IID_IAMPlayListItem: TGUID = (D1:$56A868FF;D2:$0AD4;D3:$11CE;D4:($B0,$A3,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM IID_IAMPlayListItem} + IID_IAMPlayList: TGUID = (D1:$56A868FE;D2:$0AD4;D3:$11CE;D4:($B0,$A3,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM IID_IAMPlayList} + IID_ISpecifyParticularPages : TGUID = '{4C437B91-6E9E-11d1-A704-006097C4E476}'; + {$EXTERNALSYM IID_ISpecifyParticularPages} + IID_IAMRebuild: TGUID = '{02EF04DD-7580-11d1-BECE-00C04FB6E937}'; + {$EXTERNALSYM IID_IAMRebuild} + SPECIFYPAGES_STATISTICS: TGUID = (D1:$4c437b92;D2:$6e9e;D3:$11d1;D4:($a7,$4,$0,$60,$97,$c4,$e4,$76)); + {$EXTERNALSYM SPECIFYPAGES_STATISTICS} + + AMPLAYLISTITEM_CANSKIP = 1; + {$EXTERNALSYM AMPLAYLISTITEM_CANSKIP} + AMPLAYLISTITEM_CANBIND = 2; + {$EXTERNALSYM AMPLAYLISTITEM_CANBIND} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMPlayListItem;'} + {$EXTERNALSYM IAMPlayListItem} + IAMPlayListItem = interface(IUnknown) + ['{56A868FF-0AD4-11CE-B0A3-0020AF0BA770}'] + (*** IAMPlayListItem methods ***) + function GetFlags(out pdwFlags: DWORD): HResult; stdcall; + function GetSourceCount(out pdwSources: DWORD): HResult; stdcall; + function GetSourceURL(dwSourceIndex: DWORD; out pbstrURL: WideChar): HResult; stdcall; + function GetSourceStart(dwSourceIndex: DWORD; out prtStart: TReferenceTime): HResult; stdcall; + function GetSourceDuration(dwSourceIndex: DWORD; + out prtDuration: TReferenceTime): HResult; stdcall; + function GetSourceStartMarker(dwSourceIndex: DWORD; + out pdwMarker: DWORD): HResult; stdcall; + function GetSourceEndMarker(dwSourceIndex: DWORD; + out pdwMarker: DWORD): HResult; stdcall; + function GetSourceStartMarkerName(dwSourceIndex: DWORD; + out pbstrStartMarker: WideChar): HResult; stdcall; + function GetSourceEndMarkerName(dwSourceIndex: DWORD; + out pbstrEndMarker: WideChar): HResult; stdcall; + function GetLinkURL(out pbstrURL: WideChar): HResult; stdcall; + function GetScanDuration(dwSourceIndex: DWORD; + out prtScanDuration: TReferenceTime): HResult; stdcall; + end; + +const + AMPLAYLIST_STARTINSCANMODE = 1; + {$EXTERNALSYM AMPLAYLIST_STARTINSCANMODE} + AMPLAYLIST_FORCEBANNER = 2; + {$EXTERNALSYM AMPLAYLIST_FORCEBANNER} + + AMPLAYLISTEVENT_RESUME = $0; + {$EXTERNALSYM AMPLAYLISTEVENT_RESUME} + AMPLAYLISTEVENT_BREAK = $1; + {$EXTERNALSYM AMPLAYLISTEVENT_BREAK} + AMPLAYLISTEVENT_NEXT = $2; + {$EXTERNALSYM AMPLAYLISTEVENT_NEXT} + AMPLAYLISTEVENT_MASK = $f; + {$EXTERNALSYM AMPLAYLISTEVENT_MASK} + AMPLAYLISTEVENT_REFRESH = $10; + {$EXTERNALSYM AMPLAYLISTEVENT_REFRESH} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMPlayList;'} + {$EXTERNALSYM IAMPlayList} + IAMPlayList = interface(IUnknown) + ['{56A868FE-0AD4-11CE-B0A3-0020AF0BA770}'] + (*** IAMPlayList methods ***) + function GetFlags(out pdwFlags: DWORD): HResult; stdcall; + function GetItemCount(out pdwItems: DWORD): HResult; stdcall; + function GetItem(dwItemIndex: DWORD; out ppItem: IAMPlayListItem): HResult; stdcall; + function GetNamedEvent(var pwszEventName: WideChar; dwItemIndex: DWORD; + out ppItem: IAMPlayListItem; out pdwFlags: DWORD): HResult; stdcall; + function GetRepeatInfo(out pdwRepeatCount, pdwRepeatStart, + pdwRepeatEnd: DWORD): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_ISpecifyParticularPages;'} + {$EXTERNALSYM ISpecifyParticularPages} + ISpecifyParticularPages = interface(IUnknown) + ['{4C437B91-6E9E-11d1-A704-006097C4E476}'] + (*** ISpecifyParticularPages methods ***) + function GetPages(const guidWhatPages: TGUID; out pPages: PGUID): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMRebuild;'} + {$EXTERNALSYM IAMRebuild} + IAMRebuild = interface(IUnknown) + ['{02EF04DD-7580-11d1-BECE-00C04FB6E937}'] + (*** IAMRebuild methods ***) + function RebuildNow: HResult; stdcall; + end; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: amvideo.h + * + ***************************************************************************) + +const + IID_IDirectDrawVideo: TGUID = (D1:$36D39EB0;D2:$DD75;D3:$11CE;D4:($BF,$0E,$00,$AA,$00,$55,$59,$5A)); + {$EXTERNALSYM IID_IDirectDrawVideo} + IID_IQualProp: TGUID = (D1:$1BD0ECB0;D2:$F8E2;D3:$11CE;D4:($AA,$C6,$00,$20,$AF,$0B,$99,$A3)); + {$EXTERNALSYM IID_IQualProp} + IID_IFullScreenVideo: TGUID = (D1:$DD1D7110;D2:$7836;D3:$11CF;D4:($BF,$47,$00,$AA,$00,$55,$59,$5A)); + {$EXTERNALSYM IID_IFullScreenVideo} + IID_IFullScreenVideoEx: TGUID = (D1:$53479470;D2:$F1DD;D3:$11CF;D4:($BC,$42,$00,$AA,$00,$AC,$74,$F6)); + {$EXTERNALSYM IID_IFullScreenVideoEx} + IID_IBaseVideoMixer: TGUID = (D1:$61DED640;D2:$E912;D3:$11CE;D4:($A0,$99,$00,$AA,$00,$47,$9A,$58)); + {$EXTERNALSYM IID_IBaseVideoMixer} + +const + AMDDS_NONE = $00; // No use for DCI/DirectDraw + {$EXTERNALSYM AMDDS_NONE} + AMDDS_DCIPS = $01; // Use DCI primary surface + {$EXTERNALSYM AMDDS_DCIPS} + AMDDS_PS = $02; // Use DirectDraw primary + {$EXTERNALSYM AMDDS_PS} + AMDDS_RGBOVR = $04; // RGB overlay surfaces + {$EXTERNALSYM AMDDS_RGBOVR} + AMDDS_YUVOVR = $08; // YUV overlay surfaces + {$EXTERNALSYM AMDDS_YUVOVR} + AMDDS_RGBOFF = $10; // RGB offscreen surfaces + {$EXTERNALSYM AMDDS_RGBOFF} + AMDDS_YUVOFF = $20; // YUV offscreen surfaces + {$EXTERNALSYM AMDDS_YUVOFF} + AMDDS_RGBFLP = $40; // RGB flipping surfaces + {$EXTERNALSYM AMDDS_RGBFLP} + AMDDS_YUVFLP = $80; // YUV flipping surfaces + {$EXTERNALSYM AMDDS_YUVFLP} + AMDDS_ALL = $FF; // ALL the previous flags + {$EXTERNALSYM AMDDS_ALL} + AMDDS_DEFAULT = AMDDS_ALL; // Use all available surfaces + {$EXTERNALSYM AMDDS_DEFAULT} + + AMDDS_YUV = AMDDS_YUVOFF or AMDDS_YUVOVR or AMDDS_YUVFLP; + {$EXTERNALSYM AMDDS_YUV} + AMDDS_RGB = AMDDS_RGBOFF or AMDDS_RGBOVR or AMDDS_RGBFLP; + {$EXTERNALSYM AMDDS_RGB} + AMDDS_PRIMARY = AMDDS_DCIPS or AMDDS_PS; + {$EXTERNALSYM AMDDS_PRIMARY} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IDirectDrawVideo;'} + {$EXTERNALSYM IDirectDrawVideo} + IDirectDrawVideo = interface(IUnknown) + ['{36D39EB0-DD75-11CE-BF0E-00AA0055595A}'] + (*** IDirectDrawVideo methods ***) + function GetSwitches(out pSwitches: DWORD): HResult; stdcall; + function SetSwitches(pSwitches: DWORD): HResult; stdcall; + function GetCaps(out pCaps: TDDCaps): HResult; stdcall; + function GetEmulatedCaps(out pCaps: TDDCaps): HResult; stdcall; + function GetSurfaceDesc(out pSurfaceDesc: TDDSurfaceDesc): HResult; stdcall; + function GetFourCCCodes(out pCount, pCodes: DWORD): HResult; stdcall; + function SetDirectDraw(pDirectDraw: IDirectDraw): HResult; stdcall; + function GetDirectDraw(out ppDirectDraw: IDirectDraw): HResult; stdcall; + function GetSurfaceType(out pSurfaceType: DWORD): HResult; stdcall; + function SetDefault: HResult; stdcall; + function UseScanLine(UseScanLine: LongBool): HResult; stdcall; + function CanUseScanLine(var UseScanLine: LongBool): HResult; stdcall; + function UseOverlayStretch(UseOverlayStretch: LongBool): HResult; stdcall; + function CanUseOverlayStretch(var UseOverlayStretch: LongBool): HResult; + stdcall; + function UseWhenFullScreen(UseWhenFullScreen: LongBool): HResult; stdcall; + function WillUseFullScreen(var UseWhenFullScreen: LongBool): HResult; + stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IQualProp;'} + {$EXTERNALSYM IQualProp} + IQualProp = interface(IUnknown) + ['{1BD0ECB0-F8E2-11CE-AAC6-0020AF0B99A3}'] + (*** IQualProp methods ***) + // Compare these with the functions in class CGargle in gargle.h + function get_FramesDroppedInRenderer(var pcFrames: Integer): HResult; stdcall; + function get_FramesDrawn(out pcFrames: Integer): HResult; stdcall; + function get_AvgFrameRate(out piAvgFrameRate: Integer): HResult; stdcall; + function get_Jitter(out iJitter: Integer): HResult; stdcall; + function get_AvgSyncOffset(out piAvg: Integer): HResult; stdcall; + function get_DevSyncOffset(out piDev: Integer): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IFullScreenVideo;'} + {$EXTERNALSYM IFullScreenVideo} + IFullScreenVideo = interface(IUnknown) + ['{DD1D7110-7836-11CF-BF47-00AA0055595A}'] + (*** IFullScreenVideo methods ***) + function CountModes(out pModes: Longint): HResult; stdcall; + function GetModeInfo(Mode: Longint; out pWidth, pHeight, pDepth: Longint): + HResult; stdcall; + function GetCurrentMode(out pMode: Longint): HResult; stdcall; + function IsModeAvailable(Mode: Longint): HResult; stdcall; + function IsModeEnabled(Mode: Longint): HResult; stdcall; + function SetEnabled(Mode: Longint; bEnabled: Longint): HResult; stdcall; + function GetClipFactor(out pClipFactor: Longint): HResult; stdcall; + function SetClipFactor(ClipFactor: Longint): HResult; stdcall; + function SetMessageDrain(hwnd: HWND): HResult; stdcall; + function GetMessageDrain(out hwnd: HWND): HResult; stdcall; + function SetMonitor(Monitor: Longint): HResult; stdcall; + function GetMonitor(out Monitor: Longint): HResult; stdcall; + function HideOnDeactivate(Hide: LongBool): HResult; stdcall; + function IsHideOnDeactivate: HResult; stdcall; + function SetCaption(strCaption: TBStr): HResult; stdcall; + function GetCaption(out pstrCaption: TBStr): HResult; stdcall; + function SetDefault: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IFullScreenVideoEx;'} + {$EXTERNALSYM IFullScreenVideoEx} + IFullScreenVideoEx = interface(IFullScreenVideo) + ['{53479470-F1DD-11CF-BC42-00AA00AC74F6}'] + (*** IFullScreenVideoEx methods ***) + // IFullScreenVideoEx + function SetAcceleratorTable(hwnd: HWND; hAccel: HACCEL): HResult; stdcall; + function GetAcceleratorTable(var hwnd: HWND; var hAccel: HACCEL): HResult; + stdcall; + function KeepPixelAspectRatio(KeepAspect: LongBool): HResult; stdcall; + function IsKeepPixelAspectRatio(var pKeepAspect: LongBool): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBaseVideoMixer;'} + {$EXTERNALSYM IBaseVideoMixer} + IBaseVideoMixer = interface(IUnknown) + ['{61DED640-E912-11CE-A099-00AA00479A58}'] + (*** IBaseVideoMixer methods ***) + function SetLeadPin(iPin: Integer): HResult; stdcall; + function GetLeadPin(out iPin: Integer): HResult; stdcall; + function GetInputPinCount(out piPinCount: Integer): HResult; stdcall; + function IsUsingClock(out pbValue: Integer): HResult; stdcall; + function SetUsingClock(bValue: Integer): HResult; stdcall; + function GetClockPeriod(out pbValue: Integer): HResult; stdcall; + function SetClockPeriod(bValue: Integer): HResult; stdcall; + end; + +const + iPALETTE_COLORS = 256; // Maximum colours in palette + {$EXTERNALSYM iPALETTE_COLORS} + iEGA_COLORS = 16; // Number colours in EGA palette + {$EXTERNALSYM iEGA_COLORS} + iMASK_COLORS = 3; // Maximum three components + {$EXTERNALSYM iMASK_COLORS} + iTRUECOLOR = 16; // Minimum true colour device + {$EXTERNALSYM iTRUECOLOR} + iRED = 0; // Index position for RED mask + {$EXTERNALSYM iRED} + iGREEN = 1; // Index position for GREEN mask + {$EXTERNALSYM iGREEN} + iBLUE = 2; // Index position for BLUE mask + {$EXTERNALSYM iBLUE} + iPALETTE = 8; // Maximum colour depth using a palette + {$EXTERNALSYM iPALETTE} + iMAXBITS = 8; // Maximum bits per colour component + {$EXTERNALSYM iMAXBITS} + +type + // Used for true colour images that also have a palette + tag_TRUECOLORINFO = record + dwBitMasks: array[0..iMASK_COLORS-1] of DWORD; + bmiColors: array[0..iPALETTE_COLORS-1] of TRGBQuad; + end; + {$EXTERNALSYM tag_TRUECOLORINFO} + TRUECOLORINFO = tag_TRUECOLORINFO; + {$EXTERNALSYM TRUECOLORINFO} + TTrueColorInfo = tag_TRUECOLORINFO; + + PVideoInfoHeader = ^TVideoInfoHeader; + tagVIDEOINFOHEADER = record + rcSource: TRect; // The bit we really want to use + rcTarget: TRect; // Where the video should go + dwBitRate: DWORD; // Approximate bit data rate + dwBitErrorRate: DWORD; // Bit error rate for this stream + AvgTimePerFrame: TReferenceTime; // Average time per frame (100ns units) + + bmiHeader: TBitmapInfoHeader; + end; + {$EXTERNALSYM tagVIDEOINFOHEADER} + VIDEOINFOHEADER = tagVIDEOINFOHEADER; + {$EXTERNALSYM VIDEOINFOHEADER} + TVideoInfoHeader = tagVIDEOINFOHEADER; + +// make sure the pbmi is initialized before using these macros +{function TRUECOLOR(pbmi: PBitmapInfo): Pointer; +function COLORS(pbmi: PBitmapInfo): Pointer; +function BITMASKS(pbmi: PBitmapInfo): Pointer; +{ +#define TRUECOLOR(pbmi) ((TRUECOLORINFO *)(((LPBYTE)&((pbmi)->bmiHeader)) \ + + (pbmi)->bmiHeader.biSize)) +#define COLORS(pbmi) ((RGBQUAD *)(((LPBYTE)&((pbmi)->bmiHeader)) \ + + (pbmi)->bmiHeader.biSize)) +#define BITMASKS(pbmi) ((DWORD *)(((LPBYTE)&((pbmi)->bmiHeader)) \ + + (pbmi)->bmiHeader.biSize)) + } +// All the image based filters use this to communicate their media types. It's +// centred principally around the BITMAPINFO. This structure always contains a +// BITMAPINFOHEADER followed by a number of other fields depending on what the +// BITMAPINFOHEADER contains. If it contains details of a palettised format it +// will be followed by one or more RGBQUADs defining the palette. If it holds +// details of a true colour format then it may be followed by a set of three +// DWORD bit masks that specify where the RGB data can be found in the image +// (For more information regarding BITMAPINFOs see the Win32 documentation) + +// The rcSource and rcTarget fields are not for use by filters supplying the +// data. The destination (target) rectangle should be set to all zeroes. The +// source may also be zero filled or set with the dimensions of the video. So +// if the video is 352x288 pixels then set it to (0,0,352,288). These fields +// are mainly used by downstream filters that want to ask the source filter +// to place the image in a different position in an output buffer. So when +// using for example the primary surface the video renderer may ask a filter +// to place the video images in a destination position of (100,100,452,388) +// on the display since that's where the window is positioned on the display + +// !!! WARNING !!! +// DO NOT use this structure unless you are sure that the BITMAPINFOHEADER +// has a normal biSize == sizeof(BITMAPINFOHEADER) ! +// !!! WARNING !!! + +type + PVideoInfo = ^TVideoInfo; + tagVIDEOINFO = record + rcSource: TRect; // The bit we really want to use + rcTarget: TRect; // Where the video should go + dwBitRate: DWORD; // Approximate bit data rate + dwBitErrorRate: DWORD; // Bit error rate for this stream + AvgTimePerFrame: TReferenceTime; // Average time per frame (100ns units) + + bmiHeader: TBitmapInfoHeader; + + case Integer of + 0: ( + bmiColors: array[0..iPALETTE_COLORS-1] of TRGBQuad // Colour palette + ); + 1: ( + dwBitMasks: array[0..iMASK_COLORS-1] of DWORD // True colour masks + ); + 2: ( + TrueColorInfo: TTrueColorInfo // Both of the above + ); + end; + {$EXTERNALSYM tagVIDEOINFO} + VIDEOINFO = tagVIDEOINFO; + {$EXTERNALSYM VIDEOINFO} + TVideoInfo = tagVIDEOINFO; + +// These macros define some standard bitmap format sizes + +const + SIZE_EGA_PALETTE = iEGA_COLORS * SizeOf(TRGBQuad); + {$EXTERNALSYM SIZE_EGA_PALETTE} + SIZE_PALETTE = iPALETTE_COLORS * SizeOf(TRGBQuad); + {$EXTERNALSYM SIZE_PALETTE} + SIZE_MASKS = iMASK_COLORS * SizeOf(DWORD); + {$EXTERNALSYM SIZE_MASKS} + + SIZE_PREHEADER = 48; // offset TVideoInfoHeader.bmiHeader + {$EXTERNALSYM SIZE_PREHEADER} + SIZE_VIDEOHEADER = SizeOf(TVideoInfoHeader); + {$EXTERNALSYM SIZE_VIDEOHEADER} + +// !!! for abnormal biSizes +// #define SIZE_VIDEOHEADER(pbmi) ((pbmi)->bmiHeader.biSize + SIZE_PREHEADER) + +// DIBSIZE calculates the number of bytes required by an image +{ +function WIDTHBYTES(bits: Integer): DWORD; +function DIBWIDTHBYTES(const bhi: TBitmapInfoHeader): DWORD; +function _DIBSIZE(const bmi: TBitmapInfoHeader): DWORD; +function DIBSIZE(const bmi: TBitmapInfoHeader): DWORD; +{ +#define WIDTHBYTES(bits) ((DWORD)(((bits)+31) & (~31)) / 8) +#define DIBWIDTHBYTES(bi) (DWORD)WIDTHBYTES((DWORD)(bi).biWidth * (DWORD)(bi).biBitCount) +#define _DIBSIZE(bi) (DIBWIDTHBYTES(bi) * (DWORD)(bi).biHeight) +#define DIBSIZE(bi) ((bi).biHeight < 0 ? (-1)*(_DIBSIZE(bi)) : _DIBSIZE(bi)) +} +// This compares the bit masks between two VIDEOINFOHEADERs +{ +function BIT_MASKS_MATCH(const bmi1, bmi2: TBitmapInfo): Boolean; +{ +#define BIT_MASKS_MATCH(pbmi1,pbmi2) \ + (((pbmi1)->dwBitMasks[iRED] == (pbmi2)->dwBitMasks[iRED]) && \ + ((pbmi1)->dwBitMasks[iGREEN] == (pbmi2)->dwBitMasks[iGREEN]) && \ + ((pbmi1)->dwBitMasks[iBLUE] == (pbmi2)->dwBitMasks[iBLUE])) +} +// These zero fill different parts of the VIDEOINFOHEADER structure + +// Only use these macros for pbmi's with a normal BITMAPINFOHEADER biSize +{procedure RESET_MASKS(var bmi: TBitmapInfo); +procedure RESET_HEADER(var bmi: TBitmapInfo); +procedure RESET_PALETTE(var bmi: TBitmapInfo); +{ +#define RESET_MASKS(pbmi) (ZeroMemory((PVOID)(pbmi)->dwBitFields,SIZE_MASKS)) +#define RESET_HEADER(pbmi) (ZeroMemory((PVOID)(pbmi),SIZE_VIDEOHEADER)) +#define RESET_PALETTE(pbmi) (ZeroMemory((PVOID)(pbmi)->bmiColors,SIZE_PALETTE)); +} +{ +// !!! This is the right way to do it, but may break existing code +#define RESET_MASKS(pbmi) (ZeroMemory((PVOID)(((LPBYTE)(pbmi)->bmiHeader) + \ + (pbmi)->bmiHeader.biSize,SIZE_MASKS))) +#define RESET_HEADER(pbmi) (ZeroMemory((PVOID)(pbmi), SIZE_PREHEADER + \ + sizeof(BITMAPINFOHEADER))) +#define RESET_PALETTE(pbmi) (ZeroMemory((PVOID)(((LPBYTE)(pbmi)->bmiHeader) + \ + (pbmi)->bmiHeader.biSize,SIZE_PALETTE)) +} + +// Other (hopefully) useful bits and bobs +{ +#define PALETTISED(pbmi) ((pbmi)->bmiHeader.biBitCount <= iPALETTE) +#define PALETTE_ENTRIES(pbmi) ((DWORD) 1 << (pbmi)->bmiHeader.biBitCount) + +// Returns the address of the BITMAPINFOHEADER from the VIDEOINFOHEADER +#define HEADER(pVideoInfo) (&(((VIDEOINFOHEADER *) (pVideoInfo))->bmiHeader)) + } + +// MPEG variant - includes a DWORD length followed by the +// video sequence header after the video header. +// +// The sequence header includes the sequence header start code and the +// quantization matrices associated with the first sequence header in the +// stream so is a maximum of 140 bytes long. +type + PMPEG1VideoInfo = ^TMPEG1VideoInfo; + tagMPEG1VIDEOINFO = record + hdr: TVideoInfoHeader; // Compatible with VIDEOINFO + dwStartTimeCode: DWORD; // 25-bit Group of pictures time code + // at start of data + cbSequenceHeader: DWORD; // Length in bytes of bSequenceHeader + bSequenceHeader: array[0..0] of Byte; // Sequence header including + // quantization matrices if any + end; + {$EXTERNALSYM tagMPEG1VIDEOINFO} + MPEG1VIDEOINFO = tagMPEG1VIDEOINFO; + {$EXTERNALSYM MPEG1VIDEOINFO} + TMPEG1VideoInfo = tagMPEG1VIDEOINFO; + +const + MAX_SIZE_MPEG1_SEQUENCE_INFO = 140; + {$EXTERNALSYM MAX_SIZE_MPEG1_SEQUENCE_INFO} +{ +#define SIZE_MPEG1VIDEOINFO(pv) (FIELD_OFFSET(MPEG1VIDEOINFO, bSequenceHeader[0]) + (pv)->cbSequenceHeader) +#define MPEG1_SEQUENCE_INFO(pv) ((const BYTE *)(pv)->bSequenceHeader) +} + +// Analog video variant - Use this when the format is FORMAT_AnalogVideo +// +// rcSource defines the portion of the active video signal to use +// rcTarget defines the destination rectangle +// both of the above are relative to the dwActiveWidth and dwActiveHeight fields +// dwActiveWidth is currently set to 720 for all formats (but could change for HDTV) +// dwActiveHeight is 483 for NTSC and 575 for PAL/SECAM (but could change for HDTV) +type + tagAnalogVideoInfo = record + rcSource: TRect; // Width max is 720, height varies w/ TransmissionS + rcTarget: TRect; // Where the video should go + dwBitRate: DWORD; // Always 720 (CCIR-601 active samples per line) + dwBitErrorRate: DWORD; // 483 for NTSC, 575 for PAL/SECAM + AvgTimePerFrame: TReferenceTime; // Normal ActiveMovie units (100 nS) + end; + {$EXTERNALSYM tagAnalogVideoInfo} + ANALOGVIDEOINFO = tagAnalogVideoInfo; + {$EXTERNALSYM ANALOGVIDEOINFO} + TAnalogVideoInfo = tagAnalogVideoInfo; + + +// +// AM_KSPROPSETID_FrameStep property set definitions +// + + AM_PROPERTY_FRAMESTEP = ( + {$IFNDEF COMPILER6_UP} + AM_PROPERTY_FRAMESTEP_INVALID_O, + // Step + AM_PROPERTY_FRAMESTEP_STEP, + AM_PROPERTY_FRAMESTEP_CANCEL, + // S_OK for these 2 means we can - S_FALSE if we can't + AM_PROPERTY_FRAMESTEP_CANSTEP, + AM_PROPERTY_FRAMESTEP_CANSTEPMULTIPLE + {$ELSE} + // Step + AM_PROPERTY_FRAMESTEP_STEP = 1, + AM_PROPERTY_FRAMESTEP_CANCEL = 2 , + // S_OK for these 2 means we can - S_FALSE if we can't + AM_PROPERTY_FRAMESTEP_CANSTEP = 3, + AM_PROPERTY_FRAMESTEP_CANSTEPMULTIPLE = 4 + {$ENDIF} + ); + {$EXTERNALSYM AM_PROPERTY_FRAMESTEP} + TAMPropertyFramesStep = AM_PROPERTY_FRAMESTEP; + + + _AM_FRAMESTEP_STEP = record + // 1 means step 1 frame forward + // 0 is invalid + // n (n > 1) means skip n - 1 frames and show the nth + dwFramesToStep: DWORD; + end; + {$EXTERNALSYM _AM_FRAMESTEP_STEP} + AM_FRAMESTEP_STEP = _AM_FRAMESTEP_STEP; + {$EXTERNALSYM AM_FRAMESTEP_STEP} + TAMFramestepStep = _AM_FRAMESTEP_STEP; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: amaudio.h + * + ***************************************************************************) + +const + IID_IAMDirectSound: TGUID = (D1:$546F4260;D2:$D53E;D3:$11CF;D4:($B3,$F0,$00,$AA,$00,$37,$61,$C5)); + {$EXTERNALSYM IID_IAMDirectSound} + +// This is the interface the audio renderer supports to give the application +// access to the direct sound object and buffers it is using, to allow the +// application to use things like the 3D features of Direct Sound for the +// soundtrack of a movie being played with Active Movie + +// be nice to our friends in C +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMDirectSound;'} + {$EXTERNALSYM IAMDirectSound} + IAMDirectSound = interface(IUnknown) + ['{546F4260-D53E-11CF-B3F0-00AA003761C5}'] + (*** IAMDirectSound methods ***) + function GetDirectSoundInterface(out lplpds: IDirectSound): HResult; + stdcall; + function GetPrimaryBufferInterface(out lplpdsb: IDirectSoundBuffer): + HResult; stdcall; + function GetSecondaryBufferInterface(out lplpdsb: IDirectSoundBuffer): + HResult; stdcall; + function ReleaseDirectSoundInterface(lpds: IDirectSound): HResult; stdcall; + function ReleasePrimaryBufferInterface(lpdsb: IDirectSoundBuffer): HResult; + stdcall; + function ReleaseSecondaryBufferInterface(lpdsb: IDirectSoundBuffer): + HResult; stdcall; + function SetFocusWindow(hwnd: HWND; b: BOOL): HResult; stdcall; + function GetFocusWindow(var hwnd: HWND; var b: BOOL): HResult; stdcall; + end; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: vptype.h + * + ***************************************************************************) + +type + // enum to specify the criterion, which the vpmixer is supposed to use + // in order to select the video format + _AMVP_SELECT_FORMAT_BY = ( + AMVP_DO_NOT_CARE, + AMVP_BEST_BANDWIDTH, + AMVP_INPUT_SAME_AS_OUTPUT + ); + {$EXTERNALSYM _AMVP_SELECT_FORMAT_BY} + AMVP_SELECT_FORMAT_BY = _AMVP_SELECT_FORMAT_BY; + {$EXTERNALSYM AMVP_SELECT_FORMAT_BY} + TAMVPSelectFormatBy = AMVP_SELECT_FORMAT_BY; + + // enum to specify the various mode + _AMVP_MODE = ( + AMVP_MODE_WEAVE, + AMVP_MODE_BOBINTERLEAVED, + AMVP_MODE_BOBNONINTERLEAVED, + AMVP_MODE_SKIPEVEN, + AMVP_MODE_SKIPODD + ); + {$EXTERNALSYM _AMVP_MODE} + AMVP_MODE = _AMVP_MODE; + {$EXTERNALSYM AMVP_MODE} + TAMVPMode = AMVP_MODE; + + // struct to specify the width and height. The context could be anything + // such as scaling cropping etc. + PAMVPSize = ^TAMVPSize; + _AMVPSIZE = record + dwWidth : DWORD; // the width + dwHeight : DWORD; // the height + end; + {$EXTERNALSYM _AMVPSIZE} + AMVPSIZE = _AMVPSIZE; + {$EXTERNALSYM AMVPSIZE} + LPAMVPSIZE = ^AMVPSIZE; + {$EXTERNALSYM LPAMVPSIZE} + TAMVPSize = _AMVPSIZE; + + // struct to specify the dimensional characteristics of the input stream + PAMVPDimInfo = ^TAMVPDimInfo; + _AMVPDIMINFO = record + {$EXTERNALSYM _AMVPDIMINFO} + dwFieldWidth : DWORD; // Field height of the data + dwFieldHeight : DWORD; // Field width of the data + dwVBIWidth : DWORD; // Width of the VBI data + dwVBIHeight : DWORD; // Height of the VBI data + rcValidRegion : TRect; // The vaild rectangle, used for cropping + end; + AMVPDIMINFO = _AMVPDIMINFO; + {$EXTERNALSYM AMVPDIMINFO} + LPAMVPDIMINFO = ^AMVPDIMINFO; + {$EXTERNALSYM LPAMVPDIMINFO} + TAMVPDimInfo = _AMVPDIMINFO; + + // struct to specify the various data specific characteristics of the input stream + PAMVPDataInfo = ^TAMVPDataInfo; + _AMVPDATAINFO = record + dwSize : DWORD; // Size of the struct + dwMicrosecondsPerField : DWORD; // Time taken by each field + amvpDimInfo : TAMVPDIMInfo; // Dimensional Information + dwPictAspectRatioX : DWORD; // X dimension of Picture Aspect Ratio + dwPictAspectRatioY : DWORD; // Y dimension of Picture Aspect Ratio + bEnableDoubleClock : BOOL; // Videoport should enable double clocking + bEnableVACT : BOOL; // Videoport should use an external VACT signal + bDataIsInterlaced : BOOL; // Indicates that the signal is interlaced + lHalfLinesOdd : Longint; // number of halflines in the odd field + bFieldPolarityInverted : BOOL; // Device inverts the polarity by default + dwNumLinesInVREF : DWORD; // Number of lines of data in VREF + lHalfLinesEven : Longint; // number of halflines in the even field + dwReserved1 : DWORD; // Reserved for future use + end; + {$EXTERNALSYM _AMVPDATAINFO} + AMVPDATAINFO = _AMVPDATAINFO; + {$EXTERNALSYM AMVPDATAINFO} + LPAMVPDATAINFO = ^AMVPDATAINFO; + {$EXTERNALSYM LPAMVPDATAINFO} + TAMVPDataInfo = _AMVPDATAINFO; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: vpconfig.h + * + ***************************************************************************) + +const + IID_IVPConfig: TGUID = (D1:$BC29A660;D2:$30E3;D3:$11D0;D4:($9E,$69,$00,$C0,$4F,$D7,$C1,$5B)); + {$EXTERNALSYM IID_IVPConfig} + IID_IVPVBIConfig: TGUID = (D1:$EC529B00;D2:$1A1F;D3:$11D1;D4:($BA,$D9,$00,$60,$97,$44,$11,$1A)); + {$EXTERNALSYM IID_IVPVBIConfig} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IVPBaseConfig;'} + {$EXTERNALSYM IVPBaseConfig} + IVPBaseConfig = interface(IUnknown) + (*** IVPBaseConfig methods ***) + // gets the various connection information structures (guid, portwidth) + // in an array of structures. If the pointer to the array is NULL, first + // parameter returns the total number of formats supported. + function GetConnectInfo(var pdwNumConnectInfo: PDWORD; + var pddVPConnectInfo: PDDVideoPortConnect): HResult; stdcall; + + // sets the connection entry chosen (0, 1, .. ,(dwNumProposedEntries-1)) + function SetConnectInfo(dwChosenEntry: DWORD): HResult; stdcall; + + // gets various data parameters, includes dimensionnal info + function GetVPDataInfo(var pamvpDataInfo: PAMVPDataInfo): HResult; stdcall; + + // retrives maximum pixels per second rate expected for a given + // format and a given scaling factor. If decoder does not support + // those scaling factors, then it gives the rate and the nearest + // scaling factors. + function GetMaxPixelRate(var pamvpSize: PAMVPSize; + out pdwMaxPixelsPerSecond: PDWORD): HResult; stdcall; + + // informs the callee of the videoformats supported by the videoport + function InformVPInputFormats(dwNumFormats: DWORD; + pTDDPixelFormats: PDDPixelFormat): HResult; stdcall; + + // gets the various formats supported by the decoder in an array + // of structures. If the pointer to the array is NULL, first parameter + // returns the total number of formats supported. + function GetVideoFormats(var pdwNumFormats: PDWORD; + var pTDDPixelFormats: PDDPixelFormat): HResult; stdcall; + + // sets the format entry chosen (0, 1, .. ,(dwNumProposedEntries-1)) + function SetVideoFormat(dwChosenEntry: DWORD): HResult; stdcall; + + // asks the decoder to treat even fields like odd fields and visa versa + function SetInvertPolarity: HResult; stdcall; + + // the mixer uses this function to determine if the callee wants + // the vpmixer to use its overlay surface and if so to get a pointer to it + function GetOverlaySurface(out ppddOverlaySurface: IDirectDrawSurface): + HResult; stdcall; + + // sets the direct draw kernel handle + function SetDirectDrawKernelHandle(dwDDKernelHandle: THandle): HResult; + stdcall; + + // sets the video port id + function SetVideoPortID(dwVideoPortID: DWORD): HResult; stdcall; + + // sets the direct draw surface kernel handle + function SetDDSurfaceKernelHandles(cHandles: DWORD; + var rgDDKernelHandles: THandle): HResult; stdcall; + + // Tells driver about surface created on its behalf by ovmixer/vbisurf and + // returned from videoport/ddraw. Should always return NOERROR or E_NOIMPL. + // dwPitch is the pitch of the surface (distance in pixels between the start + // pixels of two consecutive lines of the surface). (dwXOrigin, dwYOrigin) + // are the (X, Y) coordinates of the pixel at which valid data starts. + function SetSurfaceParameters(dwPitch, dwXOrigin, dwYOrigin: DWORD): + HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVPConfig;'} + {$EXTERNALSYM IVPConfig} + IVPConfig = interface(IVPBaseConfig) + ['{BC29A660-30E3-11D0-9E69-00C04FD7C15B}'] + (*** IVPConfig methods ***) + // the mixer uses this function to determine if the callee wants + // the mixer to decimate VIDEO data at its own descrition + function IsVPDecimationAllowed(out pbIsDecimationAllowed: PBOOL): HResult; + stdcall; + + // sets the scaling factors. If decoder does not support these, + // then it sets the values to the nearest factors it can support + function SetScalingFactors(pamvpSize: PAMVPSize): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVPVBIConfig;'} + {$EXTERNALSYM IVPVBIConfig} + IVPVBIConfig = interface(IVPBaseConfig) + ['{EC529B00-1A1F-11D1-BAD9-00609744111A}'] + (*** IVPVBIConfig methods ***) + end; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: vpnotify.h + * + ***************************************************************************) + +const + IID_IVPNotify: TGUID = (D1:$C76794A1;D2:$D6C5;D3:$11D0;D4:($9E,$69,$00,$C0,$4F,$D7,$C1,$5B)); + {$EXTERNALSYM IID_IVPNotify} + IID_IVPVBINotify: TGUID = (D1:$EC529B01;D2:$1A1F;D3:$11D1;D4:($BA,$D9,$00,$60,$97,$44,$11,$1A)); + {$EXTERNALSYM IID_IVPVBINotify} + IID_IVPNotify2: TGUID = (D1:$ebf47183;D2:$8764;D3:$11d1;D4:($9e,$69,$00,$c0,$4f,$d7,$c1,$5b)); + {$EXTERNALSYM IID_IVPNotify2} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IVPBaseNotify;'} + {$EXTERNALSYM IVPBaseNotify} + IVPBaseNotify = interface(IUnknown) + (*** IVPBaseNotify methods ***) + // this function initializes the reconnection to the decoder. + function RenegotiateVPParameters: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVPNotify;'} + {$EXTERNALSYM IVPNotify} + IVPNotify = interface(IVPBaseNotify) + ['{C76794A1-D6C5-11D0-9E69-00C04FD7C15B}'] + (*** IVPNotify methods ***) + // function to set the mode (bob, weave etc) + function SetDeinterlaceMode(mode: TAMVPMode): HResult; stdcall; + // function to get the mode (bob, weave etc) + function GetDeinterlaceMode(out pMode: TAMVPMode): HResult; stdcall; + end; + +// 4 functions have been removed from dxmedia!! + {$HPPEMIT 'typedef System::DelphiInterface _di_IVPNotify2;'} + {$EXTERNALSYM IVPNotify2} + IVPNotify2 = interface(IVPNotify) + ['{EBF47183-8764-11d1-9E69-00C04FD7C15B}'] + (*** IVPNotify2 methods ***) + // function to set the mode (bob, weave etc) + function SetVPSyncMaster(bVPSyncMaster: BOOL): HResult; stdcall; + // function to get the mode (bob, weave etc) + function GetVPSyncMaster(OUT pbVPSyncMaster: BOOL): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVPVBINotify;'} + {$EXTERNALSYM IVPVBINotify} + IVPVBINotify = interface(IVPBaseNotify) + ['{EC529B01-1A1F-11D1-BAD9-00609744111A}'] + (*** IVPVBINotify methods ***) + end; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: mpegtype.h + * + ***************************************************************************) + +const + IID_IMpegAudioDecoder: TGUID = (D1:$B45DD570;D2:$3C77;D3:$11D1;D4:($AB,$E1,$00,$A0,$C9,$05,$F3,$75)); + {$EXTERNALSYM IID_IMpegAudioDecoder} + +type +// +// AM_MPEGSYSTEMTYPE defines the format block contents for +// data of type MEDIATYPE_MPEG1System when the format +// block GUID is FORMAT_MPEG1System +// +// The format block consists of elements of type +// AM_MPEGSYSTEMTYPE up to the length of the format block +// Each format block is 8-byte aligned from the start of +// the format block +// + + tagAM_MPEGSTREAMTYPE = record + dwStreamId: DWORD; // Stream id of stream to process + dwReserved: DWORD; // 8-byte alignment + mt: TAMMediaType; // Type for substream - pbFormat is NULL + bFormat: array[0..0] of Byte; // Format data + end; + {$EXTERNALSYM tagAM_MPEGSTREAMTYPE} + AM_MPEGSTREAMTYPE = tagAM_MPEGSTREAMTYPE; + {$EXTERNALSYM AM_MPEGSTREAMTYPE} + TAMMPEGStreamType = tagAM_MPEGSTREAMTYPE; + + tagAM_MPEGSYSTEMTYPE = record + dwBitRate: DWORD; // Bits per second + cStreams: DWORD; // Number of streams + Streams: array[0..0] of TAMMPEGStreamType; + end; + {$EXTERNALSYM tagAM_MPEGSYSTEMTYPE} + AM_MPEGSYSTEMTYPE = tagAM_MPEGSYSTEMTYPE; + {$EXTERNALSYM AM_MPEGSYSTEMTYPE} + TAMMPEGSystemType = tagAM_MPEGSYSTEMTYPE; +{ +// +// Helper macros for AM_MPEGSTREAMTYPE +// +#define AM_MPEGSTREAMTYPE_ELEMENTLENGTH(pStreamType) \ + FIELD_OFFSET(AM_MPEGSTREAMTYPE, bFormat[(pStreamType)->mt.cbFormat]) +#define AM_MPEGSTREAMTYPE_NEXT(pStreamType) \ + ((AM_MPEGSTREAMTYPE *)((PBYTE)(pStreamType) + \ + ((AM_MPEGSTREAMTYPE_ELEMENTLENGTH(pStreamType) + 7) & ~7))) + } +// +// IMpegAudioDecoder +// + +// Values for DualMode +const + AM_MPEG_AUDIO_DUAL_MERGE = 0; + {$EXTERNALSYM AM_MPEG_AUDIO_DUAL_MERGE} + AM_MPEG_AUDIO_DUAL_LEFT = 1; + {$EXTERNALSYM AM_MPEG_AUDIO_DUAL_LEFT} + AM_MPEG_AUDIO_DUAL_RIGHT = 2; + {$EXTERNALSYM AM_MPEG_AUDIO_DUAL_RIGHT} + +type +// +// +// Microsoft MPEG audio WAV definition +// +(* MPEG-1 audio wave format (audio layer only). (0x0050) *) + + MPEG1WAVEFORMAT = record + wfx: TWaveFormatEx; + fwHeadLayer: Word; + dwHeadBitrate: DWORD; + fwHeadMode: Word; + fwHeadModeExt: Word; + wHeadEmphasis: Word; + fwHeadFlags: Word; + dwPTSLow: DWORD; + dwPTSHigh: DWORD; + end; + {$EXTERNALSYM MPEG1WAVEFORMAT} + TMPEG1WaveFormat = MPEG1WAVEFORMAT; + +const + ACM_MPEG_LAYER1 = $0001; + {$EXTERNALSYM ACM_MPEG_LAYER1} + ACM_MPEG_LAYER2 = $0002; + {$EXTERNALSYM ACM_MPEG_LAYER2} + ACM_MPEG_LAYER3 = $0004; + {$EXTERNALSYM ACM_MPEG_LAYER3} + ACM_MPEG_STEREO = $0001; + {$EXTERNALSYM ACM_MPEG_STEREO} + ACM_MPEG_JOINTSTEREO = $0002; + {$EXTERNALSYM ACM_MPEG_JOINTSTEREO} + ACM_MPEG_DUALCHANNEL = $0004; + {$EXTERNALSYM ACM_MPEG_DUALCHANNEL} + ACM_MPEG_SINGLECHANNEL = $0008; + {$EXTERNALSYM ACM_MPEG_SINGLECHANNEL} + ACM_MPEG_PRIVATEBIT = $0001; + {$EXTERNALSYM ACM_MPEG_PRIVATEBIT} + ACM_MPEG_COPYRIGHT = $0002; + {$EXTERNALSYM ACM_MPEG_COPYRIGHT} + ACM_MPEG_ORIGINALHOME = $0004; + {$EXTERNALSYM ACM_MPEG_ORIGINALHOME} + ACM_MPEG_PROTECTIONBIT = $0008; + {$EXTERNALSYM ACM_MPEG_PROTECTIONBIT} + ACM_MPEG_ID_MPEG1 = $0010; + {$EXTERNALSYM ACM_MPEG_ID_MPEG1} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IMpegAudioDecoder;'} + {$EXTERNALSYM IMpegAudioDecoder} + IMpegAudioDecoder = interface(IUnknown) + ['{B45DD570-3C77-11D1-ABE1-00A0C905F375}'] + (*** IMpegAudioDecoder methods ***) + function get_FrequencyDivider(out pDivider: LongWord): HResult; stdcall; + function put_FrequencyDivider(Divider: LongWord): HResult; stdcall; + function get_DecoderAccuracy(out pAccuracy: LongWord): HResult; stdcall; + function put_DecoderAccuracy(Accuracy: LongWord): HResult; stdcall; + function get_Stereo(out pStereo: LongWord): HResult; stdcall; + function put_Stereo(Stereo: LongWord): HResult; stdcall; + function get_DecoderWordSize(out pWordSize: LongWord): HResult; stdcall; + function put_DecoderWordSize(WordSize: LongWord): HResult; stdcall; + function get_IntegerDecode(out pIntDecode: LongWord): HResult; stdcall; + function put_IntegerDecode(IntDecode: LongWord): HResult; stdcall; + function get_DualMode(out pIntDecode: LongWord): HResult; stdcall; + function put_DualMode(IntDecode: LongWord): HResult; stdcall; + function get_AudioFormat(out lpFmt: TMPEG1WaveFormat): HResult; stdcall; + end; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: il21dec.h + * + ***************************************************************************) +// Line 21 Decoder related definitions and interfaces for ActiveMovie + +const + IID_IAMLine21Decoder: TGUID = (D1:$6E8D4A21;D2:$310C;D3:$11D0;D4:($B7,$9A,$00,$AA,$00,$37,$67,$A7)); + {$EXTERNALSYM IID_IAMLine21Decoder} + +type +// +// Some enum data types used as line 21 decoder params by the interface +// + _AM_LINE21_CCLEVEL = ( // should we use TC1, TC2 in stead? + AM_L21_CCLEVEL_TC2 + ); + {$EXTERNALSYM _AM_LINE21_CCLEVEL} + AM_LINE21_CCLEVEL = _AM_LINE21_CCLEVEL; + {$EXTERNALSYM AM_LINE21_CCLEVEL} + PAM_LINE21_CCLEVEL = ^AM_LINE21_CCLEVEL; + {$EXTERNALSYM PAM_LINE21_CCLEVEL} + TAMLine21CCLevel = AM_LINE21_CCLEVEL; + + _AM_LINE21_CCSERVICE = ( + {$IFNDEF COMPILER6_UP} + AM_L21_CCSERVICE_None, + AM_L21_CCSERVICE_Caption1, + AM_L21_CCSERVICE_Caption2, + AM_L21_CCSERVICE_Text1, + AM_L21_CCSERVICE_Text2, + AM_L21_CCSERVICE_XDS, + AM_L21_CCSERVICE_INVALID_6, + AM_L21_CCSERVICE_INVALID_7, + AM_L21_CCSERVICE_INVALID_8, + AM_L21_CCSERVICE_INVALID_9, + AM_L21_CCSERVICE_DefChannel, + AM_L21_CCSERVICE_Invalid + {$ELSE} + AM_L21_CCSERVICE_None = 0, + AM_L21_CCSERVICE_Caption1 = 1, + AM_L21_CCSERVICE_Caption2 = 2, + AM_L21_CCSERVICE_Text1 = 3, + AM_L21_CCSERVICE_Text2 = 4, + AM_L21_CCSERVICE_XDS = 5, + AM_L21_CCSERVICE_DefChannel = 10, + AM_L21_CCSERVICE_Invalid = 11 + {$ENDIF} + ); + {$EXTERNALSYM _AM_LINE21_CCSERVICE} + AM_LINE21_CCSERVICE = _AM_LINE21_CCSERVICE; + {$EXTERNALSYM AM_LINE21_CCSERVICE} + PAM_LINE21_CCSERVICE = ^AM_LINE21_CCSERVICE; + {$EXTERNALSYM PAM_LINE21_CCSERVICE} + TAMLine21CCService = AM_LINE21_CCSERVICE; + + _AM_LINE21_CCSTATE = ( + AM_L21_CCSTATE_Off, + AM_L21_CCSTATE_On + ); + {$EXTERNALSYM _AM_LINE21_CCSTATE} + AM_LINE21_CCSTATE = _AM_LINE21_CCSTATE; + {$EXTERNALSYM AM_LINE21_CCSTATE} + PAM_LINE21_CCSTATE = ^AM_LINE21_CCSTATE; + {$EXTERNALSYM PAM_LINE21_CCSTATE} + TAMLine21CCState = AM_LINE21_CCSTATE; + + _AM_LINE21_CCSTYLE = ( + AM_L21_CCSTYLE_None, + AM_L21_CCSTYLE_PopOn, + AM_L21_CCSTYLE_PaintOn, + AM_L21_CCSTYLE_RollUp + ); + {$EXTERNALSYM _AM_LINE21_CCSTYLE} + AM_LINE21_CCSTYLE = _AM_LINE21_CCSTYLE; + {$EXTERNALSYM AM_LINE21_CCSTYLE} + PAM_LINE21_CCSTYLE = ^AM_LINE21_CCSTYLE; + {$EXTERNALSYM PAM_LINE21_CCSTYLE} + TAMLine21CCStyle = AM_LINE21_CCSTYLE; + + _AM_LINE21_DRAWBGMODE = ( + AM_L21_DRAWBGMODE_Opaque, + AM_L21_DRAWBGMODE_Transparent + ); + {$EXTERNALSYM _AM_LINE21_DRAWBGMODE} + AM_LINE21_DRAWBGMODE = _AM_LINE21_DRAWBGMODE; + {$EXTERNALSYM AM_LINE21_DRAWBGMODE} + PAM_LINE21_DRAWBGMODE = ^AM_LINE21_DRAWBGMODE; + {$EXTERNALSYM PAM_LINE21_DRAWBGMODE} + TAMLine21DrawBGMode = AM_LINE21_DRAWBGMODE; + +// +// Line 21 Decoder standard COM interface +// + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMLine21Decoder;'} + {$EXTERNALSYM IAMLine21Decoder} + IAMLine21Decoder = interface(IUnknown) + ['{6E8D4A21-310C-11D0-B79A-00AA003767A7}'] + (*** IAMLine21Decoder methods ***) + // + // Decoder options to be used by apps + // + + // What is the decoder's level + function GetDecoderLevel(var lpLevel: TAMLine21CCLevel): HResult; stdcall; + // supported level value is AM_L21Level_TC2 only + // skipping the SetDecoderLevel( ) + + // Which of the services is being currently used + function GetCurrentService(var lpService: TAMLine21CCService): HResult; + stdcall; + function SetCurrentService(Service: TAMLine21CCService): HResult; + stdcall; + // supported service values are AM_L21Service_Caption1, + // AM_L21Service_Caption2, AM_L21Service_Text1, AM_L21Service_Text2, + // AM_L21Service_XDS, AM_L21Service_None) + + // Query/Set the service state (On/Off) + // supported state values are AM_L21State_On and AM_L21State_Off + function GetServiceState(var lpState: TAMLine21CCState): HResult; + stdcall; + function SetServiceState(State: TAMLine21CCState): HResult; + stdcall; + + // + // Output options to be used by downstream filters + // + + // What size, bitdepth etc should the output video be + function GetOutputFormat(lpbmih: PBitmapInfoHeader): HResult; stdcall; + // GetOutputFormat() method, if successful, returns + // 1. S_FALSE if no output format has so far been defined by downstream filters + // 2. S_OK if an output format has already been defined by downstream filters + function SetOutputFormat(lpbmih: PBitmapInfoHeader): HResult; + stdcall; + + // Specify physical color to be used in colorkeying the background + // for overlay mixing + function GetBackgroundColor(var pdwPhysColor: DWORD): HResult; stdcall; + function SetBackgroundColor(dwPhysColor: DWORD): HResult; stdcall; + + // Specify if whole output bitmap should be redrawn for each sample + function GetRedrawAlways(lpbOption: PBOOL): HResult; stdcall; + function SetRedrawAlways(bOption: BOOL): HResult; stdcall; + + // Specify if the caption text background should be opaque/transparent + function GetDrawBackgroundMode(var lpMode: TAMLine21DrawBGMode): HResult; + stdcall; + function SetDrawBackgroundMode(Mode: TAMLine21DrawBGMode): HResult; + stdcall; + // supported mode values are AM_L21_DrawBGMode_Opaque and + // AM_L21_DrawBGMode_Transparent + end; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: dvdevcod.h + * + ***************************************************************************) +// list of standard DVD-Video event codes and the expected params + +const + EC_DVDBASE = $0100; + {$EXTERNALSYM EC_DVDBASE} + +type + _tagDVD_ERROR = ( + {$IFNDEF COMPILER6_UP} + DVD_ERROR_INVALID_0, + DVD_ERROR_Unexpected, // Something unexpected happened, perhaps content + // is incorrectly authored. Playback is stopped. + DVD_ERROR_CopyProtectFail, // Key exchange for DVD copy protection failed. + // Playback is stopped. + DVD_ERROR_InvalidDVD1_0Disc, // DVD-Video disc is incorrectly authored for v1.0 + // of spec. Playback is stopped. + DVD_ERROR_InvalidDiscRegion, // The Disc is not approved for playback by decoders + // from this DVD region. + DVD_ERROR_LowParentalLevel, // Player parental level is lower than the lowest parental + // level available in the DVD content. Playback is stopped. + DVD_ERROR_MacrovisionFail, // Macrovision Distribution Failed. + // Playback is stopped. + DVD_ERROR_IncompatibleSystemAndDecoderRegions, + // No discs can be played because the system region + // does not match the decoder region. + DVD_ERROR_IncompatibleDiscAndDecoderRegions + // The disc cannot be played because the disc is + // not authored to be played in the decoder's region + {$ELSE} + DVD_ERROR_Unexpected = 1, // Something unexpected happened, perhaps content + // is incorrectly authored. Playback is stopped. + DVD_ERROR_CopyProtectFail = 2, // Key exchange for DVD copy protection failed. + // Playback is stopped. + DVD_ERROR_InvalidDVD1_0Disc = 3, // DVD-Video disc is incorrectly authored for v1.0 + // of spec. Playback is stopped. + DVD_ERROR_InvalidDiscRegion = 4, // The Disc is not approved for playback by decoders + // from this DVD region. + DVD_ERROR_LowParentalLevel = 5, // Player parental level is lower than the lowest parental + // level available in the DVD content. Playback is stopped. + DVD_ERROR_MacrovisionFail = 6, // Macrovision Distribution Failed. + // Playback is stopped. + DVD_ERROR_IncompatibleSystemAndDecoderRegions = 7, + // No discs can be played because the system region + // does not match the decoder region. + DVD_ERROR_IncompatibleDiscAndDecoderRegions = 8 + // The disc cannot be played because the disc is + // not authored to be played in the decoder's region + {$ENDIF} + ); + {$EXTERNALSYM _tagDVD_ERROR} + DVD_ERROR = _tagDVD_ERROR; + {$EXTERNALSYM DVD_ERROR} + TDVDError = DVD_ERROR; + + _tagDVD_WARNING = ( + {$IFNDEF COMPILER6_UP} + DVD_WARNING_INVALID_0, + DVD_WARNING_InvalidDVD1_0Disc, // DVD-Video disc is incorrectly authored. Playback + // can continue, but unexpected behavior may occur. + DVD_WARNING_FormatNotSupported, // A decoder would not support the current format. Playback + // of a stream (audio, video of SP) may not function. + // lParam2 contains the stream type (see AM_DVD_STREAM_FLAGS) -> Windows XP + DVD_WARNING_IllegalNavCommand, // The internal DVD navigation command processor attempted to + // process an illegal command. + DVD_WARNING_Open, // File Open Failed + DVD_WARNING_Seek, // File Seek Failed + DVD_WARNING_Read // File Read Failed + {$ELSE} + DVD_WARNING_InvalidDVD1_0Disc = 1, // DVD-Video disc is incorrectly authored. Playback + // can continue, but unexpected behavior may occur. + DVD_WARNING_FormatNotSupported = 2, // A decoder would not support the current format. Playback + // of a stream (audio, video of SP) may not function. + // lParam2 contains the stream type (see AM_DVD_STREAM_FLAGS) -> Windows XP + DVD_WARNING_IllegalNavCommand = 3, // The internal DVD navigation command processor attempted to + // process an illegal command. + DVD_WARNING_Open = 4, // File Open Failed + DVD_WARNING_Seek = 5, // File Seek Failed + DVD_WARNING_Read = 6 // File Read Failed + {$ENDIF} + ); + {$EXTERNALSYM _tagDVD_WARNING} + DVD_WARNING = _tagDVD_WARNING; + {$EXTERNALSYM DVD_WARNING} + TDVDWarning = DVD_WARNING; + + _tagDVD_PB_STOPPED = ( + DVD_PB_STOPPED_Other, // The navigator stopped the playback (no reason available). + DVD_PB_STOPPED_NoBranch, // The nav completed the current pgc and there was no more video and + // did not find any other branching instruction for subsequent playback. + DVD_PB_STOPPED_NoFirstPlayDomain, // The disc does not contain an initial startup program. + DVD_PB_STOPPED_StopCommand, // The app issued a stop() command or a stop command was authored on the disc. + DVD_PB_STOPPED_Reset, // The navigator was reset to the start of the disc (using ResetOnStop). + DVD_PB_STOPPED_DiscEjected, // The disc was ejected. + DVD_PB_STOPPED_IllegalNavCommand, // An illegal nav command prevented playback from continuing. + DVD_PB_STOPPED_PlayPeriodAutoStop, // PlayPeriod completed + DVD_PB_STOPPED_PlayChapterAutoStop, // PlayChapter completed + DVD_PB_STOPPED_ParentalFailure, // A parental level failure prevented playback + DVD_PB_STOPPED_RegionFailure, // A region failure prevented playback + DVD_PB_STOPPED_MacrovisionFailure, // A Macrovision failure prevented playback. + DVD_PB_STOPPED_DiscReadError, // A read error prevented playback. + DVD_PB_STOPPED_CopyProtectFailure // Copy protection failure. + ); + {$EXTERNALSYM _tagDVD_PB_STOPPED} + DVD_PB_STOPPED = _tagDVD_PB_STOPPED; + {$EXTERNALSYM DVD_PB_STOPPED} + TDVDPBStopped = DVD_PB_STOPPED; + +const + +// DVD-Video event codes +// ====================== +// +// All DVD-Video event are always passed on to the application, and are +// never processed by the filter graph + + + EC_DVD_DOMAIN_CHANGE = (EC_DVDBASE + $01); + {$EXTERNALSYM EC_DVD_DOMAIN_CHANGE} +// Parameters: ( DWORD, void ) +// lParam1 is enum DVD_DOMAIN, and indicates the player's new domain +// +// Raised from following domains: all +// +// Signaled when ever the DVD player changes domains. + + + EC_DVD_TITLE_CHANGE = (EC_DVDBASE + $02); + {$EXTERNALSYM EC_DVD_TITLE_CHANGE} +// Parameters: ( DWORD, void ) +// lParam1 is the new title number. +// +// Raised from following domains: DVD_DOMAIN_Title +// +// Indicates when the current title number changes. Title numbers +// range 1 to 99. This indicates the TTN, which is the title number +// with respect to the whole disc, not the VTS_TTN which is the title +// number with respect to just a current VTS. + + + EC_DVD_CHAPTER_START = (EC_DVDBASE + $03); + {$EXTERNALSYM EC_DVD_CHAPTER_START} +// Parameters: ( DWORD, void ) +// lParam1 is the new chapter number (which is the program number for +// One_Sequential_PGC_Titles). +// +// Raised from following domains: DVD_DOMAIN_Title +// +// Signales that DVD player started playback of a new program in the Title +// domain. This is only signaled for One_Sequential_PGC_Titles. + + + EC_DVD_AUDIO_STREAM_CHANGE = (EC_DVDBASE + $04); + {$EXTERNALSYM EC_DVD_AUDIO_STREAM_CHANGE} +// Parameters: ( DWORD, void ) +// lParam1 is the new user audio stream number. +// +// Raised from following domains: all +// +// Signaled when ever the current user audio stream number changes for the main +// title. This can be changed automatically with a navigation command on disc +// as well as through IDVDAnnexJ. +// Audio stream numbers range from 0 to 7. Stream $ffffffff +// indicates that no stream is selected. + + EC_DVD_SUBPICTURE_STREAM_CHANGE = (EC_DVDBASE + $05); + {$EXTERNALSYM EC_DVD_SUBPICTURE_STREAM_CHANGE} +// Parameters: ( DWORD, BOOL ) -> WindowsXP +// Parameters: ( DWORD, void ) +// lParam1 is the new user subpicture stream number. +// lParam2 is the subpicture's on/off state (TRUE if on) -> WindowsXP + +// Raised from following domains: all +// +// Signaled when ever the current user subpicture stream number changes for the main +// title. This can be changed automatically with a navigation command on disc +// as well as through IDVDAnnexJ. +// Subpicture stream numbers range from 0 to 31. Stream $ffffffff +// indicates that no stream is selected. + + EC_DVD_ANGLE_CHANGE = (EC_DVDBASE + $06); + {$EXTERNALSYM EC_DVD_ANGLE_CHANGE} +// Parameters: ( DWORD, DWORD ) +// lParam1 is the number of available angles. +// lParam2 is the current user angle number. +// +// Raised from following domains: all +// +// Signaled when ever either +// a) the number of available angles changes, or +// b) the current user angle number changes. +// Current angle number can be changed automatically with navigation command +// on disc as well as through IDVDAnnexJ. +// When the number of available angles is 1, the current video is not multiangle. +// Angle numbers range from 1 to 9. + + + EC_DVD_BUTTON_CHANGE = (EC_DVDBASE + $07); + {$EXTERNALSYM EC_DVD_BUTTON_CHANGE} +// Parameters: ( DWORD, DWORD ) +// lParam1 is the number of available buttons. +// lParam2 is the current selected button number. +// +// Raised from following domains: all +// +// Signaled when ever either +// a) the number of available buttons changes, or +// b) the current selected button number changes. +// The current selected button can be changed automatically with navigation +// commands on disc as well as through IDVDAnnexJ. +// Button numbers range from 1 to 36. Selected button number 0 implies that +// no button is selected. Note that these button numbers enumerate all +// available button numbers, and do not always correspond to button numbers +// used for IDVDAnnexJ::ButtonSelectAndActivate since only a subset of buttons +// may be activated with ButtonSelectAndActivate. + + + EC_DVD_VALID_UOPS_CHANGE = (EC_DVDBASE + $08); + {$EXTERNALSYM EC_DVD_VALID_UOPS_CHANGE} +// Parameters: ( DWORD, void ) +// lParam1 is a VALID_UOP_SOMTHING_OR_OTHER bit-field stuct which indicates +// which IDVDAnnexJ commands are explicitly disable by the DVD disc. +// +// Raised from following domains: all +// +// Signaled when ever the available set of IDVDAnnexJ methods changes. This +// only indicates which operations are explicited disabled by the content on +// the DVD disc, and does not guarentee that it is valid to call methods +// which are not disabled. For example, if no buttons are currently present, +// IDVDAnnexJ::ButtonActivate() won't work, even though the buttons are not +// explicitly disabled. + + + EC_DVD_STILL_ON = (EC_DVDBASE + $09); + {$EXTERNALSYM EC_DVD_STILL_ON} +// Parameters: ( BOOL, DWORD ) +// lParam1 == 0 --> buttons are available, so StillOff won't work +// lParam1 == 1 --> no buttons available, so StillOff will work +// lParam2 indicates the number of seconds the still will last, with $ffffffff +// indicating an infinite still (wait till button or StillOff selected). +// +// Raised from following domains: all +// +// Signaled at the beginning of any still: PGC still, Cell Still, or VOBU Still. +// Note that all combinations of buttons and still are possible (buttons on with +// still on, buttons on with still off, button off with still on, button off +// with still off). + + EC_DVD_STILL_OFF = (EC_DVDBASE + $0a); + {$EXTERNALSYM EC_DVD_STILL_OFF} +// Parameters: ( void, void ) +// +// Indicating that any still that is currently active +// has been released. +// +// Raised from following domains: all +// +// Signaled at the end of any still: PGC still, Cell Still, or VOBU Still. +// + + EC_DVD_CURRENT_TIME = (EC_DVDBASE + $0b); + {$EXTERNALSYM EC_DVD_CURRENT_TIME} +// Parameters: ( DWORD, BOOL ) +// lParam1 is a DVD_TIMECODE which indicates the current +// playback time code in a BCD HH:MM:SS:FF format. +// lParam2 == 0 --> time code is 25 frames/sec +// lParam2 == 1 --> time code is 30 frames/sec (non-drop). +// +// Raised from following domains: DVD_DOMAIN_Title +// +// Signaled at the beginning of every VOBU, which occurs every .4 to 1.0 sec. +// This is only signaled for One_Sequential_PGC_Titles. + + + EC_DVD_ERROR = (EC_DVDBASE + $0c); + {$EXTERNALSYM EC_DVD_ERROR} +// Parameters: ( DWORD, void) +// lParam1 is an enum DVD_ERROR which notifies the app of some error condition. +// +// Raised from following domains: all +// + + EC_DVD_WARNING = (EC_DVDBASE + $0d); + {$EXTERNALSYM EC_DVD_WARNING} +// Parameters: ( DWORD, DWORD) -> WindowsXP +// Parameters: ( DWORD, void) +// lParam1 is an enum DVD_WARNING which notifies the app of some warning condition. +// lParam2 contains more specific information about the warning (warning dependent) -> WindowsXP + +// Raised from following domains: all +// + + EC_DVD_CHAPTER_AUTOSTOP = (EC_DVDBASE + $0e); + {$EXTERNALSYM EC_DVD_CHAPTER_AUTOSTOP} +// Parameters: (void, void) +// +// Indicating that playback is stopped as a result of a call +// to IDVDControl::ChapterPlayAutoStop() +// +// Raised from following domains : DVD_DOMAIN_TITLE +// + + EC_DVD_NO_FP_PGC = (EC_DVDBASE + $0f); + {$EXTERNALSYM EC_DVD_NO_FP_PGC} +// Parameters : (void, void) +// +// Raised from the following domains : FP_DOM +// +// Indicates that the DVD disc does not have a FP_PGC (First Play Program Chain) +// and the DVD Navigator will not automatically load any PGC and start playback. +// + + EC_DVD_PLAYBACK_RATE_CHANGE = (EC_DVDBASE + $10); + {$EXTERNALSYM EC_DVD_PLAYBACK_RATE_CHANGE} +// Parameters : (LONG, void) +// lParam1 is a LONG indicating the new playback rate. +// lParam1 < 0 indicates reverse playback mode. +// lParam1 > 0 indicates forward playback mode +// Value of lParam1 is the actual playback rate multiplied by 10000. +// i.e. lParam1 = rate * 10000 +// +// Raised from the following domains : TT_DOM +// +// Indicates that a rate change in playback has been initiated and the parameter +// lParam1 indicates the new playback rate that is being used. +// + + EC_DVD_PARENTAL_LEVEL_CHANGE = (EC_DVDBASE + $11); + {$EXTERNALSYM EC_DVD_PARENTAL_LEVEL_CHANGE} +// Parameters : (LONG, void) +// lParam1 is a LONG indicating the new parental level. +// +// Raised from the following domains : VMGM_DOM +// +// Indicates that an authored Nav command has changed the parental level +// setting in the player. +// + + EC_DVD_PLAYBACK_STOPPED = (EC_DVDBASE + $12); + {$EXTERNALSYM EC_DVD_PLAYBACK_STOPPED} +// Parameters : (DWORD, void) +// +// Raised from the following domains : All Domains +// +// Indicates that playback has been stopped as the Navigator has completed +// playback of the pgc and did not find any other branching instruction for +// subsequent playback. +// +// The DWORD returns the reason for the completion of the playback. See +// The DVD_PB_STOPPED enumeration for details. +// + + EC_DVD_ANGLES_AVAILABLE = (EC_DVDBASE + $13); + {$EXTERNALSYM EC_DVD_ANGLES_AVAILABLE} +// Parameters : (BOOL, void) +// lParam1 == 0 indicates that playback is not in an angle block and angles are +// not available +// lParam1 == 1 indicates that an angle block is being played back and angle changes +// can be performed. +// +// Indicates whether an angle block is being played and if angle changes can be +// performed. However, angle changes are not restricted to angle blocks and the +// manifestation of the angle change can be seen only in an angle block. + + EC_DVD_PLAYPERIOD_AUTOSTOP = (EC_DVDBASE + $14); + {$EXTERNALSYM EC_DVD_PLAYPERIOD_AUTOSTOP} +// Parameters: (void, void) +// Sent when the PlayPeriodInTitle completes or is cancelled +// +// Raised from following domains : DVD_DOMAIN_TITLE +// + + EC_DVD_BUTTON_AUTO_ACTIVATED = (EC_DVDBASE + $15); + {$EXTERNALSYM EC_DVD_BUTTON_AUTO_ACTIVATED} +// Parameters: (DWORD button, void) +// Sent when a button is automatically activated +// +// Raised from following domains : DVD_DOMAIN_MENU +// + + EC_DVD_CMD_START = (EC_DVDBASE + $16); + {$EXTERNALSYM EC_DVD_CMD_START} +// Parameters: (CmdID, HResult) +// Sent when a command begins +// + + EC_DVD_CMD_END = (EC_DVDBASE + $17); + {$EXTERNALSYM EC_DVD_CMD_END} +// Parameters: (CmdID, HResult) +// Sent when a command completes +// + + EC_DVD_DISC_EJECTED = (EC_DVDBASE + $18); + {$EXTERNALSYM EC_DVD_DISC_EJECTED} +// Parameters: none +// Sent when the nav detects that a disc was ejected and stops the playback +// The app does not need to take any action to stop the playback. +// + + EC_DVD_DISC_INSERTED = (EC_DVDBASE + $19); + {$EXTERNALSYM EC_DVD_DISC_INSERTED} +// Parameters: none +// Sent when the nav detects that a disc was inserted and the nav begins playback +// The app does not need to take any action to start the playback. +// + + EC_DVD_CURRENT_HMSF_TIME = (EC_DVDBASE + $1a); + {$EXTERNALSYM EC_DVD_CURRENT_HMSF_TIME} +// Parameters: ( ULONG, ULONG ) +// lParam2 contains a union of the DVD_TIMECODE_FLAGS +// lParam1 contains a DVD_HMSF_TIMECODE. Assign lParam1 to a ULONG then cast the +// ULONG as a DVD_HMSF_TIMECODE to use its values. +// +// Raised from following domains: DVD_DOMAIN_Title +// +// Signaled at the beginning of every VOBU, which occurs every .4 to 1.0 sec. + + EC_DVD_KARAOKE_MODE = (EC_DVDBASE + $1b); + {$EXTERNALSYM EC_DVD_KARAOKE_MODE} +// Parameters: ( BOOL, reserved ) +// lParam1 is either TRUE (a karaoke track is being played) or FALSE (no karaoke data is being played). +// + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: dvdmedia.h + * + ***************************************************************************) + +type +// ----------------------------------------------------------------------- +// AC-3 definition for the AM_KSPROPSETID_AC3 property set +// ----------------------------------------------------------------------- + AM_PROPERTY_AC3 = ( + AM_PROPERTY_AC3_INVALID_0, + AM_PROPERTY_AC3_ERROR_CONCEALMENT, + AM_PROPERTY_AC3_ALTERNATE_AUDIO, + AM_PROPERTY_AC3_DOWNMIX, + AM_PROPERTY_AC3_BIT_STREAM_MODE, + AM_PROPERTY_AC3_DIALOGUE_LEVEL, + AM_PROPERTY_AC3_LANGUAGE_CODE, + AM_PROPERTY_AC3_ROOM_TYPE + ); + {$EXTERNALSYM AM_PROPERTY_AC3} + TAMPropertyAC3 = AM_PROPERTY_AC3; + + AM_AC3_ERROR_CONCEALMENT = record + fRepeatPreviousBlock: BOOL; + fErrorInCurrentBlock: BOOL; + end; + {$EXTERNALSYM AM_AC3_ERROR_CONCEALMENT} + PAM_AC3_ERROR_CONCEALMENT = ^AM_AC3_ERROR_CONCEALMENT; + {$EXTERNALSYM PAM_AC3_ERROR_CONCEALMENT} + TAMAC3ErrorConcelment = AM_AC3_ERROR_CONCEALMENT; + + AM_AC3_ALTERNATE_AUDIO = record + fStereo: BOOL; + DualMode: ULONG; + end; + {$EXTERNALSYM AM_AC3_ALTERNATE_AUDIO} + PAM_AC3_ALTERNATE_AUDIO = ^AM_AC3_ALTERNATE_AUDIO; + {$EXTERNALSYM PAM_AC3_ALTERNATE_AUDIO} + TAMAC3AlteranateAudio = AM_AC3_ALTERNATE_AUDIO; + +const + AM_AC3_ALTERNATE_AUDIO_1 = 1; + {$EXTERNALSYM AM_AC3_ALTERNATE_AUDIO_1} + AM_AC3_ALTERNATE_AUDIO_2 = 2; + {$EXTERNALSYM AM_AC3_ALTERNATE_AUDIO_2} + AM_AC3_ALTERNATE_AUDIO_BOTH = 3; + {$EXTERNALSYM AM_AC3_ALTERNATE_AUDIO_BOTH} + +type + AM_AC3_DOWNMIX = record + fDownMix : BOOL; + fDolbySurround : BOOL; + end; + {$EXTERNALSYM AM_AC3_DOWNMIX} + PAM_AC3_DOWNMIX = ^AM_AC3_DOWNMIX; + {$EXTERNALSYM PAM_AC3_DOWNMIX} + TAMAC3DownMix = AM_AC3_DOWNMIX; + + AM_AC3_BIT_STREAM_MODE = record + BitStreamMode: Longint; + end; + {$EXTERNALSYM AM_AC3_BIT_STREAM_MODE} + PAM_AC3_BIT_STREAM_MODE = ^AM_AC3_BIT_STREAM_MODE; + {$EXTERNALSYM PAM_AC3_BIT_STREAM_MODE} + TAMAC3BitStreamMode = AM_AC3_BIT_STREAM_MODE; +const + AM_AC3_SERVICE_MAIN_AUDIO = 0; + {$EXTERNALSYM AM_AC3_SERVICE_MAIN_AUDIO} + AM_AC3_SERVICE_NO_DIALOG = 1; + {$EXTERNALSYM AM_AC3_SERVICE_NO_DIALOG} + AM_AC3_SERVICE_VISUALLY_IMPAIRED = 2; + {$EXTERNALSYM AM_AC3_SERVICE_VISUALLY_IMPAIRED} + AM_AC3_SERVICE_HEARING_IMPAIRED = 3; + {$EXTERNALSYM AM_AC3_SERVICE_HEARING_IMPAIRED} + AM_AC3_SERVICE_DIALOG_ONLY = 4; + {$EXTERNALSYM AM_AC3_SERVICE_DIALOG_ONLY} + AM_AC3_SERVICE_COMMENTARY = 5; + {$EXTERNALSYM AM_AC3_SERVICE_COMMENTARY} + AM_AC3_SERVICE_EMERGENCY_FLASH = 6; + {$EXTERNALSYM AM_AC3_SERVICE_EMERGENCY_FLASH} + AM_AC3_SERVICE_VOICE_OVER = 7; + {$EXTERNALSYM AM_AC3_SERVICE_VOICE_OVER} + +type + AM_AC3_DIALOGUE_LEVEL = record + DialogueLevel: ULONG; + end; + {$EXTERNALSYM AM_AC3_DIALOGUE_LEVEL} + PAM_AC3_DIALOGUE_LEVEL = ^AM_AC3_DIALOGUE_LEVEL; + {$EXTERNALSYM PAM_AC3_DIALOGUE_LEVEL} + TAMAC3DialogueLevel = AM_AC3_DIALOGUE_LEVEL; + + AM_AC3_ROOM_TYPE = record + fLargeRoom: BOOL; + end; + {$EXTERNALSYM AM_AC3_ROOM_TYPE} + PAM_AC3_ROOM_TYPE = ^AM_AC3_ROOM_TYPE; + {$EXTERNALSYM PAM_AC3_ROOM_TYPE} + TAMAC3RoomType = AM_AC3_ROOM_TYPE; + +// ----------------------------------------------------------------------- +// subpicture definition for the AM_KSPROPSETID_DvdSubPic property set +// ----------------------------------------------------------------------- + + AM_PROPERTY_DVDSUBPIC = ( + AM_PROPERTY_DVDSUBPIC_PALETTE, + AM_PROPERTY_DVDSUBPIC_HLI, + AM_PROPERTY_DVDSUBPIC_COMPOSIT_ON // TRUE for subpicture is displayed + ); + {$EXTERNALSYM AM_PROPERTY_DVDSUBPIC} + TAM_Property_DVDSubpic = AM_PROPERTY_DVDSUBPIC; + + _AM_DVD_YUV = record + Reserved: Byte; + Y: byte; + U: Byte; + V: Byte; + end; + {$EXTERNALSYM _AM_DVD_YUV} + AM_DVD_YUV = _AM_DVD_YUV; + {$EXTERNALSYM AM_DVD_YUV} + TAMDVDYUV = _AM_DVD_YUV; + + _AM_PROPERTY_SPPAL = record + sppal: array[0..15] of TAMDVDYUV; + end; + {$EXTERNALSYM _AM_PROPERTY_SPPAL} + AM_PROPERTY_SPPAL = _AM_PROPERTY_SPPAL; + {$EXTERNALSYM AM_PROPERTY_SPPAL} + PAM_PROPERTY_SPPAL = ^AM_PROPERTY_SPPAL; + {$EXTERNALSYM PAM_PROPERTY_SPPAL} + TAMPropertySPPAL = _AM_PROPERTY_SPPAL; + + _AM_COLCON = record + emph1col : Byte; + emph2col : Byte; + backcol : Byte; + patcol : Byte; + emph1con : Byte; + emph2con : Byte; + backcon : Byte; + patcon : Byte; + end; + {$EXTERNALSYM _AM_COLCON} + AM_COLCON = _AM_COLCON; + {$EXTERNALSYM AM_COLCON} + PAM_COLCON = ^AM_COLCON; + {$EXTERNALSYM PAM_COLCON} + TAMColcon = _AM_COLCON; + + _AM_PROPERTY_SPHLI = record + HLISS : Word; // + Reserved : Word; + StartPTM : ULONG; // start presentation time in x/90000 + EndPTM : ULONG; // end PTM in x/90000 + StartX : Word; + StartY : Word; + StopX : Word; + StopY : Word; + ColCon : TAMColCon; // color contrast description (4 bytes as given in HLI) + end; + {$EXTERNALSYM _AM_PROPERTY_SPHLI} + AM_PROPERTY_SPHLI = _AM_PROPERTY_SPHLI; + {$EXTERNALSYM AM_PROPERTY_SPHLI} + TAMPropertySPHLI = _AM_PROPERTY_SPHLI; + + AM_PROPERTY_COMPOSIT_ON = {$IFDEF TYPE_IDENTITY}type {$ENDIF} BOOL; + {$EXTERNALSYM AM_PROPERTY_COMPOSIT_ON} + PAM_PROPERTY_COMPOSIT_ON = ^AM_PROPERTY_COMPOSIT_ON; + {$EXTERNALSYM PAM_PROPERTY_COMPOSIT_ON} + +// ----------------------------------------------------------------------- +// copy protection definitions +// ----------------------------------------------------------------------- + +// AM_UseNewCSSKey for the dwTypeSpecificFlags in IMediaSample2 to indicate +// the exact point in a stream after which to start applying a new CSS key. +// This is typically sent on an empty media sample just before attempting +// to renegotiate a CSS key. +const + AM_UseNewCSSKey = $1; + {$EXTERNALSYM AM_UseNewCSSKey} + +// +// AM_KSPROPSETID_CopyProt property set definitions +// + AM_PROPERTY_DVDCOPY_CHLG_KEY = $01; + {$EXTERNALSYM AM_PROPERTY_DVDCOPY_CHLG_KEY} + AM_PROPERTY_DVDCOPY_DVD_KEY1 = $02; + {$EXTERNALSYM AM_PROPERTY_DVDCOPY_DVD_KEY1} + AM_PROPERTY_DVDCOPY_DEC_KEY2 = $03; + {$EXTERNALSYM AM_PROPERTY_DVDCOPY_DEC_KEY2} + AM_PROPERTY_DVDCOPY_TITLE_KEY = $04; + {$EXTERNALSYM AM_PROPERTY_DVDCOPY_TITLE_KEY} + AM_PROPERTY_COPY_MACROVISION = $05; + {$EXTERNALSYM AM_PROPERTY_COPY_MACROVISION} + AM_PROPERTY_DVDCOPY_REGION = $06; + {$EXTERNALSYM AM_PROPERTY_DVDCOPY_REGION} + AM_PROPERTY_DVDCOPY_SET_COPY_STATE = $07; + {$EXTERNALSYM AM_PROPERTY_DVDCOPY_SET_COPY_STATE} + AM_PROPERTY_DVDCOPY_DISC_KEY = $80; + {$EXTERNALSYM AM_PROPERTY_DVDCOPY_DISC_KEY} + +type + _AM_DVDCOPY_CHLGKEY = record + ChlgKey: array[0..9] of Byte; + Reserved: array[0..1] of Byte; + end; + {$EXTERNALSYM _AM_DVDCOPY_CHLGKEY} + AM_DVDCOPY_CHLGKEY = _AM_DVDCOPY_CHLGKEY; + {$EXTERNALSYM AM_DVDCOPY_CHLGKEY} + PAM_DVDCOPY_CHLGKEY = ^AM_DVDCOPY_CHLGKEY; + {$EXTERNALSYM PAM_DVDCOPY_CHLGKEY} + TAMDVDCopyCHLGKey = _AM_DVDCOPY_CHLGKEY; + + _AM_DVDCOPY_BUSKEY = record + BusKey: array[0..4] of Byte; + Reserved: array[0..0] of Byte; + end; + {$EXTERNALSYM _AM_DVDCOPY_BUSKEY} + AM_DVDCOPY_BUSKEY = _AM_DVDCOPY_BUSKEY; + {$EXTERNALSYM AM_DVDCOPY_BUSKEY} + PAM_DVDCOPY_BUSKEY = ^AM_DVDCOPY_BUSKEY; + {$EXTERNALSYM PAM_DVDCOPY_BUSKEY} + TAMDVDCopyBusKey = _AM_DVDCOPY_BUSKEY; + + _AM_DVDCOPY_DISCKEY = record + DiscKey: array[0..2047] of Byte; + end; + {$EXTERNALSYM _AM_DVDCOPY_DISCKEY} + AM_DVDCOPY_DISCKEY = _AM_DVDCOPY_DISCKEY; + {$EXTERNALSYM AM_DVDCOPY_DISCKEY} + PAM_DVDCOPY_DISCKEY = ^AM_DVDCOPY_DISCKEY; + {$EXTERNALSYM PAM_DVDCOPY_DISCKEY} + TAMDVDCopyDiscKey = _AM_DVDCOPY_DISCKEY; + + AM_DVDCOPY_TITLEKEY = record + KeyFlags: ULONG; + Reserved1: array[0..1] of ULONG; + TitleKey: array[0..5] of Byte; + Reserved2: array[0..1] of Byte; + end; + {$EXTERNALSYM AM_DVDCOPY_TITLEKEY} + PAM_DVDCOPY_TITLEKEY = AM_DVDCOPY_TITLEKEY; + {$EXTERNALSYM PAM_DVDCOPY_TITLEKEY} + TAMDVDCopyTitleKey = AM_DVDCOPY_TITLEKEY; + + _AM_COPY_MACROVISION = record + MACROVISIONLevel: ULONG; + end; + {$EXTERNALSYM _AM_COPY_MACROVISION} + AM_COPY_MACROVISION = _AM_COPY_MACROVISION; + {$EXTERNALSYM AM_COPY_MACROVISION} + PAM_COPY_MACROVISION = ^AM_COPY_MACROVISION; + {$EXTERNALSYM PAM_COPY_MACROVISION} + TAMCopyMacroVision = _AM_COPY_MACROVISION; + + AM_DVDCOPY_SET_COPY_STATE = record + DVDCopyState: ULONG; + end; + {$EXTERNALSYM AM_DVDCOPY_SET_COPY_STATE} + PAM_DVDCOPY_SET_COPY_STATE = ^AM_DVDCOPY_SET_COPY_STATE; + {$EXTERNALSYM PAM_DVDCOPY_SET_COPY_STATE} + TAMDVDCopySetCopyState = AM_DVDCOPY_SET_COPY_STATE; + + AM_DVDCOPYSTATE = ( + AM_DVDCOPYSTATE_INITIALIZE, + AM_DVDCOPYSTATE_INITIALIZE_TITLE, // indicates we are starting a title + // key copy protection sequence + AM_DVDCOPYSTATE_AUTHENTICATION_NOT_REQUIRED, + AM_DVDCOPYSTATE_AUTHENTICATION_REQUIRED, + AM_DVDCOPYSTATE_DONE + ); + {$EXTERNALSYM AM_DVDCOPYSTATE} + TAMDVDCopyState = AM_DVDCOPYSTATE; + + AM_COPY_MACROVISION_LEVEL = ( + AM_MACROVISION_DISABLED, + AM_MACROVISION_LEVEL1, + AM_MACROVISION_LEVEL2, + AM_MACROVISION_LEVEL3 + ); + {$EXTERNALSYM AM_COPY_MACROVISION_LEVEL} + PAM_COPY_MACROVISION_LEVEL = ^AM_COPY_MACROVISION_LEVEL; + {$EXTERNALSYM PAM_COPY_MACROVISION_LEVEL} + TAMCopyMacroVisionLevel = AM_COPY_MACROVISION_LEVEL; + + // CSS region stucture + _DVD_REGION = record + CopySystem: Byte; + RegionData: Byte; + SystemRegion: Byte; + Reserved: Byte; + end; + {$EXTERNALSYM _DVD_REGION} + DVD_REGION = _DVD_REGION; + {$EXTERNALSYM DVD_REGION} + PDVD_REGION = ^DVD_REGION; + {$EXTERNALSYM PDVD_REGION} + TDVDRegion = _DVD_REGION; + +// +// CGMS Copy Protection Flags +// + +const + AM_DVD_CGMS_RESERVED_MASK = $00000078; + {$EXTERNALSYM AM_DVD_CGMS_RESERVED_MASK} + + AM_DVD_CGMS_COPY_PROTECT_MASK = $00000018; + {$EXTERNALSYM AM_DVD_CGMS_COPY_PROTECT_MASK} + AM_DVD_CGMS_COPY_PERMITTED = $00000000; + {$EXTERNALSYM AM_DVD_CGMS_COPY_PERMITTED} + AM_DVD_CGMS_COPY_ONCE = $00000010; + {$EXTERNALSYM AM_DVD_CGMS_COPY_ONCE} + AM_DVD_CGMS_NO_COPY = $00000018; + {$EXTERNALSYM AM_DVD_CGMS_NO_COPY} + + AM_DVD_COPYRIGHT_MASK = $00000040; + {$EXTERNALSYM AM_DVD_COPYRIGHT_MASK} + AM_DVD_NOT_COPYRIGHTED = $00000000; + {$EXTERNALSYM AM_DVD_NOT_COPYRIGHTED} + AM_DVD_COPYRIGHTED = $00000040; + {$EXTERNALSYM AM_DVD_COPYRIGHTED} + + AM_DVD_SECTOR_PROTECT_MASK = $00000020; + {$EXTERNALSYM AM_DVD_SECTOR_PROTECT_MASK} + AM_DVD_SECTOR_NOT_PROTECTED = $00000000; + {$EXTERNALSYM AM_DVD_SECTOR_NOT_PROTECTED} + AM_DVD_SECTOR_PROTECTED = $00000020; + {$EXTERNALSYM AM_DVD_SECTOR_PROTECTED} + + +// ----------------------------------------------------------------------- +// video format blocks +// ----------------------------------------------------------------------- + +type + AM_MPEG2Level = ( + {$IFNDEF COMPILER6_UP} + AM_MPEG2Level_INVALID_0, + AM_MPEG2Level_Low, + AM_MPEG2Level_Main, + AM_MPEG2Level_High1440, + AM_MPEG2Level_High + {$ELSE} + AM_MPEG2Level_Low = 1, + AM_MPEG2Level_Main = 2, + AM_MPEG2Level_High1440 = 3, + AM_MPEG2Level_High = 4 + {$ENDIF} + ); + {$EXTERNALSYM AM_MPEG2Level} + TAMMPEG2Level = AM_MPEG2Level; + + AM_MPEG2Profile = ( + {$IFNDEF COMPILER6_UP} + AM_MPEG2Profile_0, + AM_MPEG2Profile_Simple, + AM_MPEG2Profile_Main, + AM_MPEG2Profile_SNRScalable, + AM_MPEG2Profile_SpatiallyScalable, + AM_MPEG2Profile_High + {$ELSE} + AM_MPEG2Profile_Simple = 1, + AM_MPEG2Profile_Main = 2, + AM_MPEG2Profile_SNRScalable = 3, + AM_MPEG2Profile_SpatiallyScalable = 4, + AM_MPEG2Profile_High = 5 + {$ENDIF} + ); + {$EXTERNALSYM AM_MPEG2Profile} + TAMMPEG2Profile = AM_MPEG2Profile; + +const + AMINTERLACE_IsInterlaced = $00000001; // if 0, other interlace bits are irrelevent + {$EXTERNALSYM AMINTERLACE_IsInterlaced} + AMINTERLACE_1FieldPerSample = $00000002; // else 2 fields per media sample + {$EXTERNALSYM AMINTERLACE_1FieldPerSample} + AMINTERLACE_Field1First = $00000004; // else Field 2 is first; top field in PAL is field 1, top field in NTSC is field 2? + {$EXTERNALSYM AMINTERLACE_Field1First} + AMINTERLACE_UNUSED = $00000008; // + {$EXTERNALSYM AMINTERLACE_UNUSED} + AMINTERLACE_FieldPatternMask = $00000030; // use this mask with AMINTERLACE_FieldPat* + {$EXTERNALSYM AMINTERLACE_FieldPatternMask} + AMINTERLACE_FieldPatField1Only = $00000000; // stream never contains a Field2 + {$EXTERNALSYM AMINTERLACE_FieldPatField1Only} + AMINTERLACE_FieldPatField2Only = $00000010; // stream never contains a Field1 + {$EXTERNALSYM AMINTERLACE_FieldPatField2Only} + AMINTERLACE_FieldPatBothRegular = $00000020; // There will be a Field2 for every Field1 (required for Weave?) + {$EXTERNALSYM AMINTERLACE_FieldPatBothRegular} + AMINTERLACE_FieldPatBothIrregular = $00000030; // Random pattern of Field1s and Field2s + {$EXTERNALSYM AMINTERLACE_FieldPatBothIrregular} + AMINTERLACE_DisplayModeMask = $000000c0; + {$EXTERNALSYM AMINTERLACE_DisplayModeMask} + AMINTERLACE_DisplayModeBobOnly = $00000000; + {$EXTERNALSYM AMINTERLACE_DisplayModeBobOnly} + AMINTERLACE_DisplayModeWeaveOnly = $00000040; + {$EXTERNALSYM AMINTERLACE_DisplayModeWeaveOnly} + AMINTERLACE_DisplayModeBobOrWeave = $00000080; + {$EXTERNALSYM AMINTERLACE_DisplayModeBobOrWeave} + + AMCOPYPROTECT_RestrictDuplication = $00000001; // duplication of this stream should be restricted + {$EXTERNALSYM AMCOPYPROTECT_RestrictDuplication} + + AMMPEG2_DoPanScan = $00000001; //if set, the MPEG-2 video decoder should crop output image + {$EXTERNALSYM AMMPEG2_DoPanScan} // based on pan-scan vectors in picture_display_extension + // and change the picture aspect ratio accordingly. + AMMPEG2_DVDLine21Field1 = $00000002; //if set, the MPEG-2 decoder must be able to produce an output + {$EXTERNALSYM AMMPEG2_DVDLine21Field1} // pin for DVD style closed caption data found in GOP layer of field 1 + AMMPEG2_DVDLine21Field2 = $00000004; //if set, the MPEG-2 decoder must be able to produce an output + {$EXTERNALSYM AMMPEG2_DVDLine21Field2} // pin for DVD style closed caption data found in GOP layer of field 2 + AMMPEG2_SourceIsLetterboxed = $00000008; //if set, indicates that black bars have been encoded in the top + {$EXTERNALSYM AMMPEG2_SourceIsLetterboxed} // and bottom of the video. + AMMPEG2_FilmCameraMode = $00000010; //if set, indicates "film mode" used for 625/50 content. If cleared, + {$EXTERNALSYM AMMPEG2_FilmCameraMode} // indicates that "camera mode" was used. + AMMPEG2_LetterboxAnalogOut = $00000020; //if set and this stream is sent to an analog output, it should + {$EXTERNALSYM AMMPEG2_LetterboxAnalogOut} // be letterboxed. Streams sent to VGA should be letterboxed only by renderers. + AMMPEG2_DSS_UserData = $00000040; //if set, the MPEG-2 decoder must process DSS style user data + {$EXTERNALSYM AMMPEG2_DSS_UserData} + AMMPEG2_DVB_UserData = $00000080; //if set, the MPEG-2 decoder must process DVB style user data + {$EXTERNALSYM AMMPEG2_DVB_UserData} + AMMPEG2_27MhzTimebase = $00000100; //if set, the PTS,DTS timestamps advance at 27MHz rather than 90KHz + {$EXTERNALSYM AMMPEG2_27MhzTimebase} + + AMMPEG2_WidescreenAnalogOut = $00000200; //if set and this stream is sent to an analog output, it should + {$EXTERNALSYM AMMPEG2_WidescreenAnalogOut} + // be in widescreen format (4x3 content should be centered on a 16x9 output). + // Streams sent to VGA should be widescreened only by renderers. + +// PRESENT in dwReserved1 field in VIDEOINFOHEADER2 + AMCONTROL_USED = $00000001; // Used to test if these flags are supported. Set and test for AcceptMediaType. + {$EXTERNALSYM AMCONTROL_USED} // If rejected, then you cannot use the AMCONTROL flags (send 0 for dwReserved1) + AMCONTROL_PAD_TO_4x3 = $00000002; // if set means display the image in a 4x3 area + {$EXTERNALSYM AMCONTROL_PAD_TO_4x3} + AMCONTROL_PAD_TO_16x9 = $00000004; // if set means display the image in a 16x9 area + {$EXTERNALSYM AMCONTROL_PAD_TO_16x9} + +type + TVideoInfoHeader2ControlFlags = record + case byte of + 0: (dwControlFlags : DWORD); // use AMCONTROL_* defines, use this from now on + 1: (dwReserved1 : DWORD); // for backward compatiblity (was "must be 0"; connection rejected otherwise) + end; + {$EXTERNALSYM TVideoInfoHeader2ControlFlags} + + PVideoInfoHeader2 = ^TVideoInfoHeader2; + tagVIDEOINFOHEADER2 = record + rcSource: TRect; + rcTarget: TRect; + dwBitRate: DWORD; + dwBitErrorRate: DWORD; + AvgTimePerFrame: TReferenceTime; + dwInterlaceFlags: DWORD; // use AMINTERLACE_* defines. Reject connection if undefined bits are not 0 + dwCopyProtectFlags: DWORD; // use AMCOPYPROTECT_* defines. Reject connection if undefined bits are not 0 + dwPictAspectRatioX: DWORD; // X dimension of picture aspect ratio, e.g. 16 for 16x9 display + dwPictAspectRatioY: DWORD; // Y dimension of picture aspect ratio, e.g. 9 for 16x9 display + ControlFlags: TVideoInfoHeader2ControlFlags; + dwReserved2: DWORD; // must be 0; reject connection otherwise + bmiHeader: TBitmapInfoHeader; + end; + {$EXTERNALSYM tagVIDEOINFOHEADER2} + VIDEOINFOHEADER2 = tagVIDEOINFOHEADER2; + {$EXTERNALSYM VIDEOINFOHEADER2} + TVideoInfoHeader2 = tagVIDEOINFOHEADER2; + + PMPEG2VideoInfo = ^TMPEG2VideoInfo; + tagMPEG2VIDEOINFO = record + hdr: TVIDEOINFOHEADER2; + dwStartTimeCode: DWORD; // ?? not used for DVD ?? + cbSequenceHeader: DWORD; // is 0 for DVD (no sequence header) + dwProfile: DWORD; // use enum MPEG2Profile + dwLevel: DWORD; // use enum MPEG2Level + dwFlags: DWORD; // use AMMPEG2_* defines. Reject connection if undefined bits are not 0 + dwSequenceHeader: array[0..0] of DWORD; // DWORD instead of Byte for alignment purposes + // For MPEG-2, if a sequence_header is included, the sequence_extension + // should also be included + end; + {$EXTERNALSYM tagMPEG2VIDEOINFO} + MPEG2VIDEOINFO = tagMPEG2VIDEOINFO; + {$EXTERNALSYM MPEG2VIDEOINFO} + TMPEG2VideoInfo = tagMPEG2VIDEOINFO; +{ +#define SIZE_MPEG2VIDEOINFO(pv) (FIELD_OFFSET(MPEG2VIDEOINFO, bSequenceHeader[0]) + (pv)->cbSequenceHeader) +#define MPEG1_SEQUENCE_INFO(pv) ((const BYTE *)(pv)->bSequenceHeader) +// use this macro instead, the previous only works for MPEG1VIDEOINFO structures +#define MPEG2_SEQUENCE_INFO(pv) ((const BYTE *)(pv)->dwSequenceHeader) + } + +//=================================================================================== +// flags for dwTypeSpecificFlags in AM_SAMPLE2_PROPERTIES which define type specific +// data in IMediaSample2 +//=================================================================================== + +const + AM_VIDEO_FLAG_FIELD_MASK = $0003; // use this mask to check whether the sample is field1 or field2 or frame + {$EXTERNALSYM AM_VIDEO_FLAG_FIELD_MASK} + AM_VIDEO_FLAG_INTERLEAVED_FRAME = $0000; // the sample is a frame (remember to use AM_VIDEO_FLAG_FIELD_MASK when using this) + {$EXTERNALSYM AM_VIDEO_FLAG_INTERLEAVED_FRAME} + AM_VIDEO_FLAG_FIELD1 = $0001; // the sample is field1 (remember to use AM_VIDEO_FLAG_FIELD_MASK when using this) + {$EXTERNALSYM AM_VIDEO_FLAG_FIELD1} + AM_VIDEO_FLAG_FIELD2 = $0002; // the sample is the field2 (remember to use AM_VIDEO_FLAG_FIELD_MASK when using this) + {$EXTERNALSYM AM_VIDEO_FLAG_FIELD2} + AM_VIDEO_FLAG_FIELD1FIRST = $0004; // if set means display field1 first, else display field2 first. + {$EXTERNALSYM AM_VIDEO_FLAG_FIELD1FIRST} + // this bit is irrelavant for 1FieldPerSample mode + AM_VIDEO_FLAG_WEAVE = $0008; // if set use bob display mode else weave + {$EXTERNALSYM AM_VIDEO_FLAG_WEAVE} + AM_VIDEO_FLAG_IPB_MASK = $0030; // use this mask to check whether the sample is I, P or B + {$EXTERNALSYM AM_VIDEO_FLAG_IPB_MASK} + AM_VIDEO_FLAG_I_SAMPLE = $0000; // I Sample (remember to use AM_VIDEO_FLAG_IPB_MASK when using this) + {$EXTERNALSYM AM_VIDEO_FLAG_I_SAMPLE} + AM_VIDEO_FLAG_P_SAMPLE = $0010; // P Sample (remember to use AM_VIDEO_FLAG_IPB_MASK when using this) + {$EXTERNALSYM AM_VIDEO_FLAG_P_SAMPLE} + AM_VIDEO_FLAG_B_SAMPLE = $0020; // B Sample (remember to use AM_VIDEO_FLAG_IPB_MASK when using this) + {$EXTERNALSYM AM_VIDEO_FLAG_B_SAMPLE} + AM_VIDEO_FLAG_REPEAT_FIELD = $0040; // if set means display the field which has been displayed first again after displaying + {$EXTERNALSYM AM_VIDEO_FLAG_REPEAT_FIELD} + // both fields first. This bit is irrelavant for 1FieldPerSample mode +// ----------------------------------------------------------------------- +// AM_KSPROPSETID_DvdKaraoke property set definitions +// ----------------------------------------------------------------------- +type + tagAM_DvdKaraokeData = record + dwDownmix : DWORD; // bitwise OR of AM_DvdKaraoke_Downmix flags + dwSpeakerAssignment : DWORD; // AM_DvdKaraoke_SpeakerAssignment + end; + {$EXTERNALSYM tagAM_DvdKaraokeData} + AM_DvdKaraokeData = tagAM_DvdKaraokeData; + {$EXTERNALSYM AM_DvdKaraokeData} + TAMDvdKaraokeData = tagAM_DvdKaraokeData; + + AM_PROPERTY_DVDKARAOKE = ( + AM_PROPERTY_DVDKARAOKE_ENABLE, // BOOL + AM_PROPERTY_DVDKARAOKE_DATA + ); + {$EXTERNALSYM AM_PROPERTY_DVDKARAOKE} + TAMPropertyDVDKaraoke = AM_PROPERTY_DVDKARAOKE; + +// ----------------------------------------------------------------------- +// AM_KSPROPSETID_TSRateChange property set definitions for time stamp +// rate changes. +// ----------------------------------------------------------------------- +type + AM_PROPERTY_TS_RATE_CHANGE = ( + {$IFNDEF COMPILER6_UP} + AM_RATE_INVALID_0, + AM_RATE_SimpleRateChange, // rw, use AM_SimpleRateChange + AM_RATE_ExactRateChange, // rw, use AM_ExactRateChange + AM_RATE_MaxFullDataRate, // r, use AM_MaxFullDataRate + AM_RATE_Step, // w, use AM_Step + AM_RATE_UseRateVersion, // w, use WORD + AM_RATE_QueryFullFrameRate, // r, use AM_QueryRate + AM_RATE_QueryLastRateSegPTS, // r, use REFERENCE_TIME + AM_RATE_CorrectTS // w, use LONG + {$ELSE} + AM_RATE_SimpleRateChange = 1, // rw, use AM_SimpleRateChange + AM_RATE_ExactRateChange = 2, // rw, use AM_ExactRateChange + AM_RATE_MaxFullDataRate = 3, // r, use AM_MaxFullDataRate + AM_RATE_Step = 4, // w, use AM_Step + AM_RATE_UseRateVersion = 5, // w, use WORD + AM_RATE_QueryFullFrameRate = 6, // r, use AM_QueryRate + AM_RATE_QueryLastRateSegPTS = 7, // r, use REFERENCE_TIME + AM_RATE_CorrectTS = 8 // w, use LONG + {$ENDIF} + ); + {$EXTERNALSYM AM_PROPERTY_TS_RATE_CHANGE} + TAMPropertyTSRateChange = AM_PROPERTY_TS_RATE_CHANGE; + +// ------------------------------------------------------------------- +// AM_KSPROPSETID_DVD_RateChange property set definitions for new DVD +// rate change scheme. +// ------------------------------------------------------------------- + + AM_PROPERTY_DVD_RATE_CHANGE = ( + {$IFNDEF COMPILER6_UP} + AM_RATE_INVALID__0, + AM_RATE_ChangeRate, // w, use AM_DVD_ChangeRate + AM_RATE_FullDataRateMax, // r, use AM_MaxFullDataRate + AM_RATE_ReverseDecode, // r, use LONG + AM_RATE_DecoderPosition, // r, use AM_DVD_DecoderPosition + AM_RATE_DecoderVersion // r, use LONG + {$ELSE} + AM_RATE_ChangeRate = 1, // w, use AM_DVD_ChangeRate + AM_RATE_FullDataRateMax = 2, // r, use AM_MaxFullDataRate + AM_RATE_ReverseDecode = 3, // r, use LONG + AM_RATE_DecoderPosition = 4, // r, use AM_DVD_DecoderPosition + AM_RATE_DecoderVersion = 5 // r, use LONG + {$ENDIF} + ); + {$EXTERNALSYM AM_PROPERTY_DVD_RATE_CHANGE} + TAMPropertyDVDRateChange = AM_PROPERTY_DVD_RATE_CHANGE; + + AM_SimpleRateChange = record + // this is the simplest mechinism to set a time stamp rate change on + // a filter (simplest for the person setting the rate change, harder + // for the filter doing the rate change). + StartTime: TReferenceTime; //stream time at which to start this rate + Rate: Longint; //new rate * 10000 (decimal) + end; + {$EXTERNALSYM AM_SimpleRateChange} + TAMSimpleRateChange = AM_SimpleRateChange; + + AM_QueryRate = record + lMaxForwardFullFrame: LongInt; // rate * 10000 + lMaxReverseFullFrame: LongInt; // rate * 10000 + end; + {$EXTERNALSYM AM_QueryRate} + TAMQueryRate = AM_QueryRate; + + AM_ExactRateChange = record + OutputZeroTime: TReferenceTime; //input TS that maps to zero output TS + Rate: Longint; //new rate * 10000 (decimal) + end; + {$EXTERNALSYM AM_ExactRateChange} + TAMExactRateChange = AM_ExactRateChange; + + AM_MaxFullDateRate = {$IFDEF TYPE_IDENTITY}type {$ENDIF} Longint; //rate * 10000 (decimal) + {$EXTERNALSYM AM_MaxFullDateRate} + + AM_Step = {$IFDEF TYPE_IDENTITY}type {$ENDIF} DWORD; // number of frame to step + {$EXTERNALSYM AM_Step} + + // New rate change property set, structs. enums etc. + AM_DVD_ChangeRate = record + StartInTime : TReferenceTime; // stream time (input) at which to start decoding at this rate + StartOutTime : TReferenceTime; // reference time (output) at which to start showing at this rate + Rate : Longint; // new rate * 10000 (decimal) + end; + {$EXTERNALSYM AM_DVD_ChangeRate} + TAMDVDChangeRate = AM_DVD_ChangeRate; + + AM_DVD_DecoderPosition = {$IFDEF TYPE_IDENTITY}type {$ENDIF} int64 ; + {$EXTERNALSYM AM_DVD_DecoderPosition} + + DVD_PLAY_DIRECTION = ( + DVD_DIR_FORWARD, + DVD_DIR_BACKWARD + ); + {$EXTERNALSYM DVD_PLAY_DIRECTION} + TDVDPlayDirection = DVD_PLAY_DIRECTION; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: activecf.h + * + ***************************************************************************) + +const + CFSTR_VFW_FILTERLIST = 'Video for Windows 4 Filters'; + {$EXTERNALSYM CFSTR_VFW_FILTERLIST} + +type + tagVFW_FILTERLIST = record + cFilters: UINT; // number of CLSIDs in aClsId + aClsId: array[0..0] of TGUID; // ClsId of each filter + end; + {$EXTERNALSYM tagVFW_FILTERLIST} + VFW_FILTERLIST = tagVFW_FILTERLIST; + {$EXTERNALSYM VFW_FILTERLIST} + TVFWFilterList = tagVFW_FILTERLIST; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: vfwmsgs.h + * + ***************************************************************************) + +const +// +// Define the severity codes +// + + VFW_E_INVALIDMEDIATYPE = HResult($80040200); + {$EXTERNALSYM VFW_E_INVALIDMEDIATYPE} + VFW_E_INVALIDSUBTYPE = HResult($80040201); + {$EXTERNALSYM VFW_E_INVALIDSUBTYPE} + VFW_E_NEED_OWNER = HResult($80040202); + {$EXTERNALSYM VFW_E_NEED_OWNER} + VFW_E_ENUM_OUT_OF_SYNC = HResult($80040203); + {$EXTERNALSYM VFW_E_ENUM_OUT_OF_SYNC} + VFW_E_ALREADY_CONNECTED = HResult($80040204); + {$EXTERNALSYM VFW_E_ALREADY_CONNECTED} + VFW_E_FILTER_ACTIVE = HResult($80040205); + {$EXTERNALSYM VFW_E_FILTER_ACTIVE} + VFW_E_NO_TYPES = HResult($80040206); + {$EXTERNALSYM VFW_E_NO_TYPES} + VFW_E_NO_ACCEPTABLE_TYPES = HResult($80040207); + {$EXTERNALSYM VFW_E_NO_ACCEPTABLE_TYPES} + VFW_E_INVALID_DIRECTION = HResult($80040208); + {$EXTERNALSYM VFW_E_INVALID_DIRECTION} + VFW_E_NOT_CONNECTED = HResult($80040209); + {$EXTERNALSYM VFW_E_NOT_CONNECTED} + VFW_E_NO_ALLOCATOR = HResult($8004020A); + {$EXTERNALSYM VFW_E_NO_ALLOCATOR} + VFW_E_RUNTIME_ERROR = HResult($8004020B); + {$EXTERNALSYM VFW_E_RUNTIME_ERROR} + VFW_E_BUFFER_NOTSET = HResult($8004020C); + {$EXTERNALSYM VFW_E_BUFFER_NOTSET} + VFW_E_BUFFER_OVERFLOW = HResult($8004020D); + {$EXTERNALSYM VFW_E_BUFFER_OVERFLOW} + VFW_E_BADALIGN = HResult($8004020E); + {$EXTERNALSYM VFW_E_BADALIGN} + VFW_E_ALREADY_COMMITTED = HResult($8004020F); + {$EXTERNALSYM VFW_E_ALREADY_COMMITTED} + VFW_E_BUFFERS_OUTSTANDING = HResult($80040210); + {$EXTERNALSYM VFW_E_BUFFERS_OUTSTANDING} + VFW_E_NOT_COMMITTED = HResult($80040211); + {$EXTERNALSYM VFW_E_NOT_COMMITTED} + VFW_E_SIZENOTSET = HResult($80040212); + {$EXTERNALSYM VFW_E_SIZENOTSET} + VFW_E_NO_CLOCK = HResult($80040213); + {$EXTERNALSYM VFW_E_NO_CLOCK} + VFW_E_NO_SINK = HResult($80040214); + {$EXTERNALSYM VFW_E_NO_SINK} + VFW_E_NO_INTERFACE = HResult($80040215); + {$EXTERNALSYM VFW_E_NO_INTERFACE} + VFW_E_NOT_FOUND = HResult($80040216); + {$EXTERNALSYM VFW_E_NOT_FOUND} + VFW_E_CANNOT_CONNECT = HResult($80040217); + {$EXTERNALSYM VFW_E_CANNOT_CONNECT} + VFW_E_CANNOT_RENDER = HResult($80040218); + {$EXTERNALSYM VFW_E_CANNOT_RENDER} + VFW_E_CHANGING_FORMAT = HResult($80040219); + {$EXTERNALSYM VFW_E_CHANGING_FORMAT} + VFW_E_NO_COLOR_KEY_SET = HResult($8004021A); + {$EXTERNALSYM VFW_E_NO_COLOR_KEY_SET} + VFW_E_NOT_OVERLAY_CONNECTION = HResult($8004021B); + {$EXTERNALSYM VFW_E_NOT_OVERLAY_CONNECTION} + VFW_E_NOT_SAMPLE_CONNECTION = HResult($8004021C); + {$EXTERNALSYM VFW_E_NOT_SAMPLE_CONNECTION} + VFW_E_PALETTE_SET = HResult($8004021D); + {$EXTERNALSYM VFW_E_PALETTE_SET} + VFW_E_COLOR_KEY_SET = HResult($8004021E); + {$EXTERNALSYM VFW_E_COLOR_KEY_SET} + VFW_E_NO_COLOR_KEY_FOUND = HResult($8004021F); + {$EXTERNALSYM VFW_E_NO_COLOR_KEY_FOUND} + VFW_E_NO_PALETTE_AVAILABLE = HResult($80040220); + {$EXTERNALSYM VFW_E_NO_PALETTE_AVAILABLE} + VFW_E_NO_DISPLAY_PALETTE = HResult($80040221); + {$EXTERNALSYM VFW_E_NO_DISPLAY_PALETTE} + VFW_E_TOO_MANY_COLORS = HResult($80040222); + {$EXTERNALSYM VFW_E_TOO_MANY_COLORS} + VFW_E_STATE_CHANGED = HResult($80040223); + {$EXTERNALSYM VFW_E_STATE_CHANGED} + VFW_E_NOT_STOPPED = HResult($80040224); + {$EXTERNALSYM VFW_E_NOT_STOPPED} + VFW_E_NOT_PAUSED = HResult($80040225); + {$EXTERNALSYM VFW_E_NOT_PAUSED} + VFW_E_NOT_RUNNING = HResult($80040226); + {$EXTERNALSYM VFW_E_NOT_RUNNING} + VFW_E_WRONG_STATE = HResult($80040227); + {$EXTERNALSYM VFW_E_WRONG_STATE} + VFW_E_START_TIME_AFTER_END = HResult($80040228); + {$EXTERNALSYM VFW_E_START_TIME_AFTER_END} + VFW_E_INVALID_RECT = HResult($80040229); + {$EXTERNALSYM VFW_E_INVALID_RECT} + VFW_E_TYPE_NOT_ACCEPTED = HResult($8004022A); + {$EXTERNALSYM VFW_E_TYPE_NOT_ACCEPTED} + VFW_E_SAMPLE_REJECTED = HResult($8004022B); + {$EXTERNALSYM VFW_E_SAMPLE_REJECTED} + VFW_E_SAMPLE_REJECTED_EOS = HResult($8004022C); + {$EXTERNALSYM VFW_E_SAMPLE_REJECTED_EOS} + VFW_E_DUPLICATE_NAME = HResult($8004022D); + {$EXTERNALSYM VFW_E_DUPLICATE_NAME} + VFW_S_DUPLICATE_NAME = HResult($0004022D); + {$EXTERNALSYM VFW_S_DUPLICATE_NAME} + VFW_E_TIMEOUT = HResult($8004022E); + {$EXTERNALSYM VFW_E_TIMEOUT} + VFW_E_INVALID_FILE_FORMAT = HResult($8004022F); + {$EXTERNALSYM VFW_E_INVALID_FILE_FORMAT} + VFW_E_ENUM_OUT_OF_RANGE = HResult($80040230); + {$EXTERNALSYM VFW_E_ENUM_OUT_OF_RANGE} + VFW_E_CIRCULAR_GRAPH = HResult($80040231); + {$EXTERNALSYM VFW_E_CIRCULAR_GRAPH} + VFW_E_NOT_ALLOWED_TO_SAVE = HResult($80040232); + {$EXTERNALSYM VFW_E_NOT_ALLOWED_TO_SAVE} + VFW_E_TIME_ALREADY_PASSED = HResult($80040233); + {$EXTERNALSYM VFW_E_TIME_ALREADY_PASSED} + VFW_E_ALREADY_CANCELLED = HResult($80040234); + {$EXTERNALSYM VFW_E_ALREADY_CANCELLED} + VFW_E_CORRUPT_GRAPH_FILE = HResult($80040235); + {$EXTERNALSYM VFW_E_CORRUPT_GRAPH_FILE} + VFW_E_ADVISE_ALREADY_SET = HResult($80040236); + {$EXTERNALSYM VFW_E_ADVISE_ALREADY_SET} + VFW_S_STATE_INTERMEDIATE = HResult($00040237); + {$EXTERNALSYM VFW_S_STATE_INTERMEDIATE} + VFW_E_NO_MODEX_AVAILABLE = HResult($80040238); + {$EXTERNALSYM VFW_E_NO_MODEX_AVAILABLE} + VFW_E_NO_ADVISE_SET = HResult($80040239); + {$EXTERNALSYM VFW_E_NO_ADVISE_SET} + VFW_E_NO_FULLSCREEN = HResult($8004023B); + {$EXTERNALSYM VFW_E_NO_FULLSCREEN} + VFW_E_UNKNOWN_FILE_TYPE = HResult($80040240); + {$EXTERNALSYM VFW_E_UNKNOWN_FILE_TYPE} + VFW_E_CANNOT_LOAD_SOURCE_FILTER = HResult($80040241); + {$EXTERNALSYM VFW_E_CANNOT_LOAD_SOURCE_FILTER} + VFW_S_PARTIAL_RENDER = HResult($00040242); + {$EXTERNALSYM VFW_S_PARTIAL_RENDER} + VFW_E_FILE_TOO_SHORT = HResult($80040243); + {$EXTERNALSYM VFW_E_FILE_TOO_SHORT} + VFW_E_INVALID_FILE_VERSION = HResult($80040244); + {$EXTERNALSYM VFW_E_INVALID_FILE_VERSION} + VFW_S_SOME_DATA_IGNORED = HResult($00040245); + {$EXTERNALSYM VFW_S_SOME_DATA_IGNORED} + VFW_S_CONNECTIONS_DEFERRED = HResult($00040246); + {$EXTERNALSYM VFW_S_CONNECTIONS_DEFERRED} + VFW_E_INVALID_CLSID = HResult($80040247); + {$EXTERNALSYM VFW_E_INVALID_CLSID} + VFW_E_INVALID_MEDIA_TYPE = HResult($80040248); + {$EXTERNALSYM VFW_E_INVALID_MEDIA_TYPE} + VFW_E_BAD_KEY = HResult($800403F2); + {$EXTERNALSYM VFW_E_BAD_KEY} + VFW_S_NO_MORE_ITEMS = HResult($00040103); + {$EXTERNALSYM VFW_S_NO_MORE_ITEMS} + VFW_E_SAMPLE_TIME_NOT_SET = HResult($80040249); + {$EXTERNALSYM VFW_E_SAMPLE_TIME_NOT_SET} + VFW_S_RESOURCE_NOT_NEEDED = HResult($00040250); + {$EXTERNALSYM VFW_S_RESOURCE_NOT_NEEDED} + VFW_E_MEDIA_TIME_NOT_SET = HResult($80040251); + {$EXTERNALSYM VFW_E_MEDIA_TIME_NOT_SET} + VFW_E_NO_TIME_FORMAT_SET = HResult($80040252); + {$EXTERNALSYM VFW_E_NO_TIME_FORMAT_SET} + VFW_E_MONO_AUDIO_HW = HResult($80040253); + {$EXTERNALSYM VFW_E_MONO_AUDIO_HW} + VFW_S_MEDIA_TYPE_IGNORED = HResult($00040254); + {$EXTERNALSYM VFW_S_MEDIA_TYPE_IGNORED} + VFW_E_NO_AUDIO_HARDWARE = HResult($80040256); + {$EXTERNALSYM VFW_E_NO_AUDIO_HARDWARE} + VFW_S_VIDEO_NOT_RENDERED = HResult($00040257); + {$EXTERNALSYM VFW_S_VIDEO_NOT_RENDERED} + VFW_S_AUDIO_NOT_RENDERED = HResult($00040258); + {$EXTERNALSYM VFW_S_AUDIO_NOT_RENDERED} + VFW_E_RPZA = HResult($80040259); + {$EXTERNALSYM VFW_E_RPZA} + VFW_S_RPZA = HResult($0004025A); + {$EXTERNALSYM VFW_S_RPZA} + VFW_E_PROCESSOR_NOT_SUITABLE = HResult($8004025B); + {$EXTERNALSYM VFW_E_PROCESSOR_NOT_SUITABLE} + VFW_E_UNSUPPORTED_AUDIO = HResult($8004025C); + {$EXTERNALSYM VFW_E_UNSUPPORTED_AUDIO} + VFW_E_UNSUPPORTED_VIDEO = HResult($8004025D); + {$EXTERNALSYM VFW_E_UNSUPPORTED_VIDEO} + VFW_E_MPEG_NOT_CONSTRAINED = HResult($8004025E); + {$EXTERNALSYM VFW_E_MPEG_NOT_CONSTRAINED} + VFW_E_NOT_IN_GRAPH = HResult($8004025F); + {$EXTERNALSYM VFW_E_NOT_IN_GRAPH} + VFW_S_ESTIMATED = HResult($00040260); + {$EXTERNALSYM VFW_S_ESTIMATED} + VFW_E_NO_TIME_FORMAT = HResult($80040261); + {$EXTERNALSYM VFW_E_NO_TIME_FORMAT} + VFW_E_READ_ONLY = HResult($80040262); + {$EXTERNALSYM VFW_E_READ_ONLY} + VFW_S_RESERVED = HResult($00040263); + {$EXTERNALSYM VFW_S_RESERVED} + VFW_E_BUFFER_UNDERFLOW = HResult($80040264); + {$EXTERNALSYM VFW_E_BUFFER_UNDERFLOW} + VFW_E_UNSUPPORTED_STREAM = HResult($80040265); + {$EXTERNALSYM VFW_E_UNSUPPORTED_STREAM} + VFW_E_NO_TRANSPORT = HResult($80040266); + {$EXTERNALSYM VFW_E_NO_TRANSPORT} + VFW_S_STREAM_OFF = HResult($00040267); + {$EXTERNALSYM VFW_S_STREAM_OFF} + VFW_S_CANT_CUE = HResult($00040268); + {$EXTERNALSYM VFW_S_CANT_CUE} + VFW_E_BAD_VIDEOCD = HResult($80040269); + {$EXTERNALSYM VFW_E_BAD_VIDEOCD} + VFW_S_NO_STOP_TIME = HResult($00040270); + {$EXTERNALSYM VFW_S_NO_STOP_TIME} + VFW_E_OUT_OF_VIDEO_MEMORY = HResult($80040271); + {$EXTERNALSYM VFW_E_OUT_OF_VIDEO_MEMORY} + VFW_E_VP_NEGOTIATION_FAILED = HResult($80040272); + {$EXTERNALSYM VFW_E_VP_NEGOTIATION_FAILED} + VFW_E_DDRAW_CAPS_NOT_SUITABLE = HResult($80040273); + {$EXTERNALSYM VFW_E_DDRAW_CAPS_NOT_SUITABLE} + VFW_E_NO_VP_HARDWARE = HResult($80040274); + {$EXTERNALSYM VFW_E_NO_VP_HARDWARE} + VFW_E_NO_CAPTURE_HARDWARE = HResult($80040275); + {$EXTERNALSYM VFW_E_NO_CAPTURE_HARDWARE} + VFW_E_DVD_OPERATION_INHIBITED = HResult($80040276); + {$EXTERNALSYM VFW_E_DVD_OPERATION_INHIBITED} + VFW_E_DVD_INVALIDDOMAIN = HResult($80040277); + {$EXTERNALSYM VFW_E_DVD_INVALIDDOMAIN} + VFW_E_DVD_NO_BUTTON = Hresult($80040278); + {$EXTERNALSYM VFW_E_DVD_NO_BUTTON} + VFW_E_DVD_GRAPHNOTREADY = HResult($80040279); + {$EXTERNALSYM VFW_E_DVD_GRAPHNOTREADY} + VFW_E_DVD_RENDERFAIL = HResult($8004027A); + {$EXTERNALSYM VFW_E_DVD_RENDERFAIL} + VFW_E_DVD_DECNOTENOUGH = HResult($8004027B); + {$EXTERNALSYM VFW_E_DVD_DECNOTENOUGH} + VFW_E_DDRAW_VERSION_NOT_SUITABLE = HResult($8004027C); + {$EXTERNALSYM VFW_E_DDRAW_VERSION_NOT_SUITABLE} + VFW_E_COPYPROT_FAILED = HResult($8004027D); + {$EXTERNALSYM VFW_E_COPYPROT_FAILED} + VFW_S_NOPREVIEWPIN = HResult($0004027E); + {$EXTERNALSYM VFW_S_NOPREVIEWPIN} + VFW_E_TIME_EXPIRED = HResult($8004027F); + {$EXTERNALSYM VFW_E_TIME_EXPIRED} + VFW_S_DVD_NON_ONE_SEQUENTIAL = HResult($00040280); + {$EXTERNALSYM VFW_S_DVD_NON_ONE_SEQUENTIAL} + VFW_E_DVD_WRONG_SPEED = HResult($80040281); + {$EXTERNALSYM VFW_E_DVD_WRONG_SPEED} + VFW_E_DVD_MENU_DOES_NOT_EXIST = HResult($80040282); + {$EXTERNALSYM VFW_E_DVD_MENU_DOES_NOT_EXIST} + VFW_E_DVD_CMD_CANCELLED = HResult($80040283); + {$EXTERNALSYM VFW_E_DVD_CMD_CANCELLED} + VFW_E_DVD_STATE_WRONG_VERSION = HResult($80040284); + {$EXTERNALSYM VFW_E_DVD_STATE_WRONG_VERSION} + VFW_E_DVD_STATE_CORRUPT = HResult($80040285); + {$EXTERNALSYM VFW_E_DVD_STATE_CORRUPT} + VFW_E_DVD_STATE_WRONG_DISC = HResult($80040286); + {$EXTERNALSYM VFW_E_DVD_STATE_WRONG_DISC} + VFW_E_DVD_INCOMPATIBLE_REGION = HResult($80040287); + {$EXTERNALSYM VFW_E_DVD_INCOMPATIBLE_REGION} + VFW_E_DVD_NO_ATTRIBUTES = HResult($80040288); + {$EXTERNALSYM VFW_E_DVD_NO_ATTRIBUTES} + VFW_E_DVD_NO_GOUP_PGC = HResult($80040289); + {$EXTERNALSYM VFW_E_DVD_NO_GOUP_PGC} + VFW_E_DVD_LOW_PARENTAL_LEVEL = HResult($8004028A); + {$EXTERNALSYM VFW_E_DVD_LOW_PARENTAL_LEVEL} + VFW_E_DVD_NOT_IN_KARAOKE_MODE = HResult($8004028B); + {$EXTERNALSYM VFW_E_DVD_NOT_IN_KARAOKE_MODE} + VFW_S_DVD_CHANNEL_CONTENTS_NOT_AVAILABLE = HResult($0004028C); + {$EXTERNALSYM VFW_S_DVD_CHANNEL_CONTENTS_NOT_AVAILABLE} + VFW_S_DVD_NOT_ACCURATE = HResult($0004028D); + {$EXTERNALSYM VFW_S_DVD_NOT_ACCURATE} + VFW_E_FRAME_STEP_UNSUPPORTED = HResult($8004028E); + {$EXTERNALSYM VFW_E_FRAME_STEP_UNSUPPORTED} + VFW_E_DVD_STREAM_DISABLED = HResult($8004028F); + {$EXTERNALSYM VFW_E_DVD_STREAM_DISABLED} + VFW_E_DVD_TITLE_UNKNOWN = HResult($80040290); + {$EXTERNALSYM VFW_E_DVD_TITLE_UNKNOWN} + VFW_E_DVD_INVALID_DISC = HResult($80040291); + {$EXTERNALSYM VFW_E_DVD_INVALID_DISC} + VFW_E_DVD_NO_RESUME_INFORMATION = HResult($80040292); + {$EXTERNALSYM VFW_E_DVD_NO_RESUME_INFORMATION} + VFW_E_PIN_ALREADY_BLOCKED_ON_THIS_THREAD = HResult($80040293); + {$EXTERNALSYM VFW_E_PIN_ALREADY_BLOCKED_ON_THIS_THREAD} + VFW_E_PIN_ALREADY_BLOCKED = HResult($80040294); + {$EXTERNALSYM VFW_E_PIN_ALREADY_BLOCKED} + VFW_E_CERTIFICATION_FAILURE = HResult($80040295); + {$EXTERNALSYM VFW_E_CERTIFICATION_FAILURE} + VFW_E_VMR_NOT_IN_MIXER_MODE = HResult($80040296); + {$EXTERNALSYM VFW_E_VMR_NOT_IN_MIXER_MODE} + + // The application has not yet provided the VMR filter with a valid allocator-presenter object.%0 + VFW_E_VMR_NO_AP_SUPPLIED = HResult($80040297); + {$EXTERNALSYM VFW_E_VMR_NO_AP_SUPPLIED} + + // The VMR could not find any de-interlacing hardware on the current display device.%0 + VFW_E_VMR_NO_DEINTERLACE_HW = HResult($80040298); + {$EXTERNALSYM VFW_E_VMR_NO_DEINTERLACE_HW} + + // The VMR could not find any ProcAmp hardware on the current display device.%0 + VFW_E_VMR_NO_PROCAMP_HW = HResult($80040299); + {$EXTERNALSYM VFW_E_VMR_NO_PROCAMP_HW} + + // VMR9 does not work with VPE-based hardware decoders.%0 + VFW_E_DVD_VMR9_INCOMPATIBLEDEC = HResult($8004029A); + {$EXTERNALSYM VFW_E_DVD_VMR9_INCOMPATIBLEDEC} + + // The current display device does not support Content Output Protection Protocol (COPP) H/W.%0 + VFW_E_NO_COPP_HW = HRESULT($8004029B); + {$EXTERNALSYM VFW_E_NO_COPP_HW} + + E_PROP_SET_UNSUPPORTED = HResult($80070492); + {$EXTERNALSYM E_PROP_SET_UNSUPPORTED} + E_PROP_ID_UNSUPPORTED = HResult($80070490); + {$EXTERNALSYM E_PROP_ID_UNSUPPORTED} + + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * Files: edevdefs.h + * XPrtDefs.h (derived from edevdefs.h) + * + ***************************************************************************) + +const + ED_BASE = $1000; + {$EXTERNALSYM ED_BASE} + +// this is used to tell the device communications object which +// physical communications port to use. + DEV_PORT_SIM = 1; + {$EXTERNALSYM DEV_PORT_SIM} + DEV_PORT_COM1 = 2; // standard serial ports + {$EXTERNALSYM DEV_PORT_COM1} + DEV_PORT_COM2 = 3; + {$EXTERNALSYM DEV_PORT_COM2} + DEV_PORT_COM3 = 4; + {$EXTERNALSYM DEV_PORT_COM3} + DEV_PORT_COM4 = 5; + {$EXTERNALSYM DEV_PORT_COM4} + DEV_PORT_DIAQ = 6; // Diaquest driver + {$EXTERNALSYM DEV_PORT_DIAQ} + DEV_PORT_ARTI = 7; // ARTI driver + {$EXTERNALSYM DEV_PORT_ARTI} + DEV_PORT_1394 = 8; // IEEE 1394 Serial Bus + {$EXTERNALSYM DEV_PORT_1394} + DEV_PORT_USB = 9; // Universal Serial Bus + {$EXTERNALSYM DEV_PORT_USB} + DEV_PORT_MIN = DEV_PORT_SIM; + {$EXTERNALSYM DEV_PORT_MIN} + DEV_PORT_MAX = DEV_PORT_USB; + {$EXTERNALSYM DEV_PORT_MAX} + +// IAMExtDevice Capability Items: unless otherwise specified, these items return +// OATRUE or OAFALSE. All return values are in pdwValue unless otherwise specified: + + ED_DEVCAP_CAN_RECORD = ED_BASE+1; + {$EXTERNALSYM ED_DEVCAP_CAN_RECORD} + ED_DEVCAP_CAN_RECORD_STROBE = ED_BASE+2; + {$EXTERNALSYM ED_DEVCAP_CAN_RECORD_STROBE} + ED_DEVCAP_HAS_AUDIO = ED_BASE+3; + {$EXTERNALSYM ED_DEVCAP_HAS_AUDIO} + ED_DEVCAP_HAS_VIDEO = ED_BASE+4; + {$EXTERNALSYM ED_DEVCAP_HAS_VIDEO} + ED_DEVCAP_USES_FILES = ED_BASE+5; + {$EXTERNALSYM ED_DEVCAP_USES_FILES} + ED_DEVCAP_CAN_SAVE = ED_BASE+6; + {$EXTERNALSYM ED_DEVCAP_CAN_SAVE} + ED_DEVCAP_DEVICE_TYPE = ED_BASE+7; + {$EXTERNALSYM ED_DEVCAP_DEVICE_TYPE} + ED_DEVTYPE_VCR = ED_BASE+8; + {$EXTERNALSYM ED_DEVTYPE_VCR} + ED_DEVTYPE_LASERDISK = ED_BASE+9; + {$EXTERNALSYM ED_DEVTYPE_LASERDISK} + ED_DEVTYPE_ATR = ED_BASE+10; + {$EXTERNALSYM ED_DEVTYPE_ATR} + ED_DEVTYPE_DDR = ED_BASE+11; + {$EXTERNALSYM ED_DEVTYPE_DDR} + ED_DEVTYPE_ROUTER = ED_BASE+12; + {$EXTERNALSYM ED_DEVTYPE_ROUTER} + ED_DEVTYPE_KEYER = ED_BASE+13; + {$EXTERNALSYM ED_DEVTYPE_KEYER} + ED_DEVTYPE_MIXER_VIDEO = ED_BASE+14; + {$EXTERNALSYM ED_DEVTYPE_MIXER_VIDEO} + ED_DEVTYPE_DVE = ED_BASE+15; + {$EXTERNALSYM ED_DEVTYPE_DVE} + ED_DEVTYPE_WIPEGEN = ED_BASE+16; + {$EXTERNALSYM ED_DEVTYPE_WIPEGEN} + ED_DEVTYPE_MIXER_AUDIO = ED_BASE+17; + {$EXTERNALSYM ED_DEVTYPE_MIXER_AUDIO} + ED_DEVTYPE_CG = ED_BASE+18; + {$EXTERNALSYM ED_DEVTYPE_CG} + ED_DEVTYPE_TBC = ED_BASE+19; + {$EXTERNALSYM ED_DEVTYPE_TBC} + ED_DEVTYPE_TCG = ED_BASE+20; + {$EXTERNALSYM ED_DEVTYPE_TCG} + ED_DEVTYPE_GPI = ED_BASE+21; + {$EXTERNALSYM ED_DEVTYPE_GPI} + ED_DEVTYPE_JOYSTICK = ED_BASE+22; + {$EXTERNALSYM ED_DEVTYPE_JOYSTICK} + ED_DEVTYPE_KEYBOARD = ED_BASE+23; + {$EXTERNALSYM ED_DEVTYPE_KEYBOARD} + +// returns mfr-specific ID from external device. + ED_DEVCAP_EXTERNAL_DEVICE_ID = ED_BASE+24; + {$EXTERNALSYM ED_DEVCAP_EXTERNAL_DEVICE_ID} + + ED_DEVCAP_TIMECODE_READ = ED_BASE+25; + {$EXTERNALSYM ED_DEVCAP_TIMECODE_READ} + ED_DEVCAP_TIMECODE_WRITE = ED_BASE+26; + {$EXTERNALSYM ED_DEVCAP_TIMECODE_WRITE} +// used for seekable non-timecode enabled devices + ED_DEVCAP_CTLTRK_READ = ED_BASE+27; + {$EXTERNALSYM ED_DEVCAP_CTLTRK_READ} +// used for seekable non-timecode enabled devices + ED_DEVCAP_INDEX_READ = ED_BASE+28; + {$EXTERNALSYM ED_DEVCAP_INDEX_READ} + +// returns device preroll time in current time format + ED_DEVCAP_PREROLL = ED_BASE+29; + {$EXTERNALSYM ED_DEVCAP_PREROLL} +// returns device postroll time in current time format + ED_DEVCAP_POSTROLL = ED_BASE+30; + {$EXTERNALSYM ED_DEVCAP_POSTROLL} + +// returns indication of device’s synchronization accuracy. + ED_DEVCAP_SYNC_ACCURACY = ED_BASE+31; + {$EXTERNALSYM ED_DEVCAP_SYNC_ACCURACY} + ED_SYNCACC_PRECISE = ED_BASE+32; + {$EXTERNALSYM ED_SYNCACC_PRECISE} + ED_SYNCACC_FRAME = ED_BASE+33; + {$EXTERNALSYM ED_SYNCACC_FRAME} + ED_SYNCACC_ROUGH = ED_BASE+34; + {$EXTERNALSYM ED_SYNCACC_ROUGH} + +// returns device’s normal framerate. + ED_DEVCAP_NORMAL_RATE = ED_BASE+35; + {$EXTERNALSYM ED_DEVCAP_NORMAL_RATE} + ED_RATE_24 = ED_BASE+36; + {$EXTERNALSYM ED_RATE_24} + ED_RATE_25 = ED_BASE+37; + {$EXTERNALSYM ED_RATE_25} + ED_RATE_2997 = ED_BASE+38; + {$EXTERNALSYM ED_RATE_2997} + ED_RATE_30 = ED_BASE+39; + {$EXTERNALSYM ED_RATE_30} + + ED_DEVCAP_CAN_PREVIEW = ED_BASE+40; + {$EXTERNALSYM ED_DEVCAP_CAN_PREVIEW} + ED_DEVCAP_CAN_MONITOR_SOURCES = ED_BASE+41; + {$EXTERNALSYM ED_DEVCAP_CAN_MONITOR_SOURCES} + +// indicates implementation allows testing of methods/parameters by +// setting the hi bit of a parm that makes sense - see individual methods +// for details. + ED_DEVCAP_CAN_TEST = ED_BASE+42; + {$EXTERNALSYM ED_DEVCAP_CAN_TEST} + +// indicates device accepts video as an input. + ED_DEVCAP_VIDEO_INPUTS = ED_BASE+43; + {$EXTERNALSYM ED_DEVCAP_VIDEO_INPUTS} + +// indicates device accepts audio as an input. + ED_DEVCAP_AUDIO_INPUTS = ED_BASE+44; + {$EXTERNALSYM ED_DEVCAP_AUDIO_INPUTS} + + ED_DEVCAP_NEEDS_CALIBRATING = ED_BASE+45; + {$EXTERNALSYM ED_DEVCAP_NEEDS_CALIBRATING} + + ED_DEVCAP_SEEK_TYPE = ED_BASE+46; + {$EXTERNALSYM ED_DEVCAP_SEEK_TYPE} + ED_SEEK_PERFECT = ED_BASE+47; + {$EXTERNALSYM ED_SEEK_PERFECT} + ED_SEEK_FAST = ED_BASE+48; + {$EXTERNALSYM ED_SEEK_FAST} + ED_SEEK_SLOW = ED_BASE+49; + {$EXTERNALSYM ED_SEEK_SLOW} + + ED_POWER_ON = ED_BASE+50; + {$EXTERNALSYM ED_POWER_ON} + ED_POWER_OFF = ED_BASE+51; + {$EXTERNALSYM ED_POWER_OFF} + ED_POWER_STANDBY = ED_BASE+52; + {$EXTERNALSYM ED_POWER_STANDBY} + + ED_POWER_DEVICE_DEPENDENT = ED_BASE+1033; // Power is on with limited functions + {$EXTERNALSYM ED_POWER_DEVICE_DEPENDENT} + + ED_ACTIVE = ED_BASE+53; + {$EXTERNALSYM ED_ACTIVE} + ED_INACTIVE = ED_BASE+54; + {$EXTERNALSYM ED_INACTIVE} + ED_ALL = ED_BASE+55; + {$EXTERNALSYM ED_ALL} + ED_TEST = ED_BASE+56; + {$EXTERNALSYM ED_TEST} + +// IAMExtTransport Capability Items: unless otherwise specified, these items return +// OATRUE or OAFALSE. All return values are in pdwValue unless otherwise specified: + + ED_TRANSCAP_CAN_EJECT = ED_BASE+100; + {$EXTERNALSYM ED_TRANSCAP_CAN_EJECT} + ED_TRANSCAP_CAN_BUMP_PLAY = ED_BASE+101; + {$EXTERNALSYM ED_TRANSCAP_CAN_BUMP_PLAY} + ED_TRANSCAP_CAN_PLAY_BACKWARDS = ED_BASE+102; + {$EXTERNALSYM ED_TRANSCAP_CAN_PLAY_BACKWARDS} + ED_TRANSCAP_CAN_SET_EE = ED_BASE+103; + {$EXTERNALSYM ED_TRANSCAP_CAN_SET_EE} + ED_TRANSCAP_CAN_SET_PB = ED_BASE+104; + {$EXTERNALSYM ED_TRANSCAP_CAN_SET_PB} + ED_TRANSCAP_CAN_DELAY_VIDEO_IN = ED_BASE+105; + {$EXTERNALSYM ED_TRANSCAP_CAN_DELAY_VIDEO_IN} + ED_TRANSCAP_CAN_DELAY_VIDEO_OUT = ED_BASE+106; + {$EXTERNALSYM ED_TRANSCAP_CAN_DELAY_VIDEO_OUT} + ED_TRANSCAP_CAN_DELAY_AUDIO_IN = ED_BASE+107; + {$EXTERNALSYM ED_TRANSCAP_CAN_DELAY_AUDIO_IN} + ED_TRANSCAP_CAN_DELAY_AUDIO_OUT = ED_BASE+108; + {$EXTERNALSYM ED_TRANSCAP_CAN_DELAY_AUDIO_OUT} + ED_TRANSCAP_FWD_VARIABLE_MAX = ED_BASE+109; + {$EXTERNALSYM ED_TRANSCAP_FWD_VARIABLE_MAX} + ED_TRANSCAP_FWD_VARIABLE_MIN = ED_BASE+800; + {$EXTERNALSYM ED_TRANSCAP_FWD_VARIABLE_MIN} + ED_TRANSCAP_REV_VARIABLE_MAX = ED_BASE+110; + {$EXTERNALSYM ED_TRANSCAP_REV_VARIABLE_MAX} + ED_TRANSCAP_REV_VARIABLE_MIN = ED_BASE+801; + {$EXTERNALSYM ED_TRANSCAP_REV_VARIABLE_MIN} + ED_TRANSCAP_FWD_SHUTTLE_MAX = ED_BASE+802; + {$EXTERNALSYM ED_TRANSCAP_FWD_SHUTTLE_MAX} + ED_TRANSCAP_FWD_SHUTTLE_MIN = ED_BASE+803; + {$EXTERNALSYM ED_TRANSCAP_FWD_SHUTTLE_MIN} + ED_TRANSCAP_REV_SHUTTLE_MAX = ED_BASE+804; + {$EXTERNALSYM ED_TRANSCAP_REV_SHUTTLE_MAX} + ED_TRANSCAP_REV_SHUTTLE_MIN = ED_BASE+805; + {$EXTERNALSYM ED_TRANSCAP_REV_SHUTTLE_MIN} + ED_TRANSCAP_NUM_AUDIO_TRACKS = ED_BASE+111; + {$EXTERNALSYM ED_TRANSCAP_NUM_AUDIO_TRACKS} + ED_TRANSCAP_LTC_TRACK = ED_BASE+112; + {$EXTERNALSYM ED_TRANSCAP_LTC_TRACK} + ED_TRANSCAP_NEEDS_TBC = ED_BASE+113; + {$EXTERNALSYM ED_TRANSCAP_NEEDS_TBC} + ED_TRANSCAP_NEEDS_CUEING = ED_BASE+114; + {$EXTERNALSYM ED_TRANSCAP_NEEDS_CUEING} + ED_TRANSCAP_CAN_INSERT = ED_BASE+115; + {$EXTERNALSYM ED_TRANSCAP_CAN_INSERT} + ED_TRANSCAP_CAN_ASSEMBLE = ED_BASE+116; + {$EXTERNALSYM ED_TRANSCAP_CAN_ASSEMBLE} + ED_TRANSCAP_FIELD_STEP = ED_BASE+117; + {$EXTERNALSYM ED_TRANSCAP_FIELD_STEP} + ED_TRANSCAP_CLOCK_INC_RATE = ED_BASE+118; + {$EXTERNALSYM ED_TRANSCAP_CLOCK_INC_RATE} + ED_TRANSCAP_CAN_DETECT_LENGTH = ED_BASE+119; + {$EXTERNALSYM ED_TRANSCAP_CAN_DETECT_LENGTH} + ED_TRANSCAP_CAN_FREEZE = ED_BASE+120; + {$EXTERNALSYM ED_TRANSCAP_CAN_FREEZE} + ED_TRANSCAP_HAS_TUNER = ED_BASE+121; + {$EXTERNALSYM ED_TRANSCAP_HAS_TUNER} + ED_TRANSCAP_HAS_TIMER = ED_BASE+122; + {$EXTERNALSYM ED_TRANSCAP_HAS_TIMER} + ED_TRANSCAP_HAS_CLOCK = ED_BASE+123; + {$EXTERNALSYM ED_TRANSCAP_HAS_CLOCK} + ED_TRANSCAP_MULTIPLE_EDITS = ED_BASE+806; + {$EXTERNALSYM ED_TRANSCAP_MULTIPLE_EDITS} + ED_TRANSCAP_IS_MASTER = ED_BASE+807; + {$EXTERNALSYM ED_TRANSCAP_IS_MASTER} + ED_TRANSCAP_HAS_DT = ED_BASE+814; + {$EXTERNALSYM ED_TRANSCAP_HAS_DT} + +// IAMExtTransport Media States + ED_MEDIA_SPIN_UP = ED_BASE+130; + {$EXTERNALSYM ED_MEDIA_SPIN_UP} + ED_MEDIA_SPIN_DOWN = ED_BASE+131; + {$EXTERNALSYM ED_MEDIA_SPIN_DOWN} + ED_MEDIA_UNLOAD = ED_BASE+132; + {$EXTERNALSYM ED_MEDIA_UNLOAD} + +// IAMExtTransport Modes + ED_MODE_PLAY = ED_BASE+200; + {$EXTERNALSYM ED_MODE_PLAY} + ED_MODE_STOP = ED_BASE+201; + {$EXTERNALSYM ED_MODE_STOP} + ED_MODE_FREEZE = ED_BASE+202; + {$EXTERNALSYM ED_MODE_FREEZE} + ED_MODE_THAW = ED_BASE+203; + {$EXTERNALSYM ED_MODE_THAW} + ED_MODE_FF = ED_BASE+204; + {$EXTERNALSYM ED_MODE_FF} + ED_MODE_REW = ED_BASE+205; + {$EXTERNALSYM ED_MODE_REW} + ED_MODE_RECORD = ED_BASE+206; + {$EXTERNALSYM ED_MODE_RECORD} + ED_MODE_RECORD_STROBE = ED_BASE+207; + {$EXTERNALSYM ED_MODE_RECORD_STROBE} + ED_MODE_RECORD_FREEZE = ED_BASE+808; // never "put", only "get" + {$EXTERNALSYM ED_MODE_RECORD_FREEZE} + ED_MODE_STEP = ED_BASE+208; + {$EXTERNALSYM ED_MODE_STEP} + ED_MODE_STEP_FWD = ED_BASE+208; + {$EXTERNALSYM ED_MODE_STEP_FWD} + ED_MODE_STEP_REV = ED_BASE+809; + {$EXTERNALSYM ED_MODE_STEP_REV} + ED_MODE_SHUTTLE = ED_BASE+209; + {$EXTERNALSYM ED_MODE_SHUTTLE} + ED_MODE_EDIT_CUE = ED_BASE+210; + {$EXTERNALSYM ED_MODE_EDIT_CUE} + ED_MODE_VAR_SPEED = ED_BASE+211; + {$EXTERNALSYM ED_MODE_VAR_SPEED} + ED_MODE_PERFORM = ED_BASE+212; + {$EXTERNALSYM ED_MODE_PERFORM} + ED_MODE_LINK_ON = ED_BASE+280; + {$EXTERNALSYM ED_MODE_LINK_ON} + ED_MODE_LINK_OFF = ED_BASE+281; + {$EXTERNALSYM ED_MODE_LINK_OFF} + ED_MODE_NOTIFY_ENABLE = ED_BASE+810; + {$EXTERNALSYM ED_MODE_NOTIFY_ENABLE} + ED_MODE_NOTIFY_DISABLE = ED_BASE+811; + {$EXTERNALSYM ED_MODE_NOTIFY_DISABLE} + ED_MODE_SHOT_SEARCH = ED_BASE+812; + {$EXTERNALSYM ED_MODE_SHOT_SEARCH} + +// IAMTimecodeReader/Generator/Display defines +// +// Timecode Generator Mode params and values: +// + ED_TCG_TIMECODE_TYPE = ED_BASE+400; + {$EXTERNALSYM ED_TCG_TIMECODE_TYPE} + ED_TCG_SMPTE_LTC = ED_BASE+401; + {$EXTERNALSYM ED_TCG_SMPTE_LTC} + ED_TCG_SMPTE_VITC = ED_BASE+402; + {$EXTERNALSYM ED_TCG_SMPTE_VITC} + ED_TCG_MIDI_QF = ED_BASE+403; + {$EXTERNALSYM ED_TCG_MIDI_QF} + ED_TCG_MIDI_FULL = ED_BASE+404; + {$EXTERNALSYM ED_TCG_MIDI_FULL} + + ED_TCG_FRAMERATE = ED_BASE+405; + {$EXTERNALSYM ED_TCG_FRAMERATE} + ED_FORMAT_SMPTE_30 = ED_BASE+406; + {$EXTERNALSYM ED_FORMAT_SMPTE_30} + ED_FORMAT_SMPTE_30DROP = ED_BASE+407; + {$EXTERNALSYM ED_FORMAT_SMPTE_30DROP} + ED_FORMAT_SMPTE_25 = ED_BASE+408; + {$EXTERNALSYM ED_FORMAT_SMPTE_25} + ED_FORMAT_SMPTE_24 = ED_BASE+409; + {$EXTERNALSYM ED_FORMAT_SMPTE_24} + + ED_TCG_SYNC_SOURCE = ED_BASE+410; + {$EXTERNALSYM ED_TCG_SYNC_SOURCE} + ED_TCG_VIDEO = ED_BASE+411; + {$EXTERNALSYM ED_TCG_VIDEO} + ED_TCG_READER = ED_BASE+412; + {$EXTERNALSYM ED_TCG_READER} + ED_TCG_FREE = ED_BASE+413; + {$EXTERNALSYM ED_TCG_FREE} + + ED_TCG_REFERENCE_SOURCE = ED_BASE+414; + {$EXTERNALSYM ED_TCG_REFERENCE_SOURCE} + +// TimeCodeReader Mode params and values: + ED_TCR_SOURCE = ED_BASE+416; + {$EXTERNALSYM ED_TCR_SOURCE} +// ED_TCG (already defined) + ED_TCR_LTC = ED_BASE+417; + {$EXTERNALSYM ED_TCR_LTC} + ED_TCR_VITC = ED_BASE+418; + {$EXTERNALSYM ED_TCR_VITC} + ED_TCR_CT = ED_BASE+419; + {$EXTERNALSYM ED_TCR_CT} + ED_TCR_FTC = ED_BASE+420; + {$EXTERNALSYM ED_TCR_FTC} + +// ED_MODE_NOTIFY_ENABLE can be OATRUE or OAFALSE (defined in transport mode +// section of this file). + ED_TCR_LAST_VALUE = ED_BASE+421; + {$EXTERNALSYM ED_TCR_LAST_VALUE} + +// TimeCode Display Mode params and values: +// + ED_TCD_SOURCE = ED_BASE+422; + {$EXTERNALSYM ED_TCD_SOURCE} + ED_TCR = ED_BASE+423; + {$EXTERNALSYM ED_TCR} + ED_TCG = ED_BASE+424; + {$EXTERNALSYM ED_TCG} + + ED_TCD_SIZE = ED_BASE+425; + {$EXTERNALSYM ED_TCD_SIZE} + ED_SMALL = ED_BASE+426; + {$EXTERNALSYM ED_SMALL} + ED_MED = ED_BASE+427; + {$EXTERNALSYM ED_MED} + ED_LARGE = ED_BASE+428; + {$EXTERNALSYM ED_LARGE} + + ED_TCD_POSITION = ED_BASE+429; + {$EXTERNALSYM ED_TCD_POSITION} + ED_TOP = $0001; + {$EXTERNALSYM ED_TOP} + ED_MIDDLE = $0002; + {$EXTERNALSYM ED_MIDDLE} + ED_BOTTOM = $0004; + {$EXTERNALSYM ED_BOTTOM} + ED_LEFT = $0100; + {$EXTERNALSYM ED_LEFT} + ED_CENTER = $0200; + {$EXTERNALSYM ED_CENTER} + ED_RIGHT = $0400; + {$EXTERNALSYM ED_RIGHT} + + ED_TCD_INTENSITY = ED_BASE+436; + {$EXTERNALSYM ED_TCD_INTENSITY} + ED_HIGH = ED_BASE+437; + {$EXTERNALSYM ED_HIGH} + ED_LOW = ED_BASE+438; + {$EXTERNALSYM ED_LOW} + + ED_TCD_TRANSPARENCY = ED_BASE+439; + {$EXTERNALSYM ED_TCD_TRANSPARENCY} + ED_TCD_INVERT = ED_BASE+440; + {$EXTERNALSYM ED_TCD_INVERT} + +// IAMExtTransport defines +// +// Transport status, params and values +// + +// IAMExtTransport Status items and and values: + ED_MODE = ED_BASE+500; + {$EXTERNALSYM ED_MODE} + ED_ERROR = ED_BASE+501; + {$EXTERNALSYM ED_ERROR} + ED_LOCAL = ED_BASE+502; + {$EXTERNALSYM ED_LOCAL} + ED_RECORD_INHIBIT = ED_BASE+503; + {$EXTERNALSYM ED_RECORD_INHIBIT} + ED_SERVO_LOCK = ED_BASE+504; + {$EXTERNALSYM ED_SERVO_LOCK} + ED_MEDIA_PRESENT = ED_BASE+505; + {$EXTERNALSYM ED_MEDIA_PRESENT} + ED_MEDIA_LENGTH = ED_BASE+506; + {$EXTERNALSYM ED_MEDIA_LENGTH} + ED_MEDIA_SIZE = ED_BASE+507; + {$EXTERNALSYM ED_MEDIA_SIZE} + ED_MEDIA_TRACK_COUNT = ED_BASE+508; + {$EXTERNALSYM ED_MEDIA_TRACK_COUNT} + ED_MEDIA_TRACK_LENGTH = ED_BASE+509; + {$EXTERNALSYM ED_MEDIA_TRACK_LENGTH} + ED_MEDIA_SIDE = ED_BASE+510; + {$EXTERNALSYM ED_MEDIA_SIDE} + + ED_MEDIA_TYPE = ED_BASE+511; + {$EXTERNALSYM ED_MEDIA_TYPE} + ED_MEDIA_VHS = ED_BASE+512; + {$EXTERNALSYM ED_MEDIA_VHS} + ED_MEDIA_SVHS = ED_BASE+513; + {$EXTERNALSYM ED_MEDIA_SVHS} + ED_MEDIA_HI8 = ED_BASE+514; + {$EXTERNALSYM ED_MEDIA_HI8} + ED_MEDIA_UMATIC = ED_BASE+515; + {$EXTERNALSYM ED_MEDIA_UMATIC} + ED_MEDIA_DVC = ED_BASE+516; + {$EXTERNALSYM ED_MEDIA_DVC} + ED_MEDIA_1_INCH = ED_BASE+517; + {$EXTERNALSYM ED_MEDIA_1_INCH} + ED_MEDIA_D1 = ED_BASE+518; + {$EXTERNALSYM ED_MEDIA_D1} + ED_MEDIA_D2 = ED_BASE+519; + {$EXTERNALSYM ED_MEDIA_D2} + ED_MEDIA_D3 = ED_BASE+520; + {$EXTERNALSYM ED_MEDIA_D3} + ED_MEDIA_D5 = ED_BASE+521; + {$EXTERNALSYM ED_MEDIA_D5} + ED_MEDIA_DBETA = ED_BASE+522; + {$EXTERNALSYM ED_MEDIA_DBETA} + ED_MEDIA_BETA = ED_BASE+523; + {$EXTERNALSYM ED_MEDIA_BETA} + ED_MEDIA_8MM = ED_BASE+524; + {$EXTERNALSYM ED_MEDIA_8MM} + ED_MEDIA_DDR = ED_BASE+525; + {$EXTERNALSYM ED_MEDIA_DDR} + ED_MEDIA_SX = ED_BASE+813; + {$EXTERNALSYM ED_MEDIA_SX} + ED_MEDIA_OTHER = ED_BASE+526; + {$EXTERNALSYM ED_MEDIA_OTHER} + ED_MEDIA_CLV = ED_BASE+527; + {$EXTERNALSYM ED_MEDIA_CLV} + ED_MEDIA_CAV = ED_BASE+528; + {$EXTERNALSYM ED_MEDIA_CAV} + ED_MEDIA_POSITION = ED_BASE+529; + {$EXTERNALSYM ED_MEDIA_POSITION} + ED_MEDIA_NEO = ED_BASE+531; // Mini digital tape for MPEG2TS signal + {$EXTERNALSYM ED_MEDIA_NEO} + ED_MEDIA_MICROMV = ED_MEDIA_NEO; + {$EXTERNALSYM ED_MEDIA_MICROMV} + + ED_LINK_MODE = ED_BASE+530; + {$EXTERNALSYM ED_LINK_MODE} + +// IAMExtTransport Basic Parms + ED_TRANSBASIC_TIME_FORMAT = ED_BASE+540; + {$EXTERNALSYM ED_TRANSBASIC_TIME_FORMAT} + ED_FORMAT_MILLISECONDS = ED_BASE+541; + {$EXTERNALSYM ED_FORMAT_MILLISECONDS} + ED_FORMAT_FRAMES = ED_BASE+542; + {$EXTERNALSYM ED_FORMAT_FRAMES} + ED_FORMAT_REFERENCE_TIME = ED_BASE+543; + {$EXTERNALSYM ED_FORMAT_REFERENCE_TIME} + + ED_FORMAT_HMSF = ED_BASE+547; + {$EXTERNALSYM ED_FORMAT_HMSF} + ED_FORMAT_TMSF = ED_BASE+548; + {$EXTERNALSYM ED_FORMAT_TMSF} + + ED_TRANSBASIC_TIME_REFERENCE = ED_BASE+549; + {$EXTERNALSYM ED_TRANSBASIC_TIME_REFERENCE} + ED_TIMEREF_TIMECODE = ED_BASE+550; + {$EXTERNALSYM ED_TIMEREF_TIMECODE} + ED_TIMEREF_CONTROL_TRACK = ED_BASE+551; + {$EXTERNALSYM ED_TIMEREF_CONTROL_TRACK} + ED_TIMEREF_INDEX = ED_BASE+552; + {$EXTERNALSYM ED_TIMEREF_INDEX} + + ED_TRANSBASIC_SUPERIMPOSE = ED_BASE+553; + {$EXTERNALSYM ED_TRANSBASIC_SUPERIMPOSE} + ED_TRANSBASIC_END_STOP_ACTION = ED_BASE+554; + {$EXTERNALSYM ED_TRANSBASIC_END_STOP_ACTION} + + ED_TRANSBASIC_RECORD_FORMAT = ED_BASE+555; + {$EXTERNALSYM ED_TRANSBASIC_RECORD_FORMAT} + ED_RECORD_FORMAT_SP = ED_BASE+556; + {$EXTERNALSYM ED_RECORD_FORMAT_SP} + ED_RECORD_FORMAT_LP = ED_BASE+557; + {$EXTERNALSYM ED_RECORD_FORMAT_LP} + ED_RECORD_FORMAT_EP = ED_BASE+558; + {$EXTERNALSYM ED_RECORD_FORMAT_EP} + + ED_TRANSBASIC_STEP_COUNT = ED_BASE+559; + {$EXTERNALSYM ED_TRANSBASIC_STEP_COUNT} + ed_transbasic_step_unit = ed_base+560; + {$EXTERNALSYM ED_TRANSBASIC_STEP_UNIT} + ED_STEP_FIELD = ED_BASE+561; + {$EXTERNALSYM ED_STEP_FIELD} + ED_STEP_FRAME = ED_BASE+562; + {$EXTERNALSYM ED_STEP_FRAME} + ED_STEP_3_2 = ED_BASE+563; + {$EXTERNALSYM ED_STEP_3_2} + + ED_TRANSBASIC_PREROLL = ED_BASE+564; + {$EXTERNALSYM ED_TRANSBASIC_PREROLL} + ED_TRANSBASIC_RECPREROLL = ED_BASE+565; + {$EXTERNALSYM ED_TRANSBASIC_RECPREROLL} + ED_TRANSBASIC_POSTROLL = ED_BASE+566; + {$EXTERNALSYM ED_TRANSBASIC_POSTROLL} + ED_TRANSBASIC_EDIT_DELAY = ED_BASE+567; + {$EXTERNALSYM ED_TRANSBASIC_EDIT_DELAY} + ED_TRANSBASIC_PLAYTC_DELAY = ED_BASE+568; + {$EXTERNALSYM ED_TRANSBASIC_PLAYTC_DELAY} + ED_TRANSBASIC_RECTC_DELAY = ED_BASE+569; + {$EXTERNALSYM ED_TRANSBASIC_RECTC_DELAY} + ED_TRANSBASIC_EDIT_FIELD = ED_BASE+570; + {$EXTERNALSYM ED_TRANSBASIC_EDIT_FIELD} + ED_TRANSBASIC_FRAME_SERVO = ED_BASE+571; + {$EXTERNALSYM ED_TRANSBASIC_FRAME_SERVO} + ED_TRANSBASIC_CF_SERVO = ED_BASE+572; + {$EXTERNALSYM ED_TRANSBASIC_CF_SERVO} + ED_TRANSBASIC_SERVO_REF = ED_BASE+573; + {$EXTERNALSYM ED_TRANSBASIC_SERVO_REF} + ED_REF_EXTERNAL = ED_BASE+574; + {$EXTERNALSYM ED_REF_EXTERNAL} + ED_REF_INPUT = ED_BASE+575; + {$EXTERNALSYM ED_REF_INPUT} + ED_REF_INTERNAL = ED_BASE+576; + {$EXTERNALSYM ED_REF_INTERNAL} + ED_REF_AUTO = ED_BASE+577; + {$EXTERNALSYM ED_REF_AUTO} + + ED_TRANSBASIC_WARN_GL = ED_BASE+578; + {$EXTERNALSYM ED_TRANSBASIC_WARN_GL} + ED_TRANSBASIC_SET_TRACKING = ED_BASE+579; + {$EXTERNALSYM ED_TRANSBASIC_SET_TRACKING} + ED_TRACKING_PLUS = ED_BASE+580; + {$EXTERNALSYM ED_TRACKING_PLUS} + ED_TRACKING_MINUS = ED_BASE+581; + {$EXTERNALSYM ED_TRACKING_MINUS} + ED_TRACKING_RESET = ED_BASE+582; + {$EXTERNALSYM ED_TRACKING_RESET} + + ED_TRANSBASIC_SET_FREEZE_TIMEOUT = ED_BASE+583; + {$EXTERNALSYM ED_TRANSBASIC_SET_FREEZE_TIMEOUT} + ED_TRANSBASIC_VOLUME_NAME = ED_BASE+584; + {$EXTERNALSYM ED_TRANSBASIC_VOLUME_NAME} + ED_TRANSBASIC_BALLISTIC_1 = ED_BASE+585; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_1} + ED_TRANSBASIC_BALLISTIC_2 = ED_BASE+586; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_2} + ED_TRANSBASIC_BALLISTIC_3 = ED_BASE+587; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_3} + ED_TRANSBASIC_BALLISTIC_4 = ED_BASE+588; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_4} + ED_TRANSBASIC_BALLISTIC_5 = ED_BASE+589; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_5} + ED_TRANSBASIC_BALLISTIC_6 = ED_BASE+590; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_6} + ED_TRANSBASIC_BALLISTIC_7 = ED_BASE+591; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_7} + ED_TRANSBASIC_BALLISTIC_8 = ED_BASE+592; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_8} + ED_TRANSBASIC_BALLISTIC_9 = ED_BASE+593; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_9} + ED_TRANSBASIC_BALLISTIC_10 = ED_BASE+594; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_10} + ED_TRANSBASIC_BALLISTIC_11 = ED_BASE+595; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_11} + ED_TRANSBASIC_BALLISTIC_12 = ED_BASE+596; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_12} + ED_TRANSBASIC_BALLISTIC_13 = ED_BASE+597; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_13} + ED_TRANSBASIC_BALLISTIC_14 = ED_BASE+598; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_14} + ED_TRANSBASIC_BALLISTIC_15 = ED_BASE+599; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_15} + ED_TRANSBASIC_BALLISTIC_16 = ED_BASE+600; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_16} + ED_TRANSBASIC_BALLISTIC_17 = ED_BASE+601; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_17} + ED_TRANSBASIC_BALLISTIC_18 = ED_BASE+602; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_18} + ED_TRANSBASIC_BALLISTIC_19 = ED_BASE+603; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_19} + ED_TRANSBASIC_BALLISTIC_20 = ED_BASE+604; + {$EXTERNALSYM ED_TRANSBASIC_BALLISTIC_20} + +// consumer VCR items + ED_TRANSBASIC_SETCLOCK = ED_BASE+605; + {$EXTERNALSYM ED_TRANSBASIC_SETCLOCK} + ED_TRANSBASIC_SET_COUNTER_FORMAT = ED_BASE+606; + {$EXTERNALSYM ED_TRANSBASIC_SET_COUNTER_FORMAT} + ED_TRANSBASIC_SET_COUNTER_VALUE = ED_BASE+607; + {$EXTERNALSYM ED_TRANSBASIC_SET_COUNTER_VALUE} + + ED_TRANSBASIC_SETTUNER_CH_UP = ED_BASE+608; + {$EXTERNALSYM ED_TRANSBASIC_SETTUNER_CH_UP} + ED_TRANSBASIC_SETTUNER_CH_DN = ED_BASE+609; + {$EXTERNALSYM ED_TRANSBASIC_SETTUNER_CH_DN} + ED_TRANSBASIC_SETTUNER_SK_UP = ED_BASE+610; + {$EXTERNALSYM ED_TRANSBASIC_SETTUNER_SK_UP} + ED_TRANSBASIC_SETTUNER_SK_DN = ED_BASE+611; + {$EXTERNALSYM ED_TRANSBASIC_SETTUNER_SK_DN} + ED_TRANSBASIC_SETTUNER_CH = ED_BASE+612; + {$EXTERNALSYM ED_TRANSBASIC_SETTUNER_CH} + ED_TRANSBASIC_SETTUNER_NUM = ED_BASE+613; + {$EXTERNALSYM ED_TRANSBASIC_SETTUNER_NUM} + ED_TRANSBASIC_SETTIMER_EVENT = ED_BASE+614; + {$EXTERNALSYM ED_TRANSBASIC_SETTIMER_EVENT} + ED_TRANSBASIC_SETTIMER_STARTDAY = ED_BASE+615; + {$EXTERNALSYM ED_TRANSBASIC_SETTIMER_STARTDAY} + ED_TRANSBASIC_SETTIMER_STARTTIME = ED_BASE+616; + {$EXTERNALSYM ED_TRANSBASIC_SETTIMER_STARTTIME} + ED_TRANSBASIC_SETTIMER_STOPDAY = ED_BASE+617; + {$EXTERNALSYM ED_TRANSBASIC_SETTIMER_STOPDAY} + ED_TRANSBASIC_SETTIMER_STOPTIME = ED_BASE+618; + {$EXTERNALSYM ED_TRANSBASIC_SETTIMER_STOPTIME} + +// IAMExtTransport video parameters + ED_TRANSVIDEO_SET_OUTPUT = ED_BASE+630; + {$EXTERNALSYM ED_TRANSVIDEO_SET_OUTPUT} + ED_E2E = ED_BASE+631; + {$EXTERNALSYM ED_E2E} + ED_PLAYBACK = ED_BASE+632; + {$EXTERNALSYM ED_PLAYBACK} + ED_OFF = ED_BASE+633; + {$EXTERNALSYM ED_OFF} + + ED_TRANSVIDEO_SET_SOURCE = ED_BASE+634; + {$EXTERNALSYM ED_TRANSVIDEO_SET_SOURCE} + +// IAMExtTransport audio parameters + ED_TRANSAUDIO_ENABLE_OUTPUT = ED_BASE+640; + {$EXTERNALSYM ED_TRANSAUDIO_ENABLE_OUTPUT} + ED_AUDIO_ALL = $10000000; + {$EXTERNALSYM ED_AUDIO_ALL} + ED_AUDIO_1 = $0000001; + {$EXTERNALSYM ED_AUDIO_1} + ED_AUDIO_2 = $0000002; + {$EXTERNALSYM ED_AUDIO_2} + ED_AUDIO_3 = $0000004; + {$EXTERNALSYM ED_AUDIO_3} + ED_AUDIO_4 = $0000008; + {$EXTERNALSYM ED_AUDIO_4} + ED_AUDIO_5 = $0000010; + {$EXTERNALSYM ED_AUDIO_5} + ED_AUDIO_6 = $0000020; + {$EXTERNALSYM ED_AUDIO_6} + ED_AUDIO_7 = $0000040; + {$EXTERNALSYM ED_AUDIO_7} + ED_AUDIO_8 = $0000080; + {$EXTERNALSYM ED_AUDIO_8} + ED_AUDIO_9 = $0000100; + {$EXTERNALSYM ED_AUDIO_9} + ED_AUDIO_10 = $0000200; + {$EXTERNALSYM ED_AUDIO_10} + ED_AUDIO_11 = $0000400; + {$EXTERNALSYM ED_AUDIO_11} + ED_AUDIO_12 = $0000800; + {$EXTERNALSYM ED_AUDIO_12} + ED_AUDIO_13 = $0001000; + {$EXTERNALSYM ED_AUDIO_13} + ED_AUDIO_14 = $0002000; + {$EXTERNALSYM ED_AUDIO_14} + ED_AUDIO_15 = $0004000; + {$EXTERNALSYM ED_AUDIO_15} + ED_AUDIO_16 = $0008000; + {$EXTERNALSYM ED_AUDIO_16} + ED_AUDIO_17 = $0010000; + {$EXTERNALSYM ED_AUDIO_17} + ED_AUDIO_18 = $0020000; + {$EXTERNALSYM ED_AUDIO_18} + ED_AUDIO_19 = $0040000; + {$EXTERNALSYM ED_AUDIO_19} + ED_AUDIO_20 = $0080000; + {$EXTERNALSYM ED_AUDIO_20} + ED_AUDIO_21 = $0100000; + {$EXTERNALSYM ED_AUDIO_21} + ED_AUDIO_22 = $0200000; + {$EXTERNALSYM ED_AUDIO_22} + ED_AUDIO_23 = $0400000; + {$EXTERNALSYM ED_AUDIO_23} + ED_AUDIO_24 = $0800000; + {$EXTERNALSYM ED_AUDIO_24} + ED_VIDEO = $2000000; + {$EXTERNALSYM ED_VIDEO} + + ED_TRANSAUDIO_ENABLE_RECORD = ED_BASE+642; + {$EXTERNALSYM ED_TRANSAUDIO_ENABLE_RECORD} + ED_TRANSAUDIO_ENABLE_SELSYNC = ED_BASE+643; + {$EXTERNALSYM ED_TRANSAUDIO_ENABLE_SELSYNC} + ED_TRANSAUDIO_SET_SOURCE = ED_BASE+644; + {$EXTERNALSYM ED_TRANSAUDIO_SET_SOURCE} + ED_TRANSAUDIO_SET_MONITOR = ED_BASE+645; + {$EXTERNALSYM ED_TRANSAUDIO_SET_MONITOR} + +// Edit Property Set-related defs + +// The following values reflect (and control) the state of an +// edit property set + ED_INVALID = ED_BASE+652; + {$EXTERNALSYM ED_INVALID} + ED_EXECUTING = ED_BASE+653; + {$EXTERNALSYM ED_EXECUTING} + ED_REGISTER = ED_BASE+654; + {$EXTERNALSYM ED_REGISTER} + ED_DELETE = ED_BASE+655; + {$EXTERNALSYM ED_DELETE} + +// Edit property set parameters and values + ED_EDIT_HEVENT = ED_BASE+656; + {$EXTERNALSYM ED_EDIT_HEVENT} + ED_EDIT_TEST = ED_BASE+657; + {$EXTERNALSYM ED_EDIT_TEST} + ED_EDIT_IMMEDIATE = ED_BASE+658; + {$EXTERNALSYM ED_EDIT_IMMEDIATE} + + ED_EDIT_MODE = ED_BASE+659; + {$EXTERNALSYM ED_EDIT_MODE} +// can be one of the following values: + ED_EDIT_MODE_ASSEMBLE = ED_BASE+660; + {$EXTERNALSYM ED_EDIT_MODE_ASSEMBLE} + ED_EDIT_MODE_INSERT = ED_BASE+661; + {$EXTERNALSYM ED_EDIT_MODE_INSERT} + ED_EDIT_MODE_CRASH_RECORD = ED_BASE+662; + {$EXTERNALSYM ED_EDIT_MODE_CRASH_RECORD} + ED_EDIT_MODE_BOOKMARK_TIME = ED_BASE+663; + {$EXTERNALSYM ED_EDIT_MODE_BOOKMARK_TIME} + ED_EDIT_MODE_BOOKMARK_CHAPTER = ED_BASE+664; + {$EXTERNALSYM ED_EDIT_MODE_BOOKMARK_CHAPTER} + + ED_EDIT_MASTER = ED_BASE+666; + {$EXTERNALSYM ED_EDIT_MASTER} + + ED_EDIT_TRACK = ED_BASE+667; + {$EXTERNALSYM ED_EDIT_TRACK} +// can be one of the following possible OR'd values: +// ED_VIDEO, ED_AUDIO_1 thru ED_AUDIO_24 (or ED_AUDIO_ALL) + + EDED_EDIT_SRC_INPOINT = ED_BASE+668; + {$EXTERNALSYM EDED_EDIT_SRC_INPOINT} + ED_EDIT_SRC_OUTPOINT = ED_BASE+669; + {$EXTERNALSYM ED_EDIT_SRC_OUTPOINT} + ED_EDIT_REC_INPOINT = ED_BASE+670; + {$EXTERNALSYM ED_EDIT_REC_INPOINT} + ED_EDIT_REC_OUTPOINT = ED_BASE+671; + {$EXTERNALSYM ED_EDIT_REC_OUTPOINT} + + ED_EDIT_REHEARSE_MODE = ED_BASE+672; + {$EXTERNALSYM ED_EDIT_REHEARSE_MODE} +// can be one of the following possible values: + ED_EDIT_BVB = ED_BASE+673; + {$EXTERNALSYM ED_EDIT_BVB} + ED_EDIT_VBV = ED_BASE+674; + {$EXTERNALSYM ED_EDIT_VBV} + ED_EDIT_VVV = ED_BASE+675; + {$EXTERNALSYM ED_EDIT_VVV} + ED_EDIT_PERFORM = ED_BASE+676; + {$EXTERNALSYM ED_EDIT_PERFORM} + + +// Set this property to OATRUE to kill the edit if in progress + ED_EDIT_ABORT = ED_BASE+677; + {$EXTERNALSYM ED_EDIT_ABORT} +// how long to wait for edit to complete + ED_EDIT_TIMEOUT = ED_BASE+678; + {$EXTERNALSYM ED_EDIT_TIMEOUT} + +// this property causes the device to seek to a point specified by +// ed_edit_seek_mode (see below). note: only one event at a time can seek. + ed_edit_seek = ed_base+679; + {$externalsym ed_edit_seek} + ed_edit_seek_mode = ed_base+680; + {$externalsym ed_edit_seek_mode} + +//possible values: + ED_EDIT_SEEK_EDIT_IN = ED_BASE+681; + {$EXTERNALSYM ED_EDIT_SEEK_EDIT_IN} + ED_EDIT_SEEK_EDIT_OUT = ED_BASE+682; + {$EXTERNALSYM ED_EDIT_SEEK_EDIT_OUT} + ED_EDIT_SEEK_PREROLL = ED_BASE+683; + {$EXTERNALSYM ED_EDIT_SEEK_PREROLL} + ED_EDIT_SEEK_PREROLL_CT = ED_BASE+684; + {$EXTERNALSYM ED_EDIT_SEEK_PREROLL_CT} + ED_EDIT_SEEK_BOOKMARK = ED_BASE+685; + {$EXTERNALSYM ED_EDIT_SEEK_BOOKMARK} + ED_EDIT_OFFSET = ED_BASE+686; + {$EXTERNALSYM ED_EDIT_OFFSET} + ED_EDIT_PREREAD = ED_BASE+815; + {$EXTERNALSYM ED_EDIT_PREREAD} +// +// Some error codes: +// +// device could be in local mode + ED_ERR_DEVICE_NOT_READY = ED_BASE+700; + {$EXTERNALSYM ED_ERR_DEVICE_NOT_READY} + +// ************************************************** +// +// New constants added for implementation of DVCR +// +// ************************************************** + + +// +// New Device type (a DV has two subunits: camera and VCR) +// + ED_DEVTYPE_CAMERA = ED_BASE+900; + {$EXTERNALSYM ED_DEVTYPE_CAMERA} + + ED_DEVTYPE_TUNER = ED_BASE+901; + {$EXTERNALSYM ED_DEVTYPE_TUNER} + + ED_DEVTYPE_DVHS = ED_BASE+902; + {$EXTERNALSYM ED_DEVTYPE_DVHS} + + ED_DEVTYPE_UNKNOWN = ED_BASE+903; // Driver cannot determine the device type + {$EXTERNALSYM ED_DEVTYPE_UNKNOWN} + + ED_DEVTYPE_CAMERA_STORAGE = ED_BASE+1034; // Storage for digital still images, short video files, etc. + {$EXTERNALSYM ED_DEVTYPE_CAMERA_STORAGE} + + ED_DEVTYPE_DTV = ED_BASE+1035; // DTV with serial bus interface + {$EXTERNALSYM ED_DEVTYPE_DTV} + + ED_DEVTYPE_PC_VIRTUAL = ED_BASE+1036; // Emulated device (virtual) on a PC + {$EXTERNALSYM ED_DEVTYPE_PC_VIRTUAL} + + +// +// Unknownn capability +// Instead of return E_NOTIMPL, or S_OK with OAFALSE, it may return S_OK with _UNKNOWN +// + ED_CAPABILITY_UNKNOWN = ED_BASE+910; + {$EXTERNALSYM ED_CAPABILITY_UNKNOWN} + + +// +// Send raw 1394/AVC extenal device command via GetTransportBasicParameters() +// This is specifically for a 1394 AVC device connected with DEV_PORT_1394. +// + ED_RAW_EXT_DEV_CMD = ED_BASE+920; + {$EXTERNALSYM ED_RAW_EXT_DEV_CMD} + + +// +// MEDIUM INFO +// + ED_MEDIA_VHSC = ED_BASE+925; // New media type + {$EXTERNALSYM ED_MEDIA_VHSC} + ED_MEDIA_UNKNOWN = ED_BASE+926; // Unknown media + {$EXTERNALSYM ED_MEDIA_UNKNOWN} + ED_MEDIA_NOT_PRESENT = ED_BASE+927; + {$EXTERNALSYM ED_MEDIA_NOT_PRESENT} + + +// +// Device Control command that can result in pending state. +// + ED_CONTROL_HEVENT_GET = ED_BASE+928; // To get a sychronous event handle + {$EXTERNALSYM ED_CONTROL_HEVENT_GET} + ED_CONTROL_HEVENT_RELEASE = ED_BASE+929; // To release sychronous event handle must match what it got + {$EXTERNALSYM ED_CONTROL_HEVENT_RELEASE} + + ED_DEV_REMOVED_HEVENT_GET = ED_BASE+960; // To be a notify event and will be signal if device is removed. + {$EXTERNALSYM ED_DEV_REMOVED_HEVENT_GET} + ED_DEV_REMOVED_HEVENT_RELEASE = ED_BASE+961; // Release this event handle + {$EXTERNALSYM ED_DEV_REMOVED_HEVENT_RELEASE} + + +// +// TRANSPORT STATE +// + ED_NOTIFY_HEVENT_GET = ED_BASE+930; // To get a sychronous event handle + {$EXTERNALSYM ED_NOTIFY_HEVENT_GET} + ED_NOTIFY_HEVENT_RELEASE = ED_BASE+931; // To release sychronous event handle must match what it got + {$EXTERNALSYM ED_NOTIFY_HEVENT_RELEASE} + ED_MODE_CHANGE_NOTIFY = ED_BASE+932; // This is asynchronous operation, wait for event. + {$EXTERNALSYM ED_MODE_CHANGE_NOTIFY} + + ED_MODE_PLAY_FASTEST_FWD = ED_BASE+933; + {$EXTERNALSYM ED_MODE_PLAY_FASTEST_FWD} + ED_MODE_PLAY_SLOWEST_FWD = ED_BASE+934; + {$EXTERNALSYM ED_MODE_PLAY_SLOWEST_FWD} + ED_MODE_PLAY_FASTEST_REV = ED_BASE+935; + {$EXTERNALSYM ED_MODE_PLAY_FASTEST_REV} + ED_MODE_PLAY_SLOWEST_REV = ED_BASE+936; + {$EXTERNALSYM ED_MODE_PLAY_SLOWEST_REV} + + ED_MODE_WIND = ED_BASE+937; + {$EXTERNALSYM ED_MODE_WIND} + ED_MODE_REW_FASTEST = ED_BASE+938; // High speed rewind + {$EXTERNALSYM ED_MODE_REW_FASTEST} + + ED_MODE_REV_PLAY = ED_BASE+939; // x1 speed reverse play + {$EXTERNALSYM ED_MODE_REV_PLAY} + +// +// Additional play modes (added post Windows XP) +// + + ED_MODE_PLAY_SLOW_FWD_6 = ED_BASE+1001; // Slow forward + {$EXTERNALSYM ED_MODE_PLAY_SLOW_FWD_6} + ED_MODE_PLAY_SLOW_FWD_5 = ED_BASE+1002; + {$EXTERNALSYM ED_MODE_PLAY_SLOW_FWD_5} + ED_MODE_PLAY_SLOW_FWD_4 = ED_BASE+1003; + {$EXTERNALSYM ED_MODE_PLAY_SLOW_FWD_4} + ED_MODE_PLAY_SLOW_FWD_3 = ED_BASE+1004; + {$EXTERNALSYM ED_MODE_PLAY_SLOW_FWD_3} + ED_MODE_PLAY_SLOW_FWD_2 = ED_BASE+1005; + {$EXTERNALSYM ED_MODE_PLAY_SLOW_FWD_2} + ED_MODE_PLAY_SLOW_FWD_1 = ED_BASE+1006; + {$EXTERNALSYM ED_MODE_PLAY_SLOW_FWD_1} + + ED_MODE_PLAY_FAST_FWD_1 = ED_BASE+1007; // Fast forward + {$EXTERNALSYM ED_MODE_PLAY_FAST_FWD_1} + ED_MODE_PLAY_FAST_FWD_2 = ED_BASE+1008; + {$EXTERNALSYM ED_MODE_PLAY_FAST_FWD_2} + ED_MODE_PLAY_FAST_FWD_3 = ED_BASE+1009; + {$EXTERNALSYM ED_MODE_PLAY_FAST_FWD_3} + ED_MODE_PLAY_FAST_FWD_4 = ED_BASE+1010; + {$EXTERNALSYM ED_MODE_PLAY_FAST_FWD_4} + ED_MODE_PLAY_FAST_FWD_5 = ED_BASE+1011; + {$EXTERNALSYM ED_MODE_PLAY_FAST_FWD_5} + ED_MODE_PLAY_FAST_FWD_6 = ED_BASE+1012; + {$EXTERNALSYM ED_MODE_PLAY_FAST_FWD_6} + + ED_MODE_PLAY_SLOW_REV_6 = ED_BASE+1013; // Slow reverse + {$EXTERNALSYM ED_MODE_PLAY_SLOW_REV_6} + ED_MODE_PLAY_SLOW_REV_5 = ED_BASE+1014; + {$EXTERNALSYM ED_MODE_PLAY_SLOW_REV_5} + ED_MODE_PLAY_SLOW_REV_4 = ED_BASE+1015; + {$EXTERNALSYM ED_MODE_PLAY_SLOW_REV_4} + ED_MODE_PLAY_SLOW_REV_3 = ED_BASE+1016; + {$EXTERNALSYM ED_MODE_PLAY_SLOW_REV_3} + ED_MODE_PLAY_SLOW_REV_2 = ED_BASE+1017; + {$EXTERNALSYM ED_MODE_PLAY_SLOW_REV_2} + ED_MODE_PLAY_SLOW_REV_1 = ED_BASE+1018; + {$EXTERNALSYM ED_MODE_PLAY_SLOW_REV_1} + + ED_MODE_PLAY_FAST_REV_1 = ED_BASE+1019; // Fast reverse + {$EXTERNALSYM ED_MODE_PLAY_FAST_REV_1} + ED_MODE_PLAY_FAST_REV_2 = ED_BASE+1020; + {$EXTERNALSYM ED_MODE_PLAY_FAST_REV_2} + ED_MODE_PLAY_FAST_REV_3 = ED_BASE+1021; + {$EXTERNALSYM ED_MODE_PLAY_FAST_REV_3} + ED_MODE_PLAY_FAST_REV_4 = ED_BASE+1022; + {$EXTERNALSYM ED_MODE_PLAY_FAST_REV_4} + ED_MODE_PLAY_FAST_REV_5 = ED_BASE+1023; + {$EXTERNALSYM ED_MODE_PLAY_FAST_REV_5} + ED_MODE_PLAY_FAST_REV_6 = ED_BASE+1024; + {$EXTERNALSYM ED_MODE_PLAY_FAST_REV_6} + + ED_MODE_REVERSE = ED_MODE_REV_PLAY; // Same as Reverse playback + {$EXTERNALSYM ED_MODE_REVERSE} + ED_MODE_REVERSE_FREEZE = ED_BASE+1025; // Pause at reverse playback + {$EXTERNALSYM ED_MODE_REVERSE_FREEZE} + + ED_MODE_PLAY_SLOW_FWD_X = ED_BASE+1026; // Possible response for a trick play + {$EXTERNALSYM ED_MODE_PLAY_SLOW_FWD_X} + ED_MODE_PLAY_FAST_FWD_X = ED_BASE+1027; // Possible response for a trick play + {$EXTERNALSYM ED_MODE_PLAY_FAST_FWD_X} + ED_MODE_PLAY_SLOW_REV_X = ED_BASE+1028; // Possible response for a trick play + {$EXTERNALSYM ED_MODE_PLAY_SLOW_REV_X} + ED_MODE_PLAY_FAST_REV_X = ED_BASE+1029; // Possible response for a trick play + {$EXTERNALSYM ED_MODE_PLAY_FAST_REV_X} + + ED_MODE_STOP_START = ED_BASE+1030; // Indicate stopping at the begin of a tape + {$EXTERNALSYM ED_MODE_STOP_START} + ED_MODE_STOP_END = ED_BASE+1031; // Indicate stopping at the end of a tape + {$EXTERNALSYM ED_MODE_STOP_END} + ED_MODE_STOP_EMERGENCY = ED_BASE+1032; // Indicate stopping due to an emergency + {$EXTERNALSYM ED_MODE_STOP_EMERGENCY} + +// +// TRANSPOSRTBASIC: input and output signal +// + ED_TRANSBASIC_INPUT_SIGNAL = ED_BASE+940; + {$EXTERNALSYM ED_TRANSBASIC_INPUT_SIGNAL} + ED_TRANSBASIC_OUTPUT_SIGNAL = ED_BASE+941; + {$EXTERNALSYM ED_TRANSBASIC_OUTPUT_SIGNAL} + + ED_TRANSBASIC_SIGNAL_525_60_SD = ED_BASE+942; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_525_60_SD} + ED_TRANSBASIC_SIGNAL_525_60_SDL = ED_BASE+943; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_525_60_SDL} + ED_TRANSBASIC_SIGNAL_625_50_SD = ED_BASE+944; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_625_50_SD} + ED_TRANSBASIC_SIGNAL_625_50_SDL = ED_BASE+945; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_625_50_SDL} + ED_TRANSBASIC_SIGNAL_MPEG2TS = ED_BASE+946; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_MPEG2TS} + ED_TRANSBASIC_SIGNAL_625_60_HD = ED_BASE+947; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_625_60_HD} + ED_TRANSBASIC_SIGNAL_625_50_HD = ED_BASE+948; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_625_50_HD} + + ED_TRANSBASIC_SIGNAL_2500_60_MPEG = ED_BASE+980; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_2500_60_MPEG} + ED_TRANSBASIC_SIGNAL_1250_60_MPEG = ED_BASE+981; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_1250_60_MPEG} + ED_TRANSBASIC_SIGNAL_0625_60_MPEG = ED_BASE+982; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_0625_60_MPEG} + + ED_TRANSBASIC_SIGNAL_2500_50_MPEG = ED_BASE+985; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_2500_50_MPEG} + ED_TRANSBASIC_SIGNAL_1250_50_MPEG = ED_BASE+986; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_1250_50_MPEG} + ED_TRANSBASIC_SIGNAL_0625_50_MPEG = ED_BASE+987; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_0625_50_MPEG} + + ED_TRANSBASIC_SIGNAL_UNKNOWN = ED_BASE+990; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_UNKNOWN} + + ED_TRANSBASIC_SIGNAL_525_60_DV25 = ED_BASE+991; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_525_60_DV25} + ED_TRANSBASIC_SIGNAL_625_50_DV25 = ED_BASE+992; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_625_50_DV25} + + ED_TRANSBASIC_SIGNAL_525_60_DV50 = ED_BASE+993; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_525_60_DV50} + ED_TRANSBASIC_SIGNAL_625_50_DV50 = ED_BASE+994; + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_625_50_DV50} + + ED_TRANSBASIC_SIGNAL_HD_60_DVH1 = ED_BASE+995; // DVCPRO 100: 1080i or 720p + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_HD_60_DVH1} + ED_TRANSBASIC_SIGNAL_HD_50_DVH1 = ED_BASE+996; // DVCPRO 100: 1080i only + {$EXTERNALSYM ED_TRANSBASIC_SIGNAL_HD_50_DVH1} + + +// +// TIMECODE/AbsoluteTrackNumber/RealTimeCounter read/seek/write +// + ED_DEVCAP_TIMECODE_SEEK = ED_BASE+950; + {$EXTERNALSYM ED_DEVCAP_TIMECODE_SEEK} + + ED_DEVCAP_ATN_READ = ED_BASE+951; + {$EXTERNALSYM ED_DEVCAP_ATN_READ} + ED_DEVCAP_ATN_SEEK = ED_BASE+952; + {$EXTERNALSYM ED_DEVCAP_ATN_SEEK} + ED_DEVCAP_ATN_WRITE = ED_BASE+953; + {$EXTERNALSYM ED_DEVCAP_ATN_WRITE} + + ED_DEVCAP_RTC_READ = ED_BASE+954; + {$EXTERNALSYM ED_DEVCAP_RTC_READ} + ED_DEVCAP_RTC_SEEK = ED_BASE+955; + {$EXTERNALSYM ED_DEVCAP_RTC_SEEK} + ED_DEVCAP_RTC_WRITE = ED_BASE+956; + {$EXTERNALSYM ED_DEVCAP_RTC_WRITE} + +// +// Basic parameter +// + ED_TIMEREF_ATN = ED_BASE+958; + {$EXTERNALSYM ED_TIMEREF_ATN} + +// +// GUID used to identify a class driver +// + MSTapeDeviceGUID : TGUID = '{8C0F6AF2-0EDB-44c1-8AEB-59040BD830ED}'; // MSTapeDeviceGUID + {$EXTERNALSYM MSTapeDeviceGUID} + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: aviriff.h + * + ***************************************************************************) + +type +(*+ + * + * Structures and defines for the RIFF AVI file format extended to + * handle very large/long files + * + *-=====================================================================*) + + { +#if !defined NUMELMS + #define NUMELMS(aa) (sizeof(aa)/sizeof((aa)[0])) +#endif + } +// all structures in this file are packed on word boundaries +// +(* + * heres the general layout of an AVI riff file (new format) + * + * RIFF (3F??????) AVI <- not more than 1 GB in size + * LIST (size) hdrl + * avih (0038) + * LIST (size) strl + * strh (0038) + * strf (????) + * indx (3ff8) <- size may vary, should be sector sized + * LIST (size) strl + * strh (0038) + * strf (????) + * indx (3ff8) <- size may vary, should be sector sized + * LIST (size) odml + * dmlh (????) + * JUNK (size) <- fill to align to sector - 12 + * LIST (7f??????) movi <- aligned on sector - 12 + * 00dc (size) <- sector aligned + * 01wb (size) <- sector aligned + * ix00 (size) <- sector aligned + * idx1 (00??????) <- sector aligned + * RIFF (7F??????) AVIX + * JUNK (size) <- fill to align to sector -12 + * LIST (size) movi + * 00dc (size) <- sector aligned + * RIFF (7F??????) AVIX <- not more than 2GB in size + * JUNK (size) <- fill to align to sector - 12 + * LIST (size) movi + * 00dc (size) <- sector aligned + * + *-===================================================================*) + +// +// structures for manipulating RIFF headers +// +{ +#define FCC(ch4) ((((DWORD)(ch4) & 0xFF) << 24) | \ + (((DWORD)(ch4) & 0xFF00) << 8) | \ + (((DWORD)(ch4) & 0xFF0000) >> 8) | \ + (((DWORD)(ch4) & 0xFF000000) >> 24)) +} + PRIFFChunk = ^TRIFFChunk; + _riffchunk = record + fcc: FOURCC; + cb: DWORD; + end; + {$EXTERNALSYM _riffchunk} + RIFFCHUNK = _riffchunk; + {$EXTERNALSYM RIFFCHUNK} + LPRIFFCHUNK = ^RIFFCHUNK; + {$EXTERNALSYM LPRIFFCHUNK} + TRIFFChunk = _riffchunk; + + PRIFFList = ^TRIFFList; + _rifflist = record + fcc: FOURCC; + cb: DWORD; + fccListType: FOURCC; + end; + {$EXTERNALSYM _rifflist} + RIFFLIST = _rifflist; + {$EXTERNALSYM RIFFLIST} + LPRIFFLIST = ^RIFFLIST; + {$EXTERNALSYM LPRIFFLIST} + TRIFFList = _rifflist; + +{ +#define RIFFROUND(cb) ((cb) + ((cb)&1)) +#define RIFFNEXT(pChunk) (LPRIFFCHUNK)((LPBYTE)(pChunk) \ + + sizeof(RIFFCHUNK) \ + + RIFFROUND(((LPRIFFCHUNK)pChunk)->cb)) + +} +// +// ==================== avi header structures =========================== +// + +// main header for the avi file (compatibility header) +const + ckidMAINAVIHEADER = $68697661;// 'avih' + {$EXTERNALSYM ckidMAINAVIHEADER} + +type + _avimainheader = record + fcc: FOURCC; // 'avih' + cb: DWORD; // size of this structure -8 + dwMicroSecPerFrame: DWORD; // frame display rate (or 0L) + dwMaxBytesPerSec: DWORD; // max. transfer rate + dwPaddingGranularity: DWORD; // pad to multiples of this size; normally 2K. + dwFlags: DWORD; // the ever-present flags + dwTotalFrames: DWORD; // # frames in first movi list + dwInitialFrames: DWORD; + dwStreams: DWORD; + dwSuggestedBufferSize: DWORD; + dwWidth: DWORD; + dwHeight: DWORD; + dwReserved: array[0..3] of DWORD; + end; + {$EXTERNALSYM _avimainheader} + AVIMAINHEADER = _avimainheader; + {$EXTERNALSYM AVIMAINHEADER} + TAVIMainHeader = _avimainheader; + +const + AVIF_HASINDEX = $00000010; // Index at end of file? + {$EXTERNALSYM AVIF_HASINDEX} + AVIF_MUSTUSEINDEX = $00000020; + {$EXTERNALSYM AVIF_MUSTUSEINDEX} + AVIF_ISINTERLEAVED = $00000100; + {$EXTERNALSYM AVIF_ISINTERLEAVED} + AVIF_TRUSTCKTYPE = $00000800; // Use CKType to find key frames + {$EXTERNALSYM AVIF_TRUSTCKTYPE} + AVIF_WASCAPTUREFILE = $00010000; + {$EXTERNALSYM AVIF_WASCAPTUREFILE} + AVIF_COPYRIGHTED = $00020000; + {$EXTERNALSYM AVIF_COPYRIGHTED} + + ckidODML = $6C6D646F; //'odml' + {$EXTERNALSYM ckidODML} + ckidAVIEXTHEADER = $686C6D64; //'dmlh' + {$EXTERNALSYM ckidAVIEXTHEADER} + +type + _aviextheader = record + fcc: FOURCC; // 'dmlh' + cb: DWORD; // size of this structure -8 + dwGrandFrames: DWORD; // total number of frames in the file + dwFuture: array[0..60] of DWORD; // to be defined later + end; + {$EXTERNALSYM _aviextheader} + AVIEXTHEADER = _aviextheader; + {$EXTERNALSYM AVIEXTHEADER} + TAVIExtHeader = _aviextheader; + +// +// structure of an AVI stream header riff chunk +// +const + ckidSTREAMLIST = $6C727473; //'strl' + {$EXTERNALSYM ckidSTREAMLIST} + ckidSTREAMHEADER = $68727473; //'strh' + {$EXTERNALSYM ckidSTREAMHEADER} + +type + _avistreamheader = record + fcc: FOURCC; // 'strh' + cb: DWORD; // size of this structure - 8 + + fccType: FOURCC; // stream type codes + + fccHandler: FOURCC; + dwFlags: DWORD; + + wPriority: WORD; + wLanguage: WORD; + dwInitialFrames: DWORD; + dwScale: DWORD; + dwRate: DWORD; // dwRate/dwScale is stream tick rate in ticks/sec + dwStart: DWORD; + dwLength: DWORD; + dwSuggestedBufferSize: DWORD; + dwQuality: DWORD; + dwSampleSize: DWORD; + + rcFrame: record + left: SmallInt; + top: SmallInt; + right: SmallInt; + bottom: SmallInt; + end; + end; + {$EXTERNALSYM _avistreamheader} + AVISTREAMHEADER = _avistreamheader; + {$EXTERNALSYM AVISTREAMHEADER} + TAVIStreamHeader = _avistreamheader; + +const + + streamtypeVIDEO = $73646976; //'vids' + {$EXTERNALSYM streamtypeVIDEO} + streamtypeAUDIO = $73647561; //'auds' + {$EXTERNALSYM streamtypeAUDIO} + streamtypeMIDI = $7364696D; //'mids' + {$EXTERNALSYM streamtypeMIDI} + streamtypeTEXT = $73747874; //'txts' + {$EXTERNALSYM streamtypeTEXT} + + AVISF_DISABLED = $00000001; + {$EXTERNALSYM AVISF_DISABLED} + AVISF_VIDEO_PALCHANGES = $00010000; + {$EXTERNALSYM AVISF_VIDEO_PALCHANGES} + +// +// structure of an AVI stream format chunk +// + + ckidSTREAMFORMAT = $66727473; //'strf' + {$EXTERNALSYM ckidSTREAMFORMAT} + +// +// avi stream formats are different for each stream type +// +// BITMAPINFOHEADER for video streams +// WAVEFORMATEX or PCMWAVEFORMAT for audio streams +// nothing for text streams +// nothing for midi streams + + +// +// structure of old style AVI index +// + ckidAVIOLDINDEX = $31786469;//'idx1' + {$EXTERNALSYM ckidAVIOLDINDEX} + +type + _avioldindex = record + fcc: FOURCC; // 'idx1' + cb: DWORD; // size of this structure -8 + + aIndex: array[0..0] of record + dwChunkId: DWORD; + dwFlags: DWORD; + dwOffset: DWORD; // offset of riff chunk header for the data + dwSize: DWORD; // size of the data (excluding riff header size) + end; // size of this array + end; + {$EXTERNALSYM _avioldindex} + AVIOLDINDEX = _avioldindex; + {$EXTERNALSYM AVIOLDINDEX} + TAVIOldIndex = _avioldindex; + +const + AVIIF_LIST = $00000001; + {$EXTERNALSYM AVIIF_LIST} + AVIIF_KEYFRAME = $00000010; + {$EXTERNALSYM AVIIF_KEYFRAME} + + AVIIF_NO_TIME = $00000100; + {$EXTERNALSYM AVIIF_NO_TIME} + AVIIF_COMPRESSOR = $0FFF0000; // unused? + {$EXTERNALSYM AVIIF_COMPRESSOR} + + +// old timecode structure +//typedef union _timecode { +// struct { +// WORD wFrameRate; +// WORD wFrameFract; +// LONG cFrames; +// }; +// DWORDLONG qw; +// } TIMECODE; +// +// struct for all the SMPTE timecode info +// + TIMECODE_RATE_30DROP = 0; // this MUST be zero + {$EXTERNALSYM TIMECODE_RATE_30DROP} + +type + _timecodedata = record + time: TTimeCode; + dwSMPTEflags: DWORD; + dwUser: DWORD; + end; + {$EXTERNALSYM _timecodedata} + TIMECODEDATA = _timecodedata; + {$EXTERNALSYM TIMECODEDATA} + TTimeCodeData = _timecodedata; + +// dwSMPTEflags masks/values +// +const + TIMECODE_SMPTE_BINARY_GROUP = $07; + {$EXTERNALSYM TIMECODE_SMPTE_BINARY_GROUP} + TIMECODE_SMPTE_COLOR_FRAME = $08; + {$EXTERNALSYM TIMECODE_SMPTE_COLOR_FRAME} + +// +// ============ structures for new style AVI indexes ================= +// + +// index type codes +// + AVI_INDEX_OF_INDEXES = $00; + {$EXTERNALSYM AVI_INDEX_OF_INDEXES} + AVI_INDEX_OF_CHUNKS = $01; + {$EXTERNALSYM AVI_INDEX_OF_CHUNKS} + AVI_INDEX_OF_TIMED_CHUNKS = $02; + {$EXTERNALSYM AVI_INDEX_OF_TIMED_CHUNKS} + AVI_INDEX_OF_SUB_2FIELD = $03; + {$EXTERNALSYM AVI_INDEX_OF_SUB_2FIELD} + AVI_INDEX_IS_DATA = $80; + {$EXTERNALSYM AVI_INDEX_IS_DATA} + +// index subtype codes +// + AVI_INDEX_SUB_DEFAULT = $00; + {$EXTERNALSYM AVI_INDEX_SUB_DEFAULT} + +// INDEX_OF_CHUNKS subtype codes +// + AVI_INDEX_SUB_2FIELD = $01; + {$EXTERNALSYM AVI_INDEX_SUB_2FIELD} + +// meta structure of all avi indexes +// +type + _avimetaindex = record + fcc: FOURCC; + cb: UINT; + wLongsPerEntry: WORD; + bIndexSubType: BYTE; + bIndexType: BYTE; + nEntriesInUse: DWORD; + dwChunkId: DWORD; + dwReserved: array[0..2] of DWORD; + adwIndex: array[0..0] of DWORD; + end; + {$EXTERNALSYM _avimetaindex} + AVIMETAINDEX = _avimetaindex; + {$EXTERNALSYM AVIMETAINDEX} + TAVIMetaIndex = _avimetaindex; + + +const + STDINDEXSIZE = $4000; + {$EXTERNALSYM STDINDEXSIZE} +{ +#define NUMINDEX(wLongsPerEntry) ((STDINDEXSIZE-32)/4/(wLongsPerEntry)) +#define NUMINDEXFILL(wLongsPerEntry) ((STDINDEXSIZE/4) - NUMINDEX(wLongsPerEntry)) +} +// structure of a super index (INDEX_OF_INDEXES) +// + ckidAVISUPERINDEX = $78646E69;//'indx' + {$EXTERNALSYM ckidAVISUPERINDEX} + +type + _avisuperindex = record + fcc: FOURCC; // 'indx' + cb: UINT; // size of this structure + wLongsPerEntry: WORD; // ==4 + bIndexSubType: BYTE; // ==0 (frame index) or AVI_INDEX_SUB_2FIELD + bIndexType: BYTE; // ==AVI_INDEX_OF_INDEXES + nEntriesInUse: DWORD; // offset of next unused entry in aIndex + dwChunkId: DWORD; // chunk ID of chunks being indexed, (i.e. RGB8) + dwReserved: array[0..2] of DWORD; // must be 0 + + aIndex: array[0..3] of record + qwOffset: Int64; // 64 bit offset to sub index chunk + dwSize: DWORD; // 32 bit size of sub index chunk + dwDuration: DWORD; // time span of subindex chunk (in stream ticks) + end; + end; + {$EXTERNALSYM _avisuperindex} + AVISUPERINDEX = _avisuperindex; + {$EXTERNALSYM AVISUPERINDEX} + TAVISuperIndex = _avisuperindex; + +//#define Valid_SUPERINDEX(pi) (*(DWORD *)(&((pi)->wLongsPerEntry)) == (4 | (AVI_INDEX_OF_INDEXES << 24))) + +// struct of a standard index (AVI_INDEX_OF_CHUNKS) +// + + _avistdindex_entry = record + dwOffset: DWORD; // 32 bit offset to data (points to data, not riff header) + dwSize: DWORD; // 31 bit size of data (does not include size of riff header), bit 31 is deltaframe bit + end; + {$EXTERNALSYM _avistdindex_entry} + AVISTDINDEX_ENTRY = _avistdindex_entry; + {$EXTERNALSYM AVISTDINDEX_ENTRY} + TAVIStdIndexEntry = _avistdindex_entry; + +const + AVISTDINDEX_DELTAFRAME = $80000000; // Delta frames have the high bit set; + {$EXTERNALSYM AVISTDINDEX_DELTAFRAME} + AVISTDINDEX_SIZEMASK = not $80000000; + {$EXTERNALSYM AVISTDINDEX_SIZEMASK} + +type + _avistdindex = record + fcc: FOURCC; // 'indx' or '##ix' + cb: UINT; // size of this structure + wLongsPerEntry: WORD; // ==2 + bIndexSubType: BYTE; // ==0 + bIndexType: BYTE; // ==AVI_INDEX_OF_CHUNKS + nEntriesInUse: DWORD; // offset of next unused entry in aIndex + dwChunkId: DWORD; // chunk ID of chunks being indexed, (i.e. RGB8) + qwBaseOffset: Int64; // base offset that all index intries are relative to + dwReserved_3: DWORD; + aIndex: array[0..2043] of TAVIStdIndexEntry; + end; + {$EXTERNALSYM _avistdindex} + AVISTDINDEX = _avistdindex; + {$EXTERNALSYM AVISTDINDEX} + TAVIStdIndex = _avistdindex; + +// struct of a time variant standard index (AVI_INDEX_OF_TIMED_CHUNKS) +// + _avitimedindex_entry = record + dwOffset: DWORD; // 32 bit offset to data (points to data, not riff header) + dwSize: DWORD; // 31 bit size of data (does not include size of riff header) (high bit is deltaframe bit) + dwDuration: DWORD; // how much time the chunk should be played (in stream ticks) + end; + {$EXTERNALSYM _avitimedindex_entry} + AVITIMEDINDEX_ENTRY = _avitimedindex_entry; + {$EXTERNALSYM AVITIMEDINDEX_ENTRY} + TAVITimedIndexEntry = _avitimedindex_entry; + + _avitimedindex = record + fcc: FOURCC; // 'indx' or '##ix' + cb: UINT; // size of this structure + wLongsPerEntry: WORD; // ==3 + bIndexSubType: BYTE; // ==0 + bIndexType: BYTE; // ==AVI_INDEX_OF_TIMED_CHUNKS + nEntriesInUse: DWORD; // offset of next unused entry in aIndex + dwChunkId: DWORD; // chunk ID of chunks being indexed, (i.e. RGB8) + qwBaseOffset: Int64; // base offset that all index intries are relative to + dwReserved_3: DWORD; // must be 0 + aIndex: array[0..1361] of TAVITimedIndexEntry; + adwTrailingFill: array[0..2733] of DWORD; // to align struct to correct size + end; + {$EXTERNALSYM _avitimedindex} + AVITIMEDINDEX = _avitimedindex; + {$EXTERNALSYM AVITIMEDINDEX} + TAVITimedIndex = _avitimedindex; + +// structure of a timecode stream +// + _avitimecodeindex = record + fcc: FOURCC; // 'indx' or '##ix' + cb: UINT; // size of this structure + wLongsPerEntry: WORD; // ==4 + bIndexSubType: BYTE; // ==0 + bIndexType: BYTE; // ==AVI_INDEX_IS_DATA + nEntriesInUse: DWORD; // offset of next unused entry in aIndex + dwChunkId: DWORD; // 'time' + dwReserved: array[0..2] of DWORD; // must be 0 + aIndex: array[0..0] of TTimeCodeData; + end; + {$EXTERNALSYM _avitimecodeindex} + AVITIMECODEINDEX = _avitimecodeindex; + {$EXTERNALSYM AVITIMECODEINDEX} + TAviTimeCodeIndex = _avitimecodeindex; + +// structure of a timecode discontinuity list (when wLongsPerEntry == 7) +// + _avitcdlindex_entry = record + dwTick: DWORD; // stream tick time that maps to this timecode value + time: TTimeCode; + dwSMPTEflags: DWORD; + dwUser: DWORD; + szReelId: array[0..11] of Char; + end; + {$EXTERNALSYM _avitcdlindex_entry} + AVITCDLINDEX_ENTRY = _avitcdlindex_entry; + {$EXTERNALSYM AVITCDLINDEX_ENTRY} + TAVITcdlIndexEntry = _avitcdlindex_entry; + + _avitcdlindex = record + fcc: FOURCC; // 'indx' or '##ix' + cb: UINT; // size of this structure + wLongsPerEntry: WORD; // ==7 (must be 4 or more all 'tcdl' indexes + bIndexSubType: BYTE; // ==0 + bIndexType: BYTE; // ==AVI_INDEX_IS_DATA + nEntriesInUse: DWORD; // offset of next unused entry in aIndex + dwChunkId: DWORD; // 'tcdl' + dwReserved: array[0..2] of DWORD; // must be 0 + aIndex: array[0..583] of TAVITcdlIndexEntry; + adwTrailingFill: array[0..3511] of DWORD; // to align struct to correct size + end; + {$EXTERNALSYM _avitcdlindex} + AVITCDLINDEX = _avitcdlindex; + {$EXTERNALSYM AVITCDLINDEX} + TAVITcdlIndex = _avitcdlindex; + + + _avifieldindex_chunk = record + {$EXTERNALSYM _avifieldindex_chunk} + fcc: FOURCC; // 'ix##' + cb: DWORD; // size of this structure + wLongsPerEntry: WORD; // must be 3 (size of each entry in + // aIndex array) + bIndexSubType: BYTE; // AVI_INDEX_2FIELD + bIndexType: BYTE; // AVI_INDEX_OF_CHUNKS + nEntriesInUse: DWORD; // + dwChunkId: DWORD; // '##dc' or '##db' + qwBaseOffset: Int64; // offsets in aIndex array are relative to this + dwReserved3: DWORD; // must be 0 + + aIndex: array[0..0] of record + dwOffset: DWORD; + dwSize: DWORD; // size of all fields + dwOffsetField2: DWORD; // (bit 31 set for NON-keyframes) + end; // offset to second field + end; + AVIFIELDINDEX = _avifieldindex_chunk; + {$EXTERNALSYM AVIFIELDINDEX} + PAVIFIELDINDEX = ^AVIFIELDINDEX; + {$EXTERNALSYM PAVIFIELDINDEX} + TAVIFieldIndex = _avifieldindex_chunk; + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: evcode.h + * + ***************************************************************************) + +const +// +// list of standard Quartz event codes and the expected params +// + +// Event codes are broken into two groups +// -- system event codes +// -- extension event codes +// All system event codes are below EC_USER + + EC_SYSTEMBASE = $00; + {$EXTERNALSYM EC_SYSTEMBASE} + EC_USER = $8000; + {$EXTERNALSYM EC_USER} + + +// System-defined event codes +// ========================== +// +// There are three types of system-defined event codes: +// +// 1. Those which are always passed through to the application +// (To be collected by calls to GetEvent or within WaitForCompletion.) +// (e.g. EC_ERRORABORT, EC_USERABORT.) +// +// 2. Those which are pure internal and will never be passed to +// the application. (e.g. EC_SHUTDOWN) +// +// 3. Those which have default handling. Default handing implies that +// the event is not passed to the application. However, default +// handling may be canceled by calling +// IMediaEvent::CancelDefaultHandling. If the default handling is +// cancelled in this way, then the message will be delivered to the +// application and the application must action it appropriately. +// Default handling can be restored by calling RestoreDefaultHandling. +// +// We will refer to these events as application, internal and defaulted +// events respectively. +// +// System-defined events may have interface pointers, BSTR's, etc passed +// as parameters. It is therefore essential that, for any message +// retrieved using GetEvent, a matching call to FreeEventParams is made +// to ensure that relevant interfaces are released and storage freed. +// Failure to call FreeEventParams will result in memory leaks, if not +// worse. +// +// Filters sending these messages to the filter graph should not AddRef() +// any interfaces that they may pass as parameters. The filter graph +// manager will AddRef them if required. E.g. if the event is to be queued +// for the application or queued to a worker thread. + +// Each event listed below is immediately followed by a parameter list +// detailing the types of the parameters associated with the message, +// and an indication of whether the message is an application, internal +// or defaulted message. This is then followed by a short description. +// The use of "void" in the parameter list implies that the parameter is not +// used. Such parameters should be zero. + +// Other defined EC_ regions: +// DVD event codes 0x0100 - 0x0150 (dvdevcod.h) +// audio device event codes 0x0200 - 0x0250 (audevcod.h) +// WindowsMedia SDK-originated events 0x0251 - 0x0300 (see below) +// MSVIDCTL 0x0301 - 0x0325 (msvidctl.idl) +// stream buffer engine (PVR) 0x0326 - 0x0350 (sbe.idl) + + EC_COMPLETE = $01; + {$EXTERNALSYM EC_COMPLETE} +// ( HResult, void ) : defaulted (special) +// Signals the completed playback of a stream within the graph. This message +// is sent by renderers when they receive end-of-stream. The default handling +// of this message results in a _SINGLE_ EC_COMPLETE being sent to the +// application when ALL of the individual renderers have signaled EC_COMPLETE +// to the filter graph. If the default handing is canceled, the application +// will see all of the individual EC_COMPLETEs. + + + EC_USERABORT = $02; + {$EXTERNALSYM EC_USERABORT} +// ( void, void ) : application +// In some sense, the user has requested that playback be terminated. +// This message is typically sent by renderers that render into a +// window if the user closes the window into which it was rendering. +// It is up to the application to decide if playback should actually +// be stopped. + + + EC_ERRORABORT = $03; + {$EXTERNALSYM EC_ERRORABORT} +// ( HResult, void ) : application +// Operation aborted because of error + + + EC_TIME = $04; + {$EXTERNALSYM EC_TIME} +// ( DWORD, DWORD ) : application +// The requested reference time occurred. (This event is currently not used). +// lParam1 is low dword of ref time, lParam2 is high dword of TRefTime. + + + EC_REPAINT = $05; + {$EXTERNALSYM EC_REPAINT} +// ( IPin * (could be NULL), void ) : defaulted +// A repaint is required - lParam1 contains the (IPin *) that needs the data +// to be sent again. Default handling is: if the output pin which the IPin is +// attached to supports the IMediaEventSink interface then it will be called +// with the EC_REPAINT first. If that fails then normal repaint processing is +// done by the filter graph. + + +// Stream error notifications + EC_STREAM_ERROR_STOPPED = $06; + {$EXTERNALSYM EC_STREAM_ERROR_STOPPED} + EC_STREAM_ERROR_STILLPLAYING = $07; + {$EXTERNALSYM EC_STREAM_ERROR_STILLPLAYING} +// ( HResult, DWORD ) : application +// lParam 1 is major code, lParam2 is minor code, either may be zero. + + + EC_ERROR_STILLPLAYING = $08; + {$EXTERNALSYM EC_ERROR_STILLPLAYING} +// ( HResult, void ) : application +// The filter graph manager may issue Run's to the graph asynchronously. +// If such a Run fails, EC_ERROR_STILLPLAYING is issued to notify the +// application of the failure. The state of the underlying filters +// at such a time will be indeterminate - they will all have been asked +// to run, but some are almost certainly not. + + + EC_PALETTE_CHANGED = $09; + {$EXTERNALSYM EC_PALETTE_CHANGED} +// ( void, void ) : application +// notify application that the video palette has changed + + + EC_VIDEO_SIZE_CHANGED = $0A; + {$EXTERNALSYM EC_VIDEO_SIZE_CHANGED} +// ( DWORD, void ) : application +// Sent by video renderers. +// Notifies the application that the native video size has changed. +// LOWORD of the DWORD is the new width, HIWORD is the new height. + + + EC_QUALITY_CHANGE = $0B; + {$EXTERNALSYM EC_QUALITY_CHANGE} +// ( void, void ) : application +// Notify application that playback degradation has occurred + + + EC_SHUTTING_DOWN = $0C; + {$EXTERNALSYM EC_SHUTTING_DOWN} +// ( void, void ) : internal +// This message is sent by the filter graph manager to any plug-in +// distributors which support IMediaEventSink to notify them that +// the filter graph is starting to shutdown. + + + EC_CLOCK_CHANGED = $0D; + {$EXTERNALSYM EC_CLOCK_CHANGED} +// ( void, void ) : application +// Notify application that the clock has changed. +// (i.e. SetSyncSource has been called on the filter graph and has been +// distributed successfully to the filters in the graph.) + + EC_PAUSED = $0E; + {$EXTERNALSYM EC_PAUSED} +// ( HResult, void ) : application +// Notify application the previous pause request has completed + + EC_OPENING_FILE = $10; + {$EXTERNALSYM EC_OPENING_FILE} + EC_BUFFERING_DATA = $11; + {$EXTERNALSYM EC_BUFFERING_DATA} +// ( BOOL, void ) : application +// lParam1 == 1 --> starting to open file or buffer data +// lParam1 == 0 --> not opening or buffering any more +// (This event does not appear to be used by ActiveMovie.) + + + EC_FULLSCREEN_LOST = $12; + {$EXTERNALSYM EC_FULLSCREEN_LOST} +// ( void, IBaseFilter * ) : application +// Sent by full screen renderers when switched away from full screen. +// IBaseFilter may be NULL. + + + EC_ACTIVATE = $13; + {$EXTERNALSYM EC_ACTIVATE} +// ( BOOL, IBaseFilter * ) : internal +// Sent by video renderers when they lose or gain activation. +// lParam1 is set to 1 if gained or 0 if lost +// lParam2 is the IBaseFilter* for the filter that is sending the message +// Used for sound follows focus and full-screen switching + + + EC_NEED_RESTART = $14; + {$EXTERNALSYM EC_NEED_RESTART} +// ( void, void ) : defaulted +// Sent by renderers when they regain a resource (e.g. audio renderer). +// causes a restart by pause/put_current/run (if running). + + + EC_WINDOW_DESTROYED = $15; + {$EXTERNALSYM EC_WINDOW_DESTROYED} +// ( IBaseFilter *, void ) : internal +// Sent by video renderers when the window has been destroyed. Handled +// by the filter graph / distributor telling the resource manager. +// lParam1 is the IBaseFilter* of the filter whose window is being destroyed + + + EC_DISPLAY_CHANGED = $16; + {$EXTERNALSYM EC_DISPLAY_CHANGED} +// ( IPin *, void ) : internal +// Sent by renderers when they detect a display change. the filter graph +// will arrange for the graph to be stopped and the pin send in lParam1 +// to be reconnected. by being reconnected it allows a renderer to reset +// and connect with a more appropriate format for the new display mode +// lParam1 contains an (IPin *) that should be reconnected by the graph + + + EC_STARVATION = $17; + {$EXTERNALSYM EC_STARVATION} +// ( void, void ) : defaulted +// Sent by a filter when it detects starvation. Default handling (only when +// running) is for the graph to be paused until all filters enter the +// paused state and then run. Normally this would be sent by a parser or source +// filter when too little data is arriving. + + + EC_OLE_EVENT = $18; + {$EXTERNALSYM EC_OLE_EVENT} +// ( BSTR, BSTR ) : application +// Sent by a filter to pass a text string to the application. +// Conventionally, the first string is a type, and the second a parameter. + + + EC_NOTIFY_WINDOW = $19; + {$EXTERNALSYM EC_NOTIFY_WINDOW} +// ( HWND, void ) : internal +// Pass the window handle around during pin connection. + + EC_STREAM_CONTROL_STOPPED = $1A; + {$EXTERNALSYM EC_STREAM_CONTROL_STOPPED} +// ( IPin * pSender, DWORD dwCookie ) +// Notification that an earlier call to IAMStreamControl::StopAt +// has now take effect. Calls to the method can be marked +// with a cookie which is passed back in the second parameter, +// allowing applications to easily tie together request +// and completion notifications. +// +// NB: IPin will point to the pin that actioned the Stop. This +// may not be the pin that the StopAt was sent to. + + EC_STREAM_CONTROL_STARTED = $1B; + {$EXTERNALSYM EC_STREAM_CONTROL_STARTED} +// ( IPin * pSender, DWORD dwCookie ) +// Notification that an earlier call to IAMStreamControl::StartAt +// has now take effect. Calls to the method can be marked +// with a cookie which is passed back in the second parameter, +// allowing applications to easily tie together request +// and completion notifications. +// +// NB: IPin will point to the pin that actioned the Start. This +// may not be the pin that the StartAt was sent to. + + EC_END_OF_SEGMENT = $1C; + {$EXTERNALSYM EC_END_OF_SEGMENT} +// +// ( const REFERENCE_TIME *pStreamTimeAtEndOfSegment, DWORD dwSegmentNumber ) +// +// pStreamTimeAtEndOfSegment +// pointer to the accumulated stream clock +// time since the start of the segment - this is directly computable +// as the sum of the previous and current segment durations (Stop - Start) +// and the rate applied to each segment +// The source add this time to the time within each segment to get +// a total elapsed time +// +// dwSegmentNumber +// Segment number - starts at 0 +// +// Notifies that a segment end has been reached when the +// AM_SEEKING_Segment flags was set for IMediaSeeking::SetPositions +// Passes in an IMediaSeeking interface to allow the next segment +// to be defined by the application + + EC_SEGMENT_STARTED = $1D; + {$EXTERNALSYM EC_SEGMENT_STARTED} +// +// ( const REFERENCE_TIME *pStreamTimeAtStartOfSegment, DWORD dwSegmentNumber) +// +// pStreamTimeAtStartOfSegment +// pointer to the accumulated stream clock +// time since the start of the segment - this is directly computable +// as the sum of the previous segment durations (Stop - Start) +// and the rate applied to each segment +// +// dwSegmentNumber +// Segment number - starts at 0 +// +// Notifies that a new segment has been started. +// This is sent synchronously by any entity that will issue +// EC_END_OF_SEGMENT when a new segment is started +// (See IMediaSeeking::SetPositions - AM_SEEKING_Segment flag) +// It is used to compute how many EC_END_OF_SEGMENT notifications +// to expect at the end of a segment and as a consitency check + + EC_LENGTH_CHANGED = $1E; + {$EXTERNALSYM EC_LENGTH_CHANGED} +// (void, void) +// sent to indicate that the length of the "file" has changed + + EC_DEVICE_LOST = $1f; + {$EXTERNALSYM EC_DEVICE_LOST} +// (IUnknown, 0) +// +// request window notification when the device is available again +// (through WM_DEVICECHANGED messages registered with +// RegisterDeviceNotification; see IAMDeviceRemoval interface) + + EC_STEP_COMPLETE = $24; + {$EXTERNALSYM EC_STEP_COMPLETE} +// (BOOL bCacelled, void) +// Step request complete +// if bCancelled is TRUE the step was cancelled. This can happen +// if the application issued some control request or because there +// was a mode change etc etc + + +// EC_SKIP_FRAMES = $25; +// ( nFramesToSkip, void ) : internal +// Get the filter graph to seek accuratley. +// Event code 25 is reserved for future use. (dx8.1 specific) + + EC_TIMECODE_AVAILABLE = $30; + {$EXTERNALSYM EC_TIMECODE_AVAILABLE} +// Sent by filter supporting timecode +// Param1 has a pointer to the sending object +// Param2 has the device ID of the sending object + + EC_EXTDEVICE_MODE_CHANGE = $31; + {$EXTERNALSYM EC_EXTDEVICE_MODE_CHANGE} +// Sent by filter supporting IAMExtDevice +// Param1 has the new mode +// Param2 has the device ID of the sending object + + + EC_STATE_CHANGE = $32; + {$EXTERNALSYM EC_STATE_CHANGE} +// ( FILTER_STATE, BOOL bInternal) +// Used to notify the application of any state changes in the filter graph. +// lParam1 is of type enum FILTER_STATE (defined in strmif.h) and indicates +// the state of the filter graph. +// +// lParam2 == 0 indicates that the previous state change request has completed +// & a change in application state. +// lParam2 == 1 reserved for future use to indicate internal state changes. + + EC_GRAPH_CHANGED = $50; + {$EXTERNALSYM EC_GRAPH_CHANGED} +// Sent by filter to notify interesting graph changes + + EC_CLOCK_UNSET = $51; + {$EXTERNALSYM EC_CLOCK_UNSET} +// ( void, void ) : application +// Used to notify the filter graph to unset the current graph clock. +// Has the affect of forcing the filter graph to reestablish the graph clock +// on the next Pause/Run (note that this is only used by ksproxy, when the pin +// of a clock providing filter is disconnected) + + EC_VMR_RENDERDEVICE_SET = $53; + {$EXTERNALSYM EC_VMR_RENDERDEVICE_SET} +// (Render_Device type, void) +// Identifies the type of rendering mechanism the VMR +// is using to display video. Types used include: + VMR_RENDER_DEVICE_OVERLAY = $01; + {$EXTERNALSYM VMR_RENDER_DEVICE_OVERLAY} + VMR_RENDER_DEVICE_VIDMEM = $02; + {$EXTERNALSYM VMR_RENDER_DEVICE_VIDMEM} + VMR_RENDER_DEVICE_SYSMEM = $04; + {$EXTERNALSYM VMR_RENDER_DEVICE_SYSMEM} + + + EC_VMR_SURFACE_FLIPPED = $54; + {$EXTERNALSYM EC_VMR_SURFACE_FLIPPED} +// (hr - Flip return code, void) +// Identifies the VMR's allocator-presenter has called the DDraw flip api on +// the surface being presented. This allows the VMR to keep its DX-VA table +// of DDraw surfaces in sync with DDraws flipping chain. + + EC_VMR_RECONNECTION_FAILED = $55; + {$EXTERNALSYM EC_VMR_RECONNECTION_FAILED} +// (hr - ReceiveConnection return code, void) +// Identifies that an upstream decoder tried to perform a dynamic format +// change and the VMR was unable to accept the new format. + + EC_PREPROCESS_COMPLETE = $56; + {$EXTERNALSYM EC_PREPROCESS_COMPLETE} +// Sent by the WM ASF writer filter (WMSDK V9 version) to signal the completion +// of a pre-process run when running in multipass encode mode. +// Param1 = 0, Param2 = IBaseFilter ptr of sending filter + + EC_CODECAPI_EVENT = $57; + {$EXTERNALSYM EC_CODECAPI_EVENT} +// Sent by the Codec API when an event is encountered. Both the Data +// must be freed by the recipient using CoTaskMemFree +// Param1 = UserDataPointer, Param2 = VOID* Data + + + + +//------------------------------------------ +// +// BDA events: +// +// Event code 0x80 through 0x8f are reserved for BDA +// + + +//------------------------------------------ +// +// WindowsMedia SDK filter-specific events: +// +// +// Note that for EC_WMT_EVENT events the wmsdk-based filters use the following structure for +// passing event parameters to the app: + +type + PAMWMTEventData = ^TAMWMTEventData; + AM_WMT_EVENT_DATA = record + hrStatus : HResult; // status code + pData : pointer; // event data + end; + {$EXTERNALSYM AM_WMT_EVENT_DATA} + TAMWMTEventData = AM_WMT_EVENT_DATA; + +const + + EC_WMT_EVENT_BASE = $0251; + {$EXTERNALSYM EC_WMT_EVENT_BASE} +// + EC_WMT_INDEX_EVENT = EC_WMT_EVENT_BASE; + {$EXTERNALSYM EC_WMT_INDEX_EVENT} +// WindowsMedia SDK-originated file indexing status, sent by WMSDK-based filters +// +// lParam1 is one of the enum WMT_STATUS messages listed below, sent by the WindowsMedia SDK +// lParam2 is specific to the lParam event +// +// the following WMT_STATUS messages are sent for this event: +// WMT_STARTED - lParam2 is 0 +// WMT_CLOSED - lParam2 is 0 +// WMT_INDEX_PROGRESS - lParam2 is a DWORD containing the progress percent complete +// + + EC_WMT_EVENT = EC_WMT_EVENT_BASE+1; + {$EXTERNALSYM EC_WMT_EVENT} +// WindowsMedia SDK-originated event, sent by WMSDK-based filters +// +// lParam1 is one of the enum WMT_STATUS messages listed below, sent by the WindowsMedia SDK +// lParam2 is a pointer an AM_WMT_EVENT_DATA structure where, +// hrStatus is the status code sent by the wmsdk +// pData is specific to the lParam1 event +// +// the following WMT_STATUS messages are sent by the WMSDK Reader filter for this event: +// WMT_NO_RIGHTS - pData is a pointer to a WCHAR string containing a challenge URL +// WMT_ACQUIRE_LICENSE - lParam2 is a pointer to a WM_GET_LICENSE_DATA struct +// WMT_NO_RIGHTS_EX - lParam2 is a pointer to a WM_GET_LICENSE_DATA struct +// WMT_NEEDS_INDIVIDUALIZATION - lParam2 is NULL +// WMT_INDIVIDUALIZE - lParam2 is a pointer to a WM_INDIVIDUALIZE_STATUS struct +// the WMSDK (V9) ASF Writer filter will send this event in response to a wmsdk-signaled error during file +// writing, along with the wmsdk WMT_STATUS error as the lParam1 and hrStatus embedded in the +// AM_WMT_EVENT_DATA struct pointed to by the lParam2 pointer. +// +// end WMSDK-originated events +//----------------------------------------- + + EC_BUILT = $300; + {$EXTERNALSYM EC_BUILT} + // Sent to notify transition from unbuilt to built state + + EC_UNBUILT = $301; + {$EXTERNALSYM EC_UNBUILT} + // Sent to notify transtion from built to unbuilt state + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: uuids.h + * + ***************************************************************************) + +const + +// -- to allow consistent labeling of Media types and subtypes -- + // ?? GUID_NULL ?? + GUID_NULL: TGUID = (D1:$00000000;D2:$0000;D3:$0000;D4:($00,$00,$00,$00,$00,$00,$00,$00)); + MEDIATYPE_NULL: TGUID = (D1:$00000000;D2:$0000;D3:$0000;D4:($00,$00,$00,$00,$00,$00,$00,$00)); + MEDIASUBTYPE_NULL: TGUID = (D1:$00000000;D2:$0000;D3:$0000;D4:($00,$00,$00,$00,$00,$00,$00,$00)); + +// -- Use this subtype if you don't have a use for a subtype for your type + MEDIASUBTYPE_None: TGUID = (D1:$E436EB8E;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_None} + +// -- major types --- + MEDIATYPE_Video: TGUID = (D1:$73646976;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIATYPE_Video} + MEDIATYPE_Audio: TGUID = (D1:$73647561;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIATYPE_Audio} + MEDIATYPE_Text: TGUID = (D1:$73747874;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIATYPE_Text} + MEDIATYPE_Midi: TGUID = (D1:$7364696D;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIATYPE_Midi} + MEDIATYPE_Stream: TGUID = (D1:$E436EB83;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIATYPE_Stream} + MEDIATYPE_Interleaved: TGUID = (D1:$73766169;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIATYPE_Interleaved} + MEDIATYPE_File: TGUID = (D1:$656C6966;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIATYPE_File} + MEDIATYPE_ScriptCommand: TGUID = (D1:$73636D64;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIATYPE_ScriptCommand} + MEDIATYPE_AUXLine21Data: TGUID = (D1:$670AEA80;D2:$3A82;D3:$11D0;D4:($B7,$9B,$00,$AA,$00,$37,$67,$A7)); + {$EXTERNALSYM MEDIATYPE_AUXLine21Data} + MEDIATYPE_VBI : TGUID = '{F72A76E1-EB0A-11D0-ACE4-0000C0CC16BA}'; + {$EXTERNALSYM MEDIATYPE_VBI} + MEDIATYPE_Timecode: TGUID = (D1:$0482DEE3;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIATYPE_Timecode} + MEDIATYPE_LMRT : TGUID = (D1:$74726c6d;D2:$0000;D3:$0010;D4:($80,$00,$00,$aa,$00,$38,$9b,$71)); + {$EXTERNALSYM MEDIATYPE_LMRT} + MEDIATYPE_URL_STREAM: TGUID = (D1:$736c7275;D2:$0000;D3:$0010;D4:($80,$00,$00,$aa,$00,$38,$9b,$71)); + {$EXTERNALSYM MEDIATYPE_URL_STREAM} + +// -- sub types --- + MEDIASUBTYPE_CLPL: TGUID = (D1:$4C504C43;D2:$0000;D3:$0010;D4:($80,$00,$00,$aa,$00,$38,$9b,$71)); + {$EXTERNALSYM MEDIASUBTYPE_CLPL} + MEDIASUBTYPE_YUYV: TGUID = (D1:$56595559;D2:$0000;D3:$0010;D4:($80,$00,$00,$aa,$00,$38,$9b,$71)); + {$EXTERNALSYM MEDIASUBTYPE_YUYV} + MEDIASUBTYPE_IYUV: TGUID = (D1:$56555949;D2:$0000;D3:$0010;D4:($80,$00,$00,$aa,$00,$38,$9b,$71)); + {$EXTERNALSYM MEDIASUBTYPE_IYUV} + MEDIASUBTYPE_YVU9: TGUID = (D1:$39555659;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_YVU9} + MEDIASUBTYPE_Y411: TGUID = (D1:$31313459;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_Y411} + MEDIASUBTYPE_Y41P: TGUID = (D1:$50313459;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_Y41P} + MEDIASUBTYPE_YUY2: TGUID = (D1:$32595559;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_YUY2} + MEDIASUBTYPE_YVYU: TGUID = (D1:$55595659;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_YVYU} + MEDIASUBTYPE_UYVY: TGUID = (D1:$59565955;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_UYVY} + MEDIASUBTYPE_Y211: TGUID = (D1:$31313259;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_Y211} + MEDIASUBTYPE_CLJR: TGUID = (D1:$524A4C43;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_CLJR} + MEDIASUBTYPE_IF09: TGUID = (D1:$39304649;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_IF09} + MEDIASUBTYPE_CPLA: TGUID = (D1:$414C5043;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_CPLA} + MEDIASUBTYPE_MJPG: TGUID = (D1:$47504A4D;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_MJPG} + MEDIASUBTYPE_TVMJ: TGUID = (D1:$4A4D5654;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_TVMJ} + MEDIASUBTYPE_WAKE: TGUID = (D1:$454B4157;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_WAKE} + MEDIASUBTYPE_CFCC: TGUID = (D1:$43434643;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_CFCC} + MEDIASUBTYPE_IJPG: TGUID = (D1:$47504A49;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_IJPG} + MEDIASUBTYPE_Plum: TGUID = (D1:$6D756C50;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_Plum} + MEDIASUBTYPE_DVCS: TGUID = (D1:$53435644;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_DVCS} + MEDIASUBTYPE_DVSD: TGUID = (D1:$44535644;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_DVSD} + MEDIASUBTYPE_MDVF: TGUID = (D1:$4656444D;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_MDVF} + MEDIASUBTYPE_RGB1: TGUID = (D1:$E436EB78;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_RGB1} + MEDIASUBTYPE_RGB4: TGUID = (D1:$E436EB79;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_RGB4} + MEDIASUBTYPE_RGB8: TGUID = (D1:$E436EB7A;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_RGB8} + MEDIASUBTYPE_RGB565: TGUID = (D1:$E436EB7B;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_RGB565} + MEDIASUBTYPE_RGB555: TGUID = (D1:$E436EB7C;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_RGB555} + MEDIASUBTYPE_RGB24: TGUID = (D1:$E436EB7D;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_RGB24} + MEDIASUBTYPE_RGB32: TGUID = (D1:$E436EB7E;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_RGB32} + MEDIASUBTYPE_ARGB1555 : TGUID = '{297C55AF-E209-4cb3-B757-C76D6B9C88A8}'; + {$EXTERNALSYM MEDIASUBTYPE_ARGB1555} + MEDIASUBTYPE_ARGB4444 : TGUID = '{6E6415E6-5C24-425f-93CD-80102B3D1CCA}'; + {$EXTERNALSYM MEDIASUBTYPE_ARGB4444} + MEDIASUBTYPE_ARGB32 : TGUID = (D1:$773c9ac0;D2:$3274;D3:$11d0;D4:($b7,$24,$00,$aa,$00,$6c,$1a,$1 )); + {$EXTERNALSYM MEDIASUBTYPE_ARGB32} + + MEDIASUBTYPE_A2R10G10B10 : TGUID = '{2f8bb76d-b644-4550-acf3-d30caa65d5c5}'; + {$EXTERNALSYM MEDIASUBTYPE_A2R10G10B10} + MEDIASUBTYPE_A2B10G10R10 : TGUID = '{576f7893-bdf6-48c4-875f-ae7b81834567}'; + {$EXTERNALSYM MEDIASUBTYPE_A2B10G10R10} + + MEDIASUBTYPE_AYUV : TGUID = '{56555941-0000-0010-8000-00AA00389B71}'; //'AYUV' == MEDIASUBTYPE_AYUV + {$EXTERNALSYM MEDIASUBTYPE_AYUV} + MEDIASUBTYPE_AI44 : TGUID = '{34344941-0000-0010-8000-00AA00389B71}'; //'AI44' == MEDIASUBTYPE_AI44 + {$EXTERNALSYM MEDIASUBTYPE_AI44} + MEDIASUBTYPE_IA44 : TGUID = '{34344149-0000-0010-8000-00AA00389B71}'; //'IA44' == MEDIASUBTYPE_IA44 + {$EXTERNALSYM MEDIASUBTYPE_IA44} + +{$IFDEF ENABLEVMR7} +// +// DirectX7 D3D Render Target media subtypes. +// + MEDIASUBTYPE_RGB32_D3D_DX7_RT : TGUID = '{32335237-0000-0010-8000-00AA00389B71}'; //'7R32' == MEDIASUBTYPE_RGB32_D3D_DX7_RT + {$EXTERNALSYM MEDIASUBTYPE_RGB32_D3D_DX7_RT} + MEDIASUBTYPE_RGB16_D3D_DX7_RT : TGUID = '{36315237-0000-0010-8000-00AA00389B71}'; //'7R16' == MEDIASUBTYPE_RGB16_D3D_DX7_RT + {$EXTERNALSYM MEDIASUBTYPE_RGB16_D3D_DX7_RT} + MEDIASUBTYPE_ARGB32_D3D_DX7_RT : TGUID = '{38384137-0000-0010-8000-00AA00389B71}'; //'7A88' == MEDIASUBTYPE_ARGB32_D3D_DX7_RT + {$EXTERNALSYM MEDIASUBTYPE_ARGB32_D3D_DX7_RT} + MEDIASUBTYPE_ARGB4444_D3D_DX7_RT : TGUID = '{34344137-0000-0010-8000-00AA00389B71}'; //'7A44' == MEDIASUBTYPE_ARGB4444_D3D_DX7_RT + {$EXTERNALSYM MEDIASUBTYPE_ARGB4444_D3D_DX7_RT} + MEDIASUBTYPE_ARGB1555_D3D_DX7_RT : TGUID = '{35314137-0000-0010-8000-00AA00389B71}'; //'7A15' == MEDIASUBTYPE_ARGB1555_D3D_DX7_RT + {$EXTERNALSYM MEDIASUBTYPE_ARGB1555_D3D_DX7_RT} +{$ENDIF} +// +// DirectX9 D3D Render Target media subtypes. +// + + MEDIASUBTYPE_RGB32_D3D_DX9_RT : TGUID = '{32335239-0000-0010-8000-00AA00389B71}'; // 9R32 + {$EXTERNALSYM MEDIASUBTYPE_RGB32_D3D_DX9_RT} + MEDIASUBTYPE_RGB16_D3D_DX9_RT : TGUID = '{36315239-0000-0010-8000-00AA00389B71}'; // 9R16 + {$EXTERNALSYM MEDIASUBTYPE_RGB16_D3D_DX9_RT} + MEDIASUBTYPE_ARGB32_D3D_DX9_RT : TGUID = '{38384139-0000-0010-8000-00AA00389B71}'; // 9A88 + {$EXTERNALSYM MEDIASUBTYPE_ARGB32_D3D_DX9_RT} + MEDIASUBTYPE_ARGB4444_D3D_DX9_RT : TGUID = '{34344139-0000-0010-8000-00AA00389B71}'; // 9A44 + {$EXTERNALSYM MEDIASUBTYPE_ARGB4444_D3D_DX9_RT} + MEDIASUBTYPE_ARGB1555_D3D_DX9_RT : TGUID = '{35314139-0000-0010-8000-00AA00389B71}'; // 9A15 + {$EXTERNALSYM MEDIASUBTYPE_ARGB1555_D3D_DX9_RT} + + +{ +#define MEDIASUBTYPE_HASALPHA(mt) ( ((mt).subtype == MEDIASUBTYPE_ARGB4444) || \ + ((mt).subtype == MEDIASUBTYPE_ARGB32) || \ + ((mt).subtype == MEDIASUBTYPE_AYUV) || \ + ((mt).subtype == MEDIASUBTYPE_AI44) || \ + ((mt).subtype == MEDIASUBTYPE_IA44) || \ + ((mt).subtype == MEDIASUBTYPE_ARGB1555) || \ + ((mt).subtype == MEDIASUBTYPE_ARGB32_D3D_DX7_RT) || \ + ((mt).subtype == MEDIASUBTYPE_ARGB4444_D3D_DX7_RT) || \ + ((mt).subtype == MEDIASUBTYPE_ARGB1555_D3D_DX7_RT) || \ + ((mt).subtype == MEDIASUBTYPE_ARGB32_D3D_DX9_RT) || \ + ((mt).subtype == MEDIASUBTYPE_ARGB4444_D3D_DX9_RT) || \ + ((mt).subtype == MEDIASUBTYPE_ARGB1555_D3D_DX9_RT) ) + +#define MEDIASUBTYPE_HASALPHA7(mt) (((mt).subtype == MEDIASUBTYPE_ARGB32_D3D_DX7_RT) || \ + ((mt).subtype == MEDIASUBTYPE_ARGB4444_D3D_DX7_RT) || \ + ((mt).subtype == MEDIASUBTYPE_ARGB1555_D3D_DX7_RT) ) + +#define MEDIASUBTYPE_D3D_DX7_RT(mt) (((mt).subtype == MEDIASUBTYPE_ARGB32_D3D_DX7_RT) || \ + ((mt).subtype == MEDIASUBTYPE_ARGB4444_D3D_DX7_RT) || \ + ((mt).subtype == MEDIASUBTYPE_ARGB1555_D3D_DX7_RT) || \ + ((mt).subtype == MEDIASUBTYPE_RGB32_D3D_DX7_RT) || \ + ((mt).subtype == MEDIASUBTYPE_RGB16_D3D_DX7_RT)) + +#define MEDIASUBTYPE_HASALPHA9(mt) (((mt).subtype == MEDIASUBTYPE_ARGB32_D3D_DX9_RT) || \ + ((mt).subtype == MEDIASUBTYPE_ARGB4444_D3D_DX9_RT) || \ + ((mt).subtype == MEDIASUBTYPE_ARGB1555_D3D_DX9_RT) ) + + +#define MEDIASUBTYPE_D3D_DX9_RT(mt) (((mt).subtype == MEDIASUBTYPE_ARGB32_D3D_DX9_RT) || \ + ((mt).subtype == MEDIASUBTYPE_ARGB4444_D3D_DX9_RT) || \ + ((mt).subtype == MEDIASUBTYPE_ARGB1555_D3D_DX9_RT) || \ + ((mt).subtype == MEDIASUBTYPE_RGB32_D3D_DX9_RT) || \ + ((mt).subtype == MEDIASUBTYPE_RGB16_D3D_DX9_RT)) +} + +// DX-VA uncompressed surface formats + + MEDIASUBTYPE_YV12 : TGUID = '{32315659-0000-0010-8000-00AA00389B71}'; // YV12 + {$EXTERNALSYM MEDIASUBTYPE_YV12} + MEDIASUBTYPE_NV12 : TGUID = '{3231564E-0000-0010-8000-00AA00389B71}'; // NV12 + {$EXTERNALSYM MEDIASUBTYPE_NV12} + MEDIASUBTYPE_IMC1 : TGUID = '{31434D49-0000-0010-8000-00AA00389B71}'; // IMC1 + {$EXTERNALSYM MEDIASUBTYPE_IMC1} + MEDIASUBTYPE_IMC2 : TGUID = '{32434d49-0000-0010-8000-00AA00389B71}'; // IMC2 + {$EXTERNALSYM MEDIASUBTYPE_IMC2} + MEDIASUBTYPE_IMC3 : TGUID = '{33434d49-0000-0010-8000-00AA00389B71}'; // IMC3 + {$EXTERNALSYM MEDIASUBTYPE_IMC3} + MEDIASUBTYPE_IMC4 : TGUID = '{34434d49-0000-0010-8000-00AA00389B71}'; // IMC4 + {$EXTERNALSYM MEDIASUBTYPE_IMC4} + MEDIASUBTYPE_S340 : TGUID = '{30343353-0000-0010-8000-00AA00389B71}'; // S340 + {$EXTERNALSYM MEDIASUBTYPE_S340} + MEDIASUBTYPE_S342 : TGUID = '{32343353-0000-0010-8000-00AA00389B71}'; // S342 + {$EXTERNALSYM MEDIASUBTYPE_S342} + + + MEDIASUBTYPE_Overlay: TGUID = (D1:$E436EB7F;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_Overlay} + MEDIASUBTYPE_MPEG1Packet: TGUID = (D1:$E436EB80;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_MPEG1Packet} + MEDIASUBTYPE_MPEG1Payload: TGUID = (D1:$E436EB81;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_MPEG1Payload} + MEDIASUBTYPE_MPEG1AudioPayload: TGUID = (D1:$00000050;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_MPEG1AudioPayload} + MEDIATYPE_MPEG1SystemStream: TGUID = (D1:$E436EB82;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIATYPE_MPEG1SystemStream} + MEDIASUBTYPE_MPEG1System: TGUID = (D1:$E436EB84;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_MPEG1System} + MEDIASUBTYPE_MPEG1VideoCD: TGUID = (D1:$E436EB85;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_MPEG1VideoCD} + MEDIASUBTYPE_MPEG1Video: TGUID = (D1:$E436EB86;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_MPEG1Video} + MEDIASUBTYPE_MPEG1Audio: TGUID = (D1:$E436EB87;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_MPEG1Audio} + MEDIASUBTYPE_Avi: TGUID = (D1:$E436EB88;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_Avi} + MEDIASUBTYPE_Asf: TGUID = (D1:$3db80f90;D2:$9412;D3:$11d1;D4:($ad,$ed,$00,$00,$f8,$75,$4b,$99)); + {$EXTERNALSYM MEDIASUBTYPE_Asf} + MEDIASUBTYPE_QTMovie: TGUID = (D1:$E436EB89;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_QTMovie} + MEDIASUBTYPE_QTRpza: TGUID = (D1:$617A7072;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_QTRpza} + MEDIASUBTYPE_QTSmc: TGUID = (D1:$20636D73;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_QTSmc} + MEDIASUBTYPE_QTRle: TGUID = (D1:$20656C72;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_QTRle} + MEDIASUBTYPE_QTJpeg: TGUID = (D1:$6765706A;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_QTJpeg} + MEDIASUBTYPE_PCMAudio_Obsolete: TGUID = (D1:$E436EB8A;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_PCMAudio_Obsolete} + MEDIASUBTYPE_PCM: TGUID = (D1:$00000001;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_PCM} + MEDIASUBTYPE_WAVE: TGUID = (D1:$E436EB8B;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_WAVE} + MEDIASUBTYPE_AU: TGUID = (D1:$E436EB8C;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_AU} + MEDIASUBTYPE_AIFF: TGUID = (D1:$E436EB8D;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM MEDIASUBTYPE_AIFF} + MEDIASUBTYPE_dvsd_: TGUID = (D1:$64737664;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_dvsd_} + MEDIASUBTYPE_dvhd: TGUID = (D1:$64687664;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_dvhd} + MEDIASUBTYPE_dvsl : TGUID = (D1:$6C737664;D2:$0000;D3:$0010;D4:($80,$00,$00,$AA,$00,$38,$9B,$71)); + {$EXTERNALSYM MEDIASUBTYPE_dvsl} + + MEDIASUBTYPE_dv25 : TGUID = '{35327664-0000-0010-8000-00aa00389b71}'; + {$EXTERNALSYM MEDIASUBTYPE_dv25} + MEDIASUBTYPE_dv50 : TGUID = '{30357664-0000-0010-8000-00aa00389b71}'; + {$EXTERNALSYM MEDIASUBTYPE_dv50} + MEDIASUBTYPE_dvh1 : TGUID = '{31687664-0000-0010-8000-00aa00389b71}'; + {$EXTERNALSYM MEDIASUBTYPE_dvh1} + + MEDIASUBTYPE_Line21_BytePair: TGUID = (D1:$6E8D4A22;D2:$310C;D3:$11D0;D4:($B7,$9A,$00,$AA,$00,$37,$67,$A7)); + {$EXTERNALSYM MEDIASUBTYPE_Line21_BytePair} + MEDIASUBTYPE_Line21_GOPPacket: TGUID = (D1:$6E8D4A23;D2:$310C;D3:$11D0;D4:($B7,$9A,$00,$AA,$00,$37,$67,$A7)); + {$EXTERNALSYM MEDIASUBTYPE_Line21_GOPPacket} + MEDIASUBTYPE_Line21_VBIRawData: TGUID = (D1:$6E8D4A24;D2:$310C;D3:$11D0;D4:($B7,$9A,$00,$AA,$00,$37,$67,$A7)); + {$EXTERNALSYM MEDIASUBTYPE_Line21_VBIRawData} + MEDIASUBTYPE_TELETEXT : TGUID = '{F72A76E3-EB0A-11D0-ACE4-0000C0CC16BA}'; // MEDIASUBTYPE_TELETEXT + {$EXTERNALSYM MEDIASUBTYPE_TELETEXT} + MEDIASUBTYPE_WSS : TGUID = '{2791D576-8E7A-466F-9E90-5D3F3083738B}'; + {$EXTERNALSYM MEDIASUBTYPE_WSS} + MEDIASUBTYPE_VPS : TGUID = '{A1B3F620-9792-4d8d-81A4-86AF25772090}'; + {$EXTERNALSYM MEDIASUBTYPE_VPS} + MEDIASUBTYPE_DRM_Audio: TGUID = (D1:$00000009;D2:$0000;D3:$0010;D4:($80,$00,$00,$aa,$00,$38,$9b,$71)); + {$EXTERNALSYM MEDIASUBTYPE_DRM_Audio} + MEDIASUBTYPE_IEEE_FLOAT: TGUID = (D1:$00000003;D2:$0000;D3:$0010;D4:($80,$00,$00,$aa,$00,$38,$9b,$71)); + {$EXTERNALSYM MEDIASUBTYPE_IEEE_FLOAT} + MEDIASUBTYPE_DOLBY_AC3_SPDIF: TGUID = (D1:$00000092;D2:$0000;D3:$0010;D4:($80,$00,$00,$aa,$00,$38,$9b,$71)); + {$EXTERNALSYM MEDIASUBTYPE_DOLBY_AC3_SPDIF} + MEDIASUBTYPE_RAW_SPORT: TGUID = (D1:$00000240;D2:$0000;D3:$0010;D4:($80,$00,$00,$aa,$00,$38,$9b,$71)); + {$EXTERNALSYM MEDIASUBTYPE_RAW_SPORT} + MEDIASUBTYPE_SPDIF_TAG_241h: TGUID = (D1:$00000241;D2:$0000;D3:$0010;D4:($80,$00,$00,$aa,$00,$38,$9b,$71)); + {$EXTERNALSYM MEDIASUBTYPE_SPDIF_TAG_241h} + +// DirectShow DSS definitions + + MEDIASUBTYPE_DssVideo: TGUID = (D1:$A0AF4F81;D2:$E163;D3:$11D0;D4:($BA,$D9,$00,$60,$97,$44,$11,$1A)); + {$EXTERNALSYM MEDIASUBTYPE_DssVideo} + MEDIASUBTYPE_DssAudio: TGUID = (D1:$A0AF4F82;D2:$E163;D3:$11D0;D4:($BA,$D9,$00,$60,$97,$44,$11,$1A)); + {$EXTERNALSYM MEDIASUBTYPE_DssAudio} + MEDIASUBTYPE_VPVideo: TGUID = (D1:$5A9B6A40;D2:$1A22;D3:$11D1;D4:($BA,$D9,$00,$60,$97,$44,$11,$1A)); + {$EXTERNALSYM MEDIASUBTYPE_VPVideo} + MEDIASUBTYPE_VPVBI: TGUID = (D1:$5A9B6A41;D2:$1A22;D3:$11D1;D4:($BA,$D9,$00,$60,$97,$44,$11,$1A)); + {$EXTERNALSYM MEDIASUBTYPE_VPVBI} + +//--- dxmedia (the cutlist source filter) + CLSID_SimpleCutList: TGUID = (D1:$A5EA8D30;D2:$253D;D3:$11D1;D4:($B3,$F1,$00,$AA,$00,$37,$61,$C5)); + {$EXTERNALSYM CLSID_SimpleCutList} + CLSID_VideoFileClip: TGUID = (D1:$A5EA8D31;D2:$253D;D3:$11D1;D4:($B3,$F1,$00,$AA,$00,$37,$61,$C5)); + {$EXTERNALSYM CLSID_VideoFileClip} + CLSID_AudioFileClip: TGUID = (D1:$A5EA8D32;D2:$253D;D3:$11D1;D4:($B3,$F1,$00,$AA,$00,$37,$61,$C5)); + {$EXTERNALSYM CLSID_AudioFileClip} + CLSID_CutListCacheMemory: TGUID = (D1:$A5EA8D33;D2:$253D;D3:$11D1;D4:($B3,$F1,$00,$AA,$00,$37,$61,$C5)); + {$EXTERNALSYM CLSID_CutListCacheMemory} +//--- end cut list stuff + CLSID_CaptureGraphBuilder: TGUID = (D1:$BF87B6E0;D2:$8C27;D3:$11D0;D4:($B3,$F0,$00,$AA,$00,$37,$61,$C5)); + {$EXTERNALSYM CLSID_CaptureGraphBuilder} + CLSID_CaptureGraphBuilder2: TGUID = (D1:$BF87B6E1;D2:$8C27;D3:$11d0;D4:($B3,$F0,$00,$AA,$00,$37,$61,$C5)); + {$EXTERNALSYM CLSID_CaptureGraphBuilder2} + CLSID_ProtoFilterGraph: TGUID = (D1:$E436EBB0;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM CLSID_ProtoFilterGraph} + CLSID_SystemClock: TGUID = (D1:$E436EBB1;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM CLSID_SystemClock} + CLSID_FilterMapper: TGUID = (D1:$E436EBB2;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM CLSID_FilterMapper} + CLSID_FilterGraph: TGUID = (D1:$E436EBB3;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM CLSID_FilterGraph} + CLSID_FilterGraphNoThread: TGUID = (D1:$E436EBB8;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM CLSID_FilterGraphNoThread} + CLSID_MPEG1Doc: TGUID = (D1:$E4BBD160;D2:$4269;D3:$11CE;D4:($83,$8D,$00,$AA,$00,$55,$59,$5A)); + {$EXTERNALSYM CLSID_MPEG1Doc} + CLSID_FileSource: TGUID = (D1:$701722E0;D2:$8AE3;D3:$11CE;D4:($A8,$5C,$00,$AA,$00,$2F,$EA,$B5)); + {$EXTERNALSYM CLSID_FileSource} + CLSID_MPEG1PacketPlayer: TGUID = (D1:$26C25940;D2:$4CA9;D3:$11CE;D4:($A8,$28,$00,$AA,$00,$2F,$EA,$B5)); + {$EXTERNALSYM CLSID_MPEG1PacketPlayer} + CLSID_MPEG1Splitter: TGUID = (D1:$336475D0;D2:$942A;D3:$11CE;D4:($A8,$70,$00,$AA,$00,$2F,$EA,$B5)); + {$EXTERNALSYM CLSID_MPEG1Splitter} + CLSID_CMpegVideoCodec: TGUID = (D1:$FEB50740;D2:$7BEF;D3:$11CE;D4:($9B,$D9,$00,$00,$E2,$02,$59,$9C)); + {$EXTERNALSYM CLSID_CMpegVideoCodec} + CLSID_CMpegAudioCodec: TGUID = (D1:$4A2286E0;D2:$7BEF;D3:$11CE;D4:($9B,$D9,$00,$00,$E2,$02,$59,$9C)); + {$EXTERNALSYM CLSID_CMpegAudioCodec} + CLSID_TextRender: TGUID = (D1:$E30629D3;D2:$27E5;D3:$11CE;D4:($87,$5D,$00,$60,$8C,$B7,$80,$66)); + {$EXTERNALSYM CLSID_TextRender} + + CLSID_InfTee: TGUID = (D1:$F8388A40;D2:$D5BB;D3:$11D0;D4:($BE,$5A,$00,$80,$C7,$06,$56,$8E)); + {$EXTERNALSYM CLSID_InfTee} + CLSID_AviSplitter: TGUID = (D1:$1B544C20;D2:$FD0B;D3:$11CE;D4:($8C,$63,$00,$AA,$00,$44,$B5,$1E)); + {$EXTERNALSYM CLSID_AviSplitter} + CLSID_AviReader: TGUID = (D1:$1B544C21;D2:$FD0B;D3:$11CE;D4:($8C,$63,$00,$AA,$00,$44,$B5,$1E)); + {$EXTERNALSYM CLSID_AviReader} + CLSID_VfwCapture: TGUID = (D1:$1B544C22;D2:$FD0B;D3:$11CE;D4:($8C,$63,$00,$AA,$00,$44,$B5,$1E)); + {$EXTERNALSYM CLSID_VfwCapture} + CLSID_CaptureProperties: TGUID = (D1:$1B544C22;D2:$FD0B;D3:$11CE;D4:($8C,$63,$00,$AA,$00,$44,$B5,$1F)); + {$EXTERNALSYM CLSID_CaptureProperties} + CLSID_FGControl: TGUID = (D1:$E436EBB4;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM CLSID_FGControl} + CLSID_MOVReader: TGUID = (D1:$44584800;D2:$F8EE;D3:$11CE;D4:($B2,$D4,$00,$DD,$01,$10,$1B,$85)); + {$EXTERNALSYM CLSID_MOVReader} + CLSID_QuickTimeParser: TGUID = (D1:$d51bd5a0;D2:$7548;D3:$11cf;D4:($a5,$20,$00,$80,$c7,$7e,$f5,$8a)); + {$EXTERNALSYM CLSID_QuickTimeParser} + CLSID_QTDec: TGUID = (D1:$fdfe9681;D2:$74a3;D3:$11d0;D4:($af,$a7,$00,$aa,$00,$b6,$7a,$42)); + {$EXTERNALSYM CLSID_QTDec} + CLSID_AVIDoc: TGUID = (D1:$D3588AB0;D2:$0781;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM CLSID_AVIDoc} +//---dxmedia + CLSID_AVIDocWriter: TGUID = (D1:$D3588AB1;D2:$0781;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM CLSID_AVIDocWriter} +//--- + CLSID_VideoRenderer: TGUID = (D1:$70E102B0;D2:$5556;D3:$11CE;D4:($97,$C0,$00,$AA,$00,$55,$59,$5A)); + {$EXTERNALSYM CLSID_VideoRenderer} + CLSID_Colour: TGUID = (D1:$1643E180;D2:$90F5;D3:$11CE;D4:($97,$D5,$00,$AA,$00,$55,$59,$5A)); + {$EXTERNALSYM CLSID_Colour} + CLSID_Dither: TGUID = (D1:$1DA08500;D2:$9EDC;D3:$11CF;D4:($BC,$10,$00,$AA,$00,$AC,$74,$F6)); + {$EXTERNALSYM CLSID_Dither} + CLSID_ModexRenderer: TGUID = (D1:$07167665;D2:$5011;D3:$11CF;D4:($BF,$33,$00,$AA,$00,$55,$59,$5A)); + {$EXTERNALSYM CLSID_ModexRenderer} + CLSID_AudioRender: TGUID = (D1:$E30629D1;D2:$27E5;D3:$11CE;D4:($87,$5D,$00,$60,$8C,$B7,$80,$66)); + {$EXTERNALSYM CLSID_AudioRender} + CLSID_AudioProperties: TGUID = (D1:$05589FAF;D2:$C356;D3:$11CE;D4:($BF,$01,$00,$AA,$00,$55,$59,$5A)); + {$EXTERNALSYM CLSID_AudioProperties} + + CLSID_DSoundRender: TGUID = (D1:$79376820;D2:$07D0;D3:$11CF;D4:($A2,$4D,$00,$20,$AF,$D7,$97,$67)); + {$EXTERNALSYM CLSID_DSoundRender} + CLSID_AudioRecord: TGUID = (D1:$E30629D2;D2:$27E5;D3:$11CE;D4:($87,$5D,$00,$60,$8C,$B7,$80,$66)); + {$EXTERNALSYM CLSID_AudioRecord} + CLSID_AudioInputMixerProperties: TGUID = (D1:$2ca8ca52;D2:$3c3f;D3:$11d2;D4:($b7,$3d,$00,$c0,$4f,$b6,$bd,$3d)); + {$EXTERNALSYM CLSID_AudioInputMixerProperties} + CLSID_AVIDec: TGUID = (D1:$CF49D4E0;D2:$1115;D3:$11CE;D4:($B0,$3A,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM CLSID_AVIDec} + CLSID_AVIDraw: TGUID = (D1:$a888df60;D2:$1e90;D3:$11cf;D4:($ac,$98,$00,$aa,$00,$4c,$f,$a9)); + {$EXTERNALSYM CLSID_AVIDraw} + CLSID_ACMWrapper: TGUID = (D1:$6A08CF80;D2:$0E18;D3:$11CF;D4:($A2,$4D,$00,$20,$AF,$D7,$97,$67)); + {$EXTERNALSYM CLSID_ACMWrapper} + CLSID_AsyncReader: TGUID = (D1:$E436EBB5;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM CLSID_AsyncReader} + CLSID_URLReader: TGUID = (D1:$E436EBB6;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM CLSID_URLReader} + CLSID_PersistMonikerPID: TGUID = (D1:$E436EBB7;D2:$524F;D3:$11CE;D4:($9F,$53,$00,$20,$AF,$0B,$A7,$70)); + {$EXTERNALSYM CLSID_PersistMonikerPID} + CLSID_AMovie: TGUID = (D1:$5F2759C0;D2:$7685;D3:$11CF;D4:($8B,$23,$00,$80,$5F,$6C,$EF,$60)); + {$EXTERNALSYM CLSID_AMovie} + CLSID_AVICo: TGUID = (D1:$D76E2820;D2:$1563;D3:$11CF;D4:($AC,$98,$00,$AA,$00,$4C,$0F,$A9)); + {$EXTERNALSYM CLSID_AVICo} + CLSID_FileWriter: TGUID = (D1:$8596E5F0;D2:$0DA5;D3:$11D0;D4:($BD,$21,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_FileWriter} + + CLSID_AviDest: TGUID = (D1:$E2510970;D2:$F137;D3:$11CE;D4:($8B,$67,$00,$AA,$00,$A3,$F1,$A6)); + {$EXTERNALSYM CLSID_AviDest} + CLSID_AviMuxProptyPage: TGUID = (D1:$C647B5C0;D2:$157C;D3:$11D0;D4:($BD,$23,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_AviMuxProptyPage} + CLSID_AviMuxProptyPage1: TGUID = (D1:$0A9AE910;D2:$85C0;D3:$11D0;D4:($BD,$42,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_AviMuxProptyPage1} + CLSID_AVIMIDIRender: TGUID = (D1:$07B65360;D2:$C445;D3:$11CE;D4:($AF,$DE,$00,$AA,$00,$6C,$14,$F4)); + {$EXTERNALSYM CLSID_AVIMIDIRender} + CLSID_WMAsfReader: TGUID = (D1:$187463a0;D2:$5bb7;D3:$11d3;D4:($ac,$be,$00,$80,$c7,$5e,$24,$6e)); + {$EXTERNALSYM CLSID_WMAsfReader} + CLSID_WMAsfWriter: TGUID = (D1:$7c23220e;D2:$55bb;D3:$11d3;D4:($8b,$16,$00,$c0,$4f,$b6,$bd,$3d)); + {$EXTERNALSYM CLSID_WMAsfWriter} + CLSID_MPEG2Demultiplexer: TGUID = (D1:$afb6c280;D2:$2c41;D3:$11d3;D4:($8a,$60,$00,$00,$f8,$1e,$0e,$4a)); + {$EXTERNALSYM CLSID_MPEG2Demultiplexer} + CLSID_MMSPLITTER: TGUID = (D1:$3ae86b20;D2:$7be8;D3:$11d1;D4:($ab,$e6,$00,$a0,$c9,$05,$f3,$75)); + {$EXTERNALSYM CLSID_MMSPLITTER} + + CLSID_StreamBufferSink : TGUID = '{2DB47AE5-CF39-43c2-B4D6-0CD8D90946F4}'; + {$EXTERNALSYM CLSID_StreamBufferSink} + CLSID_StreamBufferSource : TGUID = '{C9F5FE02-F851-4eb5-99EE-AD602AF1E619}'; + {$EXTERNALSYM CLSID_StreamBufferSource} + CLSID_StreamBufferConfig : TGUID = '{FA8A68B2-C864-4ba2-AD53-D3876A87494B}'; + {$EXTERNALSYM CLSID_StreamBufferConfig} + CLSID_Mpeg2VideoStreamAnalyzer : TGUID = '{6CFAD761-735D-4aa5-8AFC-AF91A7D61EBA}'; + {$EXTERNALSYM CLSID_Mpeg2VideoStreamAnalyzer} + CLSID_StreamBufferRecordingAttributes : TGUID = '{CCAA63AC-1057-4778-AE92-1206AB9ACEE6}'; + {$EXTERNALSYM CLSID_StreamBufferRecordingAttributes} + CLSID_StreamBufferComposeRecording : TGUID = '{D682C4BA-A90A-42fe-B9E1-03109849C423}'; + {$EXTERNALSYM CLSID_StreamBufferComposeRecording} + + CLSID_DVVideoCodec: TGUID = (D1:$B1B77C00;D2:$C3E4;D3:$11CF;D4:($AF,$79,$00,$AA,$00,$B6,$7A,$42)); + {$EXTERNALSYM CLSID_DVVideoCodec} + CLSID_DVVideoEnc: TGUID = (D1:$13AA3650;D2:$BB6F;D3:$11D0;D4:($AF,$B9,$00,$AA,$00,$B6,$7A,$42)); + {$EXTERNALSYM CLSID_DVVideoEnc} + CLSID_DVSplitter: TGUID = (D1:$4EB31670;D2:$9FC6;D3:$11CF;D4:($AF,$6E,$00,$AA,$00,$B6,$7A,$42)); + {$EXTERNALSYM CLSID_DVSplitter} + CLSID_DVMux: TGUID = (D1:$129D7E40;D2:$C10D;D3:$11D0;D4:($AF,$B9,$00,$AA,$00,$B6,$7A,$42)); + {$EXTERNALSYM CLSID_DVMux} + CLSID_SeekingPassThru: TGUID = (D1:$060AF76C;D2:$68DD;D3:$11D0;D4:($8F,$C1,$00,$C0,$4F,$D9,$18,$9D)); + {$EXTERNALSYM CLSID_SeekingPassThru} + CLSID_Line21Decoder : TGUID = (D1:$6E8D4A20;D2:$310C;D3:$11D0;D4:($B7,$9A,$00,$AA,$00,$37,$67,$A7)); + {$EXTERNALSYM CLSID_Line21Decoder} + CLSID_Line21Decoder2 : TGUID = '{E4206432-01A1-4BEE-B3E1-3702C8EDC574}'; //Line21 (CC) Decoder v2 + {$EXTERNALSYM CLSID_Line21Decoder2} + CLSID_OverlayMixer: TGUID = (D1:$CD8743A1;D2:$3736;D3:$11D0;D4:($9E,$69,$00,$C0,$4F,$D7,$C1,$5B)); + {$EXTERNALSYM CLSID_OverlayMixer} + CLSID_OverlayMixer2: TGUID = '{A0025E90-E45B-11D1-ABE9-00A0C905F375}'; //Overlay Mixer v2 + {$EXTERNALSYM CLSID_OverlayMixer2} + CLSID_VBISurfaces: TGUID = (D1:$814B9800;D2:$1C88;D3:$11D1;D4:($BA,$D9,$00,$60,$97,$44,$11,$1A)); + {$EXTERNALSYM CLSID_VBISurfaces} + CLSID_WSTDecoder : TGUID = '{70BC06E0-5666-11d3-A184-00105AEF9F33}'; //WST Teletext Decoder + {$EXTERNALSYM CLSID_WSTDecoder} + CLSID_MjpegDec : TGUID = '{301056D0-6DFF-11d2-9EEB-006008039E37}'; + {$EXTERNALSYM CLSID_MjpegDec} + CLSID_MJPGEnc : TGUID = '{B80AB0A0-7416-11d2-9EEB-006008039E37}'; + {$EXTERNALSYM CLSID_MJPGEnc} + +// pnp objects and categories + CLSID_SystemDeviceEnum: TGUID = (D1:$62BE5D10;D2:$60EB;D3:$11D0;D4:($BD,$3B,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_SystemDeviceEnum} + CLSID_CDeviceMoniker: TGUID = (D1:$4315D437;D2:$5B8C;D3:$11D0;D4:($BD,$3B,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_CDeviceMoniker} + CLSID_VideoInputDeviceCategory: TGUID = (D1:$860BB310;D2:$5D01;D3:$11D0;D4:($BD,$3B,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_VideoInputDeviceCategory} + CLSID_CVidCapClassManager: TGUID = (D1:$860BB310;D2:$5D01;D3:$11D0;D4:($BD,$3B,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_CVidCapClassManager} + CLSID_LegacyAmFilterCategory: TGUID = (D1:$083863F1;D2:$70DE;D3:$11D0;D4:($BD,$40,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_LegacyAmFilterCategory} + CLSID_CQzFilterClassManager: TGUID = (D1:$083863F1;D2:$70DE;D3:$11D0;D4:($BD,$40,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_CQzFilterClassManager} + CLSID_VideoCompressorCategory: TGUID = (D1:$33D9A760;D2:$90C8;D3:$11D0;D4:($BD,$43,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_VideoCompressorCategory} + CLSID_CIcmCoClassManager: TGUID = (D1:$33D9A760;D2:$90C8;D3:$11D0;D4:($BD,$43,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_CIcmCoClassManager} + CLSID_AudioCompressorCategory: TGUID = (D1:$33D9A761;D2:$90C8;D3:$11D0;D4:($BD,$43,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_AudioCompressorCategory} + CLSID_CAcmCoClassManager: TGUID = (D1:$33D9A761;D2:$90C8;D3:$11D0;D4:($BD,$43,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_CAcmCoClassManager} + CLSID_AudioInputDeviceCategory: TGUID = (D1:$33D9A762;D2:$90C8;D3:$11D0;D4:($BD,$43,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_AudioInputDeviceCategory} + CLSID_CWaveinClassManager: TGUID = (D1:$33D9A762;D2:$90C8;D3:$11D0;D4:($BD,$43,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_CWaveinClassManager} + CLSID_AudioRendererCategory: TGUID = (D1:$E0F158E1;D2:$CB04;D3:$11D0;D4:($BD,$4E,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_AudioRendererCategory} + CLSID_CWaveOutClassManager: TGUID = (D1:$E0F158E1;D2:$CB04;D3:$11D0;D4:($BD,$4E,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_CWaveOutClassManager} + CLSID_MidiRendererCategory: TGUID = (D1:$4EFE2452;D2:$168A;D3:$11D1;D4:($BC,$76,$00,$C0,$4F,$B9,$45,$3B)); + {$EXTERNALSYM CLSID_MidiRendererCategory} + CLSID_CMidiOutClassManager: TGUID = (D1:$4EFE2452;D2:$168A;D3:$11D1;D4:($BC,$76,$00,$C0,$4F,$B9,$45,$3B)); + {$EXTERNALSYM CLSID_CMidiOutClassManager} + CLSID_TransmitCategory: TGUID = (D1:$cc7bfb41;D2:$f175;D3:$11d1;D4:($a3,$92,$00,$e0,$29,$1f,$39,$59)); + {$EXTERNALSYM CLSID_TransmitCategory} + CLSID_DeviceControlCategory: TGUID = (D1:$cc7bfb46;D2:$f175;D3:$11d1;D4:($a3,$92,$00,$e0,$29,$1f,$39,$59)); + {$EXTERNALSYM CLSID_DeviceControlCategory} + CLSID_ActiveMovieCategories: TGUID = (D1:$DA4E3DA0;D2:$D07D;D3:$11D0;D4:($BD,$50,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_ActiveMovieCategories} + CLSID_DVDHWDecodersCategory: TGUID = (D1:$2721AE20;D2:$7E70;D3:$11D0;D4:($A5,$D6,$28,$DB,$04,$C1,$00,$00)); + {$EXTERNALSYM CLSID_DVDHWDecodersCategory} + + CLSID_MediaEncoderCategory : TGUID = '{7D22E920-5CA9-4787-8C2B-A6779BD11781}'; // Encoder API encoder category + {$EXTERNALSYM CLSID_MediaEncoderCategory} + CLSID_MediaMultiplexerCategory : TGUID = '{236C9559-ADCE-4736-BF72-BAB34E392196}'; // Encoder API multiplexer category + {$EXTERNALSYM CLSID_MediaMultiplexerCategory} + + CLSID_FilterMapper2: TGUID = (D1:$CDA42200;D2:$BD88;D3:$11D0;D4:($BD,$4E,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_FilterMapper2} + CLSID_MemoryAllocator: TGUID = (D1:$1E651CC0;D2:$B199;D3:$11D0;D4:($82,$12,$00,$C0,$4F,$C3,$2C,$45)); + {$EXTERNALSYM CLSID_MemoryAllocator} + CLSID_MediaPropertyBag: TGUID = (D1:$CDBD8D00;D2:$C193;D3:$11D0;D4:($BD,$4E,$00,$A0,$C9,$11,$CE,$86)); + {$EXTERNALSYM CLSID_MediaPropertyBag} + CLSID_DvdGraphBuilder: TGUID = (D1:$FCC152B7;D2:$F372;D3:$11D0;D4:($8E,$00,$00,$C0,$4F,$D7,$C0,$8B)); + {$EXTERNALSYM CLSID_DvdGraphBuilder} + CLSID_DVDNavigator: TGUID = (D1:$9B8C4620;D2:$2C1A;D3:$11D0;D4:($84,$93,$00,$A0,$24,$38,$AD,$48)); + {$EXTERNALSYM CLSID_DVDNavigator} + CLSID_DVDState: TGUID = (D1:$f963c5cf;D2:$a659;D3:$4a93;D4:($96,$38,$ca,$f3,$cd,$27,$7d,$13)); + {$EXTERNALSYM CLSID_DVDState} + CLSID_SmartTee: TGUID = (D1:$cc58e280;D2:$8aa1;D3:$11d1;D4:($b3,$f1,$00,$aa,$00,$37,$61,$c5)); + {$EXTERNALSYM CLSID_SmartTee} + +// -- format types --- + FORMAT_None: TGUID = (D1:$0F6417D6;D2:$C318;D3:$11D0;D4:($A4,$3F,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM FORMAT_None} + FORMAT_VideoInfo: TGUID = (D1:$05589F80;D2:$C356;D3:$11CE;D4:($BF,$01,$00,$AA,$00,$55,$59,$5A)); + {$EXTERNALSYM FORMAT_VideoInfo} + FORMAT_VideoInfo2: TGUID = (D1:$F72A76A0;D2:$EB0A;D3:$11D0;D4:($AC,$E4,$00,$00,$C0,$CC,$16,$BA)); + {$EXTERNALSYM FORMAT_VideoInfo2} + FORMAT_WaveFormatEx: TGUID = (D1:$05589F81;D2:$C356;D3:$11CE;D4:($BF,$01,$00,$AA,$00,$55,$59,$5A)); + {$EXTERNALSYM FORMAT_WaveFormatEx} + FORMAT_MPEGVideo: TGUID = (D1:$05589F82;D2:$C356;D3:$11CE;D4:($BF,$01,$00,$AA,$00,$55,$59,$5A)); + {$EXTERNALSYM FORMAT_MPEGVideo} + FORMAT_MPEGStreams: TGUID = (D1:$05589F83;D2:$C356;D3:$11CE;D4:($BF,$01,$00,$AA,$00,$55,$59,$5A)); + {$EXTERNALSYM FORMAT_MPEGStreams} + FORMAT_DvInfo: TGUID = (D1:$05589F84;D2:$C356;D3:$11CE;D4:($BF,$01,$00,$AA,$00,$55,$59,$5A)); + {$EXTERNALSYM FORMAT_DvInfo} + + +// -- Video related GUIDs --- + CLSID_DirectDrawProperties: TGUID = (D1:$944D4C00;D2:$DD52;D3:$11CE;D4:($BF,$0E,$00,$AA,$00,$55,$59,$5A)); + {$EXTERNALSYM CLSID_DirectDrawProperties} + CLSID_PerformanceProperties: TGUID = (D1:$59CE6880;D2:$ACF8;D3:$11CF;D4:($B5,$6E,$00,$80,$C7,$C4,$B6,$8A)); + {$EXTERNALSYM CLSID_PerformanceProperties} + CLSID_QualityProperties: TGUID = (D1:$418AFB70;D2:$F8B8;D3:$11CE;D4:($AA,$C6,$00,$20,$AF,$0B,$99,$A3)); + {$EXTERNALSYM CLSID_QualityProperties} + CLSID_VPObject: TGUID = (D1:$CE292861;D2:$FC88;D3:$11D0;D4:($9E,$69,$00,$C0,$4F,$D7,$C1,$5B)); + {$EXTERNALSYM CLSID_VPObject} + IID_IVPObject: TGUID = (D1:$CE292862;D2:$FC88;D3:$11D0;D4:($9E,$69,$00,$C0,$4F,$D7,$C1,$5B)); + {$EXTERNALSYM IID_IVPObject} + IID_IVPControl: TGUID = (D1:$25DF12C1;D2:$3DE0;D3:$11D1;D4:($9E,$69,$00,$C0,$4F,$D7,$C1,$5B)); + {$EXTERNALSYM IID_IVPControl} + CLSID_VPVBIObject: TGUID = (D1:$814B9801;D2:$1C88;D3:$11D1;D4:($BA,$D9,$00,$60,$97,$44,$11,$1A)); + {$EXTERNALSYM CLSID_VPVBIObject} + IID_IVPVBIObject: TGUID = (D1:$814B9802;D2:$1C88;D3:$11D1;D4:($BA,$D9,$00,$60,$97,$44,$11,$1A)); + {$EXTERNALSYM IID_IVPVBIObject} + + CLSID_ModexProperties: TGUID = (D1:$0618AA30;D2:$6BC4;D3:$11CF;D4:($BF,$36,$00,$AA,$00,$55,$59,$5A)); + {$EXTERNALSYM CLSID_ModexProperties} + +// DV decoder property + CLSID_DVDecPropertiesPage: TGUID = (D1:$101193C0;D2:$0BFE;D3:$11D0;D4:($AF,$91,$00,$AA,$00,$B6,$7A,$42)); + {$EXTERNALSYM CLSID_DVDecPropertiesPage} + +// DV encoder property + CLSID_DVEncPropertiesPage: TGUID = (D1:$4150F050;D2:$BB6F;D3:$11D0;D4:($AF,$B9,$00,$AA,$00,$B6,$7A,$42)); + {$EXTERNALSYM CLSID_DVEncPropertiesPage} + +// DV Muxer property + CLSID_DVMuxPropertyPage: TGUID = (D1:$4DB880E0;D2:$C10D;D3:$11D0;D4:($AF,$B9,$00,$AA,$00,$B6,$7A,$42)); + {$EXTERNALSYM CLSID_DVMuxPropertyPage} + + +// -- Analog video related GUIDs --- + + +// -- format types --- + FORMAT_AnalogVideo : TGUID = (D1:$0482DDE0;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM FORMAT_AnalogVideo} + + MEDIATYPE_AnalogAudio : TGUID = '{0482DEE1-7817-11cf-8a03-00aa006ecb65}'; + {$EXTERNALSYM MEDIATYPE_AnalogAudio} + MEDIATYPE_AnalogVideo : TGUID = (D1:$0482DDE1;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIATYPE_AnalogVideo} + MEDIASUBTYPE_AnalogVideo_NTSC_M: TGUID = (D1:$0482DDE2;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIASUBTYPE_AnalogVideo_NTSC_M} + MEDIASUBTYPE_AnalogVideo_PAL_B: TGUID = (D1:$0482DDE5;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIASUBTYPE_AnalogVideo_PAL_B} + MEDIASUBTYPE_AnalogVideo_PAL_D: TGUID = (D1:$0482DDE6;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIASUBTYPE_AnalogVideo_PAL_D} + MEDIASUBTYPE_AnalogVideo_PAL_G: TGUID = (D1:$0482DDE7;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIASUBTYPE_AnalogVideo_PAL_G} + MEDIASUBTYPE_AnalogVideo_PAL_H: TGUID = (D1:$0482DDE8;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIASUBTYPE_AnalogVideo_PAL_H} + MEDIASUBTYPE_AnalogVideo_PAL_I: TGUID = (D1:$0482DDE9;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIASUBTYPE_AnalogVideo_PAL_I} + MEDIASUBTYPE_AnalogVideo_PAL_M: TGUID = (D1:$0482DDEA;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIASUBTYPE_AnalogVideo_PAL_M} + MEDIASUBTYPE_AnalogVideo_PAL_N : TGUID = (D1:$0482DDEB;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIASUBTYPE_AnalogVideo_PAL_N} + MEDIASUBTYPE_AnalogVideo_PAL_N_COMBO: TGUID = (D1:$482ddec;D2:$7817;D3:$11cf;D4:($8a,$3,$00,$aa,$00,$6e,$cb,$65)); + {$EXTERNALSYM MEDIASUBTYPE_AnalogVideo_PAL_N_COMBO} + +// -- Analog Video subtypes, SECAM + MEDIASUBTYPE_AnalogVideo_SECAM_B: TGUID = (D1:$0482DDF0;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIASUBTYPE_AnalogVideo_SECAM_B} + MEDIASUBTYPE_AnalogVideo_SECAM_D: TGUID = (D1:$0482DDF1;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIASUBTYPE_AnalogVideo_SECAM_D} + MEDIASUBTYPE_AnalogVideo_SECAM_G: TGUID = (D1:$0482DDF2;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIASUBTYPE_AnalogVideo_SECAM_G} + MEDIASUBTYPE_AnalogVideo_SECAM_H: TGUID = (D1:$0482DDF3;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIASUBTYPE_AnalogVideo_SECAM_H} + MEDIASUBTYPE_AnalogVideo_SECAM_K: TGUID = (D1:$0482DDF4;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIASUBTYPE_AnalogVideo_SECAM_K} + MEDIASUBTYPE_AnalogVideo_SECAM_K1: TGUID = (D1:$0482DDF5;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIASUBTYPE_AnalogVideo_SECAM_K1} + MEDIASUBTYPE_AnalogVideo_SECAM_L: TGUID = (D1:$0482DDF6;D2:$7817;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM MEDIASUBTYPE_AnalogVideo_SECAM_L} + +// -- Well known time format GUIDs --- + TIME_FORMAT_NONE: TGUID = (D1:$00000000;D2:$0000;D3:$0000;D4:($00,$00,$00,$00,$00,$00,$00,$00)); + {$EXTERNALSYM TIME_FORMAT_NONE} + TIME_FORMAT_FRAME: TGUID = (D1:$7B785570;D2:$8C82;D3:$11CF;D4:($BC,$0C,$00,$AA,$00,$AC,$74,$F6)); + {$EXTERNALSYM TIME_FORMAT_FRAME} + TIME_FORMAT_BYTE: TGUID = (D1:$7B785571;D2:$8C82;D3:$11CF;D4:($BC,$0C,$00,$AA,$00,$AC,$74,$F6)); + {$EXTERNALSYM TIME_FORMAT_BYTE} + TIME_FORMAT_SAMPLE: TGUID = (D1:$7B785572;D2:$8C82;D3:$11CF;D4:($BC,$0C,$00,$AA,$00,$AC,$74,$F6)); + {$EXTERNALSYM TIME_FORMAT_SAMPLE} + TIME_FORMAT_FIELD: TGUID = (D1:$7B785573;D2:$8C82;D3:$11CF;D4:($BC,$0C,$00,$AA,$00,$AC,$74,$F6)); + {$EXTERNALSYM TIME_FORMAT_FIELD} + TIME_FORMAT_MEDIA_TIME: TGUID = (D1:$7B785574;D2:$8C82;D3:$11CF;D4:($BC,$0C,$00,$AA,$00,$AC,$74,$F6)); + {$EXTERNALSYM TIME_FORMAT_MEDIA_TIME} + +// for IKsPropertySet + AMPROPSETID_Pin: TGUID = (D1:$9B00F101;D2:$1567;D3:$11D1;D4:($B3,$F1,$00,$AA,$00,$37,$61,$C5)); + {$EXTERNALSYM AMPROPSETID_Pin} + PIN_CATEGORY_CAPTURE: TGUID = (D1:$FB6C4281;D2:$0353;D3:$11D1;D4:($90,$5F,$00,$00,$C0,$CC,$16,$BA)); + {$EXTERNALSYM PIN_CATEGORY_CAPTURE} + PIN_CATEGORY_PREVIEW: TGUID = (D1:$FB6C4282;D2:$0353;D3:$11D1;D4:($90,$5F,$00,$00,$C0,$CC,$16,$BA)); + {$EXTERNALSYM PIN_CATEGORY_PREVIEW} + PIN_CATEGORY_ANALOGVIDEOIN: TGUID = (D1:$FB6C4283;D2:$0353;D3:$11D1;D4:($90,$5F,$00,$00,$C0,$CC,$16,$BA)); + {$EXTERNALSYM PIN_CATEGORY_ANALOGVIDEOIN} + PIN_CATEGORY_VBI: TGUID = (D1:$FB6C4284;D2:$0353;D3:$11D1;D4:($90,$5F,$00,$00,$C0,$CC,$16,$BA)); + {$EXTERNALSYM PIN_CATEGORY_VBI} + PIN_CATEGORY_VIDEOPORT: TGUID = (D1:$FB6C4285;D2:$0353;D3:$11D1;D4:($90,$5F,$00,$00,$C0,$CC,$16,$BA)); + {$EXTERNALSYM PIN_CATEGORY_VIDEOPORT} + PIN_CATEGORY_NABTS: TGUID = (D1:$FB6C4286;D2:$0353;D3:$11D1;D4:($90,$5F,$00,$00,$C0,$CC,$16,$BA)); + {$EXTERNALSYM PIN_CATEGORY_NABTS} + PIN_CATEGORY_EDS: TGUID = (D1:$FB6C4287;D2:$0353;D3:$11D1;D4:($90,$5F,$00,$00,$C0,$CC,$16,$BA)); + {$EXTERNALSYM PIN_CATEGORY_EDS} + PIN_CATEGORY_TELETEXT: TGUID = (D1:$FB6C4288;D2:$0353;D3:$11D1;D4:($90,$5F,$00,$00,$C0,$CC,$16,$BA)); + {$EXTERNALSYM PIN_CATEGORY_TELETEXT} + PIN_CATEGORY_CC: TGUID = (D1:$FB6C4289;D2:$0353;D3:$11D1;D4:($90,$5F,$00,$00,$C0,$CC,$16,$BA)); + {$EXTERNALSYM PIN_CATEGORY_CC} + PIN_CATEGORY_STILL: TGUID = (D1:$FB6C428A;D2:$0353;D3:$11D1;D4:($90,$5F,$00,$00,$C0,$CC,$16,$BA)); + {$EXTERNALSYM PIN_CATEGORY_STILL} + PIN_CATEGORY_TIMECODE: TGUID = (D1:$FB6C428B;D2:$0353;D3:$11D1;D4:($90,$5F,$00,$00,$C0,$CC,$16,$BA)); + {$EXTERNALSYM PIN_CATEGORY_TIMECODE} + PIN_CATEGORY_VIDEOPORT_VBI: TGUID = (D1:$FB6C428C;D2:$0353;D3:$11D1;D4:($90,$5F,$00,$00,$C0,$CC,$16,$BA)); + {$EXTERNALSYM PIN_CATEGORY_VIDEOPORT_VBI} + +// the following special GUIDS are used by ICaptureGraphBuilder::FindInterface + LOOK_UPSTREAM_ONLY: TGUID = (D1:$ac798be0;D2:$98e3;D3:$11d1;D4:($b3,$f1,$0,$aa,$0,$37,$61,$c5)); + {$EXTERNALSYM LOOK_UPSTREAM_ONLY} + LOOK_DOWNSTREAM_ONLY: TGUID = (D1:$ac798be1;D2:$98e3;D3:$11d1;D4:($b3,$f1,$0,$aa,$0,$37,$61,$c5)); + {$EXTERNALSYM LOOK_DOWNSTREAM_ONLY} + +// ------------------------------------------------------------------------- +// KSProxy GUIDS +// ------------------------------------------------------------------------- + + CLSID_TVTunerFilterPropertyPage: TGUID = (D1:$266EEE41;D2:$6C63;D3:$11CF;D4:($8A,$03,$00,$AA,$00,$6E,$CB,$65)); + {$EXTERNALSYM CLSID_TVTunerFilterPropertyPage} + CLSID_CrossbarFilterPropertyPage: TGUID = (D1:$71F96461;D2:$78F3;D3:$11D0;D4:($A1,$8C,$00,$A0,$C9,$11,$89,$56)); + {$EXTERNALSYM CLSID_CrossbarFilterPropertyPage} + CLSID_TVAudioFilterPropertyPage: TGUID = (D1:$71F96463;D2:$78F3;D3:$11D0;D4:($A1,$8C,$00,$A0,$C9,$11,$89,$56)); + {$EXTERNALSYM CLSID_TVAudioFilterPropertyPage} + CLSID_VideoProcAmpPropertyPage: TGUID = (D1:$71F96464;D2:$78F3;D3:$11D0;D4:($A1,$8C,$00,$A0,$C9,$11,$89,$56)); + {$EXTERNALSYM CLSID_VideoProcAmpPropertyPage} + CLSID_CameraControlPropertyPage: TGUID = (D1:$71F96465;D2:$78F3;D3:$11D0;D4:($A1,$8C,$00,$A0,$C9,$11,$89,$56)); + {$EXTERNALSYM CLSID_CameraControlPropertyPage} + CLSID_AnalogVideoDecoderPropertyPage: TGUID = (D1:$71F96466;D2:$78F3;D3:$11D0;D4:($A1,$8C,$00,$A0,$C9,$11,$89,$56)); + {$EXTERNALSYM CLSID_AnalogVideoDecoderPropertyPage} + CLSID_VideoStreamConfigPropertyPage: TGUID = (D1:$71F96467;D2:$78F3;D3:$11D0;D4:($A1,$8C,$00,$A0,$C9,$11,$89,$56)); + {$EXTERNALSYM CLSID_VideoStreamConfigPropertyPage} + CLSID_AudioRendererAdvancedProperties: TGUID = (D1:$37e92a92;D2:$d9aa;D3:$11d2;D4:($bf,$84,$8e,$f2,$b1,$55,$5a,$ed)); + {$EXTERNALSYM CLSID_AudioRendererAdvancedProperties} + +// ------------------------------------------------------------------------- +// VMRender GUIDS DX8 +// ------------------------------------------------------------------------- + CLSID_VideoMixingRenderer : TGUID = (D1:$B87BEB7B;D2:$8D29;D3:$423f;D4:($AE,$4D,$65,$82,$C1,$01,$75,$AC)); + {$EXTERNALSYM CLSID_VideoMixingRenderer} + CLSID_VideoRendererDefault : TGUID = '{6BC1CFFA-8FC1-4261-AC22-CFB4CC38DB50}'; + {$EXTERNALSYM CLSID_VideoRendererDefault} + CLSID_AllocPresenter : TGUID = '{99d54f63-1a69-41ae-aa4d-c976eb3f0713}'; + {$EXTERNALSYM CLSID_AllocPresenter} + CLSID_AllocPresenterDDXclMode : TGUID = '{4444ac9e-242e-471b-a3c7-45dcd46352bc}'; + {$EXTERNALSYM CLSID_AllocPresenterDDXclMode} + CLSID_VideoPortManager : TGUID = '{6f26a6cd-967b-47fd-874a-7aed2c9d25a2}'; + {$EXTERNALSYM CLSID_VideoPortManager} + CLSID_ImageSynchronization : TGUID = '{7D8AA343-6E63-4663-BE90-6B80F66540A3}'; + {$EXTERNALSYM CLSID_ImageSynchronization} + CLSID_VideoMixer : TGUID = '{06b32aee-77da-484b-973b-5d64f47201b0}'; + {$EXTERNALSYM CLSID_VideoMixer} +// ------------------------------------------------------------------------- +// VMR GUIDS for DX9 +// ------------------------------------------------------------------------- + + CLSID_VideoMixingRenderer9 : TGUID = '{51b4abf3-748f-4e3b-a276-c828330e926a}'; + {$EXTERNALSYM CLSID_VideoMixingRenderer9} + CLSID_AllocPresenter9 : TGUID = '{2D2E24CB-0CD5-458F-86EA-3E6FA22C8E64}'; // Found in Registry, Should'nt be used directly + {$EXTERNALSYM CLSID_AllocPresenter9} + CLSID_ImageSynchronization9 : TGUID = '{E4979309-7A32-495E-8A92-7B014AAD4961}'; // Found in Registry + {$EXTERNALSYM CLSID_ImageSynchronization9} + +// ------------------------------------------------------------------------- +// BDA Network Provider GUIDS +// ------------------------------------------------------------------------- + CLSID_ATSCNetworkProvider : TGUID = (D1:$0dad2fdd;D2:$5fd7;D3:$11d3;D4:($8f,$50,$00,$c0,$4f,$79,$71,$e2)); + {$EXTERNALSYM CLSID_ATSCNetworkProvider} + CLSID_ATSCNetworkPropertyPage: TGUID = (D1:$e3444d16;D2:$5ac4;D3:$4386;D4:($88,$df,$13,$fd,$23,$0e,$1d,$da)); + {$EXTERNALSYM CLSID_ATSCNetworkPropertyPage} + CLSID_DVBSNetworkProvider : TGUID = (D1:$fa4b375a;D2:$45b4;D3:$4d45;D4:($84,$40,$26,$39,$57,$b1,$16,$23)); + {$EXTERNALSYM CLSID_DVBSNetworkProvider} + CLSID_DVBTNetworkProvider : TGUID = '{216C62DF-6D7F-4e9a-8571-05F14EDB766A}'; + {$EXTERNALSYM CLSID_DVBTNetworkProvider} + CLSID_DVBCNetworkProvider : TGUID = '{DC0C0FE7-0485-4266-B93F-68FBF80ED834}'; + {$EXTERNALSYM CLSID_DVBCNetworkProvider} + + +// --- WST Decoder interface GUID --- + IID_IAMWstDecoder : TGUID = '{C056DE21-75C2-11d3-A184-00105AEF9F33}'; // IID_IAMWstDecoder + {$EXTERNALSYM IID_IAMWstDecoder} +// --- WST Decoder Property Page --- + CLSID_WstDecoderPropertyPage : TGUID = '{04E27F80-91E4-11d3-A184-00105AEF9F33}'; // WST Decoder Property Page + {$EXTERNALSYM CLSID_WstDecoderPropertyPage} + +// ------------------------------------------------------------------------- +// TVE Receiver filter guids +// ------------------------------------------------------------------------- + +// The CLSID used by the TVE Receiver filter + CLSID_DShowTVEFilter : TGUID = '{05500280-FAA5-4DF9-8246-BFC23AC5CEA8}'; + {$EXTERNALSYM CLSID_DShowTVEFilter} + CLSID_TVEFilterTuneProperties : TGUID = '{05500281-FAA5-4DF9-8246-BFC23AC5CEA8}'; + {$EXTERNALSYM CLSID_TVEFilterTuneProperties} + CLSID_TVEFilterCCProperties : TGUID = '{05500282-FAA5-4DF9-8246-BFC23AC5CEA8}'; + {$EXTERNALSYM CLSID_TVEFilterCCProperties} + CLSID_TVEFilterStatsProperties : TGUID = '{05500283-FAA5-4DF9-8246-BFC23AC5CEA8}'; + {$EXTERNALSYM CLSID_TVEFilterStatsProperties} + +// ------------------------------------------------------------------------- +// Defined ENCAPI parameter GUIDs +// ------------------------------------------------------------------------- + + // The CLSID for the original IVideoEncoder proxy plug-in + CLSID_IVideoEncoderProxy : TGUID = '{B43C4EEC-8C32-4791-9102-508ADA5EE8E7}'; + {$EXTERNALSYM CLSID_IVideoEncoderProxy} + + // The CLSID for the ICodecAPI proxy plug-in + CLSID_ICodecAPIProxy : TGUID = '{7ff0997a-1999-4286-a73c-622b8814e7eb}'; + {$EXTERNALSYM CLSID_ICodecAPIProxy} + + // The CLSID for the combination ICodecAPI/IVideoEncoder proxy plug-in + CLSID_IVideoEncoderCodecAPIProxy : TGUID = '{b05dabd9-56e5-4fdc-afa4-8a47e91f1c9c}'; + {$EXTERNALSYM CLSID_IVideoEncoderCodecAPIProxy} + + ENCAPIPARAM_BITRATE : TGUID = '{49CC4C43-CA83-4ad4-A9AF-F3696AF666DF}'; + {$EXTERNALSYM ENCAPIPARAM_BITRATE} + ENCAPIPARAM_PEAK_BITRATE : TGUID = '{703F16A9-3D48-44a1-B077-018DFF915D19}'; + {$EXTERNALSYM ENCAPIPARAM_PEAK_BITRATE} + ENCAPIPARAM_BITRATE_MODE : TGUID = '{EE5FB25C-C713-40d1-9D58-C0D7241E250F}'; + {$EXTERNALSYM ENCAPIPARAM_BITRATE_MODE} + + // for kernel control + + CODECAPI_CHANGELISTS : TGUID = '{62b12acf-f6b0-47d9-9456-96f22c4e0b9d}'; + {$EXTERNALSYM CODECAPI_CHANGELISTS} + CODECAPI_VIDEO_ENCODER : TGUID = '{7112e8e1-3d03-47ef-8e60-03f1cf537301}'; + {$EXTERNALSYM CODECAPI_VIDEO_ENCODER} + CODECAPI_AUDIO_ENCODER : TGUID = '{b9d19a3e-f897-429c-bc46-8138b7272b2d}'; + {$EXTERNALSYM CODECAPI_AUDIO_ENCODER} + CODECAPI_SETALLDEFAULTS : TGUID = '{6c5e6a7c-acf8-4f55-a999-1a628109051b}'; + {$EXTERNALSYM CODECAPI_SETALLDEFAULTS} + CODECAPI_ALLSETTINGS : TGUID = '{6a577e92-83e1-4113-adc2-4fcec32f83a1}'; + {$EXTERNALSYM CODECAPI_ALLSETTINGS} + CODECAPI_SUPPORTSEVENTS : TGUID = '{0581af97-7693-4dbd-9dca-3f9ebd6585a1}'; + {$EXTERNALSYM CODECAPI_SUPPORTSEVENTS} + CODECAPI_CURRENTCHANGELIST : TGUID = '{1cb14e83-7d72-4657-83fd-47a2c5b9d13d}'; + {$EXTERNALSYM CODECAPI_CURRENTCHANGELIST} + +(*==========================================================================; + * + * Copyright (C) 1996-1997 Microsoft Corporation. All Rights Reserved. + * + * File: ksuuids.h + * + ***************************************************************************) +// contains the GUIDs for the MediaType type, subtype fields and format types +// for DVD/MPEG2 media types. + +const +// --- MPEG 2 definitions --- + MEDIATYPE_MPEG2_PACK: TGUID = (D1:$36523B13;D2:$8EE5;D3:$11d1;D4:($8C,$A3,$00,$60,$B0,$57,$66,$4A)); + {$EXTERNALSYM MEDIATYPE_MPEG2_PACK} + MEDIATYPE_MPEG2_PES: TGUID = (D1:$e06d8020;D2:$db46;D3:$11cf;D4:($b4,$d1,$00,$80,$5f,$6c,$bb,$ea)); + {$EXTERNALSYM MEDIATYPE_MPEG2_PES} + MEDIATYPE_CONTROL: TGUID = (D1:$e06d8021;D2:$db46;D3:$11cf;D4:($b4,$d1,$00,$80,$5f,$6c,$bb,$ea)); + {$EXTERNALSYM MEDIATYPE_CONTROL} + MEDIASUBTYPE_MPEG2_VIDEO: TGUID = (D1:$e06d8026;D2:$db46;D3:$11cf;D4:($b4,$d1,$00,$80,$5f,$6c,$bb,$ea)); + {$EXTERNALSYM MEDIASUBTYPE_MPEG2_VIDEO} + + MEDIATYPE_MPEG2_SECTIONS : TGUID = '{455f176c-4b06-47ce-9aef-8caef73df7b5}'; + {$EXTERNALSYM MEDIATYPE_MPEG2_SECTIONS} + MEDIASUBTYPE_ATSC_SI : TGUID = '{b3c7397c-d303-414d-b33c-4ed2c9d29733}'; + {$EXTERNALSYM MEDIASUBTYPE_ATSC_SI} + MEDIASUBTYPE_DVB_SI : TGUID = '{e9dd31a3-221d-4adb-8532-9af309c1a408}'; + {$EXTERNALSYM MEDIASUBTYPE_DVB_SI} + MEDIASUBTYPE_MPEG2DATA : TGUID = '{C892E55B-252D-42b5-A316-D997E7A5D995}'; + {$EXTERNALSYM MEDIASUBTYPE_MPEG2DATA} + + +// use MPEG2VIDEOINFO (defined below) with FORMAT_MPEG2_VIDEO + FORMAT_MPEG2_VIDEO: TGUID = (D1:$e06d80e3;D2:$db46;D3:$11cf;D4:($b4,$d1,$00,$80,$5f,$6c,$bb,$ea)); + {$EXTERNALSYM FORMAT_MPEG2_VIDEO} + +// MPEG2 Other subtypes + MEDIASUBTYPE_MPEG2_PROGRAM: TGUID = (D1:$e06d8022;D2:$db46;D3:$11cf;D4:($b4,$d1,$00,$80,$05f,$6c,$bb,$ea)); + {$EXTERNALSYM MEDIASUBTYPE_MPEG2_PROGRAM} + MEDIASUBTYPE_MPEG2_TRANSPORT: TGUID = (D1:$e06d8023;D2:$db46;D3:$11cf;D4:($b4,$d1,$00,$80,$05f,$6c,$bb,$ea)); + {$EXTERNALSYM MEDIASUBTYPE_MPEG2_TRANSPORT} + MEDIASUBTYPE_MPEG2_AUDIO: TGUID = (D1:$E06D802B;D2:$DB46;D3:$11CF;D4:($B4,$D1,$00,$80,$005F,$6C,$BB,$EA)); + {$EXTERNALSYM MEDIASUBTYPE_MPEG2_AUDIO} + MEDIASUBTYPE_DOLBY_AC3: TGUID = (D1:$E06D802C;D2:$DB46;D3:$11CF;D4:($B4,$D1,$00,$80,$005F,$6C,$BB,$EA)); + {$EXTERNALSYM MEDIASUBTYPE_DOLBY_AC3} + MEDIASUBTYPE_DVD_SUBPICTURE: TGUID = (D1:$E06D802D;D2:$DB46;D3:$11CF;D4:($B4,$D1,$00,$80,$005F,$6C,$BB,$EA)); + {$EXTERNALSYM MEDIASUBTYPE_DVD_SUBPICTURE} + MEDIASUBTYPE_DVD_LPCM_AUDIO: TGUID = (D1:$E06D8032;D2:$DB46;D3:$11CF;D4:($B4,$D1,$00,$80,$005F,$6C,$BB,$EA)); + {$EXTERNALSYM MEDIASUBTYPE_DVD_LPCM_AUDIO} + MEDIASUBTYPE_DTS: TGUID = (D1:$e06d8033;D2:$db46;D3:$11cf;D4:($b4,$d1,$00,$80,$5f,$6c,$bb,$ea)); + {$EXTERNALSYM MEDIASUBTYPE_DTS} + MEDIASUBTYPE_SDDS: TGUID = (D1:$e06d8034;D2:$db46;D3:$11cf;D4:($b4,$d1,$00,$80,$5f,$6c,$bb,$ea)); + {$EXTERNALSYM MEDIASUBTYPE_SDDS} + +// DVD-related mediatypes + MEDIATYPE_DVD_ENCRYPTED_PACK: TGUID = (D1:$ED0B916A;D2:$044D;D3:$11D1;D4:($AA,$78,$00,$C0,$004F,$C3,$1D,$60)); + {$EXTERNALSYM MEDIATYPE_DVD_ENCRYPTED_PACK} + MEDIATYPE_DVD_NAVIGATION: TGUID = (D1:$E06D802E;D2:$DB46;D3:$11CF;D4:($B4,$D1,$00,$80,$005F,$6C,$BB,$EA)); + {$EXTERNALSYM MEDIATYPE_DVD_NAVIGATION} + MEDIASUBTYPE_DVD_NAVIGATION_PCI: TGUID = (D1:$E06D802F;D2:$DB46;D3:$11CF;D4:($B4,$D1,$00,$80,$005F,$6C,$BB,$EA)); + {$EXTERNALSYM MEDIASUBTYPE_DVD_NAVIGATION_PCI} + MEDIASUBTYPE_DVD_NAVIGATION_DSI: TGUID = (D1:$E06D8030;D2:$DB46;D3:$11CF;D4:($B4,$D1,$00,$80,$005F,$6C,$BB,$EA)); + {$EXTERNALSYM MEDIASUBTYPE_DVD_NAVIGATION_DSI} + MEDIASUBTYPE_DVD_NAVIGATION_PROVIDER: TGUID = (D1:$E06D8031;D2:$DB46;D3:$11CF;D4:($B4,$D1,$00,$80,$005F,$6C,$BB,$EA)); + {$EXTERNALSYM MEDIASUBTYPE_DVD_NAVIGATION_PROVIDER} + +// +// DVD - MPEG2/AC3-related Formats +// + + FORMAT_MPEG2Video: TGUID = (D1:$E06D80E3;D2:$DB46;D3:$11CF;D4:($B4,$D1,$00,$80,$005F,$6C,$BB,$EA)); + {$EXTERNALSYM FORMAT_MPEG2Video} + FORMAT_DolbyAC3: TGUID = (D1:$E06D80E4;D2:$DB46;D3:$11CF;D4:($B4,$D1,$00,$80,$005F,$6C,$BB,$EA)); + {$EXTERNALSYM FORMAT_DolbyAC3} + FORMAT_MPEG2Audio: TGUID = (D1:$E06D80E5;D2:$DB46;D3:$11CF;D4:($B4,$D1,$00,$80,$005F,$6C,$BB,$EA)); + {$EXTERNALSYM FORMAT_MPEG2Audio} + FORMAT_DVD_LPCMAudio: TGUID = (D1:$E06D80E6;D2:$DB46;D3:$11CF;D4:($B4,$D1,$00,$80,$005F,$6C,$BB,$EA)); + {$EXTERNALSYM FORMAT_DVD_LPCMAudio} + +// +// KS Property Set Id (to communicate with the WDM Proxy filter) -- from +// ksmedia.h of WDM DDK. +// + + AM_KSPROPSETID_AC3: TGUID = (D1:$BFABE720;D2:$6E1F;D3:$11D0;D4:($BC,$F2,$44,$45,$53,$54,$00,$00)); + {$EXTERNALSYM AM_KSPROPSETID_AC3} + AM_KSPROPSETID_DvdSubPic: TGUID = (D1:$AC390460;D2:$43AF;D3:$11D0;D4:($BD,$6A,$00,$35,$05,$C1,$03,$A9)); + {$EXTERNALSYM AM_KSPROPSETID_DvdSubPic} + AM_KSPROPSETID_CopyProt: TGUID = (D1:$0E8A0A40;D2:$6AEF;D3:$11D0;D4:($9E,$D0,$00,$A0,$24,$CA,$19,$B3)); + {$EXTERNALSYM AM_KSPROPSETID_CopyProt} + AM_KSPROPSETID_TSRateChange: TGUID = (D1:$A503C5C0;D2:$1D1D;D3:$11D1;D4:($AD,$80,$44,$45,$53,$54,$00,$00)); + {$EXTERNALSYM AM_KSPROPSETID_TSRateChange} + AM_KSPROPSETID_DVD_RateChange: TGUID = (D1:$3577eb09;D2:$9582;D3:$477f;D4:($b2,$9c,$b0,$c4,$52,$a4,$ff,$9a)); + {$EXTERNALSYM AM_KSPROPSETID_DVD_RateChange} + AM_KSPROPSETID_DvdKaraoke: TGUID = (D1:$ae4720ae;D2:$aa71;D3:$42d8;D4:($b8,$2a,$ff,$fd,$f5,$8b,$76,$fd)); + {$EXTERNALSYM AM_KSPROPSETID_DvdKaraoke} + AM_KSPROPSETID_FrameStep: TGUID = (D1:$c830acbd;D2:$ab07;D3:$492f;D4:($88,$52,$45,$b6,$98,$7c,$29,$79)); + {$EXTERNALSYM AM_KSPROPSETID_FrameStep} +// +// KS categories from ks.h and ksmedia.h +// +// + + AM_KSCATEGORY_CAPTURE: TGUID = (D1:$65E8773D;D2:$8F56;D3:$11D0;D4:($A3,$B9,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM AM_KSCATEGORY_CAPTURE} + AM_KSCATEGORY_RENDER: TGUID = (D1:$65E8773E;D2:$8F56;D3:$11D0;D4:($A3,$B9,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM AM_KSCATEGORY_RENDER} + AM_KSCATEGORY_DATACOMPRESSOR: TGUID = (D1:$1E84C900;D2:$7E70;D3:$11D0;D4:($A5,$D6,$28,$DB,$04,$C1,$00,$00)); + {$EXTERNALSYM AM_KSCATEGORY_DATACOMPRESSOR} + AM_KSCATEGORY_AUDIO: TGUID = (D1:$6994AD04;D2:$93EF;D3:$11D0;D4:($A3,$CC,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM AM_KSCATEGORY_AUDIO} + AM_KSCATEGORY_VIDEO: TGUID = (D1:$6994AD05;D2:$93EF;D3:$11D0;D4:($A3,$CC,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM AM_KSCATEGORY_VIDEO} + AM_KSCATEGORY_TVTUNER: TGUID = (D1:$A799A800;D2:$A46D;D3:$11D0;D4:($A1,$8C,$00,$A0,$24,$01,$DC,$D4)); + {$EXTERNALSYM AM_KSCATEGORY_TVTUNER} + AM_KSCATEGORY_CROSSBAR: TGUID = (D1:$A799A801;D2:$A46D;D3:$11D0;D4:($A1,$8C,$00,$A0,$24,$01,$DC,$D4)); + {$EXTERNALSYM AM_KSCATEGORY_CROSSBAR} + AM_KSCATEGORY_TVAUDIO: TGUID = (D1:$A799A802;D2:$A46D;D3:$11D0;D4:($A1,$8C,$00,$A0,$24,$01,$DC,$D4)); + {$EXTERNALSYM AM_KSCATEGORY_TVAUDIO} + AM_KSCATEGORY_VBICODEC: TGUID = (D1:$07dad660;D2:$22f1;D3:$11d1;D4:($a9,$f4,$00,$c0,$4f,$bb,$de,$8f)); + {$EXTERNALSYM AM_KSCATEGORY_VBICODEC} + AM_KSCATEGORY_SPLITTER: TGUID = (D1:$0A4252A0;D2:$7E70;D3:$11D0;D4:($A5,$D6,$28,$DB,$04,$C1,$00,$00)); + {$EXTERNALSYM AM_KSCATEGORY_SPLITTER} + +// +// guids needed to support IKsPin interface +// +// + IID_IKsInterfaceHandler: TGUID = (D1:$D3ABC7E0;D2:$9A61;D3:$11D0;D4:($A4,$0D,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM IID_IKsInterfaceHandler} + STATIC_IID_IKsInterfaceHandler: TGUID = (D1:$D3ABC7E0;D2:$9A61;D3:$11D0;D4:($A4,$0D,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM STATIC_IID_IKsInterfaceHandler} + + IID_IKsDataTypeHandler: TGUID = (D1:$5FFBAA02;D2:$49A3;D3:$11D0;D4:($9F,$36,$00,$AA,$00,$A2,$16,$A1)); + {$EXTERNALSYM IID_IKsDataTypeHandler} + STATIC_IID_IKsDataTypeHandler: TGUID = (D1:$5FFBAA02;D2:$49A3;D3:$11D0;D4:($9F,$36,$00,$AA,$00,$A2,$16,$A1)); + {$EXTERNALSYM STATIC_IID_IKsDataTypeHandler} + + IID_IKsPin: TGUID = (D1:$B61178D1;D2:$A2D9;D3:$11CF;D4:($9E,$53,$00,$AA,$00,$A2,$16,$A1)); + {$EXTERNALSYM IID_IKsPin} + STATIC_IID_IKsPin: TGUID = (D1:$B61178D1;D2:$A2D9;D3:$11CF;D4:($9E,$53,$00,$AA,$00,$A2,$16,$A1)); + {$EXTERNALSYM STATIC_IID_IKsPin} + + IID_IKsControl: TGUID = (D1:$28F54685;D2:$06FD;D3:$11D2;D4:($B2,$7A,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM IID_IKsControl} + STATIC_IID_IKsControl : TGUID = (D1:$28F54685;D2:$06FD;D3:$11D2;D4:($B2,$7A,$00,$A0,$C9,$22,$31,$96)); + + {$EXTERNALSYM STATIC_IID_IKsControl} + IID_IKsPinFactory: TGUID = (D1:$CD5EBE6B;D2:$8B6E;D3:$11D1;D4:($8A,$E0,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM IID_IKsPinFactory} + AM_INTERFACESETID_Standard: TGUID = (D1:$1A8766A0;D2:$62CE;D3:$11CF;D4:($A5,$D6,$28,$DB,$04,$C1,$00,$00)); + {$EXTERNALSYM AM_INTERFACESETID_Standard} + +//------------------------------------------------------------------------------ +// File: DXVA.h +// Desc: DirectX Video Acceleration header file. +// Copyright (c) 1999 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +const + DXVA_ModeNone : TGUID = (D1:$1b81be00; D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeNone} + DXVA_ModeH261_A : TGUID = (D1:$1b81be01; D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeH261_A} + DXVA_ModeH261_B : TGUID = (D1:$1b81be02; D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeH261_B} + DXVA_ModeH263_A : TGUID = (D1:$1b81be03; D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeH263_A} + DXVA_ModeH263_B : TGUID = (D1:$1b81be04; D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeH263_B} + DXVA_ModeH263_C : TGUID = (D1:$1b81be05; D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeH263_C} + DXVA_ModeH263_D : TGUID = (D1:$1b81be06; D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeH263_D} + DXVA_ModeH263_E : TGUID = (D1:$1b81be07; D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeH263_E} + DXVA_ModeH263_F : TGUID = (D1:$1b81be08; D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeH263_F} + DXVA_ModeMPEG1_A : TGUID = (D1:$1b81be09; D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeMPEG1_A} + DXVA_ModeMPEG2_A : TGUID = (D1:$1b81be0A; D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeMPEG2_A} + DXVA_ModeMPEG2_B : TGUID = (D1:$1b81be0B; D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeMPEG2_B} + DXVA_ModeMPEG2_C : TGUID = (D1:$1b81be0C; D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeMPEG2_C} + DXVA_ModeMPEG2_D : TGUID = (D1:$1b81be0D; D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeMPEG2_D} + + DXVA_ModeWMV8_A : TGUID = (D1:$1b81be80 ;D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeWMV8_A} + DXVA_ModeWMV8_B : TGUID = (D1:$1b81be81 ;D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeWMV8_B} + + DXVA_ModeWMV9_A : TGUID = (D1:$1b81be90 ;D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeWMV9_A} + DXVA_ModeWMV9_B : TGUID = (D1:$1b81be91 ;D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeWMV9_B} + DXVA_ModeWMV9_Ai : TGUID = (D1:$1b81be92 ;D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeWMV9_Ai} + DXVA_ModeWMV9_Bi : TGUID = (D1:$1b81be93 ;D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeWMV9_Bi} + + DXVA_ModeWMV9_C : TGUID = (D1:$1b81be94 ;D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeWMV9_C} + DXVA_ModeWMVA_A : TGUID = (D1:$1b81be96 ;D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeWMVA_A} + DXVA_ModeWMVA_B : TGUID = (D1:$1b81be97 ;D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeWMVA_B} + DXVA_ModeWMVA_C : TGUID = (D1:$1b81be98 ;D2:$a0c7; D3:$11d3; D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_ModeWMVA_C} + + DXVA_NoEncrypt : TGUID = (D1:$1b81beD0;D2:$a0c7;D3:$11d3;D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + {$EXTERNALSYM DXVA_NoEncrypt} + //DXVA_EncryptProt1 : TGUID = (D1:$1b81beD1;D2:$a0c7;D3:$11d3;D4:($b9,$84,$00,$c0,$4f,$2e,$73,$c5)); + + DXVA_RESTRICTED_MODE_UNRESTRICTED = $FFFF; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_UNRESTRICTED} + DXVA_RESTRICTED_MODE_H261_A = 1; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_H261_A} + DXVA_RESTRICTED_MODE_H261_B = 2; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_H261_B} + DXVA_RESTRICTED_MODE_H263_A = 3; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_H263_A} + DXVA_RESTRICTED_MODE_H263_B = 4; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_H263_B} + DXVA_RESTRICTED_MODE_H263_C = 5; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_H263_C} + DXVA_RESTRICTED_MODE_H263_D = 6; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_H263_D} + DXVA_RESTRICTED_MODE_H263_E = 7; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_H263_E} + DXVA_RESTRICTED_MODE_H263_F = 8; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_H263_F} + DXVA_RESTRICTED_MODE_MPEG1_A = 9; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_MPEG1_A} + DXVA_RESTRICTED_MODE_MPEG2_A = $A; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_MPEG2_A} + DXVA_RESTRICTED_MODE_MPEG2_B = $B; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_MPEG2_B} + DXVA_RESTRICTED_MODE_MPEG2_C = $C; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_MPEG2_C} + DXVA_RESTRICTED_MODE_MPEG2_D = $D; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_MPEG2_D} + + DXVA_RESTRICTED_MODE_WMV8_A = $80; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_WMV8_A} + DXVA_RESTRICTED_MODE_WMV8_B = $81; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_WMV8_B} + + DXVA_RESTRICTED_MODE_WMV9_A = $90; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_WMV9_A} + DXVA_RESTRICTED_MODE_WMV9_B = $91; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_WMV9_B} + DXVA_RESTRICTED_MODE_WMV9_Ai = $92; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_WMV9_Ai} + DXVA_RESTRICTED_MODE_WMV9_Bi = $93; + {$EXTERNALSYM DXVA_RESTRICTED_MODE_WMV9_Bi} + + + DXVA_COMPBUFFER_TYPE_THAT_IS_NOT_USED = 0; + {$EXTERNALSYM DXVA_COMPBUFFER_TYPE_THAT_IS_NOT_USED} + DXVA_PICTURE_DECODE_BUFFER = 1; + {$EXTERNALSYM DXVA_PICTURE_DECODE_BUFFER} + DXVA_MACROBLOCK_CONTROL_BUFFER = 2; + {$EXTERNALSYM DXVA_MACROBLOCK_CONTROL_BUFFER} + DXVA_RESIDUAL_DIFFERENCE_BUFFER = 3; + {$EXTERNALSYM DXVA_RESIDUAL_DIFFERENCE_BUFFER} + DXVA_DEBLOCKING_CONTROL_BUFFER = 4; + {$EXTERNALSYM DXVA_DEBLOCKING_CONTROL_BUFFER} + DXVA_INVERSE_QUANTIZATION_MATRIX_BUFFER = 5; + {$EXTERNALSYM DXVA_INVERSE_QUANTIZATION_MATRIX_BUFFER} + DXVA_SLICE_CONTROL_BUFFER = 6; + {$EXTERNALSYM DXVA_SLICE_CONTROL_BUFFER} + DXVA_BITSTREAM_DATA_BUFFER = 7; + {$EXTERNALSYM DXVA_BITSTREAM_DATA_BUFFER} + DXVA_AYUV_BUFFER = 8; + {$EXTERNALSYM DXVA_AYUV_BUFFER} + DXVA_IA44_SURFACE_BUFFER = 9; + {$EXTERNALSYM DXVA_IA44_SURFACE_BUFFER} + DXVA_DPXD_SURFACE_BUFFER = 10; + {$EXTERNALSYM DXVA_DPXD_SURFACE_BUFFER} + DXVA_HIGHLIGHT_BUFFER = 11; + {$EXTERNALSYM DXVA_HIGHLIGHT_BUFFER} + DXVA_DCCMD_SURFACE_BUFFER = 12; + {$EXTERNALSYM DXVA_DCCMD_SURFACE_BUFFER} + DXVA_ALPHA_BLEND_COMBINATION_BUFFER = 13; + {$EXTERNALSYM DXVA_ALPHA_BLEND_COMBINATION_BUFFER} + DXVA_PICTURE_RESAMPLE_BUFFER = 14; + {$EXTERNALSYM DXVA_PICTURE_RESAMPLE_BUFFER} + DXVA_READ_BACK_BUFFER = 15; + {$EXTERNALSYM DXVA_READ_BACK_BUFFER} + + DXVA_NUM_TYPES_COMP_BUFFERS = 16; + {$EXTERNALSYM DXVA_NUM_TYPES_COMP_BUFFERS} + + // values for bDXVA_Func + DXVA_PICTURE_DECODING_FUNCTION = 1; + {$EXTERNALSYM DXVA_PICTURE_DECODING_FUNCTION} + DXVA_ALPHA_BLEND_DATA_LOAD_FUNCTION = 2; + {$EXTERNALSYM DXVA_ALPHA_BLEND_DATA_LOAD_FUNCTION} + DXVA_ALPHA_BLEND_COMBINATION_FUNCTION = 3; + {$EXTERNALSYM DXVA_ALPHA_BLEND_COMBINATION_FUNCTION} + DXVA_PICTURE_RESAMPLE_FUNCTION = 4; + {$EXTERNALSYM DXVA_PICTURE_RESAMPLE_FUNCTION} + + // values returned from Execute command in absence of read-back + DXVA_EXECUTE_RETURN_OK = 0; + {$EXTERNALSYM DXVA_EXECUTE_RETURN_OK} + DXVA_EXECUTE_RETURN_DATA_ERROR_MINOR = 1; + {$EXTERNALSYM DXVA_EXECUTE_RETURN_DATA_ERROR_MINOR} + DXVA_EXECUTE_RETURN_DATA_ERROR_SIGNIF = 2; + {$EXTERNALSYM DXVA_EXECUTE_RETURN_DATA_ERROR_SIGNIF} + DXVA_EXECUTE_RETURN_DATA_ERROR_SEVERE = 3; + {$EXTERNALSYM DXVA_EXECUTE_RETURN_DATA_ERROR_SEVERE} + DXVA_EXECUTE_RETURN_OTHER_ERROR_SEVERE = 4; + {$EXTERNALSYM DXVA_EXECUTE_RETURN_OTHER_ERROR_SEVERE} + +type + PDXVAConnectMode = ^TDXVAConnectMode; + _DXVA_ConnectMode = record + guidMode : TGUID; + wRestrictedMode : WORD; + end; + {$EXTERNALSYM _DXVA_ConnectMode} + DXVA_ConnectMode = _DXVA_ConnectMode; + {$EXTERNALSYM DXVA_ConnectMode} + LPDXVA_ConnectMode = ^DXVA_ConnectMode; + {$EXTERNALSYM LPDXVA_ConnectMode} + TDXVAConnectMode = _DXVA_ConnectMode; + + DXVA_ConfigQueryOrReplyFunc = {$IFDEF TYPE_IDENTITY}type {$ENDIF} DWORD; + {$EXTERNALSYM DXVA_ConfigQueryOrReplyFunc} + LPDXVA_ConfigQueryOrReplyFunc = ^DXVA_ConfigQueryOrReplyFunc; + {$EXTERNALSYM LPDXVA_ConfigQueryOrReplyFunc} + +const + DXVA_QUERYORREPLYFUNCFLAG_DECODER_PROBE_QUERY = $FFFFF1; + {$EXTERNALSYM DXVA_QUERYORREPLYFUNCFLAG_DECODER_PROBE_QUERY} + DXVA_QUERYORREPLYFUNCFLAG_DECODER_LOCK_QUERY = $FFFFF5; + {$EXTERNALSYM DXVA_QUERYORREPLYFUNCFLAG_DECODER_LOCK_QUERY} + DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_OK_COPY = $FFFFF8; + {$EXTERNALSYM DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_OK_COPY} + DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_OK_PLUS = $FFFFF9; + {$EXTERNALSYM DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_OK_PLUS} + DXVA_QUERYORREPLYFUNCFLAG_ACCEL_LOCK_OK_COPY = $FFFFFC; + {$EXTERNALSYM DXVA_QUERYORREPLYFUNCFLAG_ACCEL_LOCK_OK_COPY} + DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_FALSE_PLUS = $FFFFFB; + {$EXTERNALSYM DXVA_QUERYORREPLYFUNCFLAG_ACCEL_PROBE_FALSE_PLUS} + DXVA_QUERYORREPLYFUNCFLAG_ACCEL_LOCK_FALSE_PLUS = $FFFFFF; + {$EXTERNALSYM DXVA_QUERYORREPLYFUNCFLAG_ACCEL_LOCK_FALSE_PLUS} + +{ +#define readDXVA_QueryOrReplyFuncFlag(ptr) ((*(ptr)) >> 8) +#define readDXVA_QueryOrReplyFuncFlag_ACCEL(ptr) (((*(ptr)) >> 11) & 1) +#define readDXVA_QueryOrReplyFuncFlag_LOCK(ptr) (((*(ptr)) >> 10) & 1) +#define readDXVA_QueryOrReplyFuncFlag_BAD(ptr) (((*(ptr)) >> 9) & 1) +#define readDXVA_QueryOrReplyFuncFlag_PLUS(ptr) (((*(ptr)) >> 8) & 1) +#define readDXVA_QueryOrReplyFuncFunc(ptr) ((*(ptr)) & 0xFF) +#define writeDXVA_QueryOrReplyFunc(ptr, flg, fnc) ((*(ptr)) = ((flg) << 8) | (fnc)) +#define setDXVA_QueryOrReplyFuncFlag(ptr, flg) ((*(ptr)) |= ((flg) << 8)) +#define setDXVA_QueryOrReplyFuncFunc(ptr, fnc) ((*(ptr)) |= (fnc)); +} + +type + DXVA_EncryptProtocolFunc = {$IFDEF TYPE_IDENTITY}type {$ENDIF} DWORD; + {$EXTERNALSYM DXVA_EncryptProtocolFunc} + LPDXVA_EncryptProtocolFunc = ^DXVA_EncryptProtocolFunc; + {$EXTERNALSYM LPDXVA_EncryptProtocolFunc} + +const + DXVA_ENCRYPTPROTOCOLFUNCFLAG_HOST = $FFFF00; + {$EXTERNALSYM DXVA_ENCRYPTPROTOCOLFUNCFLAG_HOST} + DXVA_ENCRYPTPROTOCOLFUNCFLAG_ACCEL = $FFFF08; + {$EXTERNALSYM DXVA_ENCRYPTPROTOCOLFUNCFLAG_ACCEL} + +{ +#define readDXVA_EncryptProtocolFuncFlag(ptr) ((*(ptr)) >> 8) +#define readDXVA_EncryptProtocolFuncFlag_ACCEL(ptr) (((*(ptr)) >> 11) & 1) +#define readDXVA_EncryptProtocolFuncFunc(ptr) ((*(ptr)) & 0xFF) +#define writeDXVA_EncryptProtocolFunc(ptr, flg, fnc) ((*(ptr)) = ((flg) << 8) | (fnc)) +#define setDXVA_EncryptProtocolFuncFlag(ptr, flg) ((*(ptr)) |= ((flg) << 8)) +#define setDXVA_EncryptProtocolFuncFunc(ptr, fnc) ((*(ptr)) |= (fnc)); +} + +type + PDXVAEncryptProtocolHeader = ^TDXVAEncryptProtocolHeader; + _DXVA_EncryptProtocolHeader = record + dwFunction : DXVA_EncryptProtocolFunc; + ReservedBits : array [0..2] of LongWord; + guidEncryptProtocol : TGUID; + end; + {$EXTERNALSYM _DXVA_EncryptProtocolHeader} + DXVA_EncryptProtocolHeader = _DXVA_EncryptProtocolHeader; + {$EXTERNALSYM DXVA_EncryptProtocolHeader} + LPDXVA_EncryptProtocolHeader = ^DXVA_EncryptProtocolHeader; + {$EXTERNALSYM LPDXVA_EncryptProtocolHeader} + TDXVAEncryptProtocolHeader = _DXVA_EncryptProtocolHeader; + + PDXVAConfigPictureDecode = ^TDXVAConfigPictureDecode; + _DXVA_ConfigPictureDecode = record + // Operation Indicated + dwFunction: DXVA_ConfigQueryOrReplyFunc; + // Alignment + dwReservedBits : array[0..2] of DWORD; + // Encryption GUIDs + guidConfigBitstreamEncryption : TGUID; + guidConfigMBcontrolEncryption : TGUID; + guidConfigResidDiffEncryption : TGUID; + // Bitstream Processing Indicator + bConfigBitstreamRaw : BYTE; + // Macroblock Control Config + bConfigMBcontrolRasterOrder : BYTE; + // Host Resid Diff Config + bConfigResidDiffHost : BYTE; + bConfigSpatialResid8 : BYTE; + bConfigResid8Subtraction : BYTE; + bConfigSpatialHost8or9Clipping : BYTE; + bConfigSpatialResidInterleaved : BYTE; + bConfigIntraResidUnsigned : BYTE; + // Accelerator Resid Diff Config + bConfigResidDiffAccelerator : BYTE; + bConfigHostInverseScan : BYTE; + bConfigSpecificIDCT : BYTE; + bConfig4GroupedCoefs : BYTE; + end; + {$EXTERNALSYM _DXVA_ConfigPictureDecode} + DXVA_ConfigPictureDecode = _DXVA_ConfigPictureDecode; + {$EXTERNALSYM DXVA_ConfigPictureDecode} + LPDXVA_ConfigPictureDecode = ^DXVA_ConfigPictureDecode; + {$EXTERNALSYM LPDXVA_ConfigPictureDecode} + TDXVAConfigPictureDecode = _DXVA_ConfigPictureDecode; + + // Picture Decoding Parameters + PDXVAPictureParameters = ^TDXVAPictureParameters; + _DXVA_PictureParameters = record + wDecodedPictureIndex : WORD; + wDeblockedPictureIndex : WORD; + wForwardRefPictureIndex : WORD; + wBackwardRefPictureIndex : WORD; + wPicWidthInMBminus1 : WORD; + wPicHeightInMBminus1 : WORD; + bMacroblockWidthMinus1 : BYTE; + bMacroblockHeightMinus1 : BYTE; + bBlockWidthMinus1 : BYTE; + bBlockHeightMinus1 : BYTE; + bBPPminus1 : BYTE; + bPicStructure : BYTE; + bSecondField : BYTE; + bPicIntra : BYTE; + bPicBackwardPrediction : BYTE; + bBidirectionalAveragingMode : BYTE; + bMVprecisionAndChromaRelation : BYTE; + bChromaFormat : BYTE; + bPicScanFixed : BYTE; + bPicScanMethod : BYTE; + bPicReadbackRequests : BYTE; + bRcontrol : BYTE; + bPicSpatialResid8 : BYTE; + bPicOverflowBlocks : BYTE; + bPicExtrapolation : BYTE; + bPicDeblocked : BYTE; + bPicDeblockConfined : BYTE; + bPic4MVallowed : BYTE; + bPicOBMC : BYTE; + bPicBinPB : BYTE; + bMV_RPS : BYTE; + bReservedBits : BYTE; + wBitstreamFcodes : WORD; + wBitstreamPCEelements : WORD; + bBitstreamConcealmentNeed : BYTE; + bBitstreamConcealmentMethod : BYTE; + end; + {$EXTERNALSYM _DXVA_PictureParameters} + DXVA_PictureParameters = _DXVA_PictureParameters; + {$EXTERNALSYM DXVA_PictureParameters} + LPDXVA_PictureParameters = ^DXVA_PictureParameters; + {$EXTERNALSYM LPDXVA_PictureParameters} + TDXVAPictureParameters = _DXVA_PictureParameters; + + // Picture Resampling + PDXVAPicResample = ^TDXVAPicResample; + _DXVA_PicResample = record + wPicResampleSourcePicIndex : WORD; + wPicResampleDestPicIndex : WORD; + wPicResampleRcontrol : WORD; + bPicResampleExtrapWidth : BYTE; + bPicResampleExtrapHeight : BYTE; + dwPicResampleSourceWidth : DWORD; + dwPicResampleSourceHeight : DWORD; + dwPicResampleDestWidth : DWORD; + dwPicResampleDestHeight : DWORD; + dwPicResampleFullDestWidth : DWORD; + dwPicResampleFullDestHeight : DWORD; + end; + {$EXTERNALSYM _DXVA_PicResample} + DXVA_PicResample = _DXVA_PicResample; + {$EXTERNALSYM DXVA_PicResample} + LPDXVA_PicResample = ^DXVA_PicResample; + {$EXTERNALSYM LPDXVA_PicResample} + TDXVAPicResample = _DXVA_PicResample; + +const + DXVA_CHROMA_FORMAT_420 = 1; + {$EXTERNALSYM DXVA_CHROMA_FORMAT_420} + DXVA_CHROMA_FORMAT_422 = 2; + {$EXTERNALSYM DXVA_CHROMA_FORMAT_422} + DXVA_CHROMA_FORMAT_444 = 3; + {$EXTERNALSYM DXVA_CHROMA_FORMAT_444} + + DXVA_PICTURE_STRUCTURE_TOP_FIELD = 1; + {$EXTERNALSYM DXVA_PICTURE_STRUCTURE_TOP_FIELD} + DXVA_PICTURE_STRUCTURE_BOTTOM_FIELD = 2; + {$EXTERNALSYM DXVA_PICTURE_STRUCTURE_BOTTOM_FIELD} + DXVA_PICTURE_STRUCTURE_FRAME = 3; + {$EXTERNALSYM DXVA_PICTURE_STRUCTURE_FRAME} + + DXVA_BIDIRECTIONAL_AVERAGING_MPEG2_ROUND = 0; + {$EXTERNALSYM DXVA_BIDIRECTIONAL_AVERAGING_MPEG2_ROUND} + DXVA_BIDIRECTIONAL_AVERAGING_H263_TRUNC = 1; + {$EXTERNALSYM DXVA_BIDIRECTIONAL_AVERAGING_H263_TRUNC} + + DXVA_MV_PRECISION_AND_CHROMA_RELATION_MPEG2 = 0; + {$EXTERNALSYM DXVA_MV_PRECISION_AND_CHROMA_RELATION_MPEG2} + DXVA_MV_PRECISION_AND_CHROMA_RELATION_H263 = 1; + {$EXTERNALSYM DXVA_MV_PRECISION_AND_CHROMA_RELATION_H263} + DXVA_MV_PRECISION_AND_CHROMA_RELATION_H261 = 2; + {$EXTERNALSYM DXVA_MV_PRECISION_AND_CHROMA_RELATION_H261} + + DXVA_SCAN_METHOD_ZIG_ZAG = 0; + {$EXTERNALSYM DXVA_SCAN_METHOD_ZIG_ZAG} + DXVA_SCAN_METHOD_ALTERNATE_VERTICAL = 1; + {$EXTERNALSYM DXVA_SCAN_METHOD_ALTERNATE_VERTICAL} + DXVA_SCAN_METHOD_ALTERNATE_HORIZONTAL = 2; + {$EXTERNALSYM DXVA_SCAN_METHOD_ALTERNATE_HORIZONTAL} + DXVA_SCAN_METHOD_ARBITRARY = 3; + {$EXTERNALSYM DXVA_SCAN_METHOD_ARBITRARY} + + DXVA_BITSTREAM_CONCEALMENT_NEED_UNLIKELY = 0; + {$EXTERNALSYM DXVA_BITSTREAM_CONCEALMENT_NEED_UNLIKELY} + DXVA_BITSTREAM_CONCEALMENT_NEED_MILD = 1; + {$EXTERNALSYM DXVA_BITSTREAM_CONCEALMENT_NEED_MILD} + DXVA_BITSTREAM_CONCEALMENT_NEED_LIKELY = 2; + {$EXTERNALSYM DXVA_BITSTREAM_CONCEALMENT_NEED_LIKELY} + DXVA_BITSTREAM_CONCEALMENT_NEED_SEVERE = 3; + {$EXTERNALSYM DXVA_BITSTREAM_CONCEALMENT_NEED_SEVERE} + + DXVA_BITSTREAM_CONCEALMENT_METHOD_UNSPECIFIED = 0; + {$EXTERNALSYM DXVA_BITSTREAM_CONCEALMENT_METHOD_UNSPECIFIED} + DXVA_BITSTREAM_CONCEALMENT_METHOD_INTRA = 1; + {$EXTERNALSYM DXVA_BITSTREAM_CONCEALMENT_METHOD_INTRA} + DXVA_BITSTREAM_CONCEALMENT_METHOD_FORWARD = 2; + {$EXTERNALSYM DXVA_BITSTREAM_CONCEALMENT_METHOD_FORWARD} + DXVA_BITSTREAM_CONCEALMENT_METHOD_BACKWARD = 3; + {$EXTERNALSYM DXVA_BITSTREAM_CONCEALMENT_METHOD_BACKWARD} + + +Type + // Buffer Description Data + PDXVABufferDescription = ^TDXVABufferDescription; + _DXVA_BufferDescription = record + dwTypeIndex : DWORD; + dwBufferIndex : DWORD; + dwDataOffset : DWORD; + dwDataSize : DWORD; + dwFirstMBaddress : DWORD; + dwNumMBsInBuffer : DWORD; + dwWidth : DWORD; + dwHeight : DWORD; + dwStride : DWORD; + dwReservedBits : DWORD; + end; + {$EXTERNALSYM _DXVA_BufferDescription} + DXVA_BufferDescription = _DXVA_BufferDescription; + {$EXTERNALSYM DXVA_BufferDescription} + LPDXVA_BufferDescription = ^DXVA_BufferDescription; + {$EXTERNALSYM LPDXVA_BufferDescription} + TDXVABufferDescription = _DXVA_BufferDescription; + + // Off-Host IDCT Coefficient Data Structures + PDXVATCoef4Group = ^TDXVATCoef4Group; + _DXVA_TCoef4Group = record + TCoefIDX : array [0..3] of BYTE; + TCoefValue : array [0..3] of smallint; + end; + {$EXTERNALSYM _DXVA_TCoef4Group} + DXVA_TCoef4Group = _DXVA_TCoef4Group; + {$EXTERNALSYM DXVA_TCoef4Group} + LPDXVA_TCoef4Group = ^DXVA_TCoef4Group; + {$EXTERNALSYM LPDXVA_TCoef4Group} + TDXVATCoef4Group = _DXVA_TCoef4Group; + + PDXVATCoefSingle = ^TDXVATCoefSingle; + _DXVA_TCoefSingle = record + wIndexWithEOB : WORD; + TCoefValue : smallint; + end; + {$EXTERNALSYM _DXVA_TCoefSingle} + DXVA_TCoefSingle = _DXVA_TCoefSingle; + {$EXTERNALSYM DXVA_TCoefSingle} + LPDXVA_TCoefSingle = ^DXVA_TCoefSingle; + {$EXTERNALSYM LPDXVA_TCoefSingle} + TDXVATCoefSingle = _DXVA_TCoefSingle; + +// Macros for Reading EOB and Index Values +{ +#define readDXVA_TCoefSingleIDX(ptr) ((ptr)->wIndexWithEOB >> 1) +#define readDXVA_TCoefSingleEOB(ptr) ((ptr)->wIndexWithEOB & 1) +} +// Macro for Writing EOB and Index Values +{ +#define writeDXVA_TCoefSingleIndexWithEOB(ptr, idx, eob) ((ptr)->wIndexWithEOB = ((idx) << 1) | (eob)) +#define setDXVA_TCoefSingleIDX(ptr, idx) ((ptr)->wIndexWithEOB |= ((idx) << 1)) +#define setDXVA_TCoefSingleEOB(ptr) ((ptr)->wIndexWithEOB |= 1) +} + +const + // Spatial-Domain Residual Difference Blocks + DXVA_USUAL_BLOCK_WIDTH = 8; + {$EXTERNALSYM DXVA_USUAL_BLOCK_WIDTH} + DXVA_USUAL_BLOCK_HEIGHT = 8; + {$EXTERNALSYM DXVA_USUAL_BLOCK_HEIGHT} + DXVA_USUAL_BLOCK_SIZE = (DXVA_USUAL_BLOCK_WIDTH * DXVA_USUAL_BLOCK_HEIGHT); + {$EXTERNALSYM DXVA_USUAL_BLOCK_SIZE} + +type + DXVA_Sample16 = array[0..DXVA_USUAL_BLOCK_SIZE-1] of smallint; + {$EXTERNALSYM DXVA_Sample16} + DXVA_Sample8 = array[0..DXVA_USUAL_BLOCK_SIZE-1] of Shortint; + {$EXTERNALSYM DXVA_Sample8} + + // Deblocking Filter Control Structure + DXVA_DeblockingEdgeControl = {$IFDEF TYPE_IDENTITY}type {$ENDIF} BYTE; + {$EXTERNALSYM DXVA_DeblockingEdgeControl} + LPDXVA_DeblockingEdgeControl= ^DXVA_DeblockingEdgeControl; + {$EXTERNALSYM LPDXVA_DeblockingEdgeControl} + +// Macros for Reading STRENGTH and FilterOn +{ +#define readDXVA_EdgeFilterStrength(ptr) ((*(ptr)) >> 1) +#define readDXVA_EdgeFilterOn(ptr) ((*(ptr)) & 1) +} +// Macro for Writing STRENGTH and FilterOn +{ +#define writeDXVA_DeblockingEdgeControl(ptr, str, fon) ((*(ptr)) = ((str) << 1) | (fon)) +#define setDXVA_EdgeFilterStrength(ptr, str) ((*(ptr)) |= ((str) << 1)) +#define setDXVA_EdgeFilterOn(ptr) ((*(ptr)) |= 1) +} + + // Macroblock Control Command Data Structures */ + PDXVAMVvalue = ^TDXVAMVvalue; + _DXVA_MVvalue = record + horz,vert : smallint; + end; + {$EXTERNALSYM _DXVA_MVvalue} + DXVA_MVvalue = _DXVA_MVvalue; + {$EXTERNALSYM DXVA_MVvalue} + LPDXVA_MVvalue = ^DXVA_MVvalue; + {$EXTERNALSYM LPDXVA_MVvalue} + TDXVAMVvalue = _DXVA_MVvalue; + + // Inverse Quantization Matrices + PDXVAQmatrixData = ^TDXVAQmatrixData; + _DXVA_QmatrixData = record + bNewQmatrix : array [0..3] of BYTE; + // intra Y, inter Y, intra chroma, inter chroma + Qmatrix : array [0..3,0..(DXVA_USUAL_BLOCK_WIDTH*DXVA_USUAL_BLOCK_HEIGHT)-1] of WORD; + end; + {$EXTERNALSYM _DXVA_QmatrixData} + DXVA_QmatrixData = _DXVA_QmatrixData; + {$EXTERNALSYM DXVA_QmatrixData} + LPDXVA_QmatrixData = ^DXVA_QmatrixData; + {$EXTERNALSYM LPDXVA_QmatrixData} + TDXVAQmatrixData = _DXVA_QmatrixData; + + // Slice Control Buffer Data + PDXVASliceInfo = ^TDXVASliceInfo; + _DXVA_SliceInfo = record + wHorizontalPosition : WORD; + wVerticalPosition : WORD; + dwSliceBitsInBuffer : LongWord; + dwSliceDataLocation : LongWord; + bStartCodeBitOffset : BYTE; + bReservedBits : BYTE; + wMBbitOffset : WORD; + wNumberMBsInSlice : WORD; + wQuantizerScaleCode : WORD; + wBadSliceChopping : WORD; + end; + {$EXTERNALSYM _DXVA_SliceInfo} + DXVA_SliceInfo = _DXVA_SliceInfo; + {$EXTERNALSYM DXVA_SliceInfo} + LPDXVA_SliceInfo = ^DXVA_SliceInfo; + {$EXTERNALSYM LPDXVA_SliceInfo} + TDXVASliceInfo = _DXVA_SliceInfo; + +const + DXVA_NumMV_OBMC_off_BinPBwith4MV_off = 4; + {$EXTERNALSYM DXVA_NumMV_OBMC_off_BinPBwith4MV_off} + DXVA_NumMV_OBMC_off_BinPBwith4MV_on = (4+1); + {$EXTERNALSYM DXVA_NumMV_OBMC_off_BinPBwith4MV_on} + DXVA_NumMV_OBMC_on__BinPB_off = (10); + {$EXTERNALSYM DXVA_NumMV_OBMC_on__BinPB_off} + DXVA_NumMV_OBMC_on__BinPB_on = (11); // not current standards + {$EXTERNALSYM DXVA_NumMV_OBMC_on__BinPB_on} + + DXVA_NumBlocksPerMB_420 = (4+2+0); + {$EXTERNALSYM DXVA_NumBlocksPerMB_420} + DXVA_NumBlocksPerMB_422 = (4+2+2); + {$EXTERNALSYM DXVA_NumBlocksPerMB_422} + DXVA_NumBlocksPerMB_444 = (4+4+4); + {$EXTERNALSYM DXVA_NumBlocksPerMB_444} + +type + // Basic form for I pictures + // Host Residual Differences + _DXVA_MBctrl_I_HostResidDiff_1 = record + wMBaddress : WORD; + wMBtype : WORD; + dwMB_SNL : LongWord; + wPatternCode : WORD; + wPC_Overflow : WORD; + // zero if not overflow format + dwReservedBits2 : LongWord; + end; + {$EXTERNALSYM _DXVA_MBctrl_I_HostResidDiff_1} + DXVA_MBctrl_I_HostResidDiff_1 = _DXVA_MBctrl_I_HostResidDiff_1; + {$EXTERNALSYM DXVA_MBctrl_I_HostResidDiff_1} + TDXVAMBctrlIHostResidDiff1 = _DXVA_MBctrl_I_HostResidDiff_1; + + // Basic form for I pictures + // Off-Host IDCT, 4:2:0 sampling + _DXVA_MBctrl_I_OffHostIDCT_1 = record + wMBaddress : WORD; + wMBtype : WORD; + dwMB_SNL : LongWord; + wPatternCode : WORD; + bNumCoef : array [0..DXVA_NumBlocksPerMB_420-1] of BYTE; + end; + {$EXTERNALSYM _DXVA_MBctrl_I_OffHostIDCT_1} + DXVA_MBctrl_I_OffHostIDCT_1 = _DXVA_MBctrl_I_OffHostIDCT_1; + {$EXTERNALSYM DXVA_MBctrl_I_OffHostIDCT_1} + TDXVAMBctrlIOffHostIDCT1 = _DXVA_MBctrl_I_OffHostIDCT_1; + + // Basic form for P and B pictures + // Should also be used for concealment MVs in MPEG-2 I pictures + // Without OBMC, without BinPB and 4MV together, without MV RPS + // Host Residual Differences + _DXVA_MBctrl_P_HostResidDiff_1 = record + wMBaddress : WORD; + wMBtype : WORD; + dwMB_SNL : LongWord; + wPatternCode : WORD; + wPC_Overflow : WORD; + // zero if not overflow format + dwReservedBits2 : LongWord; + MVector : array [0..DXVA_NumMV_OBMC_off_BinPBwith4MV_off-1] of TDXVAMVvalue; + end; + {$EXTERNALSYM _DXVA_MBctrl_P_HostResidDiff_1} + DXVA_MBctrl_P_HostResidDiff_1 = _DXVA_MBctrl_P_HostResidDiff_1; + {$EXTERNALSYM DXVA_MBctrl_P_HostResidDiff_1} + TDXVAMBctrlPHostResidDiff1 = _DXVA_MBctrl_P_HostResidDiff_1; + + // Basic form for P and B pictures + // Without OBMC, without BinPB and 4MV together, without MV RPS + // Off-Host IDCT, 4:2:0 sampling + _DXVA_MBctrl_P_OffHostIDCT_1 = record + wMBaddress : WORD; + wMBtype : WORD; + dwMB_SNL : LongWord; + wPatternCode : WORD; + bNumCoef : array [0..DXVA_NumBlocksPerMB_420-1] of BYTE; + MVector : array [0..DXVA_NumMV_OBMC_off_BinPBwith4MV_off-1] of TDXVAMVvalue; + end; + {$EXTERNALSYM _DXVA_MBctrl_P_OffHostIDCT_1} + DXVA_MBctrl_P_OffHostIDCT_1 = _DXVA_MBctrl_P_OffHostIDCT_1; + {$EXTERNALSYM DXVA_MBctrl_P_OffHostIDCT_1} + TDXVAMBctrlPOffHostIDCT1 = _DXVA_MBctrl_P_OffHostIDCT_1; + + // How to load alpha blending graphic data + PDXVAConfigAlphaLoad = ^TDXVAConfigAlphaLoad; + _DXVA_ConfigAlphaLoad = record + // Operation Indicated + dwFunction: DXVA_ConfigQueryOrReplyFunc ; + // Alignment + dwReservedBits: array[0..2] of DWORD; + bConfigDataType: BYTE; + end; + {$EXTERNALSYM _DXVA_ConfigAlphaLoad} + DXVA_ConfigAlphaLoad = _DXVA_ConfigAlphaLoad; + {$EXTERNALSYM DXVA_ConfigAlphaLoad} + LPDXVA_ConfigAlphaLoad = ^DXVA_ConfigAlphaLoad; + {$EXTERNALSYM LPDXVA_ConfigAlphaLoad} + TDXVAConfigAlphaLoad = _DXVA_ConfigAlphaLoad; + +const + DXVA_CONFIG_DATA_TYPE_IA44 = 0; + {$EXTERNALSYM DXVA_CONFIG_DATA_TYPE_IA44} + DXVA_CONFIG_DATA_TYPE_AI44 = 1; + {$EXTERNALSYM DXVA_CONFIG_DATA_TYPE_AI44} + DXVA_CONFIG_DATA_TYPE_DPXD = 2; + {$EXTERNALSYM DXVA_CONFIG_DATA_TYPE_DPXD} + DXVA_CONFIG_DATA_TYPE_AYUV = 3; + {$EXTERNALSYM DXVA_CONFIG_DATA_TYPE_AYUV} + + +// How to combine alpha blending graphic data +type + PDXVAConfigAlphaCombine = ^TDXVAConfigAlphaCombine; + _DXVA_ConfigAlphaCombine = record + // Operation Indicated + dwFunction: DXVA_ConfigQueryOrReplyFunc; + // Alignment + dwReservedBits: array[0..2] of DWORD; + bConfigBlendType: BYTE; + bConfigPictureResizing: BYTE; + bConfigOnlyUsePicDestRectArea: BYTE; + bConfigGraphicResizing: BYTE; + bConfigWholePlaneAlpha: BYTE; + end; + {$EXTERNALSYM _DXVA_ConfigAlphaCombine} + DXVA_ConfigAlphaCombine = _DXVA_ConfigAlphaCombine; + {$EXTERNALSYM DXVA_ConfigAlphaCombine} + LPDXVA_ConfigAlphaCombine = ^DXVA_ConfigAlphaCombine; + {$EXTERNALSYM LPDXVA_ConfigAlphaCombine} + TDXVAConfigAlphaCombine = _DXVA_ConfigAlphaCombine; + +const + DXVA_CONFIG_BLEND_TYPE_FRONT_BUFFER = 0; + {$EXTERNALSYM DXVA_CONFIG_BLEND_TYPE_FRONT_BUFFER} + DXVA_CONFIG_BLEND_TYPE_BACK_HARDWARE = 1; + {$EXTERNALSYM DXVA_CONFIG_BLEND_TYPE_BACK_HARDWARE} + +// AYUV sample for 16-entry YUV palette or graphic surface +type + PDXVAAYUVsample2 = ^TDXVAAYUVsample2; + _DXVA_AYUVsample2 = record + bCrValue : BYTE; + bCbValue : BYTE; + bY_Value : BYTE; + bSampleAlpha8 : BYTE; + end; + {$EXTERNALSYM _DXVA_AYUVsample2} + DXVA_AYUVsample2 = _DXVA_AYUVsample2; + {$EXTERNALSYM DXVA_AYUVsample2} + LPDXVA_AYUVsample2 = ^DXVA_AYUVsample2; + {$EXTERNALSYM LPDXVA_AYUVsample2} + TDXVAAYUVsample2 = _DXVA_AYUVsample2; + + // Macros for IA44 alpha blending surface samples + DXVA_AI44sample = {$IFDEF TYPE_IDENTITY}type {$ENDIF} BYTE; + {$EXTERNALSYM DXVA_AI44sample} + LPDXVA_AI44sample = ^DXVA_AI44sample; + {$EXTERNALSYM LPDXVA_AI44sample} + +{ +#define readDXVA_AI44index(ptr) ((*(ptr)) & 0x0F) +#define readDXVA_AI44alpha(ptr) (((*(ptr)) & 0xF0) >> 4) +#define writeDXVA_AI44(ptr, idx, alpha) ((*(ptr)) = (((alpha) << 4) | (idx))) +#define setDXVA_AI44index(ptr, idx) ((*(ptr)) |= (idx)) +#define setDXVA_AI44alpha(ptr, alpha) ((*(ptr)) |= ((alpha) << 4)) +} + + // Highlight data structure + PDXVAHighlight = ^TDXVAHighlight; + _DXVA_Highlight = record + wHighlightActive : WORD; + wHighlightIndices : WORD; + wHighlightAlphas : WORD; + HighlightRect : TRect; + end; + {$EXTERNALSYM _DXVA_Highlight} + DXVA_Highlight = _DXVA_Highlight; + {$EXTERNALSYM DXVA_Highlight} + LPDXVA_Highlight = ^DXVA_Highlight; + {$EXTERNALSYM LPDXVA_Highlight} + TDXVAHighlight = _DXVA_Highlight; + + DXVA_DPXD = {$IFDEF TYPE_IDENTITY}type {$ENDIF} BYTE; + {$EXTERNALSYM DXVA_DPXD} + LPDXVA_DPXD = ^DXVA_DPXD; + {$EXTERNALSYM LPDXVA_DPXD} + DXVA_DCCMD = {$IFDEF TYPE_IDENTITY}type {$ENDIF} WORD; + {$EXTERNALSYM DXVA_DCCMD} + LPDXVA_DCCMD = ^DXVA_DCCMD; + {$EXTERNALSYM LPDXVA_DCCMD} + + // Alpha blend combination + PDXVABlendCombination = ^TDXVABlendCombination; + _DXVA_BlendCombination = record + wPictureSourceIndex : WORD; + wBlendedDestinationIndex : WORD; + PictureSourceRect16thPel : TRECT; + PictureDestinationRect : TRECT; + GraphicSourceRect : TRECT; + GraphicDestinationRect : TRECT; + wBlendDelay : WORD; + bBlendOn : BYTE; + bWholePlaneAlpha : BYTE; + OutsideYUVcolor : TDXVAAYUVsample2; + end; + {$EXTERNALSYM _DXVA_BlendCombination} + DXVA_BlendCombination = _DXVA_BlendCombination; + {$EXTERNALSYM DXVA_BlendCombination} + LPDXVA_BlendCombination = ^DXVA_BlendCombination; + {$EXTERNALSYM LPDXVA_BlendCombination} + TDXVABlendCombination = _DXVA_BlendCombination; + + LPDXVA_MBctrl_I_HostResidDiff_1 = ^DXVA_MBctrl_I_HostResidDiff_1; + {$EXTERNALSYM LPDXVA_MBctrl_I_HostResidDiff_1} + LPDXVA_MBctrl_I_OffHostIDCT_1 = ^DXVA_MBctrl_I_OffHostIDCT_1; + {$EXTERNALSYM LPDXVA_MBctrl_I_OffHostIDCT_1} + LPDXVA_MBctrl_P_HostResidDiff_1 = ^DXVA_MBctrl_P_HostResidDiff_1; + {$EXTERNALSYM LPDXVA_MBctrl_P_HostResidDiff_1} + LPDXVA_MBctrl_P_OffHostIDCT_1 = ^DXVA_MBctrl_P_OffHostIDCT_1; + {$EXTERNALSYM LPDXVA_MBctrl_P_OffHostIDCT_1} + +//#pragma pack(pop) + +// +// Other forms of pictures are constructed in the obvious way +// from the above by adjusting the number of residual difference +// blocks, the number of motion vectors per macroblock, etc. +// +{ +#define readDXVA_MBskipsFollowing(ptr) (((ptr)->dwMB_SNL & 0xFF000000) >> 24) +#define readDXVA_MBdataLocation(ptr) (((ptr)->dwMB_SNL & 0x00FFFFFF)) + +#define writeDXVA_MB_SNL(ptr, skips, dloc) ((ptr)->dwMB_SNL = (((skips) << 24) | (dloc))) +#define setDXVA_MBskipsFollowing(ptr, skips) ((ptr)->dwMB_SNL |= ((skips) << 24)) +#define setDXVA_MBdataLocation(ptr, dloc) ((ptr)->dwMB_SNL |= (dloc)) + +#define readDXVA_MvertFieldSel_3(ptr) (((ptr)->wMBtype & 0x8000) >> 15) +#define readDXVA_MvertFieldSel_2(ptr) (((ptr)->wMBtype & 0x4000) >> 14) +#define readDXVA_MvertFieldSel_1(ptr) (((ptr)->wMBtype & 0x2000) >> 13) +#define readDXVA_MvertFieldSel_0(ptr) (((ptr)->wMBtype & 0x1000) >> 12) +#define readDXVA_ReservedBits(ptr) (((ptr)->wMBtype & 0x0800) >> 11) +#define readDXVA_HostResidDiff(ptr) (((ptr)->wMBtype & 0x0400) >> 10) +#define readDXVA_MotionType(ptr) (((ptr)->wMBtype & 0x0300) >> 8) +#define readDXVA_MBscanMethod(ptr) (((ptr)->wMBtype & 0x00C0) >> 6) +#define readDXVA_FieldResidual(ptr) (((ptr)->wMBtype & 0x0020) >> 5) +#define readDXVA_H261LoopFilter(ptr) (((ptr)->wMBtype & 0x0010) >> 4) +#define readDXVA_Motion4MV(ptr) (((ptr)->wMBtype & 0x0008) >> 3) +#define readDXVA_MotionBackward(ptr) (((ptr)->wMBtype & 0x0004) >> 2) +#define readDXVA_MotionForward(ptr) (((ptr)->wMBtype & 0x0002) >> 1) +#define readDXVA_IntraMacroblock(ptr) (((ptr)->wMBtype & 0x0001)) + +#define setDXVA_MvertFieldSel_3(ptr) ((ptr)->wMBtype |= 0x8000) +#define setDXVA_MvertFieldSel_2(ptr) ((ptr)->wMBtype |= 0x4000) +#define setDXVA_MvertFieldSel_1(ptr) ((ptr)->wMBtype |= 0x2000) +#define setDXVA_MvertFieldSel_0(ptr) ((ptr)->wMBtype |= 0x1000) +#define setDXVA_ReservedBits(ptr) ((ptr)->wMBtype |= 0x0800) +#define setDXVA_HostResidDiff(ptr) ((ptr)->wMBtype |= 0x0400) +#define setDXVA_MotionType(ptr, value) ((ptr)->wMBtype |= ((value) << 8)) +#define setDXVA_MBscanMethod(ptr, value) ((ptr)->wMBtype |= ((value) << 6)) +#define setDXVA_FieldResidual(ptr) ((ptr)->wMBtype |= 0x0020) +#define setDXVA_H261LoopFilter(ptr) ((ptr)->wMBtype |= 0x0010) +#define setDXVA_Motion4MV(ptr) ((ptr)->wMBtype |= 0x0008) +#define setDXVA_MotionBackward(ptr) ((ptr)->wMBtype |= 0x0004) +#define setDXVA_MotionForward(ptr) ((ptr)->wMBtype |= 0x0002) +#define setDXVA_IntraMacroblock(ptr) ((ptr)->wMBtype |= 0x0001) + +#define readDXVA_Y___0coded(ptr) (((ptr)->wPatternCode & 0x0800) >> 11) +#define readDXVA_Y___1coded(ptr) (((ptr)->wPatternCode & 0x0400) >> 10) +#define readDXVA_Y___2coded(ptr) (((ptr)->wPatternCode & 0x0200) >> 9) +#define readDXVA_Y___3coded(ptr) (((ptr)->wPatternCode & 0x0100) >> 8) +#define readDXVA_Cb__4coded(ptr) (((ptr)->wPatternCode & 0x0080) >> 7) +#define readDXVA_Cr__5coded(ptr) (((ptr)->wPatternCode & 0x0040) >> 6) +#define readDXVA_Cb__6coded(ptr) (((ptr)->wPatternCode & 0x0020) >> 5) +#define readDXVA_Cr__7coded(ptr) (((ptr)->wPatternCode & 0x0010) >> 4) +#define readDXVA_Cb__8coded(ptr) (((ptr)->wPatternCode & 0x0008) >> 3) +#define readDXVA_Cb__9coded(ptr) (((ptr)->wPatternCode & 0x0004) >> 2) +#define readDXVA_Cr_10coded(ptr) (((ptr)->wPatternCode & 0x0002) >> 1) +#define readDXVA_Cr_11coded(ptr) (((ptr)->wPatternCode & 0x0001)) + +#define readDXVA_Y___0oflow(ptr) (((ptr)->wPC_Overflow & 0x0800) >> 11) +#define readDXVA_Y___1oflow(ptr) (((ptr)->wPC_Overflow & 0x0400) >> 10) +#define readDXVA_Y___2oflow(ptr) (((ptr)->wPC_Overflow & 0x0200) >> 9) +#define readDXVA_Y___3oflow(ptr) (((ptr)->wPC_Overflow & 0x0100) >> 8) +#define readDXVA_Cb__4oflow(ptr) (((ptr)->wPC_Overflow & 0x0080) >> 7) +#define readDXVA_Cr__5oflow(ptr) (((ptr)->wPC_Overflow & 0x0040) >> 6) +#define readDXVA_Cb__6oflow(ptr) (((ptr)->wPC_Overflow & 0x0020) >> 5) +#define readDXVA_Cr__7oflow(ptr) (((ptr)->wPC_Overflow & 0x0010) >> 4) +#define readDXVA_Cb__8oflow(ptr) (((ptr)->wPC_Overflow & 0x0008) >> 3) +#define readDXVA_Cb__9oflow(ptr) (((ptr)->wPC_Overflow & 0x0004) >> 2) +#define readDXVA_Cr_10oflow(ptr) (((ptr)->wPC_Overflow & 0x0002) >> 1) +#define readDXVA_Cr_11oflow(ptr) (((ptr)->wPC_Overflow & 0x0001)) +} + +// ------------------------------------------------------------------------- +// +// D3DFORMAT describes a pixel memory layout, DXVA sample format contains +// additional information that describes how the pixels should be interpreted. +// +// ------------------------------------------------------------------------- + +//#define DXVABit(__x) (1 << __x) +const + DXVA_SampleFormatMask = $FF; // 8 bits used for DXVA Sample format + {$EXTERNALSYM DXVA_SampleFormatMask} + +type + DXVA_SampleFormat = ( + DXVA_SampleUnknown, + DXVA_SamplePreviousFrame, + DXVA_SampleProgressiveFrame, + DXVA_SampleFieldInterleavedEvenFirst, + DXVA_SampleFieldInterleavedOddFirst, + DXVA_SampleFieldSingleEven, + DXVA_SampleFieldSingleOdd, + DXVA_SampleSubStream + ); + {$EXTERNALSYM DXVA_SampleFormat} + TDXVASampleFormat = DXVA_SampleFormat; + +//#define DXVA_ExtractSampleFormat(_sf) ((_sf) & (DXVA_SampleFormatMask)) + + + +//#define DXVA_ExtractExtColorData(_sf, _Mask, _Shift) \ +// (((_sf) >> (_Shift)) & (_Mask)) + +const + +//#define DXVABitMask(__n) (~((~0) << __n)) + DXVA_ExtColorData_ShiftBase = 8; + {$EXTERNALSYM DXVA_ExtColorData_ShiftBase} +//#define DXVAColorMask(__bits,__base) (DXVABitMask(__bits) << ( __base - DXVA_ExtColorData_ShiftBase)) + + // DXVA_VideoTransFuncShift = (DXVA_ExtColorData_ShiftBase + 19), + DXVA_VideoTransFuncShift = (DXVA_ExtColorData_ShiftBase + 19); + {$EXTERNALSYM DXVA_VideoTransFuncShift} + // DXVA_VideoTransFuncMask = DXVAColorMask(5, DXVA_VideoTransFuncShift), + DXVA_VideoTransFuncMask = (not((not 0) shl 5)) shl ( DXVA_VideoTransFuncShift - DXVA_ExtColorData_ShiftBase); + {$EXTERNALSYM DXVA_VideoTransFuncMask} + +type + DXVA_VideoTransferFunction = ( + DXVA_VideoTransFunc_Unknown, + DXVA_VideoTransFunc_10, + DXVA_VideoTransFunc_18, + DXVA_VideoTransFunc_20, + DXVA_VideoTransFunc_22, + DXVA_VideoTransFunc_22_709, + DXVA_VideoTransFunc_22_240M, + DXVA_VideoTransFunc_22_8bit_sRGB, + DXVA_VideoTransFunc_28 + ); + {$EXTERNALSYM DXVA_VideoTransferFunction} + TDXVAVideoTransferFunction = DXVA_VideoTransferFunction; + +const + + + // DXVA_VideoPrimariesShift = (DXVA_ExtColorData_ShiftBase + 14), + DXVA_VideoPrimariesShift = (DXVA_ExtColorData_ShiftBase + 14); + {$EXTERNALSYM DXVA_VideoPrimariesShift} + // DXVA_VideoPrimariesMask = DXVAColorMask(5, DXVA_VideoPrimariesShift), + DXVA_VideoPrimariesMask = (not((not 0) shl 5)) shl ( DXVA_VideoPrimariesShift - DXVA_ExtColorData_ShiftBase); + {$EXTERNALSYM DXVA_VideoPrimariesMask} + +type + DXVA_VideoPrimaries = ( + DXVA_VideoPrimaries_Unknown, + DXVA_VideoPrimaries_reserved, + DXVA_VideoPrimaries_BT709, + DXVA_VideoPrimaries_BT470_2_SysM, + DXVA_VideoPrimaries_BT470_2_SysBG, + DXVA_VideoPrimaries_SMPTE170M, + DXVA_VideoPrimaries_SMPTE240M, + DXVA_VideoPrimaries_EBU3213, + DXVA_VideoPrimaries_SMPTE_C + ); + {$EXTERNALSYM DXVA_VideoPrimaries} + TDXVAVideoPrimaries = DXVA_VideoPrimaries; + +const + + // DXVA_VideoLightingShift = (DXVA_ExtColorData_ShiftBase + 10), + DXVA_VideoLightingShift = (DXVA_ExtColorData_ShiftBase + 10); + {$EXTERNALSYM DXVA_VideoLightingShift} + // DXVA_VideoLightingMask = DXVAColorMask(4, DXVA_VideoLightingShift), + DXVA_VideoLightingMask = (not((not 0) shl 4)) shl ( DXVA_VideoLightingShift - DXVA_ExtColorData_ShiftBase); + {$EXTERNALSYM DXVA_VideoLightingMask} + +type + DXVA_VideoLighting = ( + DXVA_VideoLighting_Unknown, + DXVA_VideoLighting_bright, + DXVA_VideoLighting_office, + DXVA_VideoLighting_dim, + DXVA_VideoLighting_dark + ); + {$EXTERNALSYM DXVA_VideoLighting} + TDXVAVideoLighting = DXVA_VideoLighting; + +const + DXVA_VideoTransferMatrixShift = (DXVA_ExtColorData_ShiftBase + 7); + {$EXTERNALSYM DXVA_VideoTransferMatrixShift} + DXVA_VideoTransferMatrixMask = (not((not 0) shl 3)) shl (DXVA_VideoTransferMatrixShift - DXVA_ExtColorData_ShiftBase); + {$EXTERNALSYM DXVA_VideoTransferMatrixMask} + +type + DXVA_VideoTransferMatrix = ( + DXVA_VideoTransferMatrix_Unknown, + DXVA_VideoTransferMatrix_BT709, + DXVA_VideoTransferMatrix_BT601, + DXVA_VideoTransferMatrix_SMPTE240M + ); + {$EXTERNALSYM DXVA_VideoTransferMatrix} + TDXVAVideoTransferMatrix = DXVA_VideoTransferMatrix; + +const + DXVA_NominalRangeShift = (DXVA_ExtColorData_ShiftBase + 4); + {$EXTERNALSYM DXVA_NominalRangeShift} + DXVA_NominalRangeMask = (not((not 0) shl 3)) shl (DXVA_NominalRangeShift - DXVA_ExtColorData_ShiftBase); + {$EXTERNALSYM DXVA_NominalRangeMask} + +type + DXVA_NominalRange = ( + DXVA_NominalRange_Unknown, + DXVA_NominalRange_Normal, + DXVA_NominalRange_Wide + ); + {$EXTERNALSYM DXVA_NominalRange} + TDXVANominalRange = DXVA_NominalRange; + + DXVA_VideoChromaSubsampling = LongWord; + {$EXTERNALSYM DXVA_VideoChromaSubsampling} +const + DXVA_VideoChromaSubsamplingShift = (DXVA_ExtColorData_ShiftBase + 0); + {$EXTERNALSYM DXVA_VideoChromaSubsamplingShift} + DXVA_VideoChromaSubsamplingMask = (not((not 0) shl 4)) shl (DXVA_VideoChromaSubsamplingShift - DXVA_ExtColorData_ShiftBase); + {$EXTERNALSYM DXVA_VideoChromaSubsamplingMask} + DXVA_VideoChromaSubsampling_Unknown = 0; + {$EXTERNALSYM DXVA_VideoChromaSubsampling_Unknown} + DXVA_VideoChromaSubsampling_ProgressiveChroma = $8; + {$EXTERNALSYM DXVA_VideoChromaSubsampling_ProgressiveChroma} + DXVA_VideoChromaSubsampling_Horizontally_Cosited = $4; + {$EXTERNALSYM DXVA_VideoChromaSubsampling_Horizontally_Cosited} + DXVA_VideoChromaSubsampling_Vertically_Cosited = $2; + {$EXTERNALSYM DXVA_VideoChromaSubsampling_Vertically_Cosited} + DXVA_VideoChromaSubsampling_Vertically_AlignedChromaPlanes = $1; + {$EXTERNALSYM DXVA_VideoChromaSubsampling_Vertically_AlignedChromaPlanes} + +//typedef struct _DXVA_ExtendedFormat +//{ +// UINT SampleFormat : 8; // See DXVA_SampleFormat +// UINT VideoChromaSubsampling : 4; // See DXVA_VideoChromaSubSampling +// DXVA_NominalRange NominalRange : 3; // See DXVA_NominalRange +// DXVA_VideoTransferMatrix VideoTransferMatrix : 3; // See DXVA_VideoTransferMatrix +// DXVA_VideoLighting VideoLighting : 4; // See DXVA_VideoLighting +// DXVA_VideoPrimaries VideoPrimaries : 5; // See DXVA_VideoPrimaries +// DXVA_VideoTransferFunction VideoTransferFunction : 5; // See DXVA_VideoTransferFunction +//} DXVA_ExtendedFormat; + + +// ------------------------------------------------------------------------- +// +// The definitions that follow describe the video de-interlace interface +// between the VMR and the graphics device driver. This interface is not +// accessable via the IAMVideoAccelerator interface. +// +// ------------------------------------------------------------------------- +// +const + DXVA_DeinterlaceBobDevice : TGUID = '{335aa36e-7884-43a4-9c91-7f87faf3e37e}'; + {$EXTERNALSYM DXVA_DeinterlaceBobDevice} + DXVA_DeinterlaceContainerDevice : TGUID = '{0e85cb93-3046-4ff0-aecc-d58cb5f035fd}'; + {$EXTERNALSYM DXVA_DeinterlaceContainerDevice} + +type + _DXVA_Frequency = record + Numerator : DWORD; + Denominator : DWORD; + end; + {$EXTERNALSYM _DXVA_Frequency} + DXVA_Frequency = _DXVA_Frequency; + {$EXTERNALSYM DXVA_Frequency} + TDXVAFrequency = _DXVA_Frequency; + + PDXVAVideoDesc = ^TDXVAVideoDesc; + _DXVA_VideoDesc = record + Size : DWORD; + SampleWidth : DWORD; + SampleHeight : DWORD; + SampleFormat : DWORD; // also contains extend color data + d3dFormat : TD3DFORMAT; + InputSampleFreq : TDXVAFrequency; + OutputFrameFreq : TDXVAFrequency; + end; + {$EXTERNALSYM _DXVA_VideoDesc} + DXVA_VideoDesc = _DXVA_VideoDesc; + {$EXTERNALSYM DXVA_VideoDesc} + LPDXVA_VideoDesc = ^DXVA_VideoDesc; + {$EXTERNALSYM LPDXVA_VideoDesc} + TDXVAVideoDesc = _DXVA_VideoDesc; + + DXVA_VideoProcessCaps = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM DXVA_VideoProcessCaps} +const + DXVA_VideoProcess_None = $0000; + {$EXTERNALSYM DXVA_VideoProcess_None} + DXVA_VideoProcess_YUV2RGB = $0001; + {$EXTERNALSYM DXVA_VideoProcess_YUV2RGB} + DXVA_VideoProcess_StretchX = $0002; + {$EXTERNALSYM DXVA_VideoProcess_StretchX} + DXVA_VideoProcess_StretchY = $0004; + {$EXTERNALSYM DXVA_VideoProcess_StretchY} + DXVA_VideoProcess_AlphaBlend = $0008; + {$EXTERNALSYM DXVA_VideoProcess_AlphaBlend} + DXVA_VideoProcess_SubRects = $0010; + {$EXTERNALSYM DXVA_VideoProcess_SubRects} + DXVA_VideoProcess_SubStreams = $0020; + {$EXTERNALSYM DXVA_VideoProcess_SubStreams} + DXVA_VideoProcess_SubStreamsExtended = $0040; + {$EXTERNALSYM DXVA_VideoProcess_SubStreamsExtended} + DXVA_VideoProcess_YUV2RGBExtended = $0080; + {$EXTERNALSYM DXVA_VideoProcess_YUV2RGBExtended} + DXVA_VideoProcess_AlphaBlendExtended = $0100; + {$EXTERNALSYM DXVA_VideoProcess_AlphaBlendExtended} + +type + DXVA_DeinterlaceTech = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM DXVA_DeinterlaceTech} + const + // the algorithm is unknown or proprietary + DXVA_DeinterlaceTech_Unknown = $0000; + {$EXTERNALSYM DXVA_DeinterlaceTech_Unknown} + + // the algorithm creates the missing lines by repeating + // the line either above or below it - this method will look very jaggy and + // isn't recommended + DXVA_DeinterlaceTech_BOBLineReplicate = $0001; + {$EXTERNALSYM DXVA_DeinterlaceTech_BOBLineReplicate} + + // The algorithm creates the missing lines by vertically stretching each + // video field by a factor of two by averaging two lines + DXVA_DeinterlaceTech_BOBVerticalStretch = $0002; + {$EXTERNALSYM DXVA_DeinterlaceTech_BOBVerticalStretch} + + // or using a [-1, 9, 9, -1]/16 filter across four lines. + DXVA_DeinterlaceTech_BOBVerticalStretch4Tap = $0100; + {$EXTERNALSYM DXVA_DeinterlaceTech_BOBVerticalStretch4Tap} + + // the pixels in the missing line are recreated by a median filtering operation + DXVA_DeinterlaceTech_MedianFiltering = $0004; + {$EXTERNALSYM DXVA_DeinterlaceTech_MedianFiltering} + + // the pixels in the missing line are recreated by an edge filter. + // In this process, spatial directional filters are applied to determine + // the orientation of edges in the picture content, and missing + // pixels are created by filtering along (rather than across) the + // detected edges. + DXVA_DeinterlaceTech_EdgeFiltering = $0010; + {$EXTERNALSYM DXVA_DeinterlaceTech_EdgeFiltering} + + // the pixels in the missing line are recreated by switching on a field by + // field basis between using either spatial or temporal interpolation + // depending on the amount of motion. + DXVA_DeinterlaceTech_FieldAdaptive = $0020; + {$EXTERNALSYM DXVA_DeinterlaceTech_FieldAdaptive} + + // the pixels in the missing line are recreated by switching on a pixel by pixel + // basis between using either spatial or temporal interpolation depending on + // the amount of motion.. + DXVA_DeinterlaceTech_PixelAdaptive = $0040; + {$EXTERNALSYM DXVA_DeinterlaceTech_PixelAdaptive} + + // Motion Vector Steering identifies objects within a sequence of video + // fields. The missing pixels are recreated after first aligning the + // movement axes of the individual objects in the scene to make them + // parallel with the time axis. + DXVA_DeinterlaceTech_MotionVectorSteered = $0080; + {$EXTERNALSYM DXVA_DeinterlaceTech_MotionVectorSteered} + +type + PDXVAVideoSample = ^TDXVAVideoSample; + _DXVA_VideoSample = record + rtStart : TReferenceTime; + rtEnd : TReferenceTime; + SampleFormat : TDXVASampleFormat; // only lower 8 bits used + lpDDSSrcSurface : Pointer; + end; + {$EXTERNALSYM _DXVA_VideoSample} + DXVA_VideoSample = _DXVA_VideoSample; + {$EXTERNALSYM DXVA_VideoSample} + LPDXVA_VideoSample = ^DXVA_VideoSample; + {$EXTERNALSYM LPDXVA_VideoSample} + TDXVAVideoSample = _DXVA_VideoSample; + + +// ------------------------------------------------------------------------- +// DeinterlaceBltEx declarations +// ------------------------------------------------------------------------- +// +type + DXVA_SampleFlags = LongWord; + {$EXTERNALSYM DXVA_SampleFlags} +const + DXVA_SampleFlagsMask = (1 shl 3) or (1 shl 2) or (1 shl 1) or (1 shl 0); + {$EXTERNALSYM DXVA_SampleFlagsMask} + DXVA_SampleFlag_Palette_Changed = $0001; + {$EXTERNALSYM DXVA_SampleFlag_Palette_Changed} + DXVA_SampleFlag_SrcRect_Changed = $0002; + {$EXTERNALSYM DXVA_SampleFlag_SrcRect_Changed} + DXVA_SampleFlag_DstRect_Changed = $0004; + {$EXTERNALSYM DXVA_SampleFlag_DstRect_Changed} + DXVA_SampleFlag_ColorData_Changed = $0008; + {$EXTERNALSYM DXVA_SampleFlag_ColorData_Changed} + +type + DXVA_DestinationFlags = LongWord; +const + DXVA_DestinationFlagMask = (1 shl 3) or (1 shl 2) or (1 shl 1) or (1 shl 0); + {$EXTERNALSYM DXVA_DestinationFlagMask} + DXVA_DestinationFlag_Background_Changed = $0001; + {$EXTERNALSYM DXVA_DestinationFlag_Background_Changed} + DXVA_DestinationFlag_TargetRect_Changed = $0002; + {$EXTERNALSYM DXVA_DestinationFlag_TargetRect_Changed} + DXVA_DestinationFlag_ColorData_Changed = $0004; + {$EXTERNALSYM DXVA_DestinationFlag_ColorData_Changed} + DXVA_DestinationFlag_Alpha_Changed = $0008; + {$EXTERNALSYM DXVA_DestinationFlag_Alpha_Changed} + +type + PDXVAVideoSample2 = ^TDXVAVideoSample2; + DXVA_VideoSample2 = record + rtStart: REFERENCE_TIME; + rtEnd: REFERENCE_TIME; + SampleFormat: DWORD; // cast to DXVA_ExtendedFormat, or use Extract macros + SampleFlags: DWORD; + lpDDSSrcSurface: Pointer; + rcSrc: TRect; + rcDst: TRect; + Palette: array[0..15] of TDXVAAYUVsample2; + end; + {$EXTERNALSYM DXVA_VideoSample2} + LPDXVA_VideoSample2 = ^DXVA_VideoSample2; + {$EXTERNALSYM LPDXVA_VideoSample2} + TDXVAVideoSample2 = DXVA_VideoSample2; + + PDXVADeinterlaceCaps = ^TDXVADeinterlaceCaps; + _DXVA_DeinterlaceCaps = record + Size : DWORD; + NumPreviousOutputFrames : DWORD; + InputPool : DWORD; + NumForwardRefSamples : DWORD; + NumBackwardRefSamples : DWORD; + d3dOutputFormat : TD3DFORMAT; + VideoProcessingCaps : DXVA_VideoProcessCaps; + DeinterlaceTechnology : DXVA_DeinterlaceTech; + end; + {$EXTERNALSYM _DXVA_DeinterlaceCaps} + DXVA_DeinterlaceCaps = _DXVA_DeinterlaceCaps; + {$EXTERNALSYM DXVA_DeinterlaceCaps} + LPDXVA_DeinterlaceCaps = ^DXVA_DeinterlaceCaps; + {$EXTERNALSYM LPDXVA_DeinterlaceCaps} + TDXVADeinterlaceCaps = _DXVA_DeinterlaceCaps; + + +// ------------------------------------------------------------------------- +// Data types used with RenderMoComp in kernel mode +// ------------------------------------------------------------------------- + +const + // Function codes for RenderMoComp + MAX_DEINTERLACE_SURFACES = 32; + {$EXTERNALSYM MAX_DEINTERLACE_SURFACES} + +type + PDXVADeinterlaceBlt = ^TDXVADeinterlaceBlt; + _DXVA_DeinterlaceBlt = record + Size : DWORD; + Reserved : DWORD; + rtTarget : TReferenceTime; + DstRect : TRECT; + SrcRect : TRECT; + NumSourceSurfaces : DWORD; + Alpha : Single; + Source: array[0..MAX_DEINTERLACE_SURFACES-1] of TDXVAVideoSample; + end; + {$EXTERNALSYM _DXVA_DeinterlaceBlt} + DXVA_DeinterlaceBlt = _DXVA_DeinterlaceBlt; + {$EXTERNALSYM DXVA_DeinterlaceBlt} + TDXVADeinterlaceBlt = _DXVA_DeinterlaceBlt; + +const + DXVA_DeinterlaceBltFnCode = $01; + {$EXTERNALSYM DXVA_DeinterlaceBltFnCode} + // lpInput => DXVA_DeinterlaceBlt* + // lpOuput => NULL /* not currently used */ + +type + DXVA_DeinterlaceBltEx = record + Size: DWORD; + BackgroundColor : DXVA_AYUVsample2; + rcTarget : TRect; + rtTarget : REFERENCE_TIME; + NumSourceSurfaces : DWORD; + Alpha : Single; + Source : array[0..MAX_DEINTERLACE_SURFACES-1] of DXVA_VideoSample2; + DestinationFormat : DWORD; + DestinationFlags : DWORD; + end; + {$EXTERNALSYM DXVA_DeinterlaceBltEx} + +const + DXVA_DeinterlaceBltExFnCode = $02; + {$EXTERNALSYM DXVA_DeinterlaceBltExFnCode} +// lpInput => DXVA_DeinterlaceBltEx* +// lpOuput => NULL /* not currently used */ + + + MAX_DEINTERLACE_DEVICE_GUIDS = 32; + {$EXTERNALSYM MAX_DEINTERLACE_DEVICE_GUIDS} + +type + PDXVADeinterlaceQueryAvailableModes = ^TDXVADeinterlaceQueryAvailableModes; + _DXVA_DeinterlaceQueryAvailableModes = record + Size : DWORD; + NumGuids : DWORD; + Guids: array[0..MAX_DEINTERLACE_DEVICE_GUIDS-1] of TGUID; + end; + {$EXTERNALSYM _DXVA_DeinterlaceQueryAvailableModes} + DXVA_DeinterlaceQueryAvailableModes = _DXVA_DeinterlaceQueryAvailableModes; + {$EXTERNALSYM DXVA_DeinterlaceQueryAvailableModes} + TDXVADeinterlaceQueryAvailableModes = _DXVA_DeinterlaceQueryAvailableModes; + +const + TDXVA_DeinterlaceQueryAvailableModesFnCode = $01; + {$EXTERNALSYM TDXVA_DeinterlaceQueryAvailableModesFnCode} + // lpInput => DXVA_VideoDesc* + // lpOuput => DXVA_DeinterlaceQueryAvailableModes* + +type + PDXVADeinterlaceQueryModeCaps = ^TDXVADeinterlaceQueryModeCaps; + _DXVA_DeinterlaceQueryModeCaps = record + Size : DWORD; + Guid : TGUID; + VideoDesc : TDXVAVideoDesc; + end; + {$EXTERNALSYM _DXVA_DeinterlaceQueryModeCaps} + DXVA_DeinterlaceQueryModeCaps = _DXVA_DeinterlaceQueryModeCaps; + {$EXTERNALSYM DXVA_DeinterlaceQueryModeCaps} + TDXVADeinterlaceQueryModeCaps = _DXVA_DeinterlaceQueryModeCaps; + +const + DXVA_DeinterlaceQueryModeCapsFnCode = $02; + {$EXTERNALSYM DXVA_DeinterlaceQueryModeCapsFnCode} + // lpInput => DXVA_DeinterlaceQueryModeCaps* + // lpOuput => DXVA_DeinterlaceCaps* + +// ------------------------------------------------------------------------- +// +// The definitions that follow describe the video ProcAmp interface +// between the VMR and the graphics device driver. This interface is not +// accessable via the IAMVideoAccelerator interface. +// +// ------------------------------------------------------------------------- +// +const + DXVA_ProcAmpControlDevice : TGUID = '{9f200913-2ffd-4056-9f1e-e1b508f22dcf}'; + {$EXTERNALSYM DXVA_ProcAmpControlDevice} + +type + DXVA_ProcAmpControlProp = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM DXVA_ProcAmpControlProp} + const + DXVA_ProcAmp_None = $0000; + {$EXTERNALSYM DXVA_ProcAmp_None} + DXVA_ProcAmp_Brightness = $0001; + {$EXTERNALSYM DXVA_ProcAmp_Brightness} + DXVA_ProcAmp_Contrast = $0002; + {$EXTERNALSYM DXVA_ProcAmp_Contrast} + DXVA_ProcAmp_Hue = $0004; + {$EXTERNALSYM DXVA_ProcAmp_Hue} + DXVA_ProcAmp_Saturation = $0008; + {$EXTERNALSYM DXVA_ProcAmp_Saturation} + +type + PDXVAProcAmpControlCaps = ^TDXVAProcAmpControlCaps; + _DXVA_ProcAmpControlCaps = record + Size : DWORD; + InputPool : DWORD; + d3dOutputFormat : TD3DFORMAT; + ProcAmpControlProps : DWORD; // see DXVA_ProcAmpControlProp + VideoProcessingCaps : DWORD; // see DXVA_VideoProcessCaps + end; + {$EXTERNALSYM _DXVA_ProcAmpControlCaps} + DXVA_ProcAmpControlCaps = _DXVA_ProcAmpControlCaps; + {$EXTERNALSYM DXVA_ProcAmpControlCaps} + LPDXVA_ProcAmpControlCaps = ^DXVA_ProcAmpControlCaps; + {$EXTERNALSYM LPDXVA_ProcAmpControlCaps} + TDXVAProcAmpControlCaps = _DXVA_ProcAmpControlCaps; + +const + DXVA_ProcAmpControlQueryCapsFnCode = $03; + {$EXTERNALSYM DXVA_ProcAmpControlQueryCapsFnCode} + // lpInput => DXVA_VideoDesc* + // lpOuput => DXVA_ProcAmpControlCaps* + +type + PDXVAProcAmpControlQueryRange = ^TDXVAProcAmpControlQueryRange; + _DXVA_ProcAmpControlQueryRange = record + Size : DWORD; + ProcAmpControlProp : DXVA_ProcAmpControlProp; + VideoDesc : TDXVAVideoDesc; + end; + {$EXTERNALSYM _DXVA_ProcAmpControlQueryRange} + DXVA_ProcAmpControlQueryRange = _DXVA_ProcAmpControlQueryRange; + {$EXTERNALSYM DXVA_ProcAmpControlQueryRange} + LPDXVA_ProcAmpControlQueryRange = ^DXVA_ProcAmpControlQueryRange; + {$EXTERNALSYM LPDXVA_ProcAmpControlQueryRange} + TDXVAProcAmpControlQueryRange = _DXVA_ProcAmpControlQueryRange; + + PDXVAVideoPropertyRange = ^TDXVAVideoPropertyRange; + _DXVA_VideoPropertyRange = record + MinValue : Single; + MaxValue : Single; + DefaultValue : Single; + StepSize : Single; + end; + {$EXTERNALSYM _DXVA_VideoPropertyRange} + DXVA_VideoPropertyRange = _DXVA_VideoPropertyRange; + {$EXTERNALSYM DXVA_VideoPropertyRange} + LPDXVA_VideoPropertyRange = ^DXVA_VideoPropertyRange; + {$EXTERNALSYM LPDXVA_VideoPropertyRange} + TDXVAVideoPropertyRange = _DXVA_VideoPropertyRange; + +const + DXVA_ProcAmpControlQueryRangeFnCode = $04; + {$EXTERNALSYM DXVA_ProcAmpControlQueryRangeFnCode} + // lpInput => DXVA_ProcAmpControlQueryRange* + // lpOuput => DXVA_VideoPropertyRange* + +type + PDXVAProcAmpControlBlt = ^TDXVAProcAmpControlBlt; + _DXVA_ProcAmpControlBlt = record + Size : DWORD; + DstRect : TRECT; + SrcRect : TRECT; + Alpha : Single; + Brightness : Single; + Contrast : Single; + Hue : Single; + Saturation : Single; + end; + {$EXTERNALSYM _DXVA_ProcAmpControlBlt} + DXVA_ProcAmpControlBlt = _DXVA_ProcAmpControlBlt; + {$EXTERNALSYM DXVA_ProcAmpControlBlt} + TDXVAProcAmpControlBlt = _DXVA_ProcAmpControlBlt; + +const + DXVA_ProcAmpControlBltFnCode = $01; + {$EXTERNALSYM DXVA_ProcAmpControlBltFnCode} + // lpInput => DXVA_ProcAmpControlBlt* + // lpOuput => NULL /* not currently used */ + +// ------------------------------------------------------------------------- +// +// The definitions that follow describe the Certified Output Protection +// Protocol between the VMR and the graphics device driver. This interface +// is not accessable via the IAMVideoAccelerator interface. +// +// ------------------------------------------------------------------------- +// + +const + DXVA_COPPDevice : TGUID = '{D2457ADD-8999-45ED-8A8A-D1AA047BA4D5}'; + {$EXTERNALSYM DXVA_COPPDevice} + + +// ------------------------------------------------------------------------- +// COPPGetCertificateLength +// ------------------------------------------------------------------------- + DXVA_COPPGetCertificateLengthFnCode = $01; + {$EXTERNALSYM DXVA_COPPGetCertificateLengthFnCode} +// lpInput => NULL +// lpOuput => DWORD* + + +// ------------------------------------------------------------------------- +// COPPKeyExchange +// ------------------------------------------------------------------------- + DXVA_COPPKeyExchangeFnCode = $02; + {$EXTERNALSYM DXVA_COPPKeyExchangeFnCode} +// lpInputData => NULL +// lpOuputData => GUID* + + +// ------------------------------------------------------------------------- +// COPPSequenceStart +// ------------------------------------------------------------------------- +type + PDXVACOPPSignature = ^TDXVACOPPSignature; + DXVA_COPPSignature = record + Signature: array[0..255] of Char; + end; + {$EXTERNALSYM DXVA_COPPSignature} + LPDXVA_COPPSignature = ^DXVA_COPPSignature; + {$EXTERNALSYM LPDXVA_COPPSignature} + TDXVACOPPSignature = DXVA_COPPSignature; + +const + DXVA_COPPSequenceStartFnCode = $03; + {$EXTERNALSYM DXVA_COPPSequenceStartFnCode} +// lpInputData => DXVA_COPPSignature* +// lpOuputData => NULL + + + +// ------------------------------------------------------------------------- +// COPPCommand +// ------------------------------------------------------------------------- +type + PDXVACOPPCommand = ^TDXVACOPPCommand; + DXVA_COPPCommand = packed record + macKDI: TGUID; // 16 bytes + guidCommandID: TGUID; // 16 bytes + dwSequence: ULONG; // 4 bytes + cbSizeData: ULONG; // 4 bytes + CommandData: array[0..4055] of Char; // 4056 bytes (4056+4+4+16+16 = 4096) + end; + {$EXTERNALSYM DXVA_COPPCommand} + LPDXVA_COPPCommand = ^DXVA_COPPCommand; + {$EXTERNALSYM LPDXVA_COPPCommand} + TDXVACOPPCommand = DXVA_COPPCommand; + +const + DXVA_COPPCommandFnCode = $04; + {$EXTERNALSYM DXVA_COPPCommandFnCode} +// lpInputData => DXVA_COPPCommand* +// lpOuputData => NULL + + DXVA_COPPSetProtectionLevel : TGUID = '{9bb9327c-4eb5-4727-9f00-b42b0919c0da}'; + {$EXTERNALSYM DXVA_COPPSetProtectionLevel} + +type + PDXVACOPPSetProtectionLevelCmdData = ^TDXVACOPPSetProtectionLevelCmdData; + DXVA_COPPSetProtectionLevelCmdData = packed record + ProtType: ULONG; + ProtLevel: ULONG; + ExtendedInfoChangeMask: ULONG; + ExtendedInfoData: ULONG; + end; + {$EXTERNALSYM DXVA_COPPSetProtectionLevelCmdData} + TDXVACOPPSetProtectionLevelCmdData = DXVA_COPPSetProtectionLevelCmdData; + + +// Set the HDCP protection level - (0 - 1 DWORD, 4 bytes) + + COPP_HDCP_Protection_Level = LongWord; + {$EXTERNALSYM COPP_HDCP_Protection_Level} +const + COPP_HDCP_Level0 = 0; + {$EXTERNALSYM COPP_HDCP_Level0} + COPP_HDCP_LevelMin = COPP_HDCP_Level0; + {$EXTERNALSYM COPP_HDCP_LevelMin} + COPP_HDCP_Level1 = 1; + {$EXTERNALSYM COPP_HDCP_Level1} + COPP_HDCP_LevelMax = COPP_HDCP_Level1; + {$EXTERNALSYM COPP_HDCP_LevelMax} + COPP_HDCP_ForceDWORD = $7fffffff; + {$EXTERNALSYM COPP_HDCP_ForceDWORD} + +type + COPP_CGMSA_Protection_Level = LongWord; + {$EXTERNALSYM COPP_CGMSA_Protection_Level} +const + COPP_CGMSA_Disabled = 0; + {$EXTERNALSYM COPP_CGMSA_Disabled} + COPP_CGMSA_LevelMin = COPP_CGMSA_Disabled; + {$EXTERNALSYM COPP_CGMSA_LevelMin} + COPP_CGMSA_CopyFreely = 1; + {$EXTERNALSYM COPP_CGMSA_CopyFreely} + COPP_CGMSA_CopyNoMore = 2; + {$EXTERNALSYM COPP_CGMSA_CopyNoMore} + COPP_CGMSA_CopyOneGeneration = 3; + {$EXTERNALSYM COPP_CGMSA_CopyOneGeneration} + COPP_CGMSA_CopyNever = 4; + {$EXTERNALSYM COPP_CGMSA_CopyNever} + COPP_CGMSA_RedistributionControlRequired = $08; + {$EXTERNALSYM COPP_CGMSA_RedistributionControlRequired} + COPP_CGMSA_LevelMax = (COPP_CGMSA_RedistributionControlRequired + COPP_CGMSA_CopyNever); + {$EXTERNALSYM COPP_CGMSA_LevelMax} + COPP_CGMSA_ForceDWORD = $7fffffff; + {$EXTERNALSYM COPP_CGMSA_ForceDWORD} + +type + COPP_ACP_Protection_Level = LongWord; + {$EXTERNALSYM COPP_ACP_Protection_Level} +const + COPP_ACP_Level0 = 0; + {$EXTERNALSYM COPP_ACP_Level0} + COPP_ACP_LevelMin = COPP_ACP_Level0; + {$EXTERNALSYM COPP_ACP_LevelMin} + COPP_ACP_Level1 = 1; + {$EXTERNALSYM COPP_ACP_Level1} + COPP_ACP_Level2 = 2; + {$EXTERNALSYM COPP_ACP_Level2} + COPP_ACP_Level3 = 3; + {$EXTERNALSYM COPP_ACP_Level3} + COPP_ACP_LevelMax = COPP_ACP_Level3; + {$EXTERNALSYM COPP_ACP_LevelMax} + COPP_ACP_ForceDWORD = $7fffffff; + {$EXTERNALSYM COPP_ACP_ForceDWORD} + + COPP_NoProtectionLevelAvailable = -1; + {$EXTERNALSYM COPP_NoProtectionLevelAvailable} + COPP_DefaultProtectionLevel = 0; + {$EXTERNALSYM COPP_DefaultProtectionLevel} + + +// +// Bit flags of possible protection types. Note that it is possible to apply +// different protection settings to a single connector. +// + COPP_ProtectionType_Unknown = $80000000; + {$EXTERNALSYM COPP_ProtectionType_Unknown} + COPP_ProtectionType_None = $00000000; + {$EXTERNALSYM COPP_ProtectionType_None} + COPP_ProtectionType_HDCP = $00000001; + {$EXTERNALSYM COPP_ProtectionType_HDCP} + COPP_ProtectionType_ACP = $00000002; + {$EXTERNALSYM COPP_ProtectionType_ACP} + COPP_ProtectionType_CGMSA = $00000004; + {$EXTERNALSYM COPP_ProtectionType_CGMSA} + COPP_ProtectionType_Mask = $80000007; + {$EXTERNALSYM COPP_ProtectionType_Mask} + COPP_ProtectionType_Reserved = $7FFFFFF8; + {$EXTERNALSYM COPP_ProtectionType_Reserved} + + DXVA_COPPSetSignaling : TGUID = '{09A631A5-D684-4C60-8E4D-D3BB0F0BE3EE}'; + {$EXTERNALSYM DXVA_COPPSetSignaling} + +type + DXVA_COPPSetSignalingCmdData = packed record + ActiveTVProtectionStandard: ULONG; // See COPP_TVProtectionStandard + AspectRatioChangeMask1: ULONG; + AspectRatioData1: ULONG; // See COPP_ImageAspectRatio_EN300294 for ETSI EN 300 294 values + AspectRatioChangeMask2: ULONG; + AspectRatioData2: ULONG; + AspectRatioChangeMask3: ULONG; + AspectRatioData3: ULONG; + ExtendedInfoChangeMask: array[0..3] of ULONG; + ExtendedInfoData: array[0..3] of ULONG; + Reserved: ULONG; + end; + {$EXTERNALSYM DXVA_COPPSetSignalingCmdData} + TDXVACOPPSetSignalingCmdData = DXVA_COPPSetSignalingCmdData; + +// Add format enum and data enum + COPP_TVProtectionStandard = longword; + {$EXTERNALSYM COPP_TVProtectionStandard} +const + COPP_ProtectionStandard_Unknown = $80000000; + {$EXTERNALSYM COPP_ProtectionStandard_Unknown} + COPP_ProtectionStandard_None = $00000000; + {$EXTERNALSYM COPP_ProtectionStandard_None} + COPP_ProtectionStandard_IEC61880_525i = $00000001; + {$EXTERNALSYM COPP_ProtectionStandard_IEC61880_525i} + COPP_ProtectionStandard_IEC61880_2_525i = $00000002; + {$EXTERNALSYM COPP_ProtectionStandard_IEC61880_2_525i} + COPP_ProtectionStandard_IEC62375_625p = $00000004; + {$EXTERNALSYM COPP_ProtectionStandard_IEC62375_625p} + COPP_ProtectionStandard_EIA608B_525 = $00000008; + {$EXTERNALSYM COPP_ProtectionStandard_EIA608B_525} + COPP_ProtectionStandard_EN300294_625i = $00000010; + {$EXTERNALSYM COPP_ProtectionStandard_EN300294_625i} + COPP_ProtectionStandard_CEA805A_TypeA_525p = $00000020; + {$EXTERNALSYM COPP_ProtectionStandard_CEA805A_TypeA_525p} + COPP_ProtectionStandard_CEA805A_TypeA_750p = $00000040; + {$EXTERNALSYM COPP_ProtectionStandard_CEA805A_TypeA_750p} + COPP_ProtectionStandard_CEA805A_TypeA_1125i = $00000080; + {$EXTERNALSYM COPP_ProtectionStandard_CEA805A_TypeA_1125i} + COPP_ProtectionStandard_CEA805A_TypeB_525p = $00000100; + {$EXTERNALSYM COPP_ProtectionStandard_CEA805A_TypeB_525p} + COPP_ProtectionStandard_CEA805A_TypeB_750p = $00000200; + {$EXTERNALSYM COPP_ProtectionStandard_CEA805A_TypeB_750p} + COPP_ProtectionStandard_CEA805A_TypeB_1125i = $00000400; + {$EXTERNALSYM COPP_ProtectionStandard_CEA805A_TypeB_1125i} + COPP_ProtectionStandard_ARIBTRB15_525i = $00000800; + {$EXTERNALSYM COPP_ProtectionStandard_ARIBTRB15_525i} + COPP_ProtectionStandard_ARIBTRB15_525p = $00001000; + {$EXTERNALSYM COPP_ProtectionStandard_ARIBTRB15_525p} + COPP_ProtectionStandard_ARIBTRB15_750p = $00002000; + {$EXTERNALSYM COPP_ProtectionStandard_ARIBTRB15_750p} + COPP_ProtectionStandard_ARIBTRB15_1125i = $00004000; + {$EXTERNALSYM COPP_ProtectionStandard_ARIBTRB15_1125i} + COPP_ProtectionStandard_Mask = $80007FFF; + {$EXTERNALSYM COPP_ProtectionStandard_Mask} + COPP_ProtectionStandard_Reserved = $7FFF8000; + {$EXTERNALSYM COPP_ProtectionStandard_Reserved} + + + COPP_ImageAspectRatio_EN300294_Mask = $00000007; + {$EXTERNALSYM COPP_ImageAspectRatio_EN300294_Mask} + +type + COPP_ImageAspectRatio_EN300294 = ( + COPP_AspectRatio_EN300294_FullFormat4by3, + COPP_AspectRatio_EN300294_Box14by9Center, + COPP_AspectRatio_EN300294_Box14by9Top, + COPP_AspectRatio_EN300294_Box16by9Center, + COPP_AspectRatio_EN300294_Box16by9Top, + COPP_AspectRatio_EN300294_BoxGT16by9Center, + COPP_AspectRatio_EN300294_FullFormat4by3ProtectedCenter, + COPP_AspectRatio_EN300294_FullFormat16by9Anamorphic + ); + {$EXTERNALSYM COPP_ImageAspectRatio_EN300294} + TCOPPImageAspectRatioEN300294 = COPP_ImageAspectRatio_EN300294; + +// ------------------------------------------------------------------------- +// COPPQueryStatus +// ------------------------------------------------------------------------- +type + PDXVACOPPStatusInput = ^TDXVACOPPStatusInput; + DXVA_COPPStatusInput = packed record + rApp : TGUID; // 16 bytes + guidStatusRequestID : TGUID; // 16 bytes + dwSequence : ULONG; // 4 bytes + cbSizeData : ULONG; // 4 bytes + StatusData: array[0..4055] of char; // 4056 bytes (4056+4+4+16+16 = 4096) + end; + {$EXTERNALSYM DXVA_COPPStatusInput} + LPDXVA_COPPStatusInput = ^DXVA_COPPStatusInput; + {$EXTERNALSYM LPDXVA_COPPStatusInput} + TDXVACOPPStatusInput = DXVA_COPPStatusInput; + + PDXVACOPPStatusOutput = ^TDXVACOPPStatusOutput; + DXVA_COPPStatusOutput = packed record + macKDI : TGUID; // 16 bytes + cbSizeData : ULONG; // 4 bytes + COPPStatus : array[0..4075] of Char; // 4076 bytes (4076+16+4 = 4096) + end; + {$EXTERNALSYM DXVA_COPPStatusOutput} + LPDXVA_COPPStatusOutput = ^DXVA_COPPStatusOutput; + {$EXTERNALSYM LPDXVA_COPPStatusOutput} + TDXVACOPPStatusOutput = DXVA_COPPStatusOutput; + +type + COPP_StatusFlags = ( + COPP_StatusNormal, + COPP_LinkLost, + COPP_RenegotiationRequired + ); + {$EXTERNALSYM COPP_StatusFlags} + TCOPPStatusFlags = COPP_StatusFlags; + +const + COPP_StatusFlagsReserved = $FFFFFFFC; + {$EXTERNALSYM COPP_StatusFlagsReserved} + +type + PDXVACOPPStatusData = ^TDXVACOPPStatusData; + DXVA_COPPStatusData = packed record + rApp : TGUID; + dwFlags : ULONG; // See COPP_StatusFlags above + dwData : ULONG; + ExtendedInfoValidMask : ULONG; + ExtendedInfoData : ULONG; + end; + {$EXTERNALSYM DXVA_COPPStatusData} + TDXVACOPPStatusData = DXVA_COPPStatusData; + + DXVA_COPPStatusDisplayData = packed record + rApp: TGUID; + dwFlags: ULONG; // See COPP_StatusFlags above + DisplayWidth: ULONG; + DisplayHeight: ULONG; + Format: ULONG; // also contains extended color data + d3dFormat: ULONG; + FreqNumerator: ULONG; + FreqDenominator: ULONG; + end; + {$EXTERNALSYM DXVA_COPPStatusDisplayData} + + COPP_StatusHDCPFlags = LongWord; + {$EXTERNALSYM COPP_StatusHDCPFlags} +const + COPP_HDCPRepeater = $01; + {$EXTERNALSYM COPP_HDCPRepeater} + COPP_HDCPFlagsReserved = $FFFFFFFE; + {$EXTERNALSYM COPP_HDCPFlagsReserved} + +type + PDXVACOPPStatusHDCPKeyData = ^TDXVACOPPStatusHDCPKeyData; + DXVA_COPPStatusHDCPKeyData = packed record + rApp: TGUID; + dwFlags: ULONG; // See COPP_StatusFlags above + dwHDCPFlags: ULONG; // See COPP_StatusHDCPFlags above + BKey: TGUID; // Lower 40 bits + Reserved1: TGUID; + Reserved2: TGUID; + end; + {$EXTERNALSYM DXVA_COPPStatusHDCPKeyData} + TDXVACOPPStatusHDCPKeyData = DXVA_COPPStatusHDCPKeyData; + +const + DXVA_COPPQueryStatusFnCode = $05; + {$EXTERNALSYM DXVA_COPPQueryStatusFnCode} +// lpInputData => DXVA_COPPStatusInput* +// lpOuputData => DXVA_COPPStatusOutput* + + +// +// Status GUID and enumerations +// + DXVA_COPPQueryConnectorType: TGUID = '{81d0bfd5-6afe-48c2-99c0-95a08f97c5da}'; + {$EXTERNALSYM DXVA_COPPQueryConnectorType} + +const + COPP_ConnectorType_Unknown = -1; + {$EXTERNALSYM COPP_ConnectorType_Unknown} + COPP_ConnectorType_Internal = $80000000; // can be combined with the other connector types + {$EXTERNALSYM COPP_ConnectorType_Internal} +type + COPP_ConnectorType = ( + COPP_ConnectorType_VGA, + COPP_ConnectorType_SVideo, + COPP_ConnectorType_CompositeVideo, + COPP_ConnectorType_ComponentVideo, + COPP_ConnectorType_DVI, + COPP_ConnectorType_HDMI, + COPP_ConnectorType_LVDS, + COPP_ConnectorType_TMDS, + COPP_ConnectorType_D_JPN + //COPP_ConnectorType_ForceDWORD = $7fffffff; (* force 32-bit size enum *) + ); + {$EXTERNALSYM COPP_ConnectorType} + TCOPPConnectorType = COPP_ConnectorType; + +const + DXVA_COPPQueryProtectionType : TGUID = '{38f2a801-9a6c-48bb-9107-b6696e6f1797}'; + {$EXTERNALSYM DXVA_COPPQueryProtectionType} + DXVA_COPPQueryLocalProtectionLevel : TGUID = '{b2075857-3eda-4d5d-88db-748f8c1a0549}'; + {$EXTERNALSYM DXVA_COPPQueryLocalProtectionLevel} + DXVA_COPPQueryGlobalProtectionLevel : TGUID = '{1957210a-7766-452a-b99a-d27aed54f03a}'; + {$EXTERNALSYM DXVA_COPPQueryGlobalProtectionLevel} + DXVA_COPPQueryDisplayData : TGUID = '{d7bf1ba3-ad13-4f8e-af98-0dcb3ca204cc}'; + {$EXTERNALSYM DXVA_COPPQueryDisplayData} + DXVA_COPPQueryHDCPKeyData : TGUID = '{0db59d74-a992-492e-a0bd-c23fda564e00}'; + {$EXTERNALSYM DXVA_COPPQueryHDCPKeyData} + DXVA_COPPQueryBusData : TGUID = '{c6f4d673-6174-4184-8e35-f6db5200bcba}'; + {$EXTERNALSYM DXVA_COPPQueryBusData} + + COPP_BusType_Integrated = $80000000; // can be combined with the other bus types + {$EXTERNALSYM COPP_BusType_Integrated} + +type + COPP_BusType = ( + COPP_BusType_Unknown, + COPP_BusType_PCI, + COPP_BusType_PCIX, + COPP_BusType_PCIExpress, + COPP_BusType_AGP + //COPP_BusType_ForceDWORD = 0x7fffffff /* force 32-bit size enum */ + ); + {$EXTERNALSYM COPP_BusType} + TCOPPBusType = COPP_BusType; + +const + DXVA_COPPQuerySignaling : TGUID = '{6629A591-3B79-4CF3-924A-11E8E7811671}'; + {$EXTERNALSYM DXVA_COPPQuerySignaling} + +type + DXVA_COPPStatusSignalingCmdData = packed record + rApp: TGUID; + dwFlags: ULONG; // See COPP_StatusFlags above + AvailableTVProtectionStandards: ULONG; // See COPP_TVProtectionStandard + ActiveTVProtectionStandard: ULONG; // See COPP_TVProtectionStandard + TVType: ULONG; + AspectRatioValidMask1: ULONG; + AspectRatioData1: ULONG; // See COPP_AspectRatio_EN300294 for ETSI EN 300 294 values + AspectRatioValidMask2: ULONG; + AspectRatioData2: ULONG; + AspectRatioValidMask3: ULONG; + AspectRatioData3: ULONG; + ExtendedInfoValidMask: array[0..3] of ULONG; + ExtendedInfoData: array[0..3] of ULONG; + end; + {$EXTERNALSYM DXVA_COPPStatusSignalingCmdData} + TDXVACOPPStatusSignalingCmdData = DXVA_COPPStatusSignalingCmdData; + +//------------------------------------------------------------------------------ +// File: AMVA.h +// Desc: DirectShowMotionComp include file. +// Copyright (c) 1997 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +const + AMVA_TYPEINDEX_OUTPUTFRAME = $FFFFFFFF; + {$EXTERNALSYM AMVA_TYPEINDEX_OUTPUTFRAME} + + // Flags for QueryRenderStatus + AMVA_QUERYRENDERSTATUSF_READ = $00000001; // Query for read + {$EXTERNALSYM AMVA_QUERYRENDERSTATUSF_READ} + // set this bit to 0 + // if query for update +type + PAMVAUncompBufferInfo = ^TAMVAUncompBufferInfo; + _tag_AMVAUncompBufferInfo = record + dwMinNumSurfaces : DWORD ; // IN min number of surfaces to be allocated + dwMaxNumSurfaces : DWORD ; // IN max number of surfaces to be allocated + ddUncompPixelFormat : TDDPixelFormat ; // IN pixel format of surfaces to be allocated + end; + {$EXTERNALSYM _tag_AMVAUncompBufferInfo} + AMVAUncompBufferInfo = _tag_AMVAUncompBufferInfo; + {$EXTERNALSYM AMVAUncompBufferInfo} + LPAMVAUncompBufferInfo = ^AMVAUncompBufferInfo; + {$EXTERNALSYM LPAMVAUncompBufferInfo} + TAMVAUncompBufferInfo = _tag_AMVAUncompBufferInfo; + + PAMVAUncompDataInfo = ^TAMVAUncompDataInfo; + _tag_AMVAUncompDataInfo = record + dwUncompWidth : DWORD ; // [in] width of uncompressed data + dwUncompHeight : DWORD ; // [in] height of uncompressed data + ddUncompPixelFormat : TDDPixelFormat ; // [in] pixel-format of uncompressed data + end; + {$EXTERNALSYM _tag_AMVAUncompDataInfo} + AMVAUncompDataInfo = _tag_AMVAUncompDataInfo; + {$EXTERNALSYM AMVAUncompDataInfo} + LPAMVAUncompDataInfo = ^AMVAUncompDataInfo; + {$EXTERNALSYM LPAMVAUncompDataInfo} + TAMVAUncompDataInfo = _tag_AMVAUncompDataInfo; + + PAMVAInternalMemInfo = ^TAMVAInternalMemInfo; + _tag_AMVAInternalMemInfo = record + dwScratchMemAlloc : DWORD ; // [out] amount of scratch memory will the hal allocate for its private use + end; + {$EXTERNALSYM _tag_AMVAInternalMemInfo} + AMVAInternalMemInfo = _tag_AMVAInternalMemInfo; + {$EXTERNALSYM AMVAInternalMemInfo} + LPAMVAInternalMemInfo = ^AMVAInternalMemInfo; + {$EXTERNALSYM LPAMVAInternalMemInfo} + TAMVAInternalMemInfo = _tag_AMVAInternalMemInfo; + + PAMVACompBufferInfo = ^TAMVACompBufferInfo; + _tag_AMVACompBufferInfo = record + dwNumCompBuffers : DWORD ; // [out] number of buffers reqd for compressed data + dwWidthToCreate : DWORD ; // [out] Width of surface to create + dwHeightToCreate : DWORD ; // [out] Height of surface to create + dwBytesToAllocate : DWORD ; // [out] Total number of bytes used by each surface + ddCompCaps : TDDSCAPS2 ; // [out] caps to create surfaces to store compressed data + ddPixelFormat : TDDPixelFormat; // [out] fourcc to create surfaces to store compressed data + end; + {$EXTERNALSYM _tag_AMVACompBufferInfo} + AMVACompBufferInfo = _tag_AMVACompBufferInfo; + {$EXTERNALSYM AMVACompBufferInfo} + LPAMVACompBufferInfo = ^AMVACompBufferInfo; + {$EXTERNALSYM LPAMVACompBufferInfo} + TAMVACompBufferInfo = _tag_AMVACompBufferInfo; + +// Note that you are NOT allowed to store any pointer in pMiscData + PAMVABeginFrameInfo = ^TAMVABeginFrameInfo; + _tag_AMVABeginFrameInfo = record + dwDestSurfaceIndex : DWORD ; // IN destination buffer in which to decoding this frame + pInputData : pointer ; // IN pointer to misc data + dwSizeInputData : DWORD ; // IN size of other misc data to begin frame + pOutputData : pointer ; // OUT pointer to data which the VGA is going to fill + dwSizeOutputData : DWORD ; // IN size of data which the VGA is going to fill + end; + {$EXTERNALSYM _tag_AMVABeginFrameInfo} + AMVABeginFrameInfo = _tag_AMVABeginFrameInfo; + {$EXTERNALSYM AMVABeginFrameInfo} + LPAMVABeginFrameInfo = ^AMVABeginFrameInfo; + {$EXTERNALSYM LPAMVABeginFrameInfo} + TAMVABeginFrameInfo = _tag_AMVABeginFrameInfo; + +// Note that you are NOT allowed to store any pointer in pMiscData + PAMVAEndFrameInfo = ^TAMVAEndFrameInfo; + _tag_AMVAEndFrameInfo = record + dwSizeMiscData : DWORD ; // [in] size of other misc data to begin frame + pMiscData : pointer; // [in] pointer to misc data + end; + {$EXTERNALSYM _tag_AMVAEndFrameInfo} + AMVAEndFrameInfo = _tag_AMVAEndFrameInfo; + {$EXTERNALSYM AMVAEndFrameInfo} + LPAMVAEndFrameInfo = ^AMVAEndFrameInfo; + {$EXTERNALSYM LPAMVAEndFrameInfo} + TAMVAEndFrameInfo = _tag_AMVAEndFrameInfo; + + PAMVABufferInfo = ^TAMVABufferInfo; + _tag_AMVABUFFERINFO = record + dwTypeIndex : DWORD; // [in] Type of buffer + dwBufferIndex : DWORD; // [in] Buffer index + dwDataOffset : DWORD; // [in] offset of relevant data from the beginning of buffer + dwDataSize : DWORD; // [in] size of relevant data + end; + {$EXTERNALSYM _tag_AMVABUFFERINFO} + AMVABUFFERINFO = _tag_AMVABUFFERINFO; + {$EXTERNALSYM AMVABUFFERINFO} + LPAMVABUFFERINFO = ^AMVABUFFERINFO; + {$EXTERNALSYM LPAMVABUFFERINFO} + TAMVABufferInfo = _tag_AMVABUFFERINFO; + +//------------------------------------------------------------------------------ +// File: videoacc.h +// Desc: DirectX Video Acceleration interfaces +// Copyright (c) 1999 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +const + IID_IAMVideoAcceleratorNotify : TGUID = '{256A6A21-FBAD-11d1-82BF-00A0C9696C8F}'; + {$EXTERNALSYM IID_IAMVideoAcceleratorNotify} + IID_IAMVideoAccelerator : TGUID = '{256A6A22-FBAD-11d1-82BF-00A0C9696C8F}'; + {$EXTERNALSYM IID_IAMVideoAccelerator} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMVideoAcceleratorNotify;'} + {$EXTERNALSYM IAMVideoAcceleratorNotify} + IAMVideoAcceleratorNotify = interface(IUnknown) + ['{256A6A21-FBAD-11d1-82BF-00A0C9696C8F}'] + (*** IAMVideoAcceleratorNotify methods ***) + function GetUncompSurfacesInfo(const pGuid: TGUID; var pUncompBufferInfo: PAMVAUncompBufferInfo): HResult; stdcall; + function SetUncompSurfacesInfo(dwActualUncompSurfacesAllocated: DWORD): HResult; stdcall; + function GetCreateVideoAcceleratorData(const pGuid: TGUID; out pdwSizeMiscData: PDWORD; out ppMiscData: pointer): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMVideoAccelerator;'} + {$EXTERNALSYM IAMVideoAccelerator} + IAMVideoAccelerator = interface(IUnknown) + ['{256A6A22-FBAD-11d1-82BF-00A0C9696C8F}'] + (*** IAMVideoAccelerator methods ***) + function GetVideoAcceleratorGUIDs(var pdwNumGuidsSupported: PDWORD; var pGuidsSupported: PGUID): HResult; stdcall; + function GetUncompFormatsSupported(const pGuid: TGUID; var pdwNumFormatsSupported: PDWORD; + var pFormatsSupported: PDDPixelFormat): HResult; stdcall; + function GetInternalMemInfo(const pGuid: TGUID; const pamvaUncompDataInfo: TAMVAUncompDataInfo; + var pamvaInternalMemInfo: PAMVAInternalMemInfo): HResult; stdcall; + function GetCompBufferInfo(const pGuid: TGUID; const pamvaUncompDataInfo: TAMVAUncompDataInfo ; + var pdwNumTypesCompBuffers: PDWORD; out pamvaCompBufferInfo: PAMVACompBufferInfo): HResult; stdcall; + function GetInternalCompBufferInfo(var pdwNumTypesCompBuffers: PDWORD; out pamvaCompBufferInfo: PAMVACompBufferInfo): HResult; stdcall; + function BeginFrame(const amvaBeginFrameInfo: TAMVABeginFrameInfo): HResult; stdcall; + function EndFrame(const pEndFrameInfo: TAMVAEndFrameInfo): HResult; stdcall; + function GetBuffer(dwTypeIndex, dwBufferIndex: DWORD; bReadOnly: BOOL; out ppBuffer; out lpStride: LONGINT): HResult; stdcall; + function ReleaseBuffer(dwTypeIndex, dwBufferIndex: DWORD): HResult; stdcall; + function Execute(dwFunction: DWORD; lpPrivateInputData : pointer; cbPrivateInputData: DWORD; + lpPrivateOutputDat: pointer; cbPrivateOutputData, dwNumBuffers: DWORD; + const pamvaBufferInfo: TAMVABUFFERINFO): HResult; stdcall; + function QueryRenderStatus(dwTypeIndex, dwBufferIndex, dwFlags: DWORD): HResult; stdcall; + function DisplayFrame(dwFlipToIndex: DWORD; pMediaSample: IMediaSample): HResult; stdcall; + end; + +//------------------------------------------------------------------------------ +// File: BDATypes.h +// +// Desc: Typedefs and enums needed by both the WDM drivers and the user mode +// COM interfaces. +// +// Copyright (c) 1999 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +// Utility Macros +const + MIN_DIMENSION = 1; + {$EXTERNALSYM MIN_DIMENSION} + NATURAL = 4; + {$EXTERNALSYM NATURAL} + CACHE_LINE = 128; + {$EXTERNALSYM CACHE_LINE} + PAGE = 4096; + {$EXTERNALSYM PAGE} + //#define ALIGN( pointer, size) (((ULONG)(pointer) + (ULONG)(size) - 1) & ~((ULONG)(size) - 1)) + //#define BDA_STRING_CONST(x) {sizeof(L##x)-2, sizeof(L##x), L##x} + +//=========================================================================== +// +// BDA Topology Structures +// +//=========================================================================== +type + PBDATemplateConnection = ^TBDATemplateConnection; + _BDA_TEMPLATE_CONNECTION = record + FromNodeType : ULONG; + FromNodePinType : ULONG; + ToNodeType : ULONG; + ToNodePinType : ULONG; + end; + {$EXTERNALSYM _BDA_TEMPLATE_CONNECTION} + BDA_TEMPLATE_CONNECTION = _BDA_TEMPLATE_CONNECTION; + {$EXTERNALSYM BDA_TEMPLATE_CONNECTION} + PBDA_TEMPLATE_CONNECTION = ^BDA_TEMPLATE_CONNECTION; + {$EXTERNALSYM PBDA_TEMPLATE_CONNECTION} + TBDATemplateConnection = _BDA_TEMPLATE_CONNECTION; + + PBDATemplatePinJoint = ^TBDATemplatePinJoint; + _BDA_TEMPLATE_PIN_JOINT = record + uliTemplateConnection : ULONG; + ulcInstancesMax : ULONG; + end; + {$EXTERNALSYM _BDA_TEMPLATE_PIN_JOINT} + BDA_TEMPLATE_PIN_JOINT = _BDA_TEMPLATE_PIN_JOINT; + {$EXTERNALSYM BDA_TEMPLATE_PIN_JOINT} + PBDA_TEMPLATE_PIN_JOINT = ^BDA_TEMPLATE_PIN_JOINT; + {$EXTERNALSYM PBDA_TEMPLATE_PIN_JOINT} + TBDATemplatePinJoint = _BDA_TEMPLATE_PIN_JOINT; + +//=========================================================================== +// BDA Events +//=========================================================================== +// In-band Event IDs + PBDAEventID = ^TBDAEventID; + BDA_EVENT_ID = ( + BDA_EVENT_SIGNAL_LOSS, + BDA_EVENT_SIGNAL_LOCK, + BDA_EVENT_DATA_START, + BDA_EVENT_DATA_STOP, + BDA_EVENT_CHANNEL_ACQUIRED, + BDA_EVENT_CHANNEL_LOST, + BDA_EVENT_CHANNEL_SOURCE_CHANGED, + BDA_EVENT_CHANNEL_ACTIVATED, + BDA_EVENT_CHANNEL_DEACTIVATED, + BDA_EVENT_SUBCHANNEL_ACQUIRED, + BDA_EVENT_SUBCHANNEL_LOST, + BDA_EVENT_SUBCHANNEL_SOURCE_CHANGED, + BDA_EVENT_SUBCHANNEL_ACTIVATED, + BDA_EVENT_SUBCHANNEL_DEACTIVATED, + BDA_EVENT_ACCESS_GRANTED, + BDA_EVENT_ACCESS_DENIED, + BDA_EVENT_OFFER_EXTENDED, + BDA_EVENT_PURCHASE_COMPLETED, + BDA_EVENT_SMART_CARD_INSERTED, + BDA_EVENT_SMART_CARD_REMOVED + ); + {$EXTERNALSYM BDA_EVENT_ID} + PBDA_EVENT_ID = ^BDA_EVENT_ID; + {$EXTERNALSYM PBDA_EVENT_ID} + TBDAEventID = BDA_EVENT_ID; + +//=========================================================================== +// +// KSSTREAM_HEADER extensions for BDA +// +//=========================================================================== + + PKSBDAFrameInfo = ^TKSBDAFrameInfo; + tagKS_BDA_FRAME_INFO = record + ExtendedHeaderSize : ULONG; // Size of this extended header + dwFrameFlags : DWORD; + ulEvent : ULONG; + ulChannelNumber : ULONG; + ulSubchannelNumber : ULONG; + ulReason : ULONG; + end; + {$EXTERNALSYM tagKS_BDA_FRAME_INFO} + KS_BDA_FRAME_INFO = tagKS_BDA_FRAME_INFO; + {$EXTERNALSYM KS_BDA_FRAME_INFO} + PKS_BDA_FRAME_INFO = ^KS_BDA_FRAME_INFO; + {$EXTERNALSYM PKS_BDA_FRAME_INFO} + TKSBDAFrameInfo = tagKS_BDA_FRAME_INFO; + +//------------------------------------------------------------ +// BDA Network Ethernet Filter Property Set +// {71985F43-1CA1-11d3-9CC8-00C04F7971E0} + + PBDAEthernetAddress = ^TBDAEthernetAddress; + _BDA_ETHERNET_ADDRESS = record + rgbAddress : array[0..5] of BYTE; + end; + {$EXTERNALSYM _BDA_ETHERNET_ADDRESS} + BDA_ETHERNET_ADDRESS = _BDA_ETHERNET_ADDRESS; + {$EXTERNALSYM BDA_ETHERNET_ADDRESS} + PBDA_ETHERNET_ADDRESS = ^BDA_ETHERNET_ADDRESS; + {$EXTERNALSYM PBDA_ETHERNET_ADDRESS} + TBDAEthernetAddress = _BDA_ETHERNET_ADDRESS; + + PBDAEthernetAddressList = ^TBDAEthernetAddressList; + _BDA_ETHERNET_ADDRESS_LIST = record + ulcAddresses : ULONG; + rgAddressl : array[0..MIN_DIMENSION-1] of TBDAEthernetAddress; + end; + {$EXTERNALSYM _BDA_ETHERNET_ADDRESS_LIST} + BDA_ETHERNET_ADDRESS_LIST = _BDA_ETHERNET_ADDRESS_LIST; + {$EXTERNALSYM BDA_ETHERNET_ADDRESS_LIST} + PBDA_ETHERNET_ADDRESS_LIST = ^BDA_ETHERNET_ADDRESS_LIST; + {$EXTERNALSYM PBDA_ETHERNET_ADDRESS_LIST} + TBDAEthernetAddressList = _BDA_ETHERNET_ADDRESS_LIST; + + PBDAMulticastMode = ^TBDAMulticastMode; + BDA_MULTICAST_MODE = ( + BDA_PROMISCUOUS_MULTICAST, + BDA_FILTERED_MULTICAST, + BDA_NO_MULTICAST + ); + {$EXTERNALSYM BDA_MULTICAST_MODE} + PBDA_MULTICAST_MODE = ^BDA_MULTICAST_MODE; + {$EXTERNALSYM PBDA_MULTICAST_MODE} + TBDAMulticastMode = BDA_MULTICAST_MODE; + +//------------------------------------------------------------ +// BDA Network IPv4 Filter Property Set +// {71985F44-1CA1-11d3-9CC8-00C04F7971E0} + + PBDAIPv4Address = ^TBDAIPv4Address; + _BDA_IPv4_ADDRESS = record + rgbAddress : array[0..3] of BYTE; + end; + {$EXTERNALSYM _BDA_IPv4_ADDRESS} + BDA_IPv4_ADDRESS = _BDA_IPv4_ADDRESS; + {$EXTERNALSYM BDA_IPv4_ADDRESS} + PBDA_IPv4_ADDRESS = ^BDA_IPv4_ADDRESS; + {$EXTERNALSYM PBDA_IPv4_ADDRESS} + TBDAIPv4Address = _BDA_IPv4_ADDRESS; + + PBDAIPv4AddressList = ^TBDAIPv4AddressList; + _BDA_IPv4_ADDRESS_LIST = record + ulcAddresses : ULONG; + rgAddressl : array[0..MIN_DIMENSION-1] of TBDAIPv4Address; + end; + {$EXTERNALSYM _BDA_IPv4_ADDRESS_LIST} + BDA_IPv4_ADDRESS_LIST = _BDA_IPv4_ADDRESS_LIST; + {$EXTERNALSYM BDA_IPv4_ADDRESS_LIST} + PBDA_IPv4_ADDRESS_LIST = ^BDA_IPv4_ADDRESS_LIST; + {$EXTERNALSYM PBDA_IPv4_ADDRESS_LIST} + TBDAIPv4AddressList = _BDA_IPv4_ADDRESS_LIST; + +//------------------------------------------------------------ +// BDA Network IPv4 Filter Property Set +// {E1785A74-2A23-4fb3-9245-A8F88017EF33} + + PBDAIPv6Address = ^TBDAIPv6Address; + _BDA_IPv6_ADDRESS = record + rgbAddress : array[0..5] of BYTE; + end; + {$EXTERNALSYM _BDA_IPv6_ADDRESS} + BDA_IPv6_ADDRESS = _BDA_IPv6_ADDRESS; + {$EXTERNALSYM BDA_IPv6_ADDRESS} + PBDA_IPv6_ADDRESS = ^BDA_IPv6_ADDRESS; + {$EXTERNALSYM PBDA_IPv6_ADDRESS} + TBDAIPv6Address = _BDA_IPv6_ADDRESS; + + PBDAIPv6AddressList = ^TBDAIPv6AddressList; + _BDA_IPv6_ADDRESS_LIST = record + ulcAddresses : ULONG; + rgAddressl : array [0..MIN_DIMENSION-1] of TBDAIPv6Address; + end; + {$EXTERNALSYM _BDA_IPv6_ADDRESS_LIST} + BDA_IPv6_ADDRESS_LIST = _BDA_IPv6_ADDRESS_LIST; + {$EXTERNALSYM BDA_IPv6_ADDRESS_LIST} + PBDA_IPv6_ADDRESS_LIST = ^BDA_IPv6_ADDRESS_LIST; + {$EXTERNALSYM PBDA_IPv6_ADDRESS_LIST} + TBDAIPv6AddressList = _BDA_IPv6_ADDRESS_LIST; + +//------------------------------------------------------------ +// BDA Signal Property Set +// {D2F1644B-B409-11d2-BC69-00A0C9EE9E16} + + PBDASignalState = ^TBDASignalState; + BDA_SIGNAL_STATE = ( + BDA_SIGNAL_UNAVAILABLE, + BDA_SIGNAL_INACTIVE, + BDA_SIGNAL_ACTIVE + ); + {$EXTERNALSYM BDA_SIGNAL_STATE} + PBDA_SIGNAL_STATE = ^BDA_SIGNAL_STATE; + {$EXTERNALSYM PBDA_SIGNAL_STATE} + TBDASignalState = BDA_SIGNAL_STATE; + +//------------------------------------------------------------ +// BDA Change Sync Method Set +// {FD0A5AF3-B41D-11d2-9C95-00C04F7971E0} + + PBDAChangeState = ^TBDAChangeState; + BDA_CHANGE_STATE = ( + BDA_CHANGES_COMPLETE, + BDA_CHANGES_PENDING + ); + {$EXTERNALSYM BDA_CHANGE_STATE} + PBDA_CHANGE_STATE = ^BDA_CHANGE_STATE; + TBDAChangeState = BDA_CHANGE_STATE; + +//------------------------------------------------------------ +// BDA Device Configuration Method Set +// {71985F45-1CA1-11d3-9CC8-00C04F7971E0} + +//------------------------------------------------------------ +// BDA Topology Property Set +// {A14EE835-0A23-11d3-9CC7-00C04F7971E0} + PBDANodeDescriptor = ^TBDANodeDescriptor; + _BDANODE_DESCRIPTOR = record + ulBdaNodeType : ULONG; // The node type as it is used + // in the BDA template topology + guidFunction : TGUID; // GUID from BdaMedia.h describing + // the node's function (e.g. + // KSNODE_BDA_RF_TUNER) + guidName : TGUID; // GUID that can be use to look up + // a displayable name for the node. + end; + {$EXTERNALSYM _BDANODE_DESCRIPTOR} + BDANODE_DESCRIPTOR = _BDANODE_DESCRIPTOR; + {$EXTERNALSYM BDANODE_DESCRIPTOR} + PBDANODE_DESCRIPTOR = ^BDANODE_DESCRIPTOR; + {$EXTERNALSYM PBDANODE_DESCRIPTOR} + TBDANodeDescriptor = _BDANODE_DESCRIPTOR; + +//------------------------------------------------------------ +// BDA Void Transform Property Set +// {71985F46-1CA1-11d3-9CC8-00C04F7971E0} + +//------------------------------------------------------------ +// BDA Null Transform Property Set +// {DDF15B0D-BD25-11d2-9CA0-00C04F7971E0} + +//------------------------------------------------------------ +// BDA Frequency Filter Property Set +// {71985F47-1CA1-11d3-9CC8-00C04F7971E0} + +//------------------------------------------------------------ +// BDA Autodemodulate Property Set +// {DDF15B12-BD25-11d2-9CA0-00C04F7971E0} +const + KSPROPSETID_BdaAutodemodulate: TGuid = '{DDF15B12-BD25-11d2-9CA0-00C04F7971E0}'; + {$EXTERNALSYM KSPROPSETID_BdaAutodemodulate} + +type + KSPROPERTY_BDA_AUTODEMODULATE = ( + KSPROPERTY_BDA_AUTODEMODULATE_START {= 0}, + KSPROPERTY_BDA_AUTODEMODULATE_STOP + ); + {$EXTERNALSYM KSPROPERTY_BDA_AUTODEMODULATE} + +//------------------------------------------------------------ +// BDA Table Section Property Set +// {516B99C5-971C-4aaf-B3F3-D9FDA8A15E16} +type + PBDATableSection = ^TBDATableSection; + _BDA_TABLE_SECTION = record + ulPrimarySectionId : ULONG; + ulSecondarySectionId : ULONG; + ulcbSectionLength : ULONG; + argbSectionData : array[0..MIN_DIMENSION-1] of ULONG; + end; + {$EXTERNALSYM _BDA_TABLE_SECTION} + BDA_TABLE_SECTION = _BDA_TABLE_SECTION; + {$EXTERNALSYM BDA_TABLE_SECTION} + PBDA_TABLE_SECTION = ^BDA_TABLE_SECTION; + {$EXTERNALSYM PBDA_TABLE_SECTION} + TBDATableSection = _BDA_TABLE_SECTION; + +//------------------------------------------------------------ +// BDA PID Filter Property Set +// {D0A67D65-08DF-4fec-8533-E5B550410B85} + +//--------------------------------------------------------------------- +// From IEnumPIDMap interface +//--------------------------------------------------------------------- + + MEDIA_SAMPLE_CONTENT = ( + MEDIA_TRANSPORT_PACKET, // complete TS packet e.g. pass-through mode + MEDIA_ELEMENTARY_STREAM, // PES payloads; audio/video only + MEDIA_MPEG2_PSI, // PAT, PMT, CAT, Private + MEDIA_TRANSPORT_PAYLOAD // gathered TS packet payloads (PES packets, etc...) + ); + {$EXTERNALSYM MEDIA_SAMPLE_CONTENT} + TMediaSampleContent = MEDIA_SAMPLE_CONTENT; + + PID_MAP = record + ulPID : ULONG; + MediaSampleContent : TMediaSampleContent; + end; + {$EXTERNALSYM PID_MAP} + TPIDMap = PID_MAP; + PPIDMap = ^PID_MAP; + + + PBDAPIDMap = ^TBDAPIDMap; + _BDA_PID_MAP = record + MediaSampleContent : TMediaSampleContent; + ulcPIDs : ULONG; + aulPIDs : array[0..MIN_DIMENSION-1] of ULONG; + end; + {$EXTERNALSYM _BDA_PID_MAP} + BDA_PID_MAP = _BDA_PID_MAP; + {$EXTERNALSYM BDA_PID_MAP} + PBDA_PID_MAP = ^BDA_PID_MAP; + TBDAPIDMap = _BDA_PID_MAP; + + PBDAPIDUnmap = ^TBDAPIDUnmap; + _BDA_PID_UNMAP = record + ulcPIDs : ULONG; + aulPIDs : array[0..MIN_DIMENSION-1] of ULONG; + end; + {$EXTERNALSYM _BDA_PID_UNMAP} + BDA_PID_UNMAP = _BDA_PID_UNMAP; + {$EXTERNALSYM BDA_PID_UNMAP} + PBDA_PID_UNMAP = ^BDA_PID_UNMAP; + {$EXTERNALSYM PBDA_PID_UNMAP} + TBDAPIDUnmap = _BDA_PID_UNMAP; + +//------------------------------------------------------------ +// BDA CA Property Set +// {B0693766-5278-4ec6-B9E1-3CE40560EF5A} + + PBDACAModuleUI = ^TBDACAModuleUI; + _BDA_CA_MODULE_UI = record + ulFormat : ULONG; + ulbcDesc : ULONG; + ulDesc : array[0..MIN_DIMENSION-1] of ULONG; + end; + {$EXTERNALSYM _BDA_CA_MODULE_UI} + BDA_CA_MODULE_UI = _BDA_CA_MODULE_UI; + {$EXTERNALSYM BDA_CA_MODULE_UI} + PBDA_CA_MODULE_UI = ^BDA_CA_MODULE_UI; + {$EXTERNALSYM PBDA_CA_MODULE_UI} + TBDACAModuleUI = _BDA_CA_MODULE_UI; + + PBDAProgramPIDList = ^TBDAProgramPIDList; + _BDA_PROGRAM_PID_LIST = record + ulProgramNumber : ULONG; + ulcPIDs : ULONG; + ulPID : array[0..MIN_DIMENSION-1] of ULONG; + end; + {$EXTERNALSYM _BDA_PROGRAM_PID_LIST} + BDA_PROGRAM_PID_LIST = _BDA_PROGRAM_PID_LIST; + {$EXTERNALSYM BDA_PROGRAM_PID_LIST} + PBDA_PROGRAM_PID_LIST = ^BDA_PROGRAM_PID_LIST; + {$EXTERNALSYM PBDA_PROGRAM_PID_LIST} + TBDAProgramPIDList = _BDA_PROGRAM_PID_LIST; + +//------------------------------------------------------------ +// BDA CA Event Set +// {488C4CCC-B768-4129-8EB1-B00A071F9068} + +//============================================================= +// +// +// BDA Tuning Model enumerations +// +// +//============================================================= + +// system type for particular DVB Tuning Space instance + DVBSystemType = ( + DVB_Cable, + DVB_Terrestrial, + DVB_Satellite + ); + {$EXTERNALSYM DVBSystemType} + TDVBSystemType = DVBSystemType; + +//------------------------------------------------------------ +// BDA Channel Tune Request + +const + BDA_UNDEFINED_CHANNEL = -1; + {$EXTERNALSYM BDA_UNDEFINED_CHANNEL} + +//------------------------------------------------------------ +// BDA Component(substream) +type + ComponentCategory = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM ComponentCategory} + const + CategoryNotSet = -1; + {$EXTERNALSYM CategoryNotSet} + CategoryOther = 0; + {$EXTERNALSYM CategoryOther} + CategoryVideo = 1; + {$EXTERNALSYM CategoryVideo} + CategoryAudio = 2; + {$EXTERNALSYM CategoryAudio} + CategoryText = 3; + {$EXTERNALSYM CategoryText} + CategoryData = 4; + {$EXTERNALSYM CategoryData} + +// Component Status +type + ComponentStatus = ( + StatusActive, + StatusInactive, + StatusUnavailable + ); + {$EXTERNALSYM ComponentStatus} + TComponentStatus = ComponentStatus; + +//------------------------------------------------------------ +// +// BDA MPEG2 Component Type +// +// from the MPEG2 specification + MPEG2StreamType = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM MPEG2StreamType} + const + BDA_UNITIALIZED_MPEG2STREAMTYPE = -1; + {$EXTERNALSYM BDA_UNITIALIZED_MPEG2STREAMTYPE} + Reserved1 = $0; + {$NODEFINE Reserved1} + ISO_IEC_11172_2_VIDEO = Reserved1 + 1; + {$EXTERNALSYM ISO_IEC_11172_2_VIDEO} + ISO_IEC_13818_2_VIDEO = ISO_IEC_11172_2_VIDEO + 1; + {$EXTERNALSYM ISO_IEC_13818_2_VIDEO} + ISO_IEC_11172_3_AUDIO = ISO_IEC_13818_2_VIDEO + 1; + {$EXTERNALSYM ISO_IEC_11172_3_AUDIO} + ISO_IEC_13818_3_AUDIO = ISO_IEC_11172_3_AUDIO + 1; + {$EXTERNALSYM ISO_IEC_13818_3_AUDIO} + ISO_IEC_13818_1_PRIVATE_SECTION = ISO_IEC_13818_3_AUDIO + 1; + {$EXTERNALSYM ISO_IEC_13818_1_PRIVATE_SECTION} + ISO_IEC_13818_1_PES = ISO_IEC_13818_1_PRIVATE_SECTION + 1; + {$EXTERNALSYM ISO_IEC_13818_1_PES} + ISO_IEC_13522_MHEG = ISO_IEC_13818_1_PES + 1; + {$EXTERNALSYM ISO_IEC_13522_MHEG} + ANNEX_A_DSM_CC = ISO_IEC_13522_MHEG + 1; + {$EXTERNALSYM ANNEX_A_DSM_CC} + ITU_T_REC_H_222_1 = ANNEX_A_DSM_CC + 1; + {$EXTERNALSYM ITU_T_REC_H_222_1} + ISO_IEC_13818_6_TYPE_A = ITU_T_REC_H_222_1 + 1; + {$EXTERNALSYM ISO_IEC_13818_6_TYPE_A} + ISO_IEC_13818_6_TYPE_B = ISO_IEC_13818_6_TYPE_A + 1; + {$EXTERNALSYM ISO_IEC_13818_6_TYPE_B} + ISO_IEC_13818_6_TYPE_C = ISO_IEC_13818_6_TYPE_B + 1; + {$EXTERNALSYM ISO_IEC_13818_6_TYPE_C} + ISO_IEC_13818_6_TYPE_D = ISO_IEC_13818_6_TYPE_C + 1; + {$EXTERNALSYM ISO_IEC_13818_6_TYPE_D} + ISO_IEC_13818_1_AUXILIARY = ISO_IEC_13818_6_TYPE_D + 1; + {$EXTERNALSYM ISO_IEC_13818_1_AUXILIARY} + ISO_IEC_13818_1_RESERVED = ISO_IEC_13818_1_AUXILIARY + 1; + {$EXTERNALSYM ISO_IEC_13818_1_RESERVED} + USER_PRIVATE = ISO_IEC_13818_1_RESERVED + 1; + {$EXTERNALSYM USER_PRIVATE} + +//------------------------------------------------------------ +// +// mpeg-2 transport stride format block; associated with media +// types MEDIATYPE_Stream/MEDIASUBTYPE_MPEG2_TRANSPORT_STRIDE; +// *all* format blocks associated with above media type *must* +// start with the MPEG2_TRANSPORT_STRIDE structure +// +type + PMPEG2TransportStride = ^TMPEG2TransportStride; + _MPEG2_TRANSPORT_STRIDE = record + dwOffset : DWORD; + dwPacketLength : DWORD; + dwStride : DWORD; + end; + {$EXTERNALSYM _MPEG2_TRANSPORT_STRIDE} + MPEG2_TRANSPORT_STRIDE = _MPEG2_TRANSPORT_STRIDE; + {$EXTERNALSYM MPEG2_TRANSPORT_STRIDE} + PMPEG2_TRANSPORT_STRIDE = ^MPEG2_TRANSPORT_STRIDE; + {$EXTERNALSYM PMPEG2_TRANSPORT_STRIDE} + TMPEG2TransportStride = _MPEG2_TRANSPORT_STRIDE; + +//------------------------------------------------------------ +// +// BDA ATSC Component Type +// +// +// ATSC made AC3 Audio a descriptor instead of +// defining a user private stream type. +//enum ATSCComponentTypeFlags { + // bit flags for various component type properties +const + ATSCCT_AC3 = $00000001; + {$EXTERNALSYM ATSCCT_AC3} + +//------------------------------------------------------------ +// BDA Locators + +type + BinaryConvolutionCodeRate = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM BinaryConvolutionCodeRate} + const + BDA_BCC_RATE_NOT_SET = -1; + {$EXTERNALSYM BDA_BCC_RATE_NOT_SET} + BDA_BCC_RATE_NOT_DEFINED = 0; + {$EXTERNALSYM BDA_BCC_RATE_NOT_DEFINED} + BDA_BCC_RATE_1_2 = 1; // 1/2 + {$EXTERNALSYM BDA_BCC_RATE_1_2} + BDA_BCC_RATE_2_3 = 2; // 2/3 + {$EXTERNALSYM BDA_BCC_RATE_2_3} + BDA_BCC_RATE_3_4 = 3; // 3/4 + {$EXTERNALSYM BDA_BCC_RATE_3_4} + BDA_BCC_RATE_3_5 = 4; + {$EXTERNALSYM BDA_BCC_RATE_3_5} + BDA_BCC_RATE_4_5 = 5; + {$EXTERNALSYM BDA_BCC_RATE_4_5} + BDA_BCC_RATE_5_6 = 6; // 5/6 + {$EXTERNALSYM BDA_BCC_RATE_5_6} + BDA_BCC_RATE_5_11 = 7; + {$EXTERNALSYM BDA_BCC_RATE_5_11} + BDA_BCC_RATE_7_8 = 8; // 7/8 + {$EXTERNALSYM BDA_BCC_RATE_7_8} + BDA_BCC_RATE_MAX = 9; + {$EXTERNALSYM BDA_BCC_RATE_MAX} + +type + FECMethod = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM FECMethod} + const + BDA_FEC_METHOD_NOT_SET = -1; + {$EXTERNALSYM BDA_FEC_METHOD_NOT_SET} + BDA_FEC_METHOD_NOT_DEFINED = 0; + {$EXTERNALSYM BDA_FEC_METHOD_NOT_DEFINED} + BDA_FEC_VITERBI = 1; // FEC is a Viterbi Binary Convolution. + {$EXTERNALSYM BDA_FEC_VITERBI} + BDA_FEC_RS_204_188 = 2; // The FEC is Reed-Solomon 204/188 (outer FEC) + {$EXTERNALSYM BDA_FEC_RS_204_188} + BDA_FEC_MAX = 3; + {$EXTERNALSYM BDA_FEC_MAX} + +type + ModulationType = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM ModulationType} + const + BDA_MOD_NOT_SET = -1; + {$EXTERNALSYM BDA_MOD_NOT_SET} + BDA_MOD_NOT_DEFINED = 0; + {$EXTERNALSYM BDA_MOD_NOT_DEFINED} + BDA_MOD_16QAM = 1; + {$EXTERNALSYM BDA_MOD_16QAM} + BDA_MOD_32QAM = 2; + {$EXTERNALSYM BDA_MOD_32QAM} + BDA_MOD_64QAM = 3; + {$EXTERNALSYM BDA_MOD_64QAM} + BDA_MOD_80QAM = 4; + {$EXTERNALSYM BDA_MOD_80QAM} + BDA_MOD_96QAM = 5; + {$EXTERNALSYM BDA_MOD_96QAM} + BDA_MOD_112QAM = 6; + {$EXTERNALSYM BDA_MOD_112QAM} + BDA_MOD_128QAM = 7; + {$EXTERNALSYM BDA_MOD_128QAM} + BDA_MOD_160QAM = 8; + {$EXTERNALSYM BDA_MOD_160QAM} + BDA_MOD_192QAM = 9; + {$EXTERNALSYM BDA_MOD_192QAM} + BDA_MOD_224QAM = 10; + {$EXTERNALSYM BDA_MOD_224QAM} + BDA_MOD_256QAM = 11; + {$EXTERNALSYM BDA_MOD_256QAM} + BDA_MOD_320QAM = 12; + {$EXTERNALSYM BDA_MOD_320QAM} + BDA_MOD_384QAM = 13; + {$EXTERNALSYM BDA_MOD_384QAM} + BDA_MOD_448QAM = 14; + {$EXTERNALSYM BDA_MOD_448QAM} + BDA_MOD_512QAM = 15; + {$EXTERNALSYM BDA_MOD_512QAM} + BDA_MOD_640QAM = 16; + {$EXTERNALSYM BDA_MOD_640QAM} + BDA_MOD_768QAM = 17; + {$EXTERNALSYM BDA_MOD_768QAM} + BDA_MOD_896QAM = 18; + {$EXTERNALSYM BDA_MOD_896QAM} + BDA_MOD_1024QAM = 19; + {$EXTERNALSYM BDA_MOD_1024QAM} + BDA_MOD_QPSK = 20; + {$EXTERNALSYM BDA_MOD_QPSK} + BDA_MOD_BPSK = 21; + {$EXTERNALSYM BDA_MOD_BPSK} + BDA_MOD_OQPSK = 22; + {$EXTERNALSYM BDA_MOD_OQPSK} + BDA_MOD_8VSB = 23; + {$EXTERNALSYM BDA_MOD_8VSB} + BDA_MOD_16VSB = 24; + {$EXTERNALSYM BDA_MOD_16VSB} + BDA_MOD_ANALOG_AMPLITUDE = 25; // std am + {$EXTERNALSYM BDA_MOD_ANALOG_AMPLITUDE} + BDA_MOD_ANALOG_FREQUENCY = 26; // std fm + {$EXTERNALSYM BDA_MOD_ANALOG_FREQUENCY} + BDA_MOD_MAX = 27; + {$EXTERNALSYM BDA_MOD_MAX} + +Type + SpectralInversion = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM SpectralInversion} + const + BDA_SPECTRAL_INVERSION_NOT_SET = -1; + {$EXTERNALSYM BDA_SPECTRAL_INVERSION_NOT_SET} + BDA_SPECTRAL_INVERSION_NOT_DEFINED = 0; + {$EXTERNALSYM BDA_SPECTRAL_INVERSION_NOT_DEFINED} + BDA_SPECTRAL_INVERSION_AUTOMATIC = 1; + {$EXTERNALSYM BDA_SPECTRAL_INVERSION_AUTOMATIC} + BDA_SPECTRAL_INVERSION_NORMAL = 2; + {$EXTERNALSYM BDA_SPECTRAL_INVERSION_NORMAL} + BDA_SPECTRAL_INVERSION_INVERTED = 3; + {$EXTERNALSYM BDA_SPECTRAL_INVERSION_INVERTED} + BDA_SPECTRAL_INVERSION_MAX = 4; + {$EXTERNALSYM BDA_SPECTRAL_INVERSION_MAX} + +Type + Polarisation = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM Polarisation} + const + BDA_POLARISATION_NOT_SET = -1; + {$EXTERNALSYM BDA_POLARISATION_NOT_SET} + BDA_POLARISATION_NOT_DEFINED = 0; + {$EXTERNALSYM BDA_POLARISATION_NOT_DEFINED} + BDA_POLARISATION_LINEAR_H = 1; // Linear horizontal polarisation + {$EXTERNALSYM BDA_POLARISATION_LINEAR_H} + BDA_POLARISATION_LINEAR_V = 2; // Linear vertical polarisation + {$EXTERNALSYM BDA_POLARISATION_LINEAR_V} + BDA_POLARISATION_CIRCULAR_L = 3; // Circular left polarisation + {$EXTERNALSYM BDA_POLARISATION_CIRCULAR_L} + BDA_POLARISATION_CIRCULAR_R = 4; // Circular right polarisation + {$EXTERNALSYM BDA_POLARISATION_CIRCULAR_R} + BDA_POLARISATION_MAX = 5; + {$EXTERNALSYM BDA_POLARISATION_MAX} + +type + GuardInterval = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM GuardInterval} + const + BDA_GUARD_NOT_SET = -1; + {$EXTERNALSYM BDA_GUARD_NOT_SET} + BDA_GUARD_NOT_DEFINED = 0; + {$EXTERNALSYM BDA_GUARD_NOT_DEFINED} + BDA_GUARD_1_32 = 1; // Guard interval is 1/32 + {$EXTERNALSYM BDA_GUARD_1_32} + BDA_GUARD_1_16 = 2; // Guard interval is 1/16 + {$EXTERNALSYM BDA_GUARD_1_16} + BDA_GUARD_1_8 = 3; // Guard interval is 1/8 + {$EXTERNALSYM BDA_GUARD_1_8} + BDA_GUARD_1_4 = 4; // Guard interval is 1/4 + {$EXTERNALSYM BDA_GUARD_1_4} + BDA_GUARD_MAX = 5; + {$EXTERNALSYM BDA_GUARD_MAX} + +type + HierarchyAlpha = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM HierarchyAlpha} + const + BDA_HALPHA_NOT_SET = -1; + {$EXTERNALSYM BDA_HALPHA_NOT_SET} + BDA_HALPHA_NOT_DEFINED = 0; + {$EXTERNALSYM BDA_HALPHA_NOT_DEFINED} + BDA_HALPHA_1 = 1; // Hierarchy alpha is 1. + {$EXTERNALSYM BDA_HALPHA_1} + BDA_HALPHA_2 = 2; // Hierarchy alpha is 2. + {$EXTERNALSYM BDA_HALPHA_2} + BDA_HALPHA_4 = 3; // Hierarchy alpha is 4. + {$EXTERNALSYM BDA_HALPHA_4} + BDA_HALPHA_MAX = 4; + {$EXTERNALSYM BDA_HALPHA_MAX} + +type + TransmissionMode = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM TransmissionMode} + const + BDA_XMIT_MODE_NOT_SET = -1; + {$EXTERNALSYM BDA_XMIT_MODE_NOT_SET} + BDA_XMIT_MODE_NOT_DEFINED = 0; + {$EXTERNALSYM BDA_XMIT_MODE_NOT_DEFINED} + bda_xmit_mode_2k = 1; // transmission uses 1705 carriers (use a 2k fft) + {$externalsym bda_xmit_mode_2k} + bda_xmit_mode_8k = 2; // transmission uses 6817 carriers (use an 8k fft) + {$externalsym bda_xmit_mode_8k} + bda_xmit_mode_max = 3; + {$externalsym bda_xmit_mode_max} + + +// Settings for Tuner Frequency +// + + BDA_FREQUENCY_NOT_SET = -1; + {$EXTERNALSYM BDA_FREQUENCY_NOT_SET} + BDA_FREQUENCY_NOT_DEFINED = 0; + {$EXTERNALSYM BDA_FREQUENCY_NOT_DEFINED} + +// Settings for Tuner Range +// +// Tuner range refers to the setting of LNB High/Low as well as the +// selection of a satellite on a multiple satellite switch. +// + BDA_RANGE_NOT_SET = -1; + {$EXTERNALSYM BDA_RANGE_NOT_SET} + BDA_RANGE_NOT_DEFINED = 0; + {$EXTERNALSYM BDA_RANGE_NOT_DEFINED} + +// Settings for Tuner Channel Bandwidth +// + BDA_CHAN_BANDWITH_NOT_SET = -1; + {$EXTERNALSYM BDA_CHAN_BANDWITH_NOT_SET} + BDA_CHAN_BANDWITH_NOT_DEFINED = 0; + {$EXTERNALSYM BDA_CHAN_BANDWITH_NOT_DEFINED} + +// Settings for Tuner Frequency Multiplier +// + BDA_FREQUENCY_MULTIPLIER_NOT_SET = -1; + {$EXTERNALSYM BDA_FREQUENCY_MULTIPLIER_NOT_SET} + BDA_FREQUENCY_MULTIPLIER_NOT_DEFINED = 0; + {$EXTERNALSYM BDA_FREQUENCY_MULTIPLIER_NOT_DEFINED} + +//------------------------------------------------------------------------------ +// File: Regbag.h +// Desc: part of Tuner library +// Copyright (c) 1999 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +const + IID_ICreatePropBagOnRegKey : TGUID = '{8A674B48-1F63-11d3-B64C-00C04F79498E}'; + {$EXTERNALSYM IID_ICreatePropBagOnRegKey} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_ICreatePropBagOnRegKey;'} + {$EXTERNALSYM ICreatePropBagOnRegKey} + ICreatePropBagOnRegKey = interface(IUnknown) + ['{8A674B48-1F63-11d3-B64C-00C04F79498E}'] + (*** ICreatePropBagOnRegKey methods ***) + function Create(hkey: HKEY; subkey: POleStr; ulOptions, samDesired: DWORD; + const iid: TGUID; out ppBag): HResult; stdcall; + end; + +//------------------------------------------------------------------------------ +// File: Tuner.h +// Desc: Tuner library +// Copyright (c) 1999 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +const + IID_ITuningSpaces : TGUID = '{901284E4-33FE-4b69-8D63-634A596F3756}'; + {$EXTERNALSYM IID_ITuningSpaces} + IID_ITuningSpaceContainer : TGUID = '{5B692E84-E2F1-11d2-9493-00C04F72D980}'; + {$EXTERNALSYM IID_ITuningSpaceContainer} + IID_ITuningSpace : TGUID = '{061C6E30-E622-11d2-9493-00C04F72D980}'; + {$EXTERNALSYM IID_ITuningSpace} + IID_IEnumTuningSpaces : TGUID = '{8B8EB248-FC2B-11d2-9D8C-00C04F72D980}'; + {$EXTERNALSYM IID_IEnumTuningSpaces} + IID_IDVBTuningSpace : TGUID = '{ADA0B268-3B19-4e5b-ACC4-49F852BE13BA}'; + {$EXTERNALSYM IID_IDVBTuningSpace} + IID_IAnalogTVTuningSpace : TGUID = '{2A6E293C-2595-11d3-B64C-00C04F79498E}'; + {$EXTERNALSYM IID_IAnalogTVTuningSpace} + IID_IATSCTuningSpace : TGUID = '{0369B4E2-45B6-11d3-B650-00C04F79498E}'; + {$EXTERNALSYM IID_IATSCTuningSpace} + IID_IAnalogRadioTuningSpace : TGUID = '{2A6E293B-2595-11d3-B64C-00C04F79498E}'; + {$EXTERNALSYM IID_IAnalogRadioTuningSpace} + IID_ITuneRequest : TGUID = '{07DDC146-FC3D-11d2-9D8C-00C04F72D980}'; + {$EXTERNALSYM IID_ITuneRequest} + IID_IChannelTuneRequest : TGUID = '{0369B4E0-45B6-11d3-B650-00C04F79498E}'; + {$EXTERNALSYM IID_IChannelTuneRequest} + IID_IATSCChannelTuneRequest : TGUID = '{0369B4E1-45B6-11d3-B650-00C04F79498E}'; + {$EXTERNALSYM IID_IATSCChannelTuneRequest} + IID_IDVBTuneRequest : TGUID = '{0D6F567E-A636-42bb-83BA-CE4C1704AFA2}'; + {$EXTERNALSYM IID_IDVBTuneRequest} + IID_ITuner : TGUID = '{28C52640-018A-11d3-9D8E-00C04F72D980}'; + {$EXTERNALSYM IID_ITuner} + IID_IScanningTuner : TGUID = '{1DFD0A5C-0284-11d3-9D8E-00C04F72D980}'; + {$EXTERNALSYM IID_IScanningTuner} + IID_ITunerEvents : TGUID = '{68481420-0280-11d3-9D8E-00C04F72D980}'; + {$EXTERNALSYM IID_ITunerEvents} + IID_ISignalEvents : TGUID = '{85E2439E-0E23-11d3-9D8E-00C04F72D980}'; + {$EXTERNALSYM IID_ISignalEvents} + IID_IComponentType : TGUID = '{6A340DC0-0311-11d3-9D8E-00C04F72D980}'; + {$EXTERNALSYM IID_IComponentType} + IID_ILanguageComponentType : TGUID = '{B874C8BA-0FA2-11d3-9D8E-00C04F72D980}'; + {$EXTERNALSYM IID_ILanguageComponentType} + IID_IMPEG2ComponentType : TGUID = '{2C073D84-B51C-48c9-AA9F-68971E1F6E38}'; + {$EXTERNALSYM IID_IMPEG2ComponentType} + IID_IATSCComponentType : TGUID = '{FC189E4D-7BD4-4125-B3B3-3A76A332CC96}'; + {$EXTERNALSYM IID_IATSCComponentType} + IID_IEnumComponentTypes : TGUID = '{8A674B4A-1F63-11d3-B64C-00C04F79498E}'; + {$EXTERNALSYM IID_IEnumComponentTypes} + IID_IComponentTypes : TGUID = '{0DC13D4A-0313-11d3-9D8E-00C04F72D980}'; + {$EXTERNALSYM IID_IComponentTypes} + IID_IComponent : TGUID = '{1A5576FC-0E19-11d3-9D8E-00C04F72D980}'; + {$EXTERNALSYM IID_IComponent} + IID_IMPEG2Component : TGUID = '{1493E353-1EB6-473c-802D-8E6B8EC9D2A9}'; + {$EXTERNALSYM IID_IMPEG2Component} + IID_IEnumComponents : TGUID = '{2A6E2939-2595-11d3-B64C-00C04F79498E}'; + {$EXTERNALSYM IID_IEnumComponents} + IID_IComponents : TGUID = '{FCD01846-0E19-11d3-9D8E-00C04F72D980}'; + {$EXTERNALSYM IID_IComponents} + IID_ILocator : TGUID = '{286D7F89-760C-4F89-80C4-66841D2507AA}'; + {$EXTERNALSYM IID_ILocator} + IID_IATSCLocator : TGUID = '{BF8D986F-8C2B-4131-94D7-4D3D9FCC21EF}'; + {$EXTERNALSYM IID_IATSCLocator} + IID_IDVBTLocator : TGUID = '{8664DA16-DDA2-42ac-926A-C18F9127C302}'; + {$EXTERNALSYM IID_IDVBTLocator} + IID_IDVBSLocator : TGUID = '{3D7C353C-0D04-45f1-A742-F97CC1188DC8}'; + {$EXTERNALSYM IID_IDVBSLocator} + IID_IDVBCLocator : TGUID = '{6E42F36E-1DD2-43c4-9F78-69D25AE39034}'; + {$EXTERNALSYM IID_IDVBCLocator} + + IID_IDVBTuningSpace2 : TGUID = '{843188B4-CE62-43db-966B-8145A094E040}'; + {$EXTERNALSYM IID_IDVBTuningSpace2} + IID_IDVBSTuningSpace : TGUID = '{CDF7BE60-D954-42fd-A972-78971958E470}'; + {$EXTERNALSYM IID_IDVBSTuningSpace} + IID_IMPEG2TuneRequest : TGUID = '{EB7D987F-8A01-42AD-B8AE-574DEEE44D1A}'; + {$EXTERNALSYM IID_IMPEG2TuneRequest} + IID_IMPEG2TuneRequestFactory : TGUID = '{14E11ABD-EE37-4893-9EA1-6964DE933E39}'; + {$EXTERNALSYM IID_IMPEG2TuneRequestFactory} + IID_IMPEG2TuneRequestSupport : TGUID = '{1B9D5FC3-5BBC-4b6c-BB18-B9D10E3EEEBF}'; + {$EXTERNALSYM IID_IMPEG2TuneRequestSupport} + IID_IBroadcastEvent : TGUID = '{3B21263F-26E8-489d-AAC4-924F7EFD9511}'; + {$EXTERNALSYM IID_IBroadcastEvent} + + IID_IAuxInTuningSpace : TGUID = '{E48244B8-7E17-4f76-A763-5090FF1E2F30}'; // DX9 + {$EXTERNALSYM IID_IAuxInTuningSpace} + + CLSID_SystemTuningSpaces : TGUID = '{D02AAC50-027E-11d3-9D8E-00C04F72D980}'; + {$EXTERNALSYM CLSID_SystemTuningSpaces} + CLSID_TuningSpace : TGUID = '{5FFDC5E6-B83A-4b55-B6E8-C69E765FE9DB}'; + {$EXTERNALSYM CLSID_TuningSpace} + CLSID_ATSCTuningSpace : TGUID = '{A2E30750-6C3D-11d3-B653-00C04F79498E}'; + {$EXTERNALSYM CLSID_ATSCTuningSpace} + CLSID_AnalogRadioTuningSpace : TGUID = '{8A674B4C-1F63-11d3-B64C-00C04F79498E}'; + {$EXTERNALSYM CLSID_AnalogRadioTuningSpace} + CLSID_AnalogTVTuningSpace : TGUID = '{8A674B4D-1F63-11d3-B64C-00C04F79498E}'; + {$EXTERNALSYM CLSID_AnalogTVTuningSpace} + CLSID_DVBTuningSpace : TGUID = '{C6B14B32-76AA-4a86-A7AC-5C79AAF58DA7}'; + {$EXTERNALSYM CLSID_DVBTuningSpace} + CLSID_ComponentTypes : TGUID = '{A1A2B1C4-0E3A-11d3-9D8E-00C04F72D980}'; + {$EXTERNALSYM CLSID_ComponentTypes} + CLSID_ComponentType : TGUID = '{823535A0-0318-11d3-9D8E-00C04F72D980}'; + {$EXTERNALSYM CLSID_ComponentType} + CLSID_LanguageComponentType : TGUID = '{1BE49F30-0E1B-11d3-9D8E-00C04F72D980}'; + {$EXTERNALSYM CLSID_LanguageComponentType} + CLSID_MPEG2ComponentType : TGUID = '{418008F3-CF67-4668-9628-10DC52BE1D08}'; + {$EXTERNALSYM CLSID_MPEG2ComponentType} + CLSID_ATSCComponentType : TGUID = '{A8DCF3D5-0780-4ef4-8A83-2CFFAACB8ACE}'; + {$EXTERNALSYM CLSID_ATSCComponentType} + CLSID_Components : TGUID = '{809B6661-94C4-49e6-B6EC-3F0F862215AA}'; + {$EXTERNALSYM CLSID_Components} + CLSID_Component : TGUID = '{59DC47A8-116C-11d3-9D8E-00C04F72D980}'; + {$EXTERNALSYM CLSID_Component} + CLSID_MPEG2Component : TGUID = '{055CB2D7-2969-45cd-914B-76890722F112}'; + {$EXTERNALSYM CLSID_MPEG2Component} + CLSID_TuneRequest : TGUID = '{B46E0D38-AB35-4a06-A137-70576B01B39F}'; + {$EXTERNALSYM CLSID_TuneRequest} + CLSID_ChannelTuneRequest : TGUID = '{0369B4E5-45B6-11d3-B650-00C04F79498E}'; + {$EXTERNALSYM CLSID_ChannelTuneRequest} + CLSID_ATSCChannelTuneRequest : TGUID = '{0369B4E6-45B6-11d3-B650-00C04F79498E}'; + {$EXTERNALSYM CLSID_ATSCChannelTuneRequest} + CLSID_Locator : TGUID = '{0888C883-AC4F-4943-B516-2C38D9B34562}'; + {$EXTERNALSYM CLSID_Locator} + CLSID_ATSCLocator : TGUID = '{8872FF1B-98FA-4d7a-8D93-C9F1055F85BB}'; + {$EXTERNALSYM CLSID_ATSCLocator} + CLSID_DVBTLocator : TGUID = '{9CD64701-BDF3-4d14-8E03-F12983D86664}'; + {$EXTERNALSYM CLSID_DVBTLocator} + CLSID_DVBSLocator : TGUID = '{1DF7D126-4050-47f0-A7CF-4C4CA9241333}'; + {$EXTERNALSYM CLSID_DVBSLocator} + CLSID_DVBCLocator : TGUID = '{C531D9FD-9685-4028-8B68-6E1232079F1E}'; + {$EXTERNALSYM CLSID_DVBCLocator} + CLSID_DVBTuneRequest : TGUID = '{15D6504A-5494-499c-886C-973C9E53B9F1}'; + {$EXTERNALSYM CLSID_DVBTuneRequest} + CLSID_CreatePropBagOnRegKey : TGUID = '{8A674B49-1F63-11d3-B64C-00C04F79498E}'; + {$EXTERNALSYM CLSID_CreatePropBagOnRegKey} + + CLSID_DVBSTuningSpace : TGUID = '{B64016F3-C9A2-4066-96F0-BD9563314726}'; + {$EXTERNALSYM CLSID_DVBSTuningSpace} + CLSID_MPEG2TuneRequest : TGUID = '{0955AC62-BF2E-4CBA-A2B9-A63F772D46CF}'; + {$EXTERNALSYM CLSID_MPEG2TuneRequest} + CLSID_BroadcastEventService : TGUID = '{0B3FFB92-0919-4934-9D5B-619C719D0202}'; + {$EXTERNALSYM CLSID_BroadcastEventService} + CLSID_MPEG2TuneRequestFactory: TGUID = '{2C63E4EB-4CEA-41B8-919C-E947EA19A77C}'; + {$EXTERNALSYM CLSID_MPEG2TuneRequestFactory} + + CLSID_AuxInTuningSpace : TGUID = '{F9769A06-7ACA-4e39-9CFB-97BB35F0E77E}'; + {$EXTERNALSYM CLSID_AuxInTuningSpace} + + DISPID_TUNER_TS_UNIQUENAME = 1; + {$EXTERNALSYM DISPID_TUNER_TS_UNIQUENAME} + DISPID_TUNER_TS_FRIENDLYNAME = 2; + {$EXTERNALSYM DISPID_TUNER_TS_FRIENDLYNAME} + DISPID_TUNER_TS_CLSID = 3; + {$EXTERNALSYM DISPID_TUNER_TS_CLSID} + DISPID_TUNER_TS_NETWORKTYPE = 4; + {$EXTERNALSYM DISPID_TUNER_TS_NETWORKTYPE} + DISPID_TUNER_TS__NETWORKTYPE = 5; + {$EXTERNALSYM DISPID_TUNER_TS__NETWORKTYPE} + DISPID_TUNER_TS_CREATETUNEREQUEST = 6; + {$EXTERNALSYM DISPID_TUNER_TS_CREATETUNEREQUEST} + DISPID_TUNER_TS_ENUMCATEGORYGUIDS = 7; + {$EXTERNALSYM DISPID_TUNER_TS_ENUMCATEGORYGUIDS} + DISPID_TUNER_TS_ENUMDEVICEMONIKERS = 8; + {$EXTERNALSYM DISPID_TUNER_TS_ENUMDEVICEMONIKERS} + DISPID_TUNER_TS_DEFAULTPREFERREDCOMPONENTTYPES = 9; + {$EXTERNALSYM DISPID_TUNER_TS_DEFAULTPREFERREDCOMPONENTTYPES} + DISPID_TUNER_TS_FREQMAP = 10; + {$EXTERNALSYM DISPID_TUNER_TS_FREQMAP} + DISPID_TUNER_TS_DEFLOCATOR = 11; + {$EXTERNALSYM DISPID_TUNER_TS_DEFLOCATOR} + DISPID_TUNER_TS_CLONE = 12; + {$EXTERNALSYM DISPID_TUNER_TS_CLONE} + + // DISPIDs for ITuneRequest interface + DISPID_TUNER_TR_TUNINGSPACE = 1; + {$EXTERNALSYM DISPID_TUNER_TR_TUNINGSPACE} + DISPID_TUNER_TR_COMPONENTS = 2; + {$EXTERNALSYM DISPID_TUNER_TR_COMPONENTS} + DISPID_TUNER_TR_CLONE = 3; + {$EXTERNALSYM DISPID_TUNER_TR_CLONE} + DISPID_TUNER_TR_LOCATOR = 4; + {$EXTERNALSYM DISPID_TUNER_TR_LOCATOR} + + // DISPID for IComponentType interface + DISPID_TUNER_CT_CATEGORY = 1; + {$EXTERNALSYM DISPID_TUNER_CT_CATEGORY} + DISPID_TUNER_CT_MEDIAMAJORTYPE = 2; + {$EXTERNALSYM DISPID_TUNER_CT_MEDIAMAJORTYPE} + DISPID_TUNER_CT__MEDIAMAJORTYPE = 3; + {$EXTERNALSYM DISPID_TUNER_CT__MEDIAMAJORTYPE} + DISPID_TUNER_CT_MEDIASUBTYPE = 4; + {$EXTERNALSYM DISPID_TUNER_CT_MEDIASUBTYPE} + DISPID_TUNER_CT__MEDIASUBTYPE = 5; + {$EXTERNALSYM DISPID_TUNER_CT__MEDIASUBTYPE} + DISPID_TUNER_CT_MEDIAFORMATTYPE = 6; + {$EXTERNALSYM DISPID_TUNER_CT_MEDIAFORMATTYPE} + DISPID_TUNER_CT__MEDIAFORMATTYPE = 7; + {$EXTERNALSYM DISPID_TUNER_CT__MEDIAFORMATTYPE} + DISPID_TUNER_CT_MEDIATYPE = 8; + {$EXTERNALSYM DISPID_TUNER_CT_MEDIATYPE} + DISPID_TUNER_CT_CLONE = 9; + {$EXTERNALSYM DISPID_TUNER_CT_CLONE} + + // DISPID for ILanguageComponentType interface + DISPID_TUNER_LCT_LANGID = 100; + {$EXTERNALSYM DISPID_TUNER_LCT_LANGID} + + // DISPID for IMPEG2ComponentType interface + DISPID_TUNER_MP2CT_TYPE = 200; + {$EXTERNALSYM DISPID_TUNER_MP2CT_TYPE} + + // DISPID for IATSCComponentType interface + DISPID_TUNER_ATSCCT_FLAGS = 300; + {$EXTERNALSYM DISPID_TUNER_ATSCCT_FLAGS} + + // DISPID for ILocator interface + DISPID_TUNER_L_CARRFREQ = 1; + {$EXTERNALSYM DISPID_TUNER_L_CARRFREQ} + DISPID_TUNER_L_INNERFECMETHOD = 2; + {$EXTERNALSYM DISPID_TUNER_L_INNERFECMETHOD} + DISPID_TUNER_L_INNERFECRATE = 3; + {$EXTERNALSYM DISPID_TUNER_L_INNERFECRATE} + DISPID_TUNER_L_OUTERFECMETHOD = 4; + {$EXTERNALSYM DISPID_TUNER_L_OUTERFECMETHOD} + DISPID_TUNER_L_OUTERFECRATE = 5; + {$EXTERNALSYM DISPID_TUNER_L_OUTERFECRATE} + DISPID_TUNER_L_MOD = 6; + {$EXTERNALSYM DISPID_TUNER_L_MOD} + DISPID_TUNER_L_SYMRATE = 7; + {$EXTERNALSYM DISPID_TUNER_L_SYMRATE} + DISPID_TUNER_L_CLONE = 8; + {$EXTERNALSYM DISPID_TUNER_L_CLONE} + + // DISPID for IATSCLocator interface + DISPID_TUNER_L_ATSC_PHYS_CHANNEL = 201; + {$EXTERNALSYM DISPID_TUNER_L_ATSC_PHYS_CHANNEL} + DISPID_TUNER_L_ATSC_TSID = 202; + {$EXTERNALSYM DISPID_TUNER_L_ATSC_TSID} + + // DISPID for IDVBTLocator interface + DISPID_TUNER_L_DVBT_BANDWIDTH = 301; + {$EXTERNALSYM DISPID_TUNER_L_DVBT_BANDWIDTH} + DISPID_TUNER_L_DVBT_LPINNERFECMETHOD = 302; + {$EXTERNALSYM DISPID_TUNER_L_DVBT_LPINNERFECMETHOD} + DISPID_TUNER_L_DVBT_LPINNERFECRATE = 303; + {$EXTERNALSYM DISPID_TUNER_L_DVBT_LPINNERFECRATE} + DISPID_TUNER_L_DVBT_GUARDINTERVAL = 304; + {$EXTERNALSYM DISPID_TUNER_L_DVBT_GUARDINTERVAL} + DISPID_TUNER_L_DVBT_HALPHA = 305; + {$EXTERNALSYM DISPID_TUNER_L_DVBT_HALPHA} + DISPID_TUNER_L_DVBT_TRANSMISSIONMODE = 306; + {$EXTERNALSYM DISPID_TUNER_L_DVBT_TRANSMISSIONMODE} + DISPID_TUNER_L_DVBT_INUSE = 307; + {$EXTERNALSYM DISPID_TUNER_L_DVBT_INUSE} + + // DISPID for IDVBSLocator interface + DISPID_TUNER_L_DVBS_POLARISATION = 401; + {$EXTERNALSYM DISPID_TUNER_L_DVBS_POLARISATION} + DISPID_TUNER_L_DVBS_WEST = 402; + {$EXTERNALSYM DISPID_TUNER_L_DVBS_WEST} + DISPID_TUNER_L_DVBS_ORBITAL = 403; + {$EXTERNALSYM DISPID_TUNER_L_DVBS_ORBITAL} + DISPID_TUNER_L_DVBS_AZIMUTH = 404; + {$EXTERNALSYM DISPID_TUNER_L_DVBS_AZIMUTH} + DISPID_TUNER_L_DVBS_ELEVATION = 405; + {$EXTERNALSYM DISPID_TUNER_L_DVBS_ELEVATION} + + // DISPID for IDVBCLocator interface + + // DISPIDs for IComponent interface + DISPID_TUNER_C_TYPE = 1; + {$EXTERNALSYM DISPID_TUNER_C_TYPE} + DISPID_TUNER_C_STATUS = 2; + {$EXTERNALSYM DISPID_TUNER_C_STATUS} + DISPID_TUNER_C_LANGID = 3; + {$EXTERNALSYM DISPID_TUNER_C_LANGID} + DISPID_TUNER_C_DESCRIPTION = 4; + {$EXTERNALSYM DISPID_TUNER_C_DESCRIPTION} + DISPID_TUNER_C_CLONE = 5; + {$EXTERNALSYM DISPID_TUNER_C_CLONE} + + // DISPIDs for IMPEG2Component interface + DISPID_TUNER_C_MP2_PID = 101; + {$EXTERNALSYM DISPID_TUNER_C_MP2_PID} + DISPID_TUNER_C_MP2_PCRPID = 102; + {$EXTERNALSYM DISPID_TUNER_C_MP2_PCRPID} + DISPID_TUNER_C_MP2_PROGNO = 103; + {$EXTERNALSYM DISPID_TUNER_C_MP2_PROGNO} + DISPID_TUNER_TS_DVB_SYSTEMTYPE = 101; + {$EXTERNALSYM DISPID_TUNER_TS_DVB_SYSTEMTYPE} + + // DISPIDs for IDVBTuningSpace2 interface + DISPID_TUNER_TS_DVB2_NETWORK_ID = 102; + {$EXTERNALSYM DISPID_TUNER_TS_DVB2_NETWORK_ID} + // DISPIDs for IDVBSTuningSpace interface + DISPID_TUNER_TS_DVBS_LOW_OSC_FREQ = 1001; + {$EXTERNALSYM DISPID_TUNER_TS_DVBS_LOW_OSC_FREQ} + DISPID_TUNER_TS_DVBS_HI_OSC_FREQ = 1002; + {$EXTERNALSYM DISPID_TUNER_TS_DVBS_HI_OSC_FREQ} + DISPID_TUNER_TS_DVBS_LNB_SWITCH_FREQ = 1003; + {$EXTERNALSYM DISPID_TUNER_TS_DVBS_LNB_SWITCH_FREQ} + DISPID_TUNER_TS_DVBS_INPUT_RANGE = 1004; + {$EXTERNALSYM DISPID_TUNER_TS_DVBS_INPUT_RANGE} + DISPID_TUNER_TS_DVBS_SPECTRAL_INVERSION = 1005; + {$EXTERNALSYM DISPID_TUNER_TS_DVBS_SPECTRAL_INVERSION} + + // DISPIDs for IAnalogRadioTuningSpace interface + DISPID_TUNER_TS_AR_MINFREQUENCY = 101; + {$EXTERNALSYM DISPID_TUNER_TS_AR_MINFREQUENCY} + DISPID_TUNER_TS_AR_MAXFREQUENCY = 102; + {$EXTERNALSYM DISPID_TUNER_TS_AR_MAXFREQUENCY} + DISPID_TUNER_TS_AR_STEP = 103; + {$EXTERNALSYM DISPID_TUNER_TS_AR_STEP} + + // DISPIDs for IAnalogTVTuningSpace interface + DISPID_TUNER_TS_ATV_MINCHANNEL = 101; + {$EXTERNALSYM DISPID_TUNER_TS_ATV_MINCHANNEL} + DISPID_TUNER_TS_ATV_MAXCHANNEL = 102; + {$EXTERNALSYM DISPID_TUNER_TS_ATV_MAXCHANNEL} + DISPID_TUNER_TS_ATV_INPUTTYPE = 103; + {$EXTERNALSYM DISPID_TUNER_TS_ATV_INPUTTYPE} + DISPID_TUNER_TS_ATV_COUNTRYCODE = 104; + {$EXTERNALSYM DISPID_TUNER_TS_ATV_COUNTRYCODE} + + // DISPIDs for IATSCTuningSpace interface + DISPID_TUNER_TS_ATSC_MINMINORCHANNEL = 201; + {$EXTERNALSYM DISPID_TUNER_TS_ATSC_MINMINORCHANNEL} + DISPID_TUNER_TS_ATSC_MAXMINORCHANNEL = 202; + {$EXTERNALSYM DISPID_TUNER_TS_ATSC_MAXMINORCHANNEL} + DISPID_TUNER_TS_ATSC_MINPHYSCHANNEL = 203; + {$EXTERNALSYM DISPID_TUNER_TS_ATSC_MINPHYSCHANNEL} + DISPID_TUNER_TS_ATSC_MAXPHYSCHANNEL = 204; + {$EXTERNALSYM DISPID_TUNER_TS_ATSC_MAXPHYSCHANNEL} + + // DISPID for IAnalogTVAudioComponent interface + DISPID_CHTUNER_ATVAC_CHANNEL = 101; + {$EXTERNALSYM DISPID_CHTUNER_ATVAC_CHANNEL} + + // DISPIDs for IAnalogTVDataComponent interface + DISPID_CHTUNER_ATVDC_SYSTEM = 101; + {$EXTERNALSYM DISPID_CHTUNER_ATVDC_SYSTEM} + DISPID_CHTUNER_ATVDC_CONTENT = 102; + {$EXTERNALSYM DISPID_CHTUNER_ATVDC_CONTENT} + + // DISPID for IChannelTuneRequest interface + DISPID_CHTUNER_CTR_CHANNEL = 101; + {$EXTERNALSYM DISPID_CHTUNER_CTR_CHANNEL} + + // DISPID IATSCChannelTuneRequest + DISPID_CHTUNER_ACTR_MINOR_CHANNEL = 201; + {$EXTERNALSYM DISPID_CHTUNER_ACTR_MINOR_CHANNEL} + + // DISPIDs for IDVBComponent interface + DISPID_DVBTUNER_DVBC_ATTRIBUTESVALID = 101; + {$EXTERNALSYM DISPID_DVBTUNER_DVBC_ATTRIBUTESVALID} + DISPID_DVBTUNER_DVBC_PID = 102; + {$EXTERNALSYM DISPID_DVBTUNER_DVBC_PID} + DISPID_DVBTUNER_DVBC_TAG = 103; + {$EXTERNALSYM DISPID_DVBTUNER_DVBC_TAG} + DISPID_DVBTUNER_DVBC_COMPONENTTYPE = 104; + {$EXTERNALSYM DISPID_DVBTUNER_DVBC_COMPONENTTYPE} + + // DISPIDs for IDVBTuneRequest interface + DISPID_DVBTUNER_ONID = 101; + {$EXTERNALSYM DISPID_DVBTUNER_ONID} + DISPID_DVBTUNER_TSID = 102; + {$EXTERNALSYM DISPID_DVBTUNER_TSID} + DISPID_DVBTUNER_SID = 103; + {$EXTERNALSYM DISPID_DVBTUNER_SID} + + // DISPIDs for IMPEG2TuneRequest interface + DISPID_MP2TUNER_TSID = 101; + {$EXTERNALSYM DISPID_MP2TUNER_TSID} + DISPID_MP2TUNER_PROGNO = 102; + {$EXTERNALSYM DISPID_MP2TUNER_PROGNO} + + // DISPIDs for IMPEG2TuneRequestFactory interface + DISPID_MP2TUNERFACTORY_CREATETUNEREQUEST = 1; + {$EXTERNALSYM DISPID_MP2TUNERFACTORY_CREATETUNEREQUEST} + +type + ITuningSpace = interface; + IEnumTuningSpaces = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_ITuningSpaces;'} + {$EXTERNALSYM ITuningSpaces} + ITuningSpaces = interface(IDispatch) + ['{901284E4-33FE-4b69-8D63-634A596F3756}'] + (*** ITuningSpaces methods ***) + function get_Count(out Count: longint): HResult; stdcall; + function get__NewEnum(out NewEnum: IEnumVARIANT): HResult; stdcall; + function get_Item(varIndex: OLEVARIANT; out TuningSpace: ITuningSpace): HResult; stdcall; + function get_EnumTuningSpaces(out NewEnum: IEnumTuningSpaces): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_ITuningSpaceContainer;'} + {$EXTERNALSYM ITuningSpaceContainer} + ITuningSpaceContainer = interface(IDispatch) + ['{5B692E84-E2F1-11d2-9493-00C04F72D980}'] + (*** ITuningSpaceContainer methods ***) + function get_Count(out Count: longint): HResult; stdcall; + function get__NewEnum(out NewEnum: IEnumVARIANT): HResult; stdcall; + function get_Item(varIndex: OLEVARIANT; out TuningSpace: ITuningSpace): HResult; stdcall; + function put_Item(varIndex: OLEVARIANT; TuningSpace: ITuningSpace): HResult; stdcall; + function TuningSpacesForCLSID(SpaceCLSID: widestring; out NewColl: ITuningSpaces): HResult; stdcall; + function _TuningSpacesForCLSID(const SpaceCLSID: TGUID; out NewColl: ITuningSpaces): HResult; stdcall; + function TuningSpacesForName(Name: WideString; out NewColl: ITuningSpaces): HResult; stdcall; + function FindID(TuningSpace: ITuningSpace; out ID: longint): HResult; stdcall; + function Add(TuningSpace: ITuningSpace; out NewIndex: OLEVARIANT): HResult; stdcall; + function get_EnumTuningSpaces(out ppEnum: IEnumTuningSpaces): HResult; stdcall; + function Remove(Index: OLEVARIANT): HResult; stdcall; + function get_MaxCount(out MaxCount: longint): HResult; stdcall; + function put_MaxCount(MaxCount: longint): HResult; stdcall; + end; + + ITuneRequest = interface; + IComponentTypes = interface; + ILocator = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_ITuningSpace;'} + {$EXTERNALSYM ITuningSpace} + ITuningSpace = interface(IDispatch) + ['{061C6E30-E622-11d2-9493-00C04F72D980}'] + (*** ITuningSpace methods ***) + function get_UniqueName(out Name: WideString): HResult; stdcall; + function put_UniqueName(Name: WideString): HResult; stdcall; + function get_FriendlyName(out Name: WideString): HResult; stdcall; + function put_FriendlyName: HResult; stdcall; + function get_CLSID(out SpaceCLSID: WideString): HResult; stdcall; + function get_NetworkType(out NetworkTypeGuid: WideString): HResult; stdcall; + function put_NetworkType(NetworkTypeGuid: WideString): HResult; stdcall; + function get__NetworkType(out NetworkTypeGuid: WideString): HResult; stdcall; + function put__NetworkType(const NetworkTypeGuid: WideString): HResult; stdcall; + // this method creates the "best" kind of tune request for this tuning space. + // the tuning space may support other kinds of tune requests created via + // other factory mechanisms(for example, see mpeg2tunerequestfactory). but, + // this method is the preferred way to get a tune request as it always returns + // the optimal type of tune request for this space. + function CreateTuneRequest(out TuneRequest: ITuneRequest): HResult; stdcall; + function EnumCategoryGUIDs(out ppEnum: IEnumGUID): HResult; stdcall; + function EnumDeviceMonikers(out ppEnum: IEnumMoniker): HResult; stdcall; + function get_DefaultPreferredComponentTypes(out ComponentTypes: IComponentTypes): HResult; stdcall; + function put_DefaultPreferredComponentTypes(NewComponentTypes: IComponentTypes): HResult; stdcall; + function get_FrequencyMapping(out pMapping: WideString): HResult; stdcall; + function put_FrequencyMapping(Mapping: WideString): HResult; stdcall; + function get_DefaultLocator(out LocatorVal: ILocator): HResult; stdcall; + function put_DefaultLocator(LocatorVal: ILocator): HResult; stdcall; + function Clone(out NewTS: ITuningSpace): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IEnumTuningSpaces;'} + {$EXTERNALSYM IEnumTuningSpaces} + IEnumTuningSpaces = interface(IUnknown) + ['{8B8EB248-FC2B-11d2-9D8C-00C04F72D980}'] + (*** IEnumTuningSpaces methods ***) + function Next(celt: ULONG; out rgelt: ITuningSpace; out pceltFetched: ULONG): HResult; stdcall; + function Skip(celt: ULONG): HResult; stdcall; + function Reset: HResult; stdcall; + function Clone(out ppEnum: IEnumTuningSpaces): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDVBTuningSpace;'} + {$EXTERNALSYM IDVBTuningSpace} + IDVBTuningSpace = interface(ITuningSpace) + ['{ADA0B268-3B19-4e5b-ACC4-49F852BE13BA}'] + (*** IDVBTuningSpace methods ***) + function get_SystemType(out SysType: TDVBSystemType): HResult; stdcall; + function put_SystemType(SysType: TDVBSystemType): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDVBTuningSpace2;'} + {$EXTERNALSYM IDVBTuningSpace2} + IDVBTuningSpace2 = interface(IDVBTuningSpace) + ['{843188B4-CE62-43db-966B-8145A094E040}'] + (*** IDVBTuningSpace2 methods ***) + function get_NetworkID(out NetworkID: longint): HResult; stdcall; + function put_NetworkID(NetworkID: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDVBSTuningSpace;'} + {$EXTERNALSYM IDVBSTuningSpace} + IDVBSTuningSpace = interface(IDVBTuningSpace2) + ['{CDF7BE60-D954-42FD-A972-78971958E470}'] + (*** IDVBSTuningSpace methods ***) + function get_LowOscillator(out LowOscillator: longint): HResult; stdcall; + function put_LowOscillator(LowOscillator: longint): HResult; stdcall; + function get_HighOscillator(out HighOscillator: longint): HResult; stdcall; + function put_HighOscillator(HighOscillator: longint): HResult; stdcall; + function get_LNBSwitch(out LNBSwitch: longint): HResult; stdcall; + function put_LNBSwitch(LNBSwitch: longint): HResult; stdcall; + function get_InputRange(out InputRange: WideString): HResult; stdcall; + function put_InputRange(const InputRange: WideString): HResult; stdcall; + function get_SpectralInversion(out SpectralInversionVal: SpectralInversion): HResult; stdcall; + function put_SpectralInversion(SpectralInversionVal: SpectralInversion): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAuxInTuningSpace;'} + {$EXTERNALSYM IAuxInTuningSpace} + IAuxInTuningSpace = interface(ITuningSpace) + ['{E48244B8-7E17-4f76-A763-5090FF1E2F30}'] + (*** IAuxInTuningSpace methods ***) + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAnalogTVTuningSpace;'} + {$EXTERNALSYM IAnalogTVTuningSpace} + IAnalogTVTuningSpace = interface(ITuningSpace) + ['{2A6E293C-2595-11d3-B64C-00C04F79498E}'] + (*** IAnalogTVTuningSpace methods ***) + function get_MinChannel(out MinChannelVal: longint): HResult; stdcall; + function put_MinChannel(NewMinChannelVal: longint): HResult; stdcall; + function get_MaxChannel(out MaxChannelVal: longint): HResult; stdcall; + function put_MaxChannel(NewMaxChannelVal: longint): HResult; stdcall; + function get_InputType(out InputTypeVal: TTunerInputType): HResult; stdcall; + function put_InputType(NewInputTypeVal: TTunerInputType): HResult; stdcall; + function get_CountryCode(out CountryCodeVal: longint): HResult; stdcall; + function put_CountryCode(NewCountryCodeVal: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IATSCTuningSpace;'} + {$EXTERNALSYM IATSCTuningSpace} + IATSCTuningSpace = interface(IAnalogTVTuningSpace) + ['{0369B4E2-45B6-11d3-B650-00C04F79498E}'] + (*** IATSCTuningSpace methods ***) + function get_MinMinorChannel(out MinMinorChannelVal: longint): HResult; stdcall; + function put_MinMinorChannel(NewMinMinorChannelVal: longint): HResult; stdcall; + function get_MaxMinorChannel(out MaxMinorChannelVal: longint): HResult; stdcall; + function put_MaxMinorChannel(NewMaxMinorChannelVal: longint): HResult; stdcall; + function get_MinPhysicalChannel(out MinPhysicalChannelVal: longint): HResult; stdcall; + function put_MinPhysicalChannel(NewMinPhysicalChannelVal: longint): HResult; stdcall; + function get_MaxPhysicalChannel(out MaxPhysicalChannelVal: longint): HResult; stdcall; + function put_MaxPhysicalChannel(NewMaxPhysicalChannelVal: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAnalogRadioTuningSpace;'} + {$EXTERNALSYM IAnalogRadioTuningSpace} + IAnalogRadioTuningSpace = interface(ITuningSpace) + ['{2A6E293B-2595-11d3-B64C-00C04F79498E}'] + (*** IAnalogRadioTuningSpace methods ***) + function get_MinFrequency(out MinFrequencyVal: longint): HResult; stdcall; + function put_MinFrequency(NewMinFrequencyVal: longint): HResult; stdcall; + function get_MaxFrequency(out MaxFrequencyVal: longint): HResult; stdcall; + function put_MaxFrequency(NewMaxFrequencyVal: longint): HResult; stdcall; + function get_Step(out StepVal: longint): HResult; stdcall; + function put_Step(NewStepVal: longint): HResult; stdcall; + end; + + IComponents = interface; + + ////////////////////////////////////////////////////////////////////////////////////// + // Tune Request Interfaces + ////////////////////////////////////////////////////////////////////////////////////// + // tune requests(of any kind) can only be obtained from tune request factories such as + // ITuningSpace::CreateTuneRequest. one reason for this is that we always want to be + // certain that a tune request is bound to the right tuning space. this means we don't + // have to perform consistency checks all over the place. + + {$HPPEMIT 'typedef System::DelphiInterface _di_ITuneRequest;'} + {$EXTERNALSYM ITuneRequest} + ITuneRequest = interface(IDispatch) + ['{07DDC146-FC3D-11d2-9D8C-00C04F72D980}'] + (*** ITuneRequest methods ***) + function get_TuningSpace(out TuningSpace: ITuningSpace): HResult; stdcall; + function get_Components(out Components: IComponents): HResult; stdcall; + function Clone(out NewTuneRequest: ITuneRequest): HResult; stdcall; + function get_Locator(out Locator: ILocator): HResult; stdcall; + function put_Locator(Locator: ILocator): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IChannelTuneRequest;'} + {$EXTERNALSYM IChannelTuneRequest} + IChannelTuneRequest = interface(ITuneRequest) + ['{0369B4E0-45B6-11d3-B650-00C04F79498E}'] + (*** IChannelTuneRequest methods ***) + function get_Channel(out Channel: longint): HResult; stdcall; + function put_Channel(Channel: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IATSCChannelTuneRequest;'} + {$EXTERNALSYM IATSCChannelTuneRequest} + IATSCChannelTuneRequest = interface(IChannelTuneRequest) + ['{0369B4E1-45B6-11d3-B650-00C04F79498E}'] + (*** IATSCChannelTuneRequest methods ***) + function get_MinorChannel(out MinorChannel: longint): HResult; stdcall; + function put_MinorChannel(MinorChannel: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDVBTuneRequest;'} + {$EXTERNALSYM IDVBTuneRequest} + IDVBTuneRequest = interface(ITuneRequest) + ['{0D6F567E-A636-42bb-83BA-CE4C1704AFA2}'] + (*** IDVBTuneRequest methods ***) + function get_ONID(out ONID: longint): HResult; stdcall; + function put_ONID(ONID: longint): HResult; stdcall; + function get_TSID(out TSID: longint): HResult; stdcall; + function put_TSID(TSID: longint): HResult; stdcall; + function get_SID(out SID: longint): HResult; stdcall; + function put_SID(SID: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMPEG2TuneRequest;'} + {$EXTERNALSYM IMPEG2TuneRequest} + IMPEG2TuneRequest = interface(ITuneRequest) + ['{EB7D987F-8A01-42AD-B8AE-574DEEE44D1A}'] + (*** IMPEG2TuneRequest methods ***) + function get_TSID: HResult; stdcall; + function put_TSID(TSID: longint): HResult; stdcall; + function get_ProgNo: HResult; stdcall; + function put_ProgNo(ProgNo: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMPEG2TuneRequestFactory;'} + {$EXTERNALSYM IMPEG2TuneRequestFactory} + IMPEG2TuneRequestFactory = interface(IDispatch) + ['{14E11ABD-EE37-4893-9EA1-6964DE933E39}'] + (*** IMPEG2TuneRequestFactory methods ***) + function CreateTuneRequest(TuningSpace: ITuningSpace; + out TuneRequest: IMPEG2TuneRequest): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMPEG2TuneRequestSupport;'} + {$EXTERNALSYM IMPEG2TuneRequestSupport} + IMPEG2TuneRequestSupport = interface(IUnknown) + ['{1B9D5FC3-5BBC-4b6c-BB18-B9D10E3EEEBF}'] + (*** IMPEG2TuneRequestSupport methods ***) + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_ITuner;'} + {$EXTERNALSYM ITuner} + ITuner = interface(IUnknown) + ['{28C52640-018A-11d3-9D8E-00C04F72D980}'] + (*** ITuner methods ***) + function get_TuningSpace(out TuningSpace: ITuningSpace): HResult; stdcall; + function put_TuningSpace(TuningSpace: ITuningSpace): HResult; stdcall; + function EnumTuningSpaces(out ppEnum: IEnumTuningSpaces): HResult; stdcall; + function get_TuneRequest(out TuneRequest: ITuneRequest): HResult; stdcall; + function put_TuneRequest(TuneRequest: ITuneRequest): HResult; stdcall; + function Validate(TuneRequest: ITuneRequest): HResult; stdcall; + function get_PreferredComponentTypes(out ComponentTypes: IComponentTypes): HResult; stdcall; + function put_PreferredComponentTypes(ComponentTypes: IComponentTypes): HResult; stdcall; + function get_SignalStrength(out Strength: longint): HResult; stdcall; + function TriggerSignalEvents(Interval: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IScanningTuner;'} + {$EXTERNALSYM IScanningTuner} + IScanningTuner = interface(ITuner) + ['{1DFD0A5C-0284-11d3-9D8E-00C04F72D980}'] + (*** IScanningTuner methods ***) + function SeekUp: HResult; stdcall; + function SeekDown: HResult; stdcall; + function ScanUp(MillisecondsPause: longint): HResult; stdcall; + function ScanDown(MillisecondsPause: longint): HResult; stdcall; + function AutoProgram: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IComponentType;'} + {$EXTERNALSYM IComponentType} + IComponentType = interface(IDispatch) + ['{6A340DC0-0311-11d3-9D8E-00C04F72D980}'] + (*** IComponentType methods ***) + function get_Category(out Category: ComponentCategory): HResult; stdcall; + function put_Category(Category: ComponentCategory): HResult; stdcall; + function get_MediaMajorType(out MediaMajorType: WideString): HResult; stdcall; + function put_MediaMajorType(MediaMajorType: WideString): HResult; stdcall; + function get__MediaMajorType(out MediaMajorTypeGuid: TGUID): HResult; stdcall; + function put__MediaMajorType(const MediaMajorTypeGuid: TGUID): HResult; stdcall; + function get_MediaSubType(out MediaSubType: WideString): HResult; stdcall; + function put_MediaSubType(MediaSubType: WideString): HResult; stdcall; + function get__MediaSubType(out MediaSubTypeGuid: TGUID): HResult; stdcall; + function put__MediaSubType(const MediaSubTypeGuid: TGUID): HResult; stdcall; + function get_MediaFormatType(out MediaFormatType: WideString): HResult; stdcall; + function put_MediaFormatType(MediaFormatType: WideString): HResult; stdcall; + function get__MediaFormatType(out MediaFormatTypeGuid: TGUID): HResult; stdcall; + function put__MediaFormatType(const MediaFormatTypeGuid: TGUID): HResult; stdcall; + function get_MediaType(out MediaType: TAMMediaType): HResult; stdcall; + function put_MediaType(MediaType: TAMMediaType): HResult; stdcall; + function Clone(out NewCT: IComponentType): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_ILanguageComponentType;'} + {$EXTERNALSYM ILanguageComponentType} + ILanguageComponentType = interface(IComponentType) + ['{B874C8BA-0FA2-11d3-9D8E-00C04F72D980}'] + (*** ILanguageComponentType methods ***) + function get_LangID(out LangID: longint): HResult; stdcall; + function put_LangID(LangID: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMPEG2ComponentType;'} + {$EXTERNALSYM IMPEG2ComponentType} + IMPEG2ComponentType = interface(ILanguageComponentType) + ['{2C073D84-B51C-48c9-AA9F-68971E1F6E38}'] + (*** IMPEG2ComponentType methods ***) + function get_StreamType(out MP2StreamType: MPEG2StreamType): HResult; stdcall; + function put_StreamType(MP2StreamType: MPEG2StreamType): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IATSCComponentType;'} + {$EXTERNALSYM IATSCComponentType} + IATSCComponentType = interface(IMPEG2ComponentType) + ['{FC189E4D-7BD4-4125-B3B3-3A76A332CC96}'] + (*** IATSCComponentType methods ***) + function get_Flags(out Flags: longint): HResult; stdcall; + function put_Flags(Flags: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IEnumComponentTypes;'} + {$EXTERNALSYM IEnumComponentTypes} + IEnumComponentTypes = interface(IUnknown) + ['{8A674B4A-1F63-11d3-B64C-00C04F79498E}'] + (*** IEnumComponentTypes methods ***) + function Next(celt: ULONG; out rgelt: IComponentType; out pceltFetched: ULONG): HResult; stdcall; + function Skip(celt: ULONG): HResult; stdcall; + function Reset: HResult; stdcall; + function Clone(out ppEnum: IEnumComponentTypes): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IComponentTypes;'} + {$EXTERNALSYM IComponentTypes} + IComponentTypes = interface(IDispatch) + ['{0DC13D4A-0313-11d3-9D8E-00C04F72D980}'] + (*** IComponentTypes methods ***) + function get_Count(out Count: longint): HResult; stdcall; + function get__NewEnum(out ppNewEnum: IEnumVARIANT): HResult; stdcall; + function EnumComponentTypes(out ppNewEnum: IEnumComponentTypes): HResult; stdcall; + function get_Item(Index: OLEVARIANT; out ComponentType: IComponentType): HResult; stdcall; + function put_Item(Index: OLEVARIANT; ComponentType: IComponentType): HResult; stdcall; + function Add(ComponentType: IComponentType; out NewIndex: OLEVARIANT): HResult; stdcall; + function Remove(Index: OLEVARIANT): HResult; stdcall; + function Clone(out NewList: IComponentTypes): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IComponent;'} + {$EXTERNALSYM IComponent} + IComponent = interface(IDispatch) + ['{1A5576FC-0E19-11d3-9D8E-00C04F72D980}'] + (*** IComponent methods ***) + function get_Type(out CT: IComponentType): HResult; stdcall; + function put_Type(CT: IComponentType): HResult; stdcall; + function get_DescLangID(out LangID: longint): HResult; stdcall; + function put_DescLangID(LangID: longint): HResult; stdcall; + function get_Status(out Status: TComponentStatus): HResult; stdcall; + function put_Status(Status: TComponentStatus): HResult; stdcall; + function get_Description(out Description: WideString): HResult; stdcall; + function put_Description(Description: WideString): HResult; stdcall; + function Clone(out NewComponent: IComponent): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMPEG2Component;'} + {$EXTERNALSYM IMPEG2Component} + IMPEG2Component = interface(IComponent) + ['{1493E353-1EB6-473c-802D-8E6B8EC9D2A9}'] + (*** IMPEG2Component methods ***) + function get_PID(out PID: longint): HResult; stdcall; + function put_PID(PID: longint): HResult; stdcall; + function get_PCRPID(out PCRPID: longint): HResult; stdcall; + function put_PCRPID(PCRPID: longint): HResult; stdcall; + function get_ProgramNumber(out ProgramNumber: longint): HResult; stdcall; + function put_ProgramNumber(ProgramNumber: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IEnumComponents;'} + {$EXTERNALSYM IEnumComponents} + IEnumComponents = interface(IUnknown) + ['{2A6E2939-2595-11d3-B64C-00C04F79498E}'] + (*** IEnumComponents methods ***) + function Next(celt: ULONG; out rgelt: IComponent; out pceltFetched: ULONG): HResult; stdcall; + function Skip(celt: ULONG): HResult; stdcall; + function Reset: HResult; stdcall; + function Clone(out ppEnum: IEnumComponents): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IComponents;'} + {$EXTERNALSYM IComponents} + IComponents = interface(IDispatch) + ['{FCD01846-0E19-11d3-9D8E-00C04F72D980}'] + (*** IComponents methods ***) + function get_Count(out Count: longint): HResult; stdcall; + function get__NewEnum(out ppNewEnum: IEnumVARIANT): HResult; stdcall; + function EnumComponents(out ppNewEnum: IEnumComponents): HResult; stdcall; + function get_Item(Index: OLEVARIANT; out ppComponent: IComponent): HResult; stdcall; + function Add(Component: IComponent; out NewIndex: OLEVARIANT): HResult; stdcall; + function Remove(Index: OLEVARIANT): HResult; stdcall; + function Clone(out NewList: IComponents): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_ILocator;'} + {$EXTERNALSYM ILocator} + ILocator = interface(IDispatch) + ['{286D7F89-760C-4F89-80C4-66841D2507AA}'] + (*** ILocator methods ***) + function get_CarrierFrequency(out Frequency: longint): HResult; stdcall; + function put_CarrierFrequency(Frequency: longint): HResult; stdcall; + function get_InnerFEC(out FEC: FECMethod): HResult; stdcall; + function put_InnerFEC(FEC: FECMethod): HResult; stdcall; + function get_InnerFECRate(out FEC: BinaryConvolutionCodeRate): HResult; stdcall; + function put_InnerFECRate(FEC: BinaryConvolutionCodeRate): HResult; stdcall; + function get_OuterFEC(out FEC: FECMethod): HResult; stdcall; + function put_OuterFEC(FEC: FECMethod): HResult; stdcall; + function get_OuterFECRate(out FEC: BinaryConvolutionCodeRate): HResult; stdcall; + function put_OuterFECRate(FEC: BinaryConvolutionCodeRate): HResult; stdcall; + function get_Modulation(out Modulation: ModulationType): HResult; stdcall; + function put_Modulation(Modulation: ModulationType): HResult; stdcall; + function get_SymbolRate(out Rate: longint): HResult; stdcall; + function put_SymbolRate(Rate: longint): HResult; stdcall; + function Clone(out NewLocator: ILocator): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IATSCLocator;'} + {$EXTERNALSYM IATSCLocator} + IATSCLocator = interface(ILocator) + ['{BF8D986F-8C2B-4131-94D7-4D3D9FCC21EF}'] + (*** IATSCLocator methods ***) + function get_PhysicalChannel(out PhysicalChannel: longint): HResult; stdcall; + function put_PhysicalChannel(PhysicalChannel: longint): HResult; stdcall; + function get_TSID(out TSID: longint): HResult; stdcall; + function put_TSID(TSID: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDVBTLocator;'} + {$EXTERNALSYM IDVBTLocator} + IDVBTLocator = interface(ILocator) + ['{8664DA16-DDA2-42ac-926A-C18F9127C302}'] + (*** IDVBTLocator methods ***) + function get_Bandwidth(out BandWidthVal: longint): HResult; stdcall; + function put_Bandwidth(BandwidthVal: longint): HResult; stdcall; + function get_LPInnerFEC(out FEC: FECMethod): HResult; stdcall; + function put_LPInnerFEC(FEC: FECMethod): HResult; stdcall; + function get_LPInnerFECRate(out FEC: BinaryConvolutionCodeRate): HResult; stdcall; + function put_LPInnerFECRate(FEC: BinaryConvolutionCodeRate): HResult; stdcall; + function get_HAlpha(out Alpha: HierarchyAlpha): HResult; stdcall; + function put_HAlpha(Alpha: HierarchyAlpha): HResult; stdcall; + function get_Guard(out GI: GuardInterval): HResult; stdcall; + function put_Guard(GI: GuardInterval): HResult; stdcall; + function get_Mode(out mode: TransmissionMode): HResult; stdcall; + function put_Mode(mode: TransmissionMode): HResult; stdcall; + function get_OtherFrequencyInUse(out OtherFrequencyInUseVal: WordBool): HResult; stdcall; + function put_OtherFrequencyInUse(OtherFrequencyInUseVal: WordBool): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDVBSLocator;'} + {$EXTERNALSYM IDVBSLocator} + IDVBSLocator = interface(ILocator) + ['{3D7C353C-0D04-45f1-A742-F97CC1188DC8}'] + (*** IDVBSLocator methods ***) + function get_SignalPolarisation(out PolarisationVal: Polarisation): HResult; stdcall; + function put_SignalPolarisation(PolarisationVal: Polarisation): HResult; stdcall; + function get_WestPosition(out WestLongitude: WordBool): HResult; stdcall; + function put_WestPosition(WestLongitude: WordBool): HResult; stdcall; + function get_OrbitalPosition(out longitude: longint): HResult; stdcall; + function put_OrbitalPosition(longitude: longint): HResult; stdcall; + function get_Azimuth(out Azimuth: longint): HResult; stdcall; + function put_Azimuth(Azimuth: longint): HResult; stdcall; + function get_Elevation(out Elevation: longint): HResult; stdcall; + function put_Elevation(Elevation: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDVBCLocator;'} + {$EXTERNALSYM IDVBCLocator} + IDVBCLocator = interface(ILocator) + ['{6E42F36E-1DD2-43c4-9F78-69D25AE39034}'] + (*** IDVBCLocator methods ***) + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBroadcastEvent;'} + {$EXTERNALSYM IBroadcastEvent} + IBroadcastEvent = interface(IUnknown) + ['{3B21263F-26E8-489d-AAC4-924F7EFD9511}'] + (*** IBroadcastEvent methods ***) + function Fire(EventID: TGUID): HResult; stdcall; + end; + +//------------------------------------------------------------------------------ +// File: DXTrans.h +// Desc: DirectX Transform library +// Copyright (c) 1999 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +const + LIBID_DXTRANSLib : TGUID = '{54314D1D-35FE-11D1-81A1-0000F87557DB}'; + {$EXTERNALSYM LIBID_DXTRANSLib} + + IID_IDXBaseObject : TGUID = '{17B59B2B-9CC8-11D1-9053-00C04FD9189D}'; + {$EXTERNALSYM IID_IDXBaseObject} + IID_IDXTransformFactory : TGUID = '{6A950B2B-A971-11D1-81C8-0000F87557DB}'; + {$EXTERNALSYM IID_IDXTransformFactory} + IID_IDXTransform : TGUID = '{30A5FB78-E11F-11D1-9064-00C04FD9189D}'; + {$EXTERNALSYM IID_IDXTransform} + IID_IDXSurfacePick : TGUID = '{30A5FB79-E11F-11d1-9064-00C04FD9189D}'; + {$EXTERNALSYM IID_IDXSurfacePick} + IID_IDXTBindHost : TGUID = '{D26BCE55-E9DC-11d1-9066-00C04FD9189D}'; + {$EXTERNALSYM IID_IDXTBindHost} + IID_IDXTaskManager : TGUID = '{254DBBC1-F922-11D0-883A-3C8B00C10000}'; + {$EXTERNALSYM IID_IDXTaskManager} + IID_IDXSurfaceFactory : TGUID = '{144946F5-C4D4-11D1-81D1-0000F87557DB}'; + {$EXTERNALSYM IID_IDXSurfaceFactory} + IID_IDXSurfaceModifier : TGUID = '{9EA3B637-C37D-11D1-905E-00C04FD9189D}'; + {$EXTERNALSYM IID_IDXSurfaceModifier} + IID_IDXSurface : TGUID = '{B39FD73F-E139-11D1-9065-00C04FD9189D}'; + {$EXTERNALSYM IID_IDXSurface} + IID_IDXSurfaceInit : TGUID = '{9EA3B639-C37D-11d1-905E-00C04FD9189D}'; + {$EXTERNALSYM IID_IDXSurfaceInit} + IID_IDXARGBSurfaceInit : TGUID = '{9EA3B63A-C37D-11d1-905E-00C04FD9189D}'; + {$EXTERNALSYM IID_IDXARGBSurfaceInit} + IID_IDXARGBReadPtr : TGUID = '{EAAAC2D6-C290-11d1-905D-00C04FD9189D}'; + {$EXTERNALSYM IID_IDXARGBReadPtr} + IID_IDXARGBReadWritePtr : TGUID = '{EAAAC2D7-C290-11d1-905D-00C04FD9189D}'; + {$EXTERNALSYM IID_IDXARGBReadWritePtr} + IID_IDXDCLock : TGUID = '{0F619456-CF39-11D1-905E-00C04FD9189D}'; + {$EXTERNALSYM IID_IDXDCLock} + IID_IDXTScaleOutput : TGUID = '{B2024B50-EE77-11D1-9066-00C04FD9189D}'; + {$EXTERNALSYM IID_IDXTScaleOutput} + IID_IDXGradient : TGUID = '{B2024B51-EE77-11D1-9066-00C04FD9189D}'; + {$EXTERNALSYM IID_IDXGradient} + IID_IDXTScale : TGUID = '{B39FD742-E139-11D1-9065-00C04FD9189D}'; + {$EXTERNALSYM IID_IDXTScale} + IID_IDXEffect : TGUID = '{E31FB81B-1335-11d1-8189-0000F87557DB}'; + {$EXTERNALSYM IID_IDXEffect} + IID_IDXLookupTable : TGUID = '{01BAFC7F-9E63-11D1-9053-00C04FD9189D}'; + {$EXTERNALSYM IID_IDXLookupTable} + IID_IDXRawSurface : TGUID = '{09756C8A-D96A-11d1-9062-00C04FD9189D}'; + {$EXTERNALSYM IID_IDXRawSurface} + IID_IHTMLDXTransform : TGUID = '{30E2AB7D-4FDD-4159-B7EA-DC722BF4ADE5}'; + {$EXTERNALSYM IID_IHTMLDXTransform} + + CLSID_DXTransformFactory : TGUID = '{D1FE6762-FC48-11D0-883A-3C8B00C10000}'; + {$EXTERNALSYM CLSID_DXTransformFactory} + CLSID_DXTaskManager : TGUID = '{4CB26C03-FF93-11D0-817E-0000F87557DB}'; + {$EXTERNALSYM CLSID_DXTaskManager} + CLSID_DXTScale : TGUID = '{555278E2-05DB-11D1-883A-3C8B00C10000}'; + {$EXTERNALSYM CLSID_DXTScale} + CLSID_DXSurface : TGUID = '{0E890F83-5F79-11D1-9043-00C04FD9189D}'; + {$EXTERNALSYM CLSID_DXSurface} + CLSID_DXSurfaceModifier : TGUID = '{3E669F1D-9C23-11D1-9053-00C04FD9189D}'; + {$EXTERNALSYM CLSID_DXSurfaceModifier} + CLSID_DXGradient : TGUID = '{C6365470-F667-11D1-9067-00C04FD9189D}'; + {$EXTERNALSYM CLSID_DXGradient} + + +// +// Pixel format definitions +// + DDPF_RGB1 : TGUID = '{e436eb78-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM DDPF_RGB1} + DDPF_RGB2 : TGUID = '{BBF7D3F3-143F-11d1-B50A-0000F8756A10}'; + {$EXTERNALSYM DDPF_RGB2} + DDPF_RGB4 : TGUID = '{e436eb79-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM DDPF_RGB4} + DDPF_RGB8 : TGUID = '{e436eb7a-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM DDPF_RGB8} + DDPF_RGB332 : TGUID = '{BBF7D3F6-143F-11d1-B50A-0000F8756A10}'; + {$EXTERNALSYM DDPF_RGB332} + DDPF_ARGB4444 : TGUID = '{BBF7D3F7-143F-11d1-B50A-0000F8756A10}'; + {$EXTERNALSYM DDPF_ARGB4444} + DDPF_RGB565 : TGUID = '{e436eb7b-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM DDPF_RGB565} + DDPF_BGR565 : TGUID = '{BBF7D3F9-143F-11d1-B50A-0000F8756A10}'; + {$EXTERNALSYM DDPF_BGR565} + DDPF_RGB555 : TGUID = '{e436eb7c-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM DDPF_RGB555} + DDPF_ARGB1555 : TGUID = '{BBF7D3FB-143F-11d1-B50A-0000F8756A10}'; + {$EXTERNALSYM DDPF_ARGB1555} + DDPF_RGB24 : TGUID = '{e436eb7d-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM DDPF_RGB24} + DDPF_BGR24 : TGUID = '{BBF7D3FD-143F-11d1-B50A-0000F8756A10}'; + {$EXTERNALSYM DDPF_BGR24} + DDPF_RGB32 : TGUID = '{e436eb7e-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM DDPF_RGB32} + DDPF_BGR32 : TGUID = '{BBF7D3FF-143F-11d1-B50A-0000F8756A10}'; + {$EXTERNALSYM DDPF_BGR32} + DDPF_ABGR32 : TGUID = '{BBF7D401-143F-11d1-B50A-0000F8756A10}'; + {$EXTERNALSYM DDPF_ABGR32} + DDPF_ARGB32 : TGUID = '{773c9ac0-3274-11d0-B724-00aa006c1A01}'; + {$EXTERNALSYM DDPF_ARGB32} + DDPF_PMARGB32 : TGUID = '{BBF7D403-143F-11d1-B50A-0000F8756A10}'; + {$EXTERNALSYM DDPF_PMARGB32} + DDPF_A1 : TGUID = '{7846F94E-3915-11d1-99AA-0000F8756A10}'; + {$EXTERNALSYM DDPF_A1} + DDPF_A2 : TGUID = '{7846F94F-3915-11d1-99AA-0000F8756A10}'; + {$EXTERNALSYM DDPF_A2} + DDPF_A4 : TGUID = '{7846F950-3915-11d1-99AA-0000F8756A10}'; + {$EXTERNALSYM DDPF_A4} + DDPF_A8 : TGUID = '{7846F951-3915-11d1-99AA-0000F8756A10}'; + {$EXTERNALSYM DDPF_A8} + DDPF_Z8 : TGUID = '{7846F952-3915-11d1-99AA-0000F8756A10}'; + {$EXTERNALSYM DDPF_Z8} + DDPF_Z16 : TGUID = '{7846F953-3915-11d1-99AA-0000F8756A10}'; + {$EXTERNALSYM DDPF_Z16} + DDPF_Z24 : TGUID = '{7846F954-3915-11d1-99AA-0000F8756A10}'; + {$EXTERNALSYM DDPF_Z24} + DDPF_Z32 : TGUID = '{7846F955-3915-11d1-99AA-0000F8756A10}'; + {$EXTERNALSYM DDPF_Z32} +// +// Component categories +// + CATID_DXImageTransform : TGUID = '{C501EDBE-9E70-11d1-9053-00C04FD9189D}'; + {$EXTERNALSYM CATID_DXImageTransform} + CATID_DX3DTransform : TGUID = '{C501EDBF-9E70-11d1-9053-00C04FD9189D}'; + {$EXTERNALSYM CATID_DX3DTransform} + CATID_DXAuthoringTransform : TGUID = '{ACAC94FC-E5CF-11d1-9066-00C04FD9189D}'; + {$EXTERNALSYM CATID_DXAuthoringTransform} + CATID_DXSurface : TGUID = '{52BA7097-B52C-11d1-81CB-0000F87557DB}'; + {$EXTERNALSYM CATID_DXSurface} + +// +// Service IDs. +// + SID_SDirectDraw : TGUID = (D1:$618f8ad4;D2:$8b7a;D3:$11d0;D4:($8f,$cc,$0,$c0,$4f,$d9,$18,$9d)); + {$EXTERNALSYM SID_SDirectDraw} + SID_SDirect3DRM : TGUID = (D1:$2bc49361;D2:$8327;D3:$11cf;D4:($ac,$4a,$0,$0,$c0,$38,$25,$a1)); + {$EXTERNALSYM SID_SDirect3DRM} + SID_SDXTaskManager : TGUID = '{4CB26C03-FF93-11D0-817E-0000F87557DB}'; + {$EXTERNALSYM SID_SDXTaskManager} + SID_SDXSurfaceFactory : TGUID = '{144946F5-C4D4-11D1-81D1-0000F87557DB}'; + {$EXTERNALSYM SID_SDXSurfaceFactory} + SID_SDXTransformFactory : TGUID = '{6A950B2B-A971-11D1-81C8-0000F87557DB}'; + {$EXTERNALSYM SID_SDXTransformFactory} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXBaseObject;'} + {$EXTERNALSYM IDXBaseObject} + IDXBaseObject = interface(IUnknown) + ['{17B59B2B-9CC8-11D1-9053-00C04FD9189D}'] + (*** IDXBaseObject methods ***) + function GetGenerationId(out pID: ULONG): HResult; stdcall; + function IncrementGenerationId(bRefresh: BOOL): HResult; stdcall; + function GetObjectSize(out pcbSize: ULONG): HResult; stdcall; + end; + + DXBNDID = ( + DXB_X, + DXB_Y, + DXB_Z, + DXB_T + ); + {$EXTERNALSYM DXBNDID} + TDXBNDID = DXBNDID; + + DXBNDTYPE = ( + DXBT_DISCRETE, + DXBT_DISCRETE64, + DXBT_CONTINUOUS, + DXBT_CONTINUOUS64 + ); + {$EXTERNALSYM DXBNDTYPE} + TDXBNDType = DXBNDTYPE; + + DXDBND = record + Min: longint; + Max: longint; + end; + {$EXTERNALSYM DXDBND} + TDXDBND = DXDBND; + + DXDBNDS = array[0..3] of TDXDBND; + {$EXTERNALSYM DXDBNDS} + + DXDBND64 = record + Min: int64; + Max: int64; + end; + {$EXTERNALSYM DXDBND64} + TDXDBND64 = DXDBND64; + + DXDBNDS64 = array [0..3] of TDXDBND64; + {$EXTERNALSYM DXDBNDS64} + + DXCBND = record + {$EXTERNALSYM DXCBND} + Min: single; + Max: single; + end; + TDXCBND = DXCBND; + + DXCBNDS = array[0..3] of TDXCBND; + {$EXTERNALSYM DXCBNDS} + + DXCBND64 = record + Min: double; + Max: double; + end; + {$EXTERNALSYM DXCBND64} + TDXCBND64 = DXCBND64; + + DXCBNDS64 = array[0..3] of TDXCBND64; + {$EXTERNALSYM DXCBNDS64} + + DXBNDS = record + {$EXTERNALSYM DXBNDS} + eType: TDXBNDTYPE; + case Integer of + 0: (D: array[0..3] of TDXDBND); + 1: (LD: array[0..3] of TDXDBND64); + 2: (C: array[0..3] of TDXCBND); + 3: (LC: array[0..3] of TDXCBND64); + end; + TDXBNDS = DXBNDS; + + DXDVEC = array[0..3] of longint; + {$EXTERNALSYM DXDVEC} + + DXDVEC64 = array[0..3] of int64; + {$EXTERNALSYM DXDVEC64} + + DXCVEC = array[0..3] of single; + {$EXTERNALSYM DXCVEC} + + DXCVEC64 = array[0..3] of double; + {$EXTERNALSYM DXCVEC64} + + DXVEC = record + eType: TDXBNDTYPE; + case Integer of + 0: (D: array[0..3] of Longint); + 1: (LD: array[0..3] of Int64); + 2: (C: array[0..3] of Single); + 3: (LC: array[0..3] of Double); + end; + {$EXTERNALSYM DXVEC} + TDXVEC = DXVEC; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXTransform;'} + {$EXTERNALSYM IDXTransform} + IDXTransform = interface(IDXBaseObject) + ['{30A5FB78-E11F-11D1-9064-00C04FD9189D}'] + (*** IDXTransform methods ***) + function Setup(punkInputs: IUnknown; ulNumInputs: ULONG; punkOutputs: IUnknown; + ulNumOutputs: ULONG; dwFlags: DWORD): HResult; stdcall; + function Execute(const pRequestID: TGUID; var pClipBnds: TDXBNDS; var pPlacement: TDXVEC): HResult; stdcall; + function MapBoundsIn2Out(var pInBounds: TDXBNDS; ulNumInBnds: ULONG; ulOutIndex: ULONG; + out pOutBounds: TDXBNDS): HResult; stdcall; + function MapBoundsOut2In(ulOutIndex: ULONG; var pOutBounds: TDXBNDS; ulInIndex: ULONG; + out pInBounds: TDXBNDS): HResult; stdcall; + function SetMiscFlags(dwMiscFlags: DWORD): HResult; stdcall; + function GetMiscFlags(out pdwMiscFlags: DWORD): HResult; stdcall; + function GetInOutInfo(bIsOutput: BOOL; ulIndex: ULONG; out pdwFlags: DWORD; + out pIDs: TGUID; var pcIDs: ULONG; out ppUnkCurrentObject: IUnknown): HResult; stdcall; + function SetQuality(fQuality: Single): HResult; stdcall; + function GetQuality(out fQuality: Single): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXTransformFactory;'} + {$EXTERNALSYM IDXTransformFactory} + IDXTransformFactory = interface(IServiceProvider) + ['{6A950B2B-A971-11D1-81C8-0000F87557DB}'] + (*** IDXTransformFactory methods ***) + function SetService(const guidService: TGUID; pUnkService: IUnknown; + bWeakReference: BOOL): HResult; stdcall; + function CreateTransform(punkInputs: IUnknown; ulNumInputs: ULONG; + punkOutputs: IUnknown; ulNumOutputs: ULONG; + pInitProps: IPropertyBag; pErrLog: IErrorLog; + const TransCLSID: TGUID; const TransIID: TGUID; out ppTransform: Pointer): HResult; stdcall; + function InitializeTransform(pTransform: IDXTransform; punkInputs: IUnknown; + ulNumInputs: ULONG; punkOutputs: IUnknown; + ulNumOutputs: ULONG; pInitProps: IPropertyBag; + pErrLog: IErrorLog): HResult; stdcall; + end; + + + DXTMISCFLAGS = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM DXTMISCFLAGS} + const + DXTMF_BLEND_WITH_OUTPUT = 1 shl 0; + {$EXTERNALSYM DXTMF_BLEND_WITH_OUTPUT} + DXTMF_DITHER_OUTPUT = 1 shl 1; + {$EXTERNALSYM DXTMF_DITHER_OUTPUT} + DXTMF_OPTION_MASK = $ffff; + {$EXTERNALSYM DXTMF_OPTION_MASK} + DXTMF_VALID_OPTIONS = DXTMF_BLEND_WITH_OUTPUT or DXTMF_DITHER_OUTPUT; + {$EXTERNALSYM DXTMF_VALID_OPTIONS} + DXTMF_BLEND_SUPPORTED = 1 shl 16; + {$EXTERNALSYM DXTMF_BLEND_SUPPORTED} + DXTMF_DITHER_SUPPORTED = 1 shl 17; + {$EXTERNALSYM DXTMF_DITHER_SUPPORTED} + DXTMF_INPLACE_OPERATION = 1 shl 24; + {$EXTERNALSYM DXTMF_INPLACE_OPERATION} + DXTMF_BOUNDS_SUPPORTED = 1 shl 25; + {$EXTERNALSYM DXTMF_BOUNDS_SUPPORTED} + DXTMF_PLACEMENT_SUPPORTED= 1 shl 26; + {$EXTERNALSYM DXTMF_PLACEMENT_SUPPORTED} + DXTMF_QUALITY_SUPPORTED = 1 shl 27; + {$EXTERNALSYM DXTMF_QUALITY_SUPPORTED} + DXTMF_OPAQUE_RESULT = 1 shl 28; + {$EXTERNALSYM DXTMF_OPAQUE_RESULT} + +type + DXINOUTINFOFLAGS = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM DXINOUTINFOFLAGS} + const + DXINOUTF_OPTIONAL = 1 shl 0; + {$EXTERNALSYM DXINOUTF_OPTIONAL} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXSurfacePick;'} + {$EXTERNALSYM IDXSurfacePick} + IDXSurfacePick = interface(IUnknown) + ['{30A5FB79-E11F-11d1-9064-00C04FD9189D}'] + (*** IDXSurfacePick methods ***) + function PointPick(var pPoint: TDXVEC; out pulInputSurfaceIndex: ULONG; + out pInputPoint: TDXVEC): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXTBindHost;'} + {$EXTERNALSYM IDXTBindHost} + IDXTBindHost = interface(IUnknown) + ['{D26BCE55-E9DC-11d1-9066-00C04FD9189D}'] + (*** IDXTBindHost methods ***) + function SetBindHost(pBindHost: IBindHost): HResult; stdcall; + end; + + DXTASKPROC = procedure(var pTaskData: pointer; var pbContinueProcessing: BOOL); stdcall; + {$EXTERNALSYM DXTASKPROC} + PFNDXTASKPROC = ^DXTASKPROC; + {$EXTERNALSYM PFNDXTASKPROC} + + DXAPCPROC = procedure(dwData: DWORD);stdcall; + {$EXTERNALSYM DXAPCPROC} + PFNDXAPCPROC = ^DXAPCPROC; + {$EXTERNALSYM PFNDXAPCPROC} + + DXTMTASKINFO = record + pfnTaskProc: PFNDXTASKPROC; + pTaskData: Pointer; + pfnCompletionAPC: PFNDXAPCPROC; + dwCompletionData: DWORD; + pRequestID: PGUID; + end; + {$EXTERNALSYM DXTMTASKINFO} + TDXTMTaskInfo = DXTMTASKINFO; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXTaskManager;'} + {$EXTERNALSYM IDXTaskManager} + IDXTaskManager = interface(IUnknown) + ['{254DBBC1-F922-11D0-883A-3C8B00C10000}'] + (*** IDXTaskManager methods ***) + function QueryNumProcessors(out pulNumProc: ULONG): HResult; stdcall; + function SetThreadPoolSize(ulNumThreads: ULONG): HResult; stdcall; + function GetThreadPoolSize(out pulNumThreads: ULONG): HResult; stdcall; + function SetConcurrencyLimit(ulNumThreads: ULONG): HResult; stdcall; + function GetConcurrencyLimit(out pulNumThreads: ULONG): HResult; stdcall; + function ScheduleTasks(var TaskInfo: TDXTMTASKINFO; Events: PHANDLE; + out TaskIDs: DWORD; ulNumTasks: ULONG; ulWaitPeriod: ULONG): HResult; stdcall; + function TerminateTasks(var TaskIDs: DWORD; ulCount: ULONG; ulTimeOut: ULONG): HResult; stdcall; + function TerminateRequest(const RequestID: TGUID; ulTimeOut: ULONG): HResult; stdcall; + end; + + DXBASESAMPLE = record + Blue : Byte; + Green : Byte; + Red : Byte; + Alpha : Byte; + end; + {$EXTERNALSYM DXBASESAMPLE} + TDXBaseSample = DXBASESAMPLE; + + DXSAMPLE = record + Blue : Byte; + Green : Byte; + Red : Byte; + Alpha : Byte; + end; + {$EXTERNALSYM DXSAMPLE} + TDXSample = DXSAMPLE; + + DXPMSAMPLE = record + Blue : Byte; + Green : Byte; + Red : Byte; + Alpha : Byte; + end; + {$EXTERNALSYM DXPMSAMPLE} + TDXPMSample = DXPMSAMPLE; + + DXRUNTYPE = ( + DXRUNTYPE_CLEAR, + DXRUNTYPE_OPAQUE, + DXRUNTYPE_TRANS, + DXRUNTYPE_UNKNOWN + ); + {$EXTERNALSYM DXRUNTYPE} + TDXRunType = DXRUNTYPE; + +const + DX_MAX_RUN_INFO_COUNT = 128; + {$EXTERNALSYM DX_MAX_RUN_INFO_COUNT} + +type +// 2 : Type ; // Type +// 30 : Count ; // Number of samples in run + PDXRunInfo = ^TDXRunInfo; + DXRUNINFO = record + Bitfields : ULONG; + end; + {$EXTERNALSYM DXRUNINFO} + TDXRunInfo = DXRUNINFO; + + DXSFCREATE = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM DXSFCREATE} + const + DXSF_FORMAT_IS_CLSID = 1 shl 0; + {$EXTERNALSYM DXSF_FORMAT_IS_CLSID} + DXSF_NO_LAZY_DDRAW_LOCK = 1 shl 1; + {$EXTERNALSYM DXSF_NO_LAZY_DDRAW_LOCK} + +type + DXBLTOPTIONS = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM DXBLTOPTIONS} + const + DXBOF_DO_OVER = 1 shl 0; + {$EXTERNALSYM DXBOF_DO_OVER} + DXBOF_DITHER = 1 shl 1; + {$EXTERNALSYM DXBOF_DITHER} + +type + DXSAMPLEFORMATENUM = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM DXSAMPLEFORMATENUM} + const + DXPF_FLAGSMASK = $FFFF0000; + {$EXTERNALSYM DXPF_FLAGSMASK} + DXPF_NONPREMULT = $00010000; + {$EXTERNALSYM DXPF_NONPREMULT} + DXPF_TRANSPARENCY = $00020000; + {$EXTERNALSYM DXPF_TRANSPARENCY} + DXPF_TRANSLUCENCY = $00040000; + {$EXTERNALSYM DXPF_TRANSLUCENCY} + DXPF_2BITERROR = $00200000; + {$EXTERNALSYM DXPF_2BITERROR} + DXPF_3BITERROR = $00300000; + {$EXTERNALSYM DXPF_3BITERROR} + DXPF_4BITERROR = $00400000; + {$EXTERNALSYM DXPF_4BITERROR} + DXPF_5BITERROR = $00500000; + {$EXTERNALSYM DXPF_5BITERROR} + DXPF_ERRORMASK = $00700000; + {$EXTERNALSYM DXPF_ERRORMASK} + DXPF_NONSTANDARD = $00000000; + {$EXTERNALSYM DXPF_NONSTANDARD} + DXPF_PMARGB32 = $00060001; + {$EXTERNALSYM DXPF_PMARGB32} + DXPF_ARGB32 = $00070002; + {$EXTERNALSYM DXPF_ARGB32} + DXPF_ARGB4444 = $00470003; + {$EXTERNALSYM DXPF_ARGB4444} + DXPF_A8 = $00060004; + {$EXTERNALSYM DXPF_A8} + DXPF_RGB32 = $00000005; + {$EXTERNALSYM DXPF_RGB32} + DXPF_RGB24 = $00000006; + {$EXTERNALSYM DXPF_RGB24} + DXPF_RGB565 = $00300007; + {$EXTERNALSYM DXPF_RGB565} + DXPF_RGB555 = $00300008; + {$EXTERNALSYM DXPF_RGB555} + DXPF_RGB8 = $00500009; + {$EXTERNALSYM DXPF_RGB8} + DXPF_ARGB1555 = $0032000A; + {$EXTERNALSYM DXPF_ARGB1555} + DXPF_RGB32_CK = $00020005; + {$EXTERNALSYM DXPF_RGB32_CK} + DXPF_RGB24_CK = $00020006; + {$EXTERNALSYM DXPF_RGB24_CK} + DXPF_RGB555_CK = $00320008; + {$EXTERNALSYM DXPF_RGB555_CK} + DXPF_RGB565_CK = $00320007; + {$EXTERNALSYM DXPF_RGB565_CK} + DXPF_RGB8_CK = $00520009; + {$EXTERNALSYM DXPF_RGB8_CK} + +type + DXLOCKSURF = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM DXLOCKSURF} + const + DXLOCKF_READ = 0; + {$EXTERNALSYM DXLOCKF_READ} + DXLOCKF_READWRITE = 1 shl 0; + {$EXTERNALSYM DXLOCKF_READWRITE} + DXLOCKF_EXISTINGINFOONLY = 1 shl 1; + {$EXTERNALSYM DXLOCKF_EXISTINGINFOONLY} + DXLOCKF_WANTRUNINFO = 1 shl 2; + {$EXTERNALSYM DXLOCKF_WANTRUNINFO} + DXLOCKF_NONPREMULT = 1 shl 16; + {$EXTERNALSYM DXLOCKF_NONPREMULT} + DXLOCKF_VALIDFLAGS = (DXLOCKF_READWRITE or DXLOCKF_EXISTINGINFOONLY or DXLOCKF_WANTRUNINFO or DXLOCKF_NONPREMULT); + {$EXTERNALSYM DXLOCKF_VALIDFLAGS} + +Type + DXSURFSTATUS = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM DXSURFSTATUS} + const + DXSURF_TRANSIENT = 1 shl 0; + {$EXTERNALSYM DXSURF_TRANSIENT} + DXSURF_READONLY = 1 shl 1; + {$EXTERNALSYM DXSURF_READONLY} + DXSURF_VALIDFLAGS = (DXSURF_TRANSIENT or DXSURF_READONLY); + {$EXTERNALSYM DXSURF_VALIDFLAGS} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXDCLock;'} + {$EXTERNALSYM IDXDCLock} + IDXDCLock = interface(IUnknown) + ['{0F619456-CF39-11D1-905E-00C04FD9189D}'] + (*** IDXDCLock methods ***) + function GetDC: HDC; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXSurface;'} + {$EXTERNALSYM IDXSurface} + IDXSurface = interface(IDXBaseObject) + ['{B39FD73F-E139-11D1-9065-00C04FD9189D}'] + (*** IDXSurface methods ***) + function GetPixelFormat(out pFormatID: TGUID; out pSampleFormatEnum: DXSAMPLEFORMATENUM): HResult; stdcall; + function GetBounds(out pBounds: TDXBNDS): HResult; stdcall; + function GetStatusFlags(out pdwStatusFlags: DWORD): HResult; stdcall; + function SetStatusFlags(dwStatusFlags: DWORD): HResult; stdcall; + function LockSurface(var pBounds: TDXBNDS; ulTimeOut: ULONG; dwFlags: DWORD; + const riid: TGUID; out ppPointer: Pointer; out pulGenerationId: ULONG): HResult; stdcall; + function GetDirectDrawSurface(const riid: TGUID; out ppSurface: Pointer): HResult; stdcall; + function GetColorKey(var pColorKey: TDXSAMPLE): HResult; stdcall; + function SetColorKey(ColorKey: TDXSAMPLE): HResult; stdcall; + function LockSurfaceDC(var pBounds: TDXBNDS; ulTimeOut: ULONG; dwFlags: DWORD; + out ppDCLock: IDXDCLock): HResult; stdcall; + function SetAppData(dwAppData: DWORD): HResult; stdcall; + function GetAppData(var pdwAppData: DWORD): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXSurfaceFactory;'} + {$EXTERNALSYM IDXSurfaceFactory} + IDXSurfaceFactory = interface(IUnknown) + ['{144946F5-C4D4-11D1-81D1-0000F87557DB}'] + (*** IDXSurfaceFactory methods ***) + function CreateSurface(pDirectDraw: IUnknown; var pDDSurfaceDesc: PDDSurfaceDesc; + const pFormatID: TGUID; var pBounds: TDXBNDS; dwFlags: DWORD; + punkOuter: IUnknown; const riid: TGUID; out ppDXSurface: Pointer): HResult; stdcall; + function CreateFromDDSurface(pDDrawSurface: IUnknown; const pFormatID: TGUID; + dwFlags: DWORD; punkOuter: IUnknown; const riid: TGUID; + out ppDXSurface: Pointer): HResult; stdcall; + function LoadImage(pszFileName: PWideChar; pDirectDraw: IUnknown; + pDDSurfaceDesc: PDDSURFACEDESC; const pFormatID: TGUID; const riid: TGUID; + out ppDXSurface: Pointer): HResult; stdcall; + function LoadImageFromStream(pStream: IStream; pDirectDraw: IUnknown; + pDDSurfaceDesc: PDDSURFACEDESC; const pFormatID: TGUID; + const riid: TGUID; out ppDXSurface: Pointer): HResult; stdcall; + function CopySurfaceToNewFormat(pSrc: IDXSurface; pDirectDraw: IUnknown; + pDDSurfaceDesc: PDDSURFACEDESC; const pDestFormatID: TGUID; + out ppNewSurface: IDXSurface): HResult; stdcall; + function CreateD3DRMTexture(pSrc: IDXSurface; pDirectDraw: IUnknown; + pD3DRM3: IUnknown; const riid: TGUID; out ppTexture3: Pointer): HResult; stdcall; + function BitBlt(pDest: IDXSurface; var pPlacement: TDXVEC; pSrc: IDXSurface; + var pClipBounds: TDXBNDS; dwFlags: DWORD): HResult; stdcall; + end; + + //convenient type declaration for IDXLookupTable + LUT = array[0..255] of Byte; + {$EXTERNALSYM LUT} + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXLookupTable;'} + {$EXTERNALSYM IDXLookupTable} + IDXLookupTable = interface(IDXBaseObject) + ['{01BAFC7F-9E63-11D1-9053-00C04FD9189D}'] + (*** IDXLookupTable methods ***) + function GetTables(RedLUT: LUT; GreenLUT: LUT; BlueLUT: LUT; AlphaLUT: LUT): HResult; stdcall; + function IsChannelIdentity(out pSampleBools: TDXBASESAMPLE): HResult; stdcall; + function GetIndexValues(Index: ULONG; out pSample: TDXBASESAMPLE): HResult; stdcall; + function ApplyTables(var pSamples: TDXSAMPLE; cSamples: ULONG): HResult; stdcall; + end; + + DXSURFMODCOMPOP = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM DXSURFMODCOMPOP} + const + DXSURFMOD_COMP_OVER = 0; + {$EXTERNALSYM DXSURFMOD_COMP_OVER} + DXSURFMOD_COMP_ALPHA_MASK = 1; + {$EXTERNALSYM DXSURFMOD_COMP_ALPHA_MASK} + DXSURFMOD_COMP_MAX_VALID = 1; + {$EXTERNALSYM DXSURFMOD_COMP_MAX_VALID} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXSurfaceModifier;'} + {$EXTERNALSYM IDXSurfaceModifier} + IDXSurfaceModifier = interface(IUnknown) + ['{9EA3B637-C37D-11D1-905E-00C04FD9189D}'] + (*** IDXSurfaceModifier methods ***) + function SetFillColor(Color: TDXSAMPLE): HResult; stdcall; + function GetFillColor(out pColor: TDXSAMPLE): HResult; stdcall; + function SetBounds(var pBounds: TDXBNDS): HResult; stdcall; + function SetBackground(pSurface: IDXSurface): HResult; stdcall; + function GetBackground(out ppSurface: IDXSurface): HResult; stdcall; + function SetCompositeOperation(CompOp: DXSURFMODCOMPOP): HResult; stdcall; + function GetCompositeOperation(out pCompOp: DXSURFMODCOMPOP): HResult; stdcall; + function SetForeground(pSurface: IDXSurface; bTile: BOOL; var pOrigin: TPOINT): HResult; stdcall; + function GetForeground(out ppSurface: IDXSurface; out pbTile: BOOL; out pOrigin: TPOINT): HResult; stdcall; + function SetOpacity(Opacity: Single): HResult; stdcall; + function GetOpacity(out pOpacity: Single): HResult; stdcall; + function SetLookup(pLookupTable: IDXLookupTable): HResult; stdcall; + function GetLookup(out ppLookupTable: IDXLookupTable): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXSurfaceInit;'} + {$EXTERNALSYM IDXSurfaceInit} + IDXSurfaceInit = interface(IUnknown) + ['{9EA3B639-C37D-11d1-905E-00C04FD9189D}'] + (*** IDXSurfaceInit methods ***) + function InitSurface(pDirectDraw: IUnknown; var pDDSurfaceDesc: TDDSURFACEDESC; + const pFormatID: TGUID; var pBounds: TDXBNDS; dwFlags: DWORD): HResult; stdcall; + end; + + DXRAWSURFACEINFO = record + pFirstByte : PBYTE; + lPitch : LongInt; + Width : ULONG; + Height : ULONG; + pPixelFormat : PGUID; + hdc : HDC; + dwColorKey : DWORD; + pPalette : ^TDXBASESAMPLE; + end; + {$EXTERNALSYM DXRAWSURFACEINFO} + TDXRawSurfaceInfo = DXRAWSURFACEINFO; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXRawSurface;'} + {$EXTERNALSYM IDXRawSurface} + IDXRawSurface = interface(IUnknown) + ['{09756C8A-D96A-11d1-9062-00C04FD9189D}'] + (*** IDXRawSurface methods ***) + function GetSurfaceInfo(var pSurfaceInfo: TDXRawSurfaceInfo): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXARGBSurfaceInit;'} + {$EXTERNALSYM IDXARGBSurfaceInit} + IDXARGBSurfaceInit = interface(IDXSurfaceInit) + ['{9EA3B63A-C37D-11d1-905E-00C04FD9189D}'] + (*** IDXARGBSurfaceInit methods ***) + function InitFromDDSurface(pDDrawSurface: IUnknown; const pFormatID: TGUID; + dwFlags: DWORD): HResult; stdcall; + function InitFromRawSurface(pRawSurface: IDXRawSurface): HResult; stdcall; + end; + + DXNATIVETYPEINFO = record + pCurrentData : ^BYTE; + pFirstByte : ^PBYTE; + lPitch : LongInt; + dwColorKey : DWORD; + end; + {$EXTERNALSYM DXNATIVETYPEINFO} + TDXNativeTypeInfo = DXNATIVETYPEINFO; + + DXPACKEDRECTDESC = record + pSamples : ^TDXBASESAMPLE; + bPremult : BOOL; + rect : TRECT; + lRowPadding : LongInt; + end; + {$EXTERNALSYM DXPACKEDRECTDESC} + TDXPackedRectDesc = DXPACKEDRECTDESC; + + DXOVERSAMPLEDESC = record + p : TPOINT; + Color : TDXPMSAMPLE; + end; + {$EXTERNALSYM DXOVERSAMPLEDESC} + TDXOverSampleDesc = DXOVERSAMPLEDESC; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXARGBReadPtr;'} + {$EXTERNALSYM IDXARGBReadPtr} + IDXARGBReadPtr = interface(IUnknown) + ['{EAAAC2D6-C290-11d1-905D-00C04FD9189D}'] + (*** IDXARGBReadPtr methods ***) + function GetSurface(const riid: TGUID; out ppSurface: pointer): HResult; stdcall; + function GetNativeType(out pInfo: TDXNativeTypeInfo): DXSAMPLEFORMATENUM; stdcall; + procedure Move(cSamples: LongInt); stdcall; + procedure MoveToRow(y: ULONG); stdcall; + procedure MoveToXY(x, y: ULONG); stdcall; + function MoveAndGetRunInfo(Row: ULONG; out ppInfo: PDXRUNINFO): ULONG; stdcall; + function Unpack(var pSamples: TDXSAMPLE; cSamples: ULONG; bMove: BOOL): TDXSAMPLE; stdcall; + function UnpackPremult(var pSamples: TDXPMSAMPLE; cSamples: ULONG; bMove: BOOL): TDXPMSAMPLE; stdcall; + procedure UnpackRect(var pRectDesc: TDXPackedRectDesc); stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXARGBReadWritePtr;'} + {$EXTERNALSYM IDXARGBReadWritePtr} + IDXARGBReadWritePtr = interface(IDXARGBReadPtr) + ['{EAAAC2D7-C290-11d1-905D-00C04FD9189D}'] + (*** IDXARGBReadWritePtr methods ***) + procedure PackAndMove(var pSamples: TDXSAMPLE; cSamples: ULONG); stdcall; + procedure PackPremultAndMove(var pSamples: TDXPMSAMPLE; cSamples: ULONG); stdcall; + procedure PackRect(var pRectDesc: TDXPackedRectDesc); stdcall; + procedure CopyAndMoveBoth(var pScratchBuffer: TDXBASESAMPLE; pSrc: IDXARGBReadPtr; + cSamples: ULONG; bIsOpaque: BOOL); stdcall; + procedure CopyRect(var pScratchBuffer: TDXBASESAMPLE; var pDestRect: TRECT; + pSrc: IDXARGBReadPtr; var pSrcOrigin: TPOINT; bIsOpaque: BOOL); stdcall; + procedure FillAndMove(var pScratchBuffer: TDXBASESAMPLE; SampVal: TDXPMSAMPLE; + cSamples: ULONG; bDoOver: BOOL); stdcall; + procedure FillRect(var pRect: TRECT; SampVal: TDXPMSAMPLE; bDoOver: BOOL); stdcall; + procedure OverSample(var pOverDesc: TDXOverSampleDesc); stdcall; + procedure OverArrayAndMove(var pScratchBuffer: TDXBASESAMPLE; var pSrc: TDXPMSAMPLE; + cSamples: ULONG); stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXTScaleOutput;'} + {$EXTERNALSYM IDXTScaleOutput} + IDXTScaleOutput = interface(IUnknown) + ['{B2024B50-EE77-11D1-9066-00C04FD9189D}'] + (*** IDXTScaleOutput methods ***) + function SetOutputSize(const OutSize: SIZE; bMaintainAspect: BOOL): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXGradient;'} + {$EXTERNALSYM IDXGradient} + IDXGradient = interface(IDXTScaleOutput) + ['{B2024B51-EE77-11D1-9066-00C04FD9189D}'] + (*** IDXGradient methods ***) + function SetGradient(StartColor: TDXSAMPLE; EndColor: TDXSAMPLE; bHorizontal: BOOL): HResult; stdcall; + function GetOutputSize(out pOutSize: SIZE): HResult; stdcall; + end; + + Scales = array[0..1] of Single; + {$EXTERNALSYM Scales} + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXTScale;'} + {$EXTERNALSYM IDXTScale} + IDXTScale = interface(IUnknown) + ['{B39FD742-E139-11D1-9065-00C04FD9189D}'] + (*** IDXTScale methods ***) + function SetScales(var Scales: Scales): HResult; stdcall; + function GetScales(out Scales: Scales): HResult; stdcall; + function ScaleFitToSize(var pClipBounds: TDXBNDS; FitToSize: SIZE; bMaintainAspect: BOOL): HResult; stdcall; + end; + + DISPIDDXEFFECT = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM DISPIDDXEFFECT} + const + DISPID_DXECAPABILITIES = 10000; + {$EXTERNALSYM DISPID_DXECAPABILITIES} + DISPID_DXEPROGRESS = DISPID_DXECAPABILITIES + 1; + {$EXTERNALSYM DISPID_DXEPROGRESS} + DISPID_DXESTEP = DISPID_DXEPROGRESS + 1; + {$EXTERNALSYM DISPID_DXESTEP} + DISPID_DXEDURATION = DISPID_DXESTEP + 1; + {$EXTERNALSYM DISPID_DXEDURATION} + DISPID_DXE_NEXT_ID = DISPID_DXEDURATION + 1; + {$EXTERNALSYM DISPID_DXE_NEXT_ID} + +type + DXEFFECTTYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM DXEFFECTTYPE} + const + DXTET_PERIODIC = 1 shl 0; + {$EXTERNALSYM DXTET_PERIODIC} + DXTET_MORPH = 1 shl 1; + {$EXTERNALSYM DXTET_MORPH} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IDXEffect;'} + {$EXTERNALSYM IDXEffect} + IDXEffect = interface(IDispatch) + ['{E31FB81B-1335-11d1-8189-0000F87557DB}'] + (*** IDXEffect methods ***) + function get_Capabilities(out pVal: LongInt): HResult; stdcall; + function get_Progress(out pVal: Single): HResult; stdcall; + function put_Progress(newVal: Single): HResult; stdcall; + function get_StepResolution(out pVal: Single): HResult; stdcall; + function get_Duration(out pVal: Single): HResult; stdcall; + function put_Duration(newVal: Single): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IHTMLDXTransform;'} + {$EXTERNALSYM IHTMLDXTransform} + IHTMLDXTransform = interface(IUnknown) + ['{30E2AB7D-4FDD-4159-B7EA-DC722BF4ADE5}'] + (*** IHTMLDXTransform methods ***) + function SetHostUrl(bstrHostUrl: WideString): HResult; stdcall; + end; + +//------------------------------------------------------------------------------ +// File: QEdit.h +// Desc: Dexter library (DES) +// Copyright (c) 1999 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +const + LIBID_DexterLib: TGUID = '{78530B68-61F9-11D2-8CAD-00A024580902}'; + {$EXTERNALSYM LIBID_DexterLib} + + IID_IPropertySetter : TGUID = '{AE9472BD-B0C3-11D2-8D24-00A0C9441E20}'; + {$EXTERNALSYM IID_IPropertySetter} + IID_IDxtCompositor : TGUID = '{BB44391E-6ABD-422F-9E2E-385C9DFF51FC}'; + {$EXTERNALSYM IID_IDxtCompositor} + IID_IDxtAlphaSetter : TGUID = '{4EE9EAD9-DA4D-43D0-9383-06B90C08B12B}'; + {$EXTERNALSYM IID_IDxtAlphaSetter} + IID_IDxtJpeg : TGUID = '{DE75D011-7A65-11D2-8CEA-00A0C9441E20}'; + {$EXTERNALSYM IID_IDxtJpeg} + IID_IDxtKey : TGUID = '{3255DE56-38FB-4901-B980-94B438010D7B}'; + {$EXTERNALSYM IID_IDxtKey} + IID_IMediaLocator : TGUID = '{288581E0-66CE-11D2-918F-00C0DF10D434}'; + {$EXTERNALSYM IID_IMediaLocator} + IID_IMediaDet : TGUID = '{65BD0710-24D2-4FF7-9324-ED2E5D3ABAFA}'; + {$EXTERNALSYM IID_IMediaDet} + IID_IGrfCache : TGUID = '{AE9472BE-B0C3-11D2-8D24-00A0C9441E20}'; + {$EXTERNALSYM IID_IGrfCache} + IID_IRenderEngine : TGUID = '{6BEE3A81-66C9-11D2-918F-00C0DF10D434}'; + {$EXTERNALSYM IID_IRenderEngine} + IID_IRenderEngine2 : TGUID = '{6BEE3A82-66C9-11d2-918F-00C0DF10D434}'; + {$EXTERNALSYM IID_IRenderEngine2} + IID_IFindCompressorCB : TGUID = '{F03FA8DE-879A-4D59-9B2C-26BB1CF83461}'; + {$EXTERNALSYM IID_IFindCompressorCB} + IID_ISmartRenderEngine : TGUID = '{F03FA8CE-879A-4D59-9B2C-26BB1CF83461}'; + {$EXTERNALSYM IID_ISmartRenderEngine} + IID_IAMTimelineObj : TGUID = '{78530B77-61F9-11D2-8CAD-00A024580902}'; + {$EXTERNALSYM IID_IAMTimelineObj} + IID_IAMTimelineEffectable : TGUID = '{EAE58537-622E-11D2-8CAD-00A024580902}'; + {$EXTERNALSYM IID_IAMTimelineEffectable} + IID_IAMTimelineEffect : TGUID = '{BCE0C264-622D-11D2-8CAD-00A024580902}'; + {$EXTERNALSYM IID_IAMTimelineEffect} + IID_IAMTimelineTransable : TGUID = '{378FA386-622E-11D2-8CAD-00A024580902}'; + {$EXTERNALSYM IID_IAMTimelineTransable} + IID_IAMTimelineSplittable : TGUID = '{A0F840A0-D590-11D2-8D55-00A0C9441E20}'; + {$EXTERNALSYM IID_IAMTimelineSplittable} + IID_IAMTimelineTrans : TGUID = '{BCE0C265-622D-11D2-8CAD-00A024580902}'; + {$EXTERNALSYM IID_IAMTimelineTrans} + IID_IAMTimelineSrc : TGUID = '{78530B79-61F9-11D2-8CAD-00A024580902}'; + {$EXTERNALSYM IID_IAMTimelineSrc} + IID_IAMTimelineTrack : TGUID = '{EAE58538-622E-11D2-8CAD-00A024580902}'; + {$EXTERNALSYM IID_IAMTimelineTrack} + IID_IAMTimelineVirtualTrack : TGUID = '{A8ED5F80-C2C7-11D2-8D39-00A0C9441E20}'; + {$EXTERNALSYM IID_IAMTimelineVirtualTrack} + IID_IAMTimelineComp : TGUID = '{EAE58536-622E-11D2-8CAD-00A024580902}'; + {$EXTERNALSYM IID_IAMTimelineComp} + IID_IAMTimelineGroup : TGUID = '{9EED4F00-B8A6-11D2-8023-00C0DF10D434}'; + {$EXTERNALSYM IID_IAMTimelineGroup} + IID_IAMTimeline : TGUID = '{78530B74-61F9-11D2-8CAD-00A024580902}'; + {$EXTERNALSYM IID_IAMTimeline} + IID_IXml2Dex : TGUID = '{18C628ED-962A-11D2-8D08-00A0C9441E20}'; + {$EXTERNALSYM IID_IXml2Dex} + IID_IAMErrorLog : TGUID = '{E43E73A2-0EFA-11D3-9601-00A0C9441E20}'; + {$EXTERNALSYM IID_IAMErrorLog} + IID_IAMSetErrorLog : TGUID = '{963566DA-BE21-4EAF-88E9-35704F8F52A1}'; + {$EXTERNALSYM IID_IAMSetErrorLog} + IID_ISampleGrabberCB : TGUID = '{0579154A-2B53-4994-B0D0-E773148EFF85}'; + {$EXTERNALSYM IID_ISampleGrabberCB} + IID_ISampleGrabber : TGUID = '{6B652FFF-11FE-4FCE-92AD-0266B5D7C78F}'; + {$EXTERNALSYM IID_ISampleGrabber} + IID_IResize : TGUID = '{4ada63a0-72d5-11d2-952a-0060081840bc}'; + {$EXTERNALSYM IID_IResize} + + CLSID_AMTimeline : TGUID = '{78530B75-61F9-11D2-8CAD-00A024580902}'; + {$EXTERNALSYM CLSID_AMTimeline} + CLSID_AMTimelineObj : TGUID = '{78530B78-61F9-11D2-8CAD-00A024580902}'; + {$EXTERNALSYM CLSID_AMTimelineObj} + CLSID_AMTimelineSrc : TGUID = '{78530B7A-61F9-11D2-8CAD-00A024580902}'; + {$EXTERNALSYM CLSID_AMTimelineSrc} + CLSID_AMTimelineTrack : TGUID = '{8F6C3C50-897B-11D2-8CFB-00A0C9441E20}'; + {$EXTERNALSYM CLSID_AMTimelineTrack} + CLSID_AMTimelineComp : TGUID = '{74D2EC80-6233-11D2-8CAD-00A024580902}'; + {$EXTERNALSYM CLSID_AMTimelineComp} + CLSID_AMTimelineGroup : TGUID = '{F6D371E1-B8A6-11D2-8023-00C0DF10D434}'; + {$EXTERNALSYM CLSID_AMTimelineGroup} + CLSID_AMTimelineTrans : TGUID = '{74D2EC81-6233-11D2-8CAD-00A024580902}'; + {$EXTERNALSYM CLSID_AMTimelineTrans} + CLSID_AMTimelineEffect : TGUID = '{74D2EC82-6233-11D2-8CAD-00A024580902}'; + {$EXTERNALSYM CLSID_AMTimelineEffect} + CLSID_RenderEngine : TGUID = '{64D8A8E0-80A2-11D2-8CF3-00A0C9441E20}'; + {$EXTERNALSYM CLSID_RenderEngine} + CLSID_SmartRenderEngine : TGUID = '{498B0949-BBE9-4072-98BE-6CCAEB79DC6F}'; + {$EXTERNALSYM CLSID_SmartRenderEngine} + CLSID_AudMixer : TGUID = '{036A9790-C153-11D2-9EF7-006008039E37}'; + {$EXTERNALSYM CLSID_AudMixer} + CLSID_Xml2Dex : TGUID = '{18C628EE-962A-11D2-8D08-00A0C9441E20}'; + {$EXTERNALSYM CLSID_Xml2Dex} + CLSID_MediaLocator : TGUID = '{CC1101F2-79DC-11D2-8CE6-00A0C9441E20}'; + {$EXTERNALSYM CLSID_MediaLocator} + CLSID_PropertySetter : TGUID = '{ADF95821-DED7-11D2-ACBE-0080C75E246E}'; + {$EXTERNALSYM CLSID_PropertySetter} + CLSID_MediaDet : TGUID = '{65BD0711-24D2-4FF7-9324-ED2E5D3ABAFA}'; + {$EXTERNALSYM CLSID_MediaDet} + CLSID_SampleGrabber : TGUID = '{C1F400A0-3F08-11D3-9F0B-006008039E37}'; + {$EXTERNALSYM CLSID_SampleGrabber} + CLSID_NullRenderer : TGUID = '{C1F400A4-3F08-11D3-9F0B-006008039E37}'; + {$EXTERNALSYM CLSID_NullRenderer} + CLSID_DxtCompositor : TGUID = '{BB44391D-6ABD-422F-9E2E-385C9DFF51FC}'; + {$EXTERNALSYM CLSID_DxtCompositor} + CLSID_DxtAlphaSetter : TGUID = '{506D89AE-909A-44F7-9444-ABD575896E35}'; + {$EXTERNALSYM CLSID_DxtAlphaSetter} + CLSID_DxtJpeg : TGUID = '{DE75D012-7A65-11D2-8CEA-00A0C9441E20}'; + {$EXTERNALSYM CLSID_DxtJpeg} + CLSID_ColorSource : TGUID = '{0CFDD070-581A-11D2-9EE6-006008039E37}'; + {$EXTERNALSYM CLSID_ColorSource} + CLSID_DxtKey : TGUID = '{C5B19592-145E-11D3-9F04-006008039E37}'; + {$EXTERNALSYM CLSID_DxtKey} + +type + // used by DEXTER_VALUE's dwInterp var + DEXTERF = ( + DEXTERF_JUMP, + DEXTERF_INTERPOLATE + ); + {$EXTERNALSYM DEXTERF} + TDexterF = DEXTERF; + + // used to set values on the property setter + PDexterParam = ^TDexterParam; + DEXTER_PARAM = record + Name : WideString ; + dispID : longint; + nValues : longint; + end; + {$EXTERNALSYM DEXTER_PARAM} + TDexterParam = DEXTER_PARAM; + + // used to set values on the property setter + PDexterValue = ^TDexterValue; + DEXTER_VALUE = record + v : OLEVARIANT ; + rt : TReferenceTime ; + dwInterp : DWORD ; + end; + {$EXTERNALSYM DEXTER_VALUE} + TDexterValue = DEXTER_VALUE; + +const + // used by bMethod directly below + DEXTER_AUDIO_JUMP = 0; + {$EXTERNALSYM DEXTER_AUDIO_JUMP} + DEXTER_AUDIO_INTERPOLATE = DEXTER_AUDIO_JUMP + 1; + {$EXTERNALSYM DEXTER_AUDIO_INTERPOLATE} + +type + // used to set volumes on the mixer and mixer pins + DEXTER_AUDIO_VOLUMEENVELOPE = record + rtEnd : TReferenceTime ; + dLevel : double ; + bMethod : BOOL ; + end; + {$EXTERNALSYM DEXTER_AUDIO_VOLUMEENVELOPE} + TDexterAudioVolumeEnvelope = DEXTER_AUDIO_VOLUMEENVELOPE; + +const + // used in IAMTimeline::Get(Set)InsertMode + TIMELINE_INSERT_MODE_INSERT = 1; + {$EXTERNALSYM TIMELINE_INSERT_MODE_INSERT} + TIMELINE_INSERT_MODE_OVERLAY = 2; + {$EXTERNALSYM TIMELINE_INSERT_MODE_OVERLAY} + + // define what main 'things' can be put into the timeline tree. + // these values are used quite a bit with timeline access + // (bitmap mask flags) +// TIMELINE_MAJOR_TYPE + TIMELINE_MAJOR_TYPE_COMPOSITE = 1; + {$EXTERNALSYM TIMELINE_MAJOR_TYPE_COMPOSITE} + TIMELINE_MAJOR_TYPE_TRACK = 2; + {$EXTERNALSYM TIMELINE_MAJOR_TYPE_TRACK} + TIMELINE_MAJOR_TYPE_SOURCE = 4; + {$EXTERNALSYM TIMELINE_MAJOR_TYPE_SOURCE} + TIMELINE_MAJOR_TYPE_TRANSITION = 8; + {$EXTERNALSYM TIMELINE_MAJOR_TYPE_TRANSITION} + TIMELINE_MAJOR_TYPE_EFFECT = 16; + {$EXTERNALSYM TIMELINE_MAJOR_TYPE_EFFECT} + TIMELINE_MAJOR_TYPE_GROUP = 128; + {$EXTERNALSYM TIMELINE_MAJOR_TYPE_GROUP} + +// used in various IAMTimelineXXX "search" functions. Look in this +// file for "SearchDirection" to see where it's used. I didn't want +// to use an enum as an interface param type, so I used a long. Probably +// silly of me. +// DEXTERF_TRACK_SEARCH_FLAGS + DEXTERF_BOUNDING = -1; + {$EXTERNALSYM DEXTERF_BOUNDING} + DEXTERF_EXACTLY_AT = 0; + {$EXTERNALSYM DEXTERF_EXACTLY_AT} + DEXTERF_FORWARDS = 1; + {$EXTERNALSYM DEXTERF_FORWARDS} + +type + // right now, the media type in the group contains enough information about + // how we want to recompress. This might not be enough information in the + // future, so we define a structure we can get and set to the group. + _SCompFmt0 = record + nFormatId : longint ; + MediaType : TAMMediaType ; + end; + {$EXTERNALSYM _SCompFmt0} + SCompFmt0 = _SCompFmt0; + {$EXTERNALSYM SCompFmt0} + TSCompFmt0 = _SCompFmt0; + +const + // used in IAMTimelineSrc::Get(Set)StretchMode + RESIZEF_STRETCH = 0; + {$EXTERNALSYM RESIZEF_STRETCH} + RESIZEF_CROP = RESIZEF_STRETCH + 1; + {$EXTERNALSYM RESIZEF_CROP} + RESIZEF_PRESERVEASPECTRATIO = RESIZEF_CROP + 1; + {$EXTERNALSYM RESIZEF_PRESERVEASPECTRATIO} + RESIZEF_PRESERVEASPECTRATIO_NOLETTERBOX = RESIZEF_PRESERVEASPECTRATIO + 1; + {$EXTERNALSYM RESIZEF_PRESERVEASPECTRATIO_NOLETTERBOX} + + // used in IRenderEngine::SetDynamicReconnectLevel + // (bitmap mask flags) + CONNECTF_DYNAMIC_NONE = 0; + {$EXTERNALSYM CONNECTF_DYNAMIC_NONE} + CONNECTF_DYNAMIC_SOURCES = $1; + {$EXTERNALSYM CONNECTF_DYNAMIC_SOURCES} + CONNECTF_DYNAMIC_EFFECTS = $2; + {$EXTERNALSYM CONNECTF_DYNAMIC_EFFECTS} + + // used in + // IMediaLocator::FindMediaFile + // IRenderEngine::SetSourceNameValidation + // IAMTimeline::ValidateSourceNames + // (bitmap mask flags) + SFN_VALIDATEF_CHECK = $1; + {$EXTERNALSYM SFN_VALIDATEF_CHECK} + SFN_VALIDATEF_POPUP = $2; + {$EXTERNALSYM SFN_VALIDATEF_POPUP} + SFN_VALIDATEF_TELLME = $4; + {$EXTERNALSYM SFN_VALIDATEF_TELLME} + SFN_VALIDATEF_REPLACE = $8; + {$EXTERNALSYM SFN_VALIDATEF_REPLACE} + SFN_VALIDATEF_USELOCAL = $10; + {$EXTERNALSYM SFN_VALIDATEF_USELOCAL} + SFN_VALIDATEF_NOFIND = $20; + {$EXTERNALSYM SFN_VALIDATEF_NOFIND} + SFN_VALIDATEF_IGNOREMUTED = $40; + {$EXTERNALSYM SFN_VALIDATEF_IGNOREMUTED} + SFN_VALIDATEF_END = SFN_VALIDATEF_IGNOREMUTED + 1; + {$EXTERNALSYM SFN_VALIDATEF_END} + + // key transitions types + DXTKEY_RGB = 0; + {$EXTERNALSYM DXTKEY_RGB} + DXTKEY_NONRED = DXTKEY_RGB + 1; + {$EXTERNALSYM DXTKEY_NONRED} + DXTKEY_LUMINANCE = DXTKEY_NONRED + 1; + {$EXTERNALSYM DXTKEY_LUMINANCE} + DXTKEY_ALPHA = DXTKEY_LUMINANCE + 1; + {$EXTERNALSYM DXTKEY_ALPHA} + DXTKEY_HUE = DXTKEY_ALPHA + 1; + {$EXTERNALSYM DXTKEY_HUE} + +type + //////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////// + // New Property setting Interfaces + //////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////// + + {$HPPEMIT 'typedef System::DelphiInterface _di_IPropertySetter;'} + {$EXTERNALSYM IPropertySetter} + IPropertySetter = interface(IUnknown) + ['{AE9472BD-B0C3-11D2-8D24-00A0C9441E20}'] + (*** IPropertySetter methods ***) + // for loading and saving through XML + function LoadXML(pxml: IUnknown): HResult; stdcall; + // !!! doesn't work HResult LoadXML([in] IXMLElement * pxml); + function PrintXML(out pszXML: pchar; cbXML: integer; out pcbPrinted: pinteger; indent: integer): HResult; stdcall; + // for cloning a portion of the props when splitting the object + function CloneProps(out ppSetter: IPropertySetter; rtStart, rtStop: TReferenceTime): HResult; stdcall; + // for loading and saving programmatically + // caller must call this in pre-sorted order, this time must be > all + // previous times + function AddProp(Param: TDexterParam; var paValue: TDexterValue): HResult; stdcall; + function GetProps(out pcParams: longint; out paParam: PDexterParam; out paValue: PDexterValue): HResult; stdcall; + // after calling GetProps, you must call FreeProps to free resources + function FreeProps(cParams: longint; var paParam: TDexterParam; var paValue: TDexterValue): HResult; stdcall; + // to empty to property setter, so you can start over again + function ClearProps: HResult; stdcall; + // for persisting + function SaveToBlob(out pcSize: longint; out ppb: pbyte): HResult; stdcall; + // + function LoadFromBlob(cSize: longint; var pb: Byte): HResult; stdcall; + // to program the object that supports IDispatch with the props + // call with rtNow == -1 to set Static Props when your object instantiates + // errors will be logged, if a log is provided + function SetProps(pTarget: IUnknown; rtNow: TReferenceTime): HResult; stdcall; + // unicode version + function PrintXMLW({out}pszXML: PWideChar; cchXML: integer; out pcchPrinted: integer; indent: integer): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDxtCompositor;'} + {$EXTERNALSYM IDxtCompositor} + IDxtCompositor = interface(IDXEffect) + ['{BB44391E-6ABD-422F-9E2E-385C9DFF51FC}'] + (*** IDxtCompositor methods ***) + function get_OffsetX(out pVal: longint): HResult; stdcall; + function put_OffsetX(newVal: longint): HResult; stdcall; + function get_OffsetY(out pVal: longint): HResult; stdcall; + function put_OffsetY(newVal: longint): HResult; stdcall; + function get_Width(out pVal: longint): HResult; stdcall; + function put_Width(newVal: longint): HResult; stdcall; + function get_Height(out pVal: longint): HResult; stdcall; + function put_Height(newVal: longint): HResult; stdcall; + function get_SrcOffsetX(out pVal: longint): HResult; stdcall; + function put_SrcOffsetX(newVal: longint): HResult; stdcall; + function get_SrcOffsetY(out pVal: longint): HResult; stdcall; + function put_SrcOffsetY(newVal: longint): HResult; stdcall; + function get_SrcWidth(out pVal: longint): HResult; stdcall; + function put_SrcWidth(newVal: longint): HResult; stdcall; + function get_SrcHeight(out pVal: longint): HResult; stdcall; + function put_SrcHeight(newVal: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDxtAlphaSetter;'} + {$EXTERNALSYM IDxtAlphaSetter} + IDxtAlphaSetter = interface(IDXEffect) + ['{4EE9EAD9-DA4D-43D0-9383-06B90C08B12B}'] + (*** IDxtAlphaSetter methods ***) + function get_Alpha(out pVal: longint): HResult; stdcall; + function put_Alpha(newVal: longint): HResult; stdcall; + function get_AlphaRamp(out pVal: Double): HResult; stdcall; + function put_AlphaRamp(newVal: Double): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDxtJpeg;'} + {$EXTERNALSYM IDxtJpeg} + IDxtJpeg = interface(IDXEffect) + ['{DE75D011-7A65-11D2-8CEA-00A0C9441E20}'] + (*** IDxtJpeg methods ***) + function get_MaskNum(out pVal: longint): HResult; stdcall; + function put_MaskNum(newVal: longint): HResult; stdcall; + function get_MaskName(out pVal: WideString): HResult; stdcall; + function put_MaskName(newVal: WideString): HResult; stdcall; + function get_ScaleX(out pVal: Double): HResult; stdcall; + function put_ScaleX(newVal: Double): HResult; stdcall; + function get_ScaleY(out pVal: Double): HResult; stdcall; + function put_ScaleY(newVal: Double): HResult; stdcall; + function get_OffsetX(out pVal: longint): HResult; stdcall; + function put_OffsetX(newVal: longint): HResult; stdcall; + function get_OffsetY(out pVal: longint): HResult; stdcall; + function put_OffsetY(newVal: longint): HResult; stdcall; + function get_ReplicateX(out pVal: longint): HResult; stdcall; + function put_ReplicateX(newVal: longint): HResult; stdcall; + function get_ReplicateY(out pVal: longint): HResult; stdcall; + function put_ReplicateY(newVal: longint): HResult; stdcall; + function get_BorderColor(out pVal: longint): HResult; stdcall; + function put_BorderColor(newVal: longint): HResult; stdcall; + function get_BorderWidth(out pVal: longint): HResult; stdcall; + function put_BorderWidth(newVal: longint): HResult; stdcall; + function get_BorderSoftness(out pVal: longint): HResult; stdcall; + function put_BorderSoftness(newVal: longint): HResult; stdcall; + function ApplyChanges: HResult; stdcall; + function LoadDefSettings: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IDxtKey;'} + {$EXTERNALSYM IDxtKey} + IDxtKey = interface(IDXEffect) + ['{3255DE56-38FB-4901-B980-94B438010D7B}'] + (*** IDxtKey methods ***) + function get_KeyType(out pVal: integer): HResult; stdcall; + function put_KeyType(newVal: integer): HResult; stdcall; + function get_Hue(out pVal: integer): HResult; stdcall; + function put_Hue(newVal: integer): HResult; stdcall; + function get_Luminance(out pVal: integer): HResult; stdcall; + function put_Luminance(newVal: integer): HResult; stdcall; + function get_RGB(out pVal: DWORD): HResult; stdcall; + function put_RGB(newVal: DWORD): HResult; stdcall; + function get_Similarity(out pVal: integer): HResult; stdcall; + function put_Similarity(newVal: integer): HResult; stdcall; + function get_Invert(out pVal: BOOL): HResult; stdcall; + function put_Invert(newVal: BOOL): HResult; stdcall; + end; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // This little COM interface will look 'around' for the closest + // path match for a given file. If the file already exists, then + // this interface should hardly do anything. If it's not found, + // it will go look for it and if successful, return S_FALSE. If it + // cannot find the file, it will call the hook, if set and return + // it's return code. if the hook is not set, it is in a type of + // error condition. The Dexter-provided MediaLocator will bring up + // a dialog box asking you to browse for your file. Other COM + // objects may do something else. + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaLocator;'} + {$EXTERNALSYM IMediaLocator} + IMediaLocator = interface(IUnknown) + ['{288581E0-66CE-11D2-918F-00C0DF10D434}'] + (*** IMediaLocator methods ***) + function FindMediaFile(Input: TBSTR; FilterString: TBSTR; + out pOutput: TBSTR; Flags: longint): HResult; stdcall; + function AddFoundLocation(DirectoryName: TBSTR): HResult; stdcall; + end; + + ISampleGrabber = interface; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // This object provides caching of duration and stream type + // information for files that would produce a directshow source + // filter. It takes too long to figure this out in DShow right + // now, so this is one way around it. The way it works is that + // you first fill out the Filename property, then call and + // ask how many streams it has, or, set the CurrentStream prop + // and then ask for the per-stream properties, StreamType or + // StreamLength. They both reference the CurrentStream prop that + // you set. I also allowed you (for convenience) to just give + // it a IUnknown Filter that represents an IBaseFilter source + // filter that is NOT currently in a graph. It will use that + // instead. When using this, though, you will not get cached + // values. The cached values are stored in the system's ini file + // called DCBC2A70-70D8-4459-BFFA-E0D61DEA3FDF.INI. Nice, huh? :-) + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaDet;'} + {$EXTERNALSYM IMediaDet} + IMediaDet = interface(IUnknown) + ['{65BD0710-24D2-4FF7-9324-ED2E5D3ABAFA}'] + (*** IMediaDet methods ***) + function get_Filter(out pVal: IUnknown): HResult; stdcall; + function put_Filter(newVal: IUnknown): HResult; stdcall; + function get_OutputStreams(out pVal: longint): HResult; stdcall; + function get_CurrentStream(out pVal: longint): HResult; stdcall; + function put_CurrentStream(newVal: longint): HResult; stdcall; + function get_StreamType(out pVal: TGUID): HResult; stdcall; + function get_StreamTypeB(out pVal: WideString): HResult; stdcall; + function get_StreamLength(out pVal: Double): HResult; stdcall; + function get_Filename(out pVal: WideString): HResult; stdcall; + function put_Filename(pVal: WideString): HResult; stdcall; + function GetBitmapBits(streamTime: Double; pBufferSize: Plongint; pBuffer: PByte; + Width: longint; Height: longint): HResult; stdcall; + function WriteBitmapBits(streamTime: Double; Width: longint; Height: longint; + Filename: WideString): HResult; stdcall; + function get_StreamMediaType(out pVal: TAMMediaType): HResult; stdcall; + function GetSampleGrabber(out ppVal: ISampleGrabber): HResult; stdcall; + function get_FrameRate(out pVal: Double): HResult; stdcall; + function EnterBitmapGrabMode(SeekTime: Double): HResult; stdcall; + end; + + // useless interface, don't use it! + + {$HPPEMIT 'typedef System::DelphiInterface _di_IGrfCache;'} + {$EXTERNALSYM IGrfCache} + IGrfCache = interface(IDispatch) + ['{AE9472BE-B0C3-11D2-8D24-00A0C9441E20}'] + (*** IGrfCache methods ***) + function AddFilter(ChainedCache: IGrfCache; Id: Int64; const pFilter: IBaseFilter; + pName: PWideChar): HResult; stdcall; + function ConnectPins(ChainedCache: IGrfCache; PinID1: Int64; const pPin1: IPin; + PinID2: Int64; const pPin2: IPin): HResult; stdcall; + function SetGraph(const pGraph: IGraphBuilder): HResult; stdcall; + function DoConnectionsNow: HResult; stdcall; + end; + + IAMTimeline = interface; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // The RenderEngin builds a graph from the timeline and gives + // you some simple positional commands. + // explained methods: + // SetTimelineObject - tell the render engine who to parse + // ConnectEverything - build up a graph based on the timeline + // ScrapIt - throw away graph and everything + // GetFilterGraph - get the graph that's built up, if any + // SetFilterGraph - allows you to preset the graph that's built up. + // cannot call this if there already is a graph. + + // !!! the following methods are unused/not implemented + + // SetInterestRange - discard COM objects and memory outside of this + // range, if possible. Used for scrubbing on a long timeline and + // freeing up resources + // SetRenderRange - pretend like a portion of the timeline IS the timeline + // and don't connect anything in the graph outside of that range. + // Commit - allocate what's necessary and get prepared to run + // Decommit - free anything possible + // GetCaps - find out some info about the render engine + // DoSmartRecompression - connect compressed sources if + // possible + // in the graph, this will RenderPin( ) on every switcher + // rendering pin. + // SetSourceNameValidation - allows you to set some flags which + // determine how source files are found, if they need to be found. + // FilterString is a list of extensions to find for the media + // files (see OPENFILENAME filters) + // pOverride is a media locator you would like to use instead + // of the built in one + // The flags are defined in the struct immediately below. + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {$HPPEMIT 'typedef System::DelphiInterface _di_IRenderEngine;'} + {$EXTERNALSYM IRenderEngine} + IRenderEngine = interface(IUnknown) + ['{6BEE3A81-66C9-11D2-918F-00C0DF10D434}'] + (*** IRenderEngine methods ***) + function SetTimelineObject(pTimeline: IAMTimeline): HResult; stdcall; + function GetTimelineObject(out ppTimeline: IAMTimeline): HResult; stdcall; + function GetFilterGraph(out ppFG: IGraphBuilder): HResult; stdcall; + function SetFilterGraph(pFG: IGraphBuilder): HResult; stdcall; + function SetInterestRange(Start, Stop: TReferenceTime): HResult; stdcall; + function SetInterestRange2(Start, Stop: Double): HResult; stdcall; + function SetRenderRange(Start, Stop: TReferenceTime): HResult; stdcall; + function SetRenderRange2(Start, Stop: Double): HResult; stdcall; + function GetGroupOutputPin(Group: longint; out ppRenderPin: IPin): HResult; stdcall; + function ScrapIt: HResult; stdcall; + function RenderOutputPins: HResult; stdcall; + function GetVendorString(out pVendorID: WideString): HResult; stdcall; + function ConnectFrontEnd: HResult; stdcall; + function SetSourceConnectCallback(pCallback: IGrfCache): HResult; stdcall; + function SetDynamicReconnectLevel(Level: longint): HResult; stdcall; + function DoSmartRecompression: HResult; stdcall; + function UseInSmartRecompressionGraph: HResult; stdcall; + function SetSourceNameValidation(const FilterString: WideString; + pOverride: IMediaLocator; Flags: longint): HResult; stdcall; + function Commit: HResult; stdcall; + function Decommit: HResult; stdcall; + function GetCaps(Index: longint; var pReturn: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IRenderEngine2;'} + {$EXTERNALSYM IRenderEngine2} + IRenderEngine2 = interface(IUnknown) + ['{6BEE3A82-66C9-11d2-918F-00C0DF10D434}'] + (*** IRenderEngine2 methods ***) + function SetResizerGUID(const ResizerGuid: TGUID): HResult; + end; + + // used for the smart render engine when it needs to find a compressor + {$HPPEMIT 'typedef System::DelphiInterface _di_IFindCompressorCB;'} + {$EXTERNALSYM IFindCompressorCB} + IFindCompressorCB = interface(IUnknown) + ['{F03FA8DE-879A-4D59-9B2C-26BB1CF83461}'] + (*** IFindCompressorCB methods ***) + function GetCompressor(var pType: TAMMediaType; var pCompType: TAMMediaType; + out ppFilter: IBaseFilter): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_ISmartRenderEngine;'} + {$EXTERNALSYM ISmartRenderEngine} + ISmartRenderEngine = interface(IUnknown) + ['{F03FA8CE-879A-4D59-9B2C-26BB1CF83461}'] + (*** ISmartRenderEngine methods ***) + function SetGroupCompressor(Group: longint; pCompressor: IBaseFilter): HResult; stdcall; + function GetGroupCompressor(Group: longint; var pCompressor: IBaseFilter): HResult; stdcall; + function SetFindCompressorCB(pCallback: IFindCompressorCB): HResult; stdcall; + end; + + IAMTimelineGroup = interface; + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// TIMELINE TIMELINE TIMELINE TIMELINE TIMELINE TIMELINE +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Every object on the timeline supports at least this interface. + // explained methods: + // Get/SetStartStop - the timeline times at which this object is + // active. Groups and Tracks have start times of zero. + // FixTimes - used by the render engine. Rounds the input times + // to the nearest FPS of the parent Group, for use in setting + // up the big switch. + // GetSubObject - get the sub-object which is associated with this + // timeline object. Each timeline object can carry around a + // pointer to 'something else'. For our Render Engine, this is + // a pointer to a filter that gets put into a graph. + // NOTE: Getting the subobject will FORCE it to load if it's possible + // to force this. If you don't want it to do this, don't call + // this function. + // SetSubObject - see GetSubObject + // SetSubObjectGUID - instead of giving the node a pointer, you can + // instead give it a GUID and see if this works instead. The + // sub-object will attempt to be instantiated when 'necessary' + // which is really when it's asked for with GetSubObject./ + // !!! a better way to do this perhaps? + // GetSubObjectLoaded - ask if the sub-object pointer is set + // Get/SetTimelineType - return the major type which is stored here, + // used by the API user and the render engine. + // Get/SetTimelineSubType - see above + // Get/SetUserID - get and set a number, any number + // GetGenID - every created object has a unique number to it. Used + // by the render engine. + // Get/SetUserName - a storable name, for users of the API + // Get/SetPropertySetter - the object that will set properties for this + // object (it will support IPropertySetter and it is created by + // CPropertySetter) + // Get/SetUserData - gets the persistant data used by the user of + // the API. + // Get/SetMuted - set whether this object should be active or not. + // Setting a parent of other objects off also turns off the + // sub-objects. + // Get/SetLocked - set whether you can edit this object or not. + // Note: the timeline doesn't enforce this, it just stores + // a value for convenience. + // Get/SetDirtyRange - + // RemoveAll - remove this object, and if in the tree already, all it's + // sub objects, including children + // Remove - remove this object, and if in the tree already, all it's + // sub objects, but not kids + // GetTimelineNoRef - called internally by the timeline. + // GetGroupIBelongTo - called internally by the timeline. + // GetEmbedDepth - find out how many tracks we are a part of + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTimelineObj;'} + {$EXTERNALSYM IAMTimelineObj} + IAMTimelineObj = interface(IUnknown) + ['{78530B77-61F9-11D2-8CAD-00A024580902}'] + (*** IAMTimelineObj methods ***) + function GetStartStop(var pStart, pStop: TReferenceTime): HResult; stdcall; + function GetStartStop2(var pStart, pStop: TREFTIME): HResult; stdcall; + function FixTimes(var pStart, pStop: TReferenceTime): HResult; stdcall; + function FixTimes2(var pStart, pStop: TREFTIME): HResult; stdcall; + function SetStartStop(Start, Stop: TReferenceTime): HResult; stdcall; + function SetStartStop2(Start, Stop: TREFTIME): HResult; stdcall; + function GetPropertySetter(out pVal: IPropertySetter): HResult; stdcall; + function SetPropertySetter(newVal: IPropertySetter): HResult; stdcall; + function GetSubObject(out pVal: IUnknown): HResult; stdcall; + function SetSubObject(newVal: IUnknown): HResult; stdcall; + function SetSubObjectGUID(newVal: TGUID): HResult; stdcall; + function SetSubObjectGUIDB(const newVal: WideString): HResult; stdcall; + function GetSubObjectGUID(var pVal: TGUID): HResult; stdcall; + function GetSubObjectGUIDB(out pVal: WideString): HResult; stdcall; + function GetSubObjectLoaded(var pVal: BOOL): HResult; stdcall; + function GetTimelineType(var pVal: integer): HResult; stdcall; // TIMELINE_MAJOR_TYPE + function SetTimelineType(newVal: integer): HResult; stdcall; // TIMELINE_MAJOR_TYPE + function GetUserID(var pVal: longint): HResult; stdcall; + function SetUserID(newVal: longint): HResult; stdcall; + function GetGenID(var pVal: longint): HResult; stdcall; + function GetUserName(out pVal: WideString): HResult; stdcall; + function SetUserName(const newVal: WideString): HResult; stdcall; + function GetUserData(var pData: PByte; var pSize: Integer): HResult; stdcall; + function SetUserData(var pData: Byte; Size: Integer): HResult; stdcall; + function GetMuted(var pVal: BOOL): HResult; stdcall; + function SetMuted(newVal: BOOL): HResult; stdcall; + function GetLocked(var pVal: BOOL): HResult; stdcall; + function SetLocked(newVal: BOOL): HResult; stdcall; + function GetDirtyRange(var pStart, pStop: TReferenceTime): HResult; stdcall; + function GetDirtyRange2(var pStart, pStop: TREFTIME): HResult; stdcall; + function SetDirtyRange(Start, Stop: TReferenceTime): HResult; stdcall; + function SetDirtyRange2(Start, Stop: TREFTIME): HResult; stdcall; + function ClearDirty: HResult; stdcall; + function Remove: HResult; stdcall; + function RemoveAll: HResult; stdcall; + function GetTimelineNoRef(var ppResult: IAMTimeline): HResult; stdcall; + function GetGroupIBelongTo(out ppGroup: IAMTimelineGroup): HResult; stdcall; + function GetEmbedDepth(var pVal: longint): HResult; stdcall; + end; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Any object on the timeline that can have an effect put on it + // implements this interface. This includes sources, tracks, and + // compositions. + // explained methods: + // EffectInsBefore - insert an effect at the given priority onto + // this object. The effect's times will be clipped within + // this object's bounds. Use -1 to specify 'at the end' for priority. + // You cannot have two effects at the same priority. + // EffectSwapPriorities - swaparoo two effects. Makes undo easier to + // implement. + // EffectGetCount - get how many effects are applied to this object. + // GetEffect - get the nth effect applied to this object + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTimelineEffectable;'} + {$EXTERNALSYM IAMTimelineEffectable} + IAMTimelineEffectable = interface(IUnknown) + ['{EAE58537-622E-11D2-8CAD-00A024580902}'] + (*** IAMTimelineEffectable methods ***) + function EffectInsBefore(pFX: IAMTimelineObj; priority: longint): HResult; stdcall; + function EffectSwapPriorities(PriorityA, PriorityB: longint): HResult; stdcall; + function EffectGetCount(var pCount: longint): HResult; stdcall; + function GetEffect(out ppFx: IAMTimelineObj; Which: longint): HResult; stdcall; + end; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Any effect on the timeline will support at least this interface. + // NOTE: The Start/Stop times on this object are RELATIVE to their + // parent's, as are all start/stop times. + // explained methods: + // EffectGetPriority - finds out this effect's priority related to the others. + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTimelineEffect;'} + {$EXTERNALSYM IAMTimelineEffect} + IAMTimelineEffect = interface(IUnknown) + ['{BCE0C264-622D-11D2-8CAD-00A024580902}'] + (*** IAMTimelineEffect methods ***) + function EffectGetPriority(var pVal: longint): HResult; stdcall; + end; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Any object on the timeline that can have a transition put on it + // implements this interface + // explained methods: + // TransAdd - add a transition on this object. Multiple trans's on + // the same object cannot overlap in time. Transitions' times + // must lie within the bounds of their parent. + // TransGetCount - get how many transitions are applied to this + // object. + // GetNextTrans - given a time, get the next transition that happens + // on this object after that time. On exit, the input time is + // set to the start time of the transition. + // GetTransAtTime - find a transition forwards or backwards from + // a given spot. See DEXTERF_TRACK_SEARCH_FLAGS enum. + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTimelineTransable;'} + {$EXTERNALSYM IAMTimelineTransable} + IAMTimelineTransable = interface(IUnknown) + ['{378FA386-622E-11D2-8CAD-00A024580902}'] + (*** IAMTimelineTransable methods ***) + function TransAdd(pTrans: IAMTimelineObj): HResult; stdcall; + function TransGetCount(var pCount: longint): HResult; stdcall; + function GetNextTrans(out ppTrans: IAMTimelineObj; var pInOut: TReferenceTime): HResult; stdcall; + function GetNextTrans2(out ppTrans: IAMTimelineObj; var pInOut: TREFTIME): HResult; stdcall; + function GetTransAtTime(out ppObj: IAMTimelineObj; Time: TReferenceTime; SearchDirection: longint): HResult; stdcall; + function GetTransAtTime2(out ppObj: IAMTimelineObj; Time: TREFTIME; SearchDirection: longint): HResult; stdcall; + end; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Any object on the timeline that can be split into two will + // implement this interface. Namely, source, effects, and transitions + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTimelineSplittable;'} + {$EXTERNALSYM IAMTimelineSplittable} + IAMTimelineSplittable = interface(IUnknown) + ['{A0F840A0-D590-11D2-8D55-00A0C9441E20}'] + (*** IAMTimelineSplittable methods ***) + function SplitAt(Time: TReferenceTime): HResult; stdcall; + function SplitAt2(Time: TREFTIME): HResult; stdcall; + end; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Any trans on the timeline will support at least this interface. + // NOTE: The Start/Stop times on this object are RELATIVE to their + // parent's, as are all start/stop times. + // explained methods: + // GetCutPoint - get where this transition should cut from A to B + // if the transition were not applied. + // GetA2B - get if this transition is to go from A->B or B->A. + // GetBackwards - get if this transition should run backwards. + // GetCutsOnly - force no transition, force doing a cut + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTimelineTrans;'} + {$EXTERNALSYM IAMTimelineTrans} + IAMTimelineTrans = interface(IUnknown) + ['{BCE0C265-622D-11D2-8CAD-00A024580902}'] + (*** IAMTimelineTrans methods ***) + function GetCutPoint(var pTLTime: TReferenceTime): HResult; stdcall; + function GetCutPoint2(var pTLTime: TREFTIME): HResult; stdcall; + function SetCutPoint(TLTime: TReferenceTime): HResult; stdcall; + function SetCutPoint2(TLTime: TREFTIME): HResult; stdcall; + function GetSwapInputs(var pVal: BOOL): HResult; stdcall; + function SetSwapInputs(pVal: BOOL): HResult; stdcall; + function GetCutsOnly(var pVal: BOOL): HResult; stdcall; + function SetCutsOnly(pVal: BOOL): HResult; stdcall; + end; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Sources represent any source media object on the timeline. + // They extend an IAMTimelineObj to include media start and stop + // times, a media name (which could represent darned near anything), + // and a StreamNumber, which defines which stream out of a potential + // many this stream represents from a source clip. + // explained methods: + // ModifyStopTime - like calling SetStartStop, but this method just + // adjusts the tail end of the clip. + // FixMediaTimes - called by the render engine to round times to + // this source clip's parent group's FPS. + // SpliceWithNext - if the next clip after this is the same source + // and this's stop time matches next's start time, the two + // will be joined. + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTimelineSrc;'} + {$EXTERNALSYM IAMTimelineSrc} + IAMTimelineSrc = interface(IUnknown) + ['{78530B79-61F9-11D2-8CAD-00A024580902}'] + (*** IAMTimelineSrc methods ***) + function GetMediaTimes(var pStart, pStop: TReferenceTime): HResult; stdcall; + function GetMediaTimes2(var pStart, pStop: TREFTIME): HResult; stdcall; + function ModifyStopTime(Stop: TReferenceTime): HResult; stdcall; + function ModifyStopTime2(Stop: TREFTIME): HResult; stdcall; + function FixMediaTimes(var pStart, pStop: TReferenceTime): HResult; stdcall; + function FixMediaTimes2(var pStart, pStop: TREFTIME): HResult; stdcall; + function SetMediaTimes(Start, Stop: TReferenceTime): HResult; stdcall; + function SetMediaTimes2(Start, Stop: TREFTIME): HResult; stdcall; + function SetMediaLength(Length: TReferenceTime): HResult; stdcall; + function SetMediaLength2(Length: TREFTIME): HResult; stdcall; + function GetMediaLength(var pLength: TReferenceTime): HResult; stdcall; + function GetMediaLength2(var pLength: TREFTIME): HResult; stdcall; + function GetMediaName(out pVal: WideString): HResult; stdcall; + function SetMediaName(const newVal: WideString): HResult; stdcall; + function SpliceWithNext(pNext: IAMTimelineObj): HResult; stdcall; + function GetStreamNumber(var pVal: longint): HResult; stdcall; + function SetStreamNumber(Val: longint): HResult; stdcall; + function IsNormalRate(var pVal: BOOL): HResult; stdcall; + // If a source can't figure out its frames per second, this number + // will be used (eg: Dib sequences). AVI, MPEG, etc. will not need this + // Use 0 fps to prevent a filename like "ski4.jpg" from using a dib seq + function GetDefaultFPS(var pFPS: Double): HResult; stdcall; + function SetDefaultFPS(FPS: Double): HResult; stdcall; + // !!! This is video specific.. new interface? + // what kind of stretching? Stretch, crop, or preserve aspect ratio? + function GetStretchMode(var pnStretchMode: integer): HResult; stdcall; + function SetStretchMode(nStretchMode: integer): HResult; stdcall; + end; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Tracks are things that can contain media in them. You can add + // and remove sources, effects, and transitions from them. Sources + // are added according to the current insert mode of the timeline. + // If in OVERLAY mode, moving or adding a source to a time that's + // already occupied by another source will wipe out any overlapping + // portion of the underlying source. In InsertMode, everything at + // the insert point is moved down in time to make room for the + // new source. + // explained methods: + // SrcAdd - add the source to this track. The source's start/stop + // times must be set up first. + // GetNextSrc - pass a time in at which you wish to find a source + // and it will return the first source which occurs after the + // given time. + // MoveEverythingBy - bump a bunch of objects a certain direction + // on the track by a given time. + // GetSourcesCount - how many sources are on this track? + // AreYouBlank - do you contain anything at all? + // GetSrcAtTime - find a source at a given time. SearchDirection + // is which way to search. -1 = backwards, 1 = forwards + // MakeSpace - !!! what does this do, anyhow? + // RemoveSlice - !!! what does this do, anyhow? + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTimelineTrack;'} + {$EXTERNALSYM IAMTimelineTrack} + IAMTimelineTrack = interface(IUnknown) + ['{EAE58538-622E-11D2-8CAD-00A024580902}'] + (*** IAMTimelineTrack methods ***) + function SrcAdd(pSource: IAMTimelineObj): HResult; stdcall; + function GetNextSrc(out ppSrc: IAMTimelineObj; var pInOut: TReferenceTime): HResult; stdcall; + function GetNextSrc2(out ppSrc: IAMTimelineObj; var pInOut: TREFTIME): HResult; stdcall; + function MoveEverythingBy(Start, MoveBy: TReferenceTime): HResult; stdcall; + function MoveEverythingBy2(Start, MoveBy: TREFTIME): HResult; stdcall; + function GetSourcesCount(var pVal: longint): HResult; stdcall; + function AreYouBlank(var pVal: longint): HResult; stdcall; + function GetSrcAtTime(out ppSrc: IAMTimelineObj; Time: TReferenceTime; SearchDirection: longint): HResult; stdcall; + function GetSrcAtTime2(out ppSrc: IAMTimelineObj; Time: TREFTIME; SearchDirection: longint): HResult; stdcall; + function InsertSpace(rtStart, rtEnd: TReferenceTime): HResult; stdcall; + function InsertSpace2(rtStart, rtEnd: TREFTIME): HResult; stdcall; + function ZeroBetween(rtStart, rtEnd: TReferenceTime): HResult; stdcall; + function ZeroBetween2(rtStart, rtEnd: TREFTIME): HResult; stdcall; + function GetNextSrcEx(pLast: IAMTimelineObj; out ppNext: IAMTimelineObj): HResult; stdcall; + end; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // This virtual track interface is shared by both the compositions + // and tracks (and groups). + // explained methods: + // TrackGetPriority - used by rendering objects which need to know this. + // SetTrackDirty - !!! not sure if this is useful. + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTimelineVirtualTrack;'} + {$EXTERNALSYM IAMTimelineVirtualTrack} + IAMTimelineVirtualTrack = interface(IUnknown) + ['{A8ED5F80-C2C7-11D2-8D39-00A0C9441E20}'] + (*** IAMTimelineVirtualTrack methods ***) + function TrackGetPriority(var pPriority: longint): HResult; stdcall; + function SetTrackDirty: HResult; stdcall; + end; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Compositions are like tracks in the sense that they also + // implement IAMVirtualTrack and you can put transitions and effects + // on them, but they really are the SUM of those tracks that they + // contain. They are "embedded" compositions. They should only contain + // media of one particular type (like all video or all audio), but + // this is not enforced. You can add a composition to another + // composition with VTrackInsBefore, just like you can add a track. + // The very top composition to which all other comps and tracks belong + // is a Group, which supports I-AMTimelineGroup as well as I-AMTimelineComp. + // explained methods: + // VTrackInsBefore - does NOT mean VideoTrack. Means Virtual Track. + // Adds a virtual track to a composition at a given priority. + // use -1 to mean "at the end" + // VTrackSwapPriorities - switch two vtracks around. + // VTrackGetCount - get how many vtracks this comp contains. + // GetVTrack - you get the idea + // GetCountOfType - Get the total number of these objects this comp + // and all it's vtracks (recursively) contains. !!! this may be dead. + // GetRecursiveLayerOfType - given a number, returns a given track. This + // is done recursively. You need to pass in a pointer to the number, + // and it will be modified upon exit to an unknown value. DO NOT + // CALL THE VERSION WITH THE POINTER! + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTimelineComp;'} + {$EXTERNALSYM IAMTimelineComp} + IAMTimelineComp = interface(IUnknown) + ['{EAE58536-622E-11D2-8CAD-00A024580902}'] + (*** IAMTimelineComp methods ***) + function VTrackInsBefore(pVirtualTrack: IAMTimelineObj; priority: longint): HResult; stdcall; + function VTrackSwapPriorities(VirtualTrackA, VirtualTrackB: longint): HResult; stdcall; + function VTrackGetCount(var pVal: longint): HResult; stdcall; + function GetVTrack(out ppVirtualTrack: IAMTimelineObj; Which: longint): HResult; stdcall; + function GetCountOfType(var pVal, pValWithComps: longint; majortype: integer): HResult; stdcall; // TIMELINE_MAJOR_TYPE + function GetRecursiveLayerOfType(out ppVirtualTrack: IAMTimelineObj; WhichLayer: longint; + Type_: integer): HResult; stdcall; // TIMELINE_MAJOR_TYPE + function GetRecursiveLayerOfTypeI(out ppVirtualTrack: IAMTimelineObj; + var pWhichLayer: longint; Type_: integer): HResult; stdcall; // TIMELINE_MAJOR_TYPE + function GetNextVTrack(pVirtualTrack: IAMTimelineObj; out ppNextVirtualTrack: IAMTimelineObj): HResult; stdcall; + end; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Groups represent the topmost composition in a timeline. Every + // group should contain media of only one major type (like all video). + // The timeline can contain multiple groups, see it's interface for + // this. Each group has a particular "media type" that you can get/set + // which help identify it. Each group has an associated FPS which + // is used by the render engine in setting up the big switch. All + // cuts on the timeline will happen rounded to this nearest FPS for + // this particular group. Each group has a priority which enables + // writing out multiple-stream files with 1 or more streams of the + // same type. (Like a 2 video stream AVI file). + // explained methods: + // SetTimeline - this is called internally when the group is added. + // Do not call this. + // GetTimeline - get the timeline this group belongs to. + // GetPriority - get this group's priority + // Get/SetOutputFPS - explained above + // SetMediaTypeForVB - method for VB. Pass in 0 for video, 1 for audio + // SetRecompFormatFromSource - set the recompress format based on the + // source that's loaded or set in the IAMTimelineSrc + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTimelineGroup;'} + {$EXTERNALSYM IAMTimelineGroup} + IAMTimelineGroup = interface(IUnknown) + ['{9EED4F00-B8A6-11D2-8023-00C0DF10D434}'] + (*** IAMTimelineGroup methods ***) + function SetTimeline(pTimeline: IAMTimeline): HResult; stdcall; + function GetTimeline(out ppTimeline: IAMTimeline): HResult; stdcall; + function GetPriority(var pPriority: longint): HResult; stdcall; + function GetMediaType(out value: TAMMediaType): HResult; stdcall; + function SetMediaType(value: PAMMediaType): HResult; stdcall; + function SetOutputFPS(FPS: Double): HResult; stdcall; + function GetOutputFPS(var pFPS: Double): HResult; stdcall; + function SetGroupName(const pGroupName: WideString): HResult; stdcall; + function GetGroupName(out pGroupName: WideString): HResult; stdcall; + function SetPreviewMode(fPreview: BOOL): HResult; stdcall; + function GetPreviewMode(var pfPreview: BOOL): HResult; stdcall; + function SetMediaTypeForVB(Val: longint): HResult; stdcall; + function GetOutputBuffering(out pnBuffer: integer): HResult; stdcall; + function SetOutputBuffering(nBuffer: integer): HResult; stdcall; + function SetSmartRecompressFormat(var pFormat: longint): HResult; stdcall; + function GetSmartRecompressFormat(ppFormat: Plongint): HResult; stdcall; + function IsSmartRecompressFormatSet(var pVal: BOOL): HResult; stdcall; + function IsRecompressFormatDirty(var pVal: BOOL): HResult; stdcall; + function ClearRecompressFormatDirty: HResult; stdcall; + function SetRecompFormatFromSource(pSource: IAMTimelineSrc): HResult; stdcall; + end; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // The main timeline. This is the base object you use to set + // properties of the timeline as a whole, and to create blank + // objects for use within the timeline. You cannot create the + // objects using COM methods, you must go through the timeline to + // create this. That's because certain information is set before + // handing the object back to you. Every object created by the + // timeline will support at LEAST IAMTimelineObj. For any timeline, + // it can have one or more "groups" that it knows about. Each group + // has the capability to hold a complete sub-tree containing media + // that is all of one type. This logical seperation is used for the + // rendering engine, but is not strictly enforced. + // explained methods: + // CreateEmptyNode - pass in a mid type and it will pass back + // an object of the type you requested. + // AddGroup - add a created group to the tree + // RemGroupFromList - make sure timeline no longer knows about this group. + // does NOT do anything to the group itself. Normally the user + // does not want to call this, it's called from the Group's Remove( ) method. + // GetGroup - get a certain group + // GetGroupCount - get how many groups + // ClearAllGroups - clear everything + // GetInsertMode - ask what the insert mode is, overlay or insert + // SetInsertMode - set whether to insert or overlay + // EnableTransitions - turn transitions on or off as a whole + // EnableEffects - same deal. + // SetIntererstRange - discard sub-objects outside of a given + // time range, to save memory/resources + // Get/SetDefaultFPS - set the 'default' FPS for this timeline, + // the RenderEngine reads this information for setting itself up + // by default. + // GetCountOfType - ask for how many of a given thing are in a given + // group. !!! this may be a useless function. + // !!! not implemented + // IsDirty - asks if anything in the timeline needs to be redrawn + // GetDirtyRange - same deal + // ValidateSourceNames - make sure the filenames in the sources + // really exist. Use the same enum flags as the render engine + // uses for setsourcenamevalidation. source's filenames will be + // changed to those of the found ones in the timeline. + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMTimeline;'} + {$EXTERNALSYM IAMTimeline} + IAMTimeline = interface(IUnknown) + ['{78530B74-61F9-11D2-8CAD-00A024580902}'] + (*** IAMTimeline methods ***) + function CreateEmptyNode(out ppObj: IAMTimelineObj; Type_: integer): HResult; stdcall; // TIMELINE_MAJOR_TYPE + function AddGroup(pGroup: IAMTimelineObj): HResult; stdcall; + function RemGroupFromList(pGroup: IAMTimelineObj): HResult; stdcall; + function GetGroup(out ppGroup: IAMTimelineObj; WhichGroup: longint): HResult; stdcall; + function GetGroupCount(var pCount: longint): HResult; stdcall; + function ClearAllGroups: HResult; stdcall; + function GetInsertMode(var pMode: longint): HResult; stdcall; + function SetInsertMode(Mode: longint): HResult; stdcall; + function EnableTransitions(fEnabled: BOOL): HResult; stdcall; + function TransitionsEnabled(var pfEnabled: BOOL): HResult; stdcall; + function EnableEffects(fEnabled: BOOL): HResult; stdcall; + function EffectsEnabled(var pfEnabled: BOOL): HResult; stdcall; + function SetInterestRange(Start, Stop: TReferenceTime): HResult; stdcall; + function GetDuration(var pDuration: TReferenceTime): HResult; stdcall; + function GetDuration2(var pDuration: Double): HResult; stdcall; + function SetDefaultFPS(FPS: Double): HResult; stdcall; + function GetDefaultFPS(var pFPS: Double): HResult; stdcall; + function IsDirty(var pDirty: BOOL): HResult; stdcall; + function GetDirtyRange(var pStart, pStop: TReferenceTime): HResult; stdcall; + function GetCountOfType(Group: longint; var pVal, pValWithComps: longint; + majortype: integer): HResult; stdcall; // TIMELINE_MAJOR_TYPE + function ValidateSourceNames(ValidateFlags: longint; pOverride: IMediaLocator; + NotifyEventHandle: integer): HResult; stdcall; + function SetDefaultTransition(const pGuid: TGUID): HResult; stdcall; + function GetDefaultTransition(var pGuid: TGUID): HResult; stdcall; + function SetDefaultEffect(const pGuid: TGUID): HResult; stdcall; + function GetDefaultEffect(var pGuid: TGUID): HResult; stdcall; + function SetDefaultTransitionB(const pGuid: WideString): HResult; stdcall; + function GetDefaultTransitionB(out pGuid: WideString): HResult; stdcall; + function SetDefaultEffectB(const pGuid: WideString): HResult; stdcall; + function GetDefaultEffectB(out pGuid: WideString): HResult; stdcall; + end; + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// XML STUFF --- XML STUFF --- XML STUFF --- XML STUFF --- XML +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// + +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// Xml2Dex - converts back and forth between XML and a dexter project +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + {$HPPEMIT 'typedef System::DelphiInterface _di_IXml2Dex;'} + {$EXTERNALSYM IXml2Dex} + IXml2Dex = interface(IDispatch) + ['{18C628ED-962A-11D2-8D08-00A0C9441E20}'] + (*** IXml2Dex methods ***) + function CreateGraphFromFile(out ppGraph: IUnknown; pTimeline: IUnknown; + const Filename: WideString): HResult; stdcall; + function WriteGrfFile(pGraph: IUnknown; const Filename: WideString): HResult; stdcall; + function WriteXMLFile(pTimeline: IUnknown; const Filename: WideString): HResult; stdcall; + function ReadXMLFile(pTimeline: IUnknown; const XMLName: WideString): HResult; stdcall; + function Delete(pTimeline: IUnknown; dStart, dEnd: Double): HResult; stdcall; + function WriteXMLPart(pTimeline: IUnknown; dStart, dEnd: Double; + const Filename: WideString): HResult; stdcall; + function PasteXMLFile(pTimeline: IUnknown; dStart: Double; const Filename: WideString): HResult; stdcall; + function CopyXML(pTimeline: IUnknown; dStart, dEnd: Double): HResult; stdcall; + function PasteXML(pTimeline: IUnknown; dStart: Double): HResult; stdcall; + function Reset: HResult; stdcall; + function ReadXML(pTimeline: IUnknown; pxml: IUnknown): HResult; stdcall; + function WriteXML(pTimeline: IUnknown; var pbstrXML: WideString): HResult; stdcall; + end; + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// USEFUL HELPER INTERFACES +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// + +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// IAMErrorLog - an interface that receives error information from +// a timeline or a render engine. +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMErrorLog;'} + {$EXTERNALSYM IAMErrorLog} + IAMErrorLog = interface(IUnknown) + ['{E43E73A2-0EFA-11D3-9601-00A0C9441E20}'] + (*** IAMErrorLog methods ***) + function LogError(Severity: longint; const pErrorString: WideString; ErrorCode: longint; + HResult: longint; var pExtraInfo: OleVariant): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMSetErrorLog;'} + {$EXTERNALSYM IAMSetErrorLog} + IAMSetErrorLog = interface(IUnknown) + ['{963566DA-BE21-4EAF-88E9-35704F8F52A1}'] + (*** IAMSetErrorLog methods ***) + function get_ErrorLog(out pVal: IAMErrorLog): HResult; stdcall; + function put_ErrorLog(pVal: IAMErrorLog): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_ISampleGrabberCB;'} + {$EXTERNALSYM ISampleGrabberCB} + ISampleGrabberCB = interface(IUnknown) + ['{0579154A-2B53-4994-B0D0-E773148EFF85}'] + (*** ISampleGrabberCB methods ***) + function SampleCB(SampleTime: Double; pSample: IMediaSample): HResult; stdcall; + function BufferCB(SampleTime: Double; pBuffer: PByte; BufferLen: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_ISampleGrabber;'} + {$EXTERNALSYM ISampleGrabber} + ISampleGrabber = interface(IUnknown) + ['{6B652FFF-11FE-4FCE-92AD-0266B5D7C78F}'] + (*** ISampleGrabber methods ***) + // set this to have the filter immediate stop after + // garnishing a sample + function SetOneShot(OneShot: BOOL): HResult; stdcall; + // set what media type we connect to. It can be partially + // specified by setting only the major type, OR the major and + // subtype, OR major, subtype, and the formattype. + function SetMediaType(var pType: TAMMediaType): HResult; stdcall; + // after something's connected to this filter, find out + // what it is + function GetConnectedMediaType(out pType: TAMMediaType): HResult; stdcall; + // call this to buffer incoming samples, so the next two methods will work + // If this is not called, the next two methods will return + // E_INVALIDARG + function SetBufferSamples(BufferThem: BOOL): HResult; stdcall; + // pass in NULL for pBuffer to get out the buffer size you need to + // allocate. This will NOT return a pointer to a compressed dib + // any longer! It will return the IMediaSample's GetPointer buffer. + function GetCurrentBuffer(var pBufferSize: longint; pBuffer: Pointer): HResult; stdcall; + // return the currently buffered sample + function GetCurrentSample(out ppSample: IMediaSample): HResult; stdcall; + // if this callback is set, then it will be called for + // every sample passing through the filter. Do not take a long time + // in the callback for smooth playback (obviously!) + function SetCallback(pCallback: ISampleGrabberCB; WhichMethodToCallback: longint): HResult; stdcall; + end; + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // resize the input video to an output size, for uniformity within DES. + // DES will set the output media type and probably also put_Size. By setting + // the output media type, DES is stating the resizer must produce only that + // media type on the output pin, unless it is succeeded by a put_Size call. + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + {$HPPEMIT 'typedef System::DelphiInterface _di_IResize;'} + {$EXTERNALSYM IResize} + IResize = interface(IUnknown) + ['{4ada63a0-72d5-11d2-952a-0060081840bc}'] + (*** IResize methods ***) + function get_Size(out piHeight, piWidth: Integer; out pFlag: LongInt): HResult; stdcall; + function get_InputSize(out piHeight, piWidth: Integer): HResult; stdcall; + function put_Size(Height, Width: Integer; Flag: LongInt): HResult; stdcall; + function get_MediaType(out pmt: TAMMediaType): HResult; stdcall; + function put_MediaType(pmt: PAMMediaType): HResult; stdcall; + end; + +const + E_NOTINTREE = HResult($80040400); + {$EXTERNALSYM E_NOTINTREE} + E_RENDER_ENGINE_IS_BROKEN = HResult($80040401); + {$EXTERNALSYM E_RENDER_ENGINE_IS_BROKEN} + E_MUST_INIT_RENDERER = HResult($80040402); + {$EXTERNALSYM E_MUST_INIT_RENDERER} + E_NOTDETERMINED = HResult($80040403); + {$EXTERNALSYM E_NOTDETERMINED} + E_NO_TIMELINE = HResult($80040404); + {$EXTERNALSYM E_NO_TIMELINE} + S_WARN_OUTPUTRESET = 40404; + {$EXTERNALSYM S_WARN_OUTPUTRESET} + +// These codes are given to the app in IAMErrorLog to help identify what went wrong + +// Filename doesn't exist, or DShow doesn't recognize the filetype +// EXTRA - filename + DEX_IDS_BAD_SOURCE_NAME = 1400; + {$EXTERNALSYM DEX_IDS_BAD_SOURCE_NAME} + +// Filename doesn't exist or contains unknown data +// EXTRA - filename (maybe no codec?) + DEX_IDS_BAD_SOURCE_NAME2 = 1401; + {$EXTERNALSYM DEX_IDS_BAD_SOURCE_NAME2} + +// filename was required, but wasn't given + DEX_IDS_MISSING_SOURCE_NAME = 1402; + {$EXTERNALSYM DEX_IDS_MISSING_SOURCE_NAME} + +// cannot parse data provided by this source +// !!! what source? + DEX_IDS_UNKNOWN_SOURCE = 1403; + {$EXTERNALSYM DEX_IDS_UNKNOWN_SOURCE} + +// unexpected error - some DShow component not installed correctly + DEX_IDS_INSTALL_PROBLEM = 1404; + {$EXTERNALSYM DEX_IDS_INSTALL_PROBLEM} + +// Source filter does not accept filenames +// !!! What source? + DEX_IDS_NO_SOURCE_NAMES = 1405; + {$EXTERNALSYM DEX_IDS_NO_SOURCE_NAMES} + +// The group's mediatype is not supported +// EXTRA - gives you an integer group number + DEX_IDS_BAD_MEDIATYPE = 1406; + {$EXTERNALSYM DEX_IDS_BAD_MEDIATYPE} + +// Invalid stream number for a source +// EXTRA - gives the stream number !!! should identify which source! + DEX_IDS_STREAM_NUMBER = 1407; + {$EXTERNALSYM DEX_IDS_STREAM_NUMBER} + +// You ran out of memory + DEX_IDS_OUTOFMEMORY = 1408; + {$EXTERNALSYM DEX_IDS_OUTOFMEMORY} + +// One bitmap in a sequence was not the same type as the others +// EXTRA - gives the bitmap name + DEX_IDS_DIBSEQ_NOTALLSAME = 1409; + {$EXTERNALSYM DEX_IDS_DIBSEQ_NOTALLSAME} + +// Clip's mediatimes are invalid, or DibSeq too short, or a previous error caused this +// !!! Needs to give the clip name + DEX_IDS_CLIPTOOSHORT = 1410; + {$EXTERNALSYM DEX_IDS_CLIPTOOSHORT} + +// Clsid of FX/Transition is not a DirectX Transform +// EXTRA - gives the CLSID + DEX_IDS_INVALID_DXT = 1411; + {$EXTERNALSYM DEX_IDS_INVALID_DXT} + +// Default FX/Transition Clsid is not a DirectX Transform" +// EXTRA - gives the CLSID + DEX_IDS_INVALID_DEFAULT_DXT = 1412; + {$EXTERNALSYM DEX_IDS_INVALID_DEFAULT_DXT} + +// Your version of DX doesn't support 3D transforms" +// EXTRA - gives the CLSID of the 3D transform you tried to use + DEX_IDS_NO_3D = 1413; + {$EXTERNALSYM DEX_IDS_NO_3D} + +// This DirectX Transform is not the right kind, or is broken +// EXTRA - gives the CLSID of the broken transform + DEX_IDS_BROKEN_DXT = 1414; + {$EXTERNALSYM DEX_IDS_BROKEN_DXT} + +// No such property exists on an object +// EXTRA - gives the name of the property (if given as a string) + DEX_IDS_NO_SUCH_PROPERTY = 1415; + {$EXTERNALSYM DEX_IDS_NO_SUCH_PROPERTY} + +// Illegal value for a property +// EXTRA - gives the VARIANT value that was illegal + DEX_IDS_ILLEGAL_PROPERTY_VAL = 1416; + {$EXTERNALSYM DEX_IDS_ILLEGAL_PROPERTY_VAL} + +// Syntax error in XML file at line: +// EXTRA - gives I4 line number, if available + DEX_IDS_INVALID_XML = 1417; + {$EXTERNALSYM DEX_IDS_INVALID_XML} + +// Can't find filter specified in XML by Category and Instance +// EXTRA - gives friendly name (instance) + DEX_IDS_CANT_FIND_FILTER = 1418; + {$EXTERNALSYM DEX_IDS_CANT_FIND_FILTER} + +// Disk error writing XML file + DEX_IDS_DISK_WRITE_ERROR = 1419; + {$EXTERNALSYM DEX_IDS_DISK_WRITE_ERROR} + +// Clsid not a valid DShow audio effect filter +// EXTRA - gives the CLSID + DEX_IDS_INVALID_AUDIO_FX = 1420; + {$EXTERNALSYM DEX_IDS_INVALID_AUDIO_FX} + +// Cannot find compressor for smart recompression type + DEX_IDS_CANT_FIND_COMPRESSOR = 1421; + {$EXTERNALSYM DEX_IDS_CANT_FIND_COMPRESSOR} + + + +// !!! Here go problems hooking up sources or finding codecs + + +// THE FOLLOWING SHOULD NEVER HAPPEN - please call me if they do + +// Unexpected error in parsing the timeline + DEX_IDS_TIMELINE_PARSE = 1426; + {$EXTERNALSYM DEX_IDS_TIMELINE_PARSE} +// Unexpected error building the filtergraph + DEX_IDS_GRAPH_ERROR = 1427; + {$EXTERNALSYM DEX_IDS_GRAPH_ERROR} +// Unexpected error with the internal grid + DEX_IDS_GRID_ERROR = 1428; + {$EXTERNALSYM DEX_IDS_GRID_ERROR} +// Unexpected error getting an interface + DEX_IDS_INTERFACE_ERROR = 1429; + {$EXTERNALSYM DEX_IDS_INTERFACE_ERROR} + +// these are the enumeration categories for effects +// + CLSID_VideoEffects1Category : TGUID = '{CC7BFB42-F175-11d1-A392-00E0291F3959}'; + {$EXTERNALSYM CLSID_VideoEffects1Category} + CLSID_VideoEffects2Category : TGUID = '{CC7BFB43-F175-11d1-A392-00E0291F3959}'; + {$EXTERNALSYM CLSID_VideoEffects2Category} + CLSID_AudioEffects1Category : TGUID = '{cc7bfb44-f175-11d1-a392-00e0291f3959}'; + {$EXTERNALSYM CLSID_AudioEffects1Category} + CLSID_AudioEffects2Category : TGUID = '{cc7bfb45-f175-11d1-a392-00e0291f3959}'; + {$EXTERNALSYM CLSID_AudioEffects2Category} + +{**************************************************************************} +{* Module Name: mpeguids.h *} +{* This file was inadvertently left out of the DirectX by Microsoft *} +{* Universal ID's for the mpeg decoder property pages. *} +{* *} +{* Copyright (c) 1995 - 1997 Microsoft Corporation. All Rights Reserved.*} +{**************************************************************************} + + IID_IMpegVideoDecoder : TGUID = '{EB1BB270-F71F-11CE-8E85-02608C9BABA2}'; + CLSID_MpegAudioDecodePropertyPage : TGUID = '{CC785860-B2CA-11ce-8D2B-0000E202599C}'; + CLSID_MpegVideoDecodePropertyPage : TGUID = '{E5B4EAA0-B2CA-11ce-8D2B-0000E202599C}'; + CLSID_MMMpeg1VideoCodec : TGUID = '{eafd3a00-a2c7-11d0-b0ac-006097707a2c}'; + VIDEO_DECODER_CLSID : TGUID = '{eafd3a00-a2c7-11d0-b0ac-006097707a2c}'; + CLSID_MMMpeg1AudioCodec : TGUID = '{2cd28f20-a2c8-11d0-b0ac-006097707a2c}'; + AUDIO_DECODER_CLSID : TGUID = '{2cd28f20-a2c8-11d0-b0ac-006097707a2c}'; + +type +// Structure to describe the caps of the mpeg video decoder. + MPEGVideoDecoderCaps = record + VideoMaxBitRate: DWORD + end; + TMPEGVideoDecoderCaps = MPEGVideoDecoderCaps; + +// -------------------------------------------------------------------------------------- +// Structure to hold the contents of an Mpeg 1 sequence header. // +// This structure come from mpgvideo.h in DXMedia SDK!! // +// -------------------------------------------------------------------------------------- + SeqHdrInfo = record // + Width : LongInt; // Native Width in pixels // + Height : LongInt; // Native Height in pixels // + vbv : LongInt; // vbv // + PictureTime : TReferenceTime; // Time per picture in 100ns units // + TimePerFrame : LongInt; // Time per picture in MPEG units // + BitRate : LongInt; // Bits per second // + XPelsPerMeter : LongInt; // Pel aspect ratio // + YPelsPerMeter : LongInt; // Pel aspect ratio // + StartTimeCode : DWORD; // First GOP time code (or -1) // + ActualHeaderLen : LongInt; // Length of valid bytes in raw seq hdr // + RawHeader : array[0..139] of Byte; // The real sequence header // + end; // + TSeqHdrInfo = SeqHdrInfo; + +// -------------------------------------------------------------------------------------- + +// IMpegVideoDecoder not documented... + IMpegVideoDecoder = interface(IUnknown) + ['{EB1BB270-F71F-11CE-8E85-02608C9BABA2}'] + (*** IMpegVideoDecoder methods ***) + procedure get_CurrentDecoderOption(out pOptions: DWORD); stdcall; + procedure set_CurrentDecoderOption(Options: DWORD); stdcall; + procedure get_DefaultDecoderOption(out pOptions: DWORD); stdcall; + procedure set_DefaultDecoderOption(Options: DWORD); stdcall; + procedure get_QualityMsgProcessing(out pfIgnore: BOOL); stdcall; + procedure set_QualityMsgProcessing(fIgnore: BOOL); stdcall; + procedure get_GreyScaleOutput(out pfGrey: BOOL); stdcall; + procedure set_GreyScaleOutput(fGrey: BOOL); stdcall; + procedure get_SequenceHeader(out pSeqHdrInfo: TSeqHdrInfo); stdcall; + procedure get_OutputFormat(out pOutputFormat: DWORD); stdcall; + procedure get_FrameStatistics(out pIFramesDecoded, pPFramesDecoded, stdcall; + pBFramesDecoded, pIFramesSkipped, pPFramesSkipped, pBFramesSkipped: DWORD); + procedure ResetFrameStatistics; stdcall; + procedure get_DecoderPaletteInfo(lpdwFirstEntry, lpdwLastEntry: PDWORD); stdcall; + procedure get_DecoderPaletteEntries(dwStartEntry, dwNumEntries: DWORD; + lppe: PPALETTEENTRY); stdcall; + procedure get_EncryptionKey(out dwEncrptionKey: DWORD); stdcall; + procedure put_EncryptionKey(dwEncrptionKey: DWORD); stdcall; + procedure get_DecoderCaps(out pCaps: TMPEGVideoDecoderCaps); stdcall; + end; + +//------------------------------------------------------------------------------ +// File: DShowASF.h +// +// Copyright (c) 1992-2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +const + IID_IConfigAsfWriter : TGUID = (D1:$45086030;D2:$F7E4;D3:$486a;D4:($B5,$04,$82,$6B,$B5,$79,$2A,$3B)); + {$EXTERNALSYM IID_IConfigAsfWriter} + // IID_IWMProfile : TGUID = (D1:$96406bdb;D2:$2b2b;D3:$11d3;D4:($b3,$6b,$00,$c0,$4f,$61,$08,$ff)); + +type +// Interface to control the ASF writer + {$HPPEMIT 'typedef System::DelphiInterface _di_IConfigAsfWriter;'} + {$EXTERNALSYM IConfigAsfWriter} + IConfigAsfWriter = interface(IUnknown) + ['{45086030-F7E4-486a-B504-826BB5792A3B}'] + (*** IConfigAsfWriter methods ***) + // The user is expected to enumerate profiles using the wmsdk IWMProfileManager + // method and then pass the desired profile index to the ASF Writer filter via this + // method. The filter will then try to configure itself for the selected profile. + // + // NOTE: These 2 XXXProfileId methods are now obsolete because they assume + // version 4.0 WMSDK profiles. To configure the filter for later profile + // versions using a profile index, use the XXXProfile methods which take + // the IWMProfile* directly. + function ConfigureFilterUsingProfileId(dwProfileId: DWORD): HResult; stdcall; + function GetCurrentProfileId(out pdwProfileId: DWORD): HResult; stdcall; + // configure using a pre-defined wmsdk profile guid + function ConfigureFilterUsingProfileGuid(const guidProfile: TGUID): HResult; stdcall; + function GetCurrentProfileGuid(out pProfileGuid: TGUID): HResult; stdcall; + // Use these methods when a custom profile setup is preferred + function ConfigureFilterUsingProfile(pProfile: IUnKnown): HResult; stdcall; // IWMProfile in Window Media Format SDK + function GetCurrentProfile(out ppProfile: IUnKnown): HResult; stdcall; // IWMProfile in Window Media Format SDK + // allow app to control whether or not to index file + function SetIndexMode(bIndexFile: BOOL): HResult; stdcall; + function GetIndexMode(out pbIndexFile: BOOL): HResult; stdcall; + end; + +//------------------------------------------------------------------------------ +// File: AMParse.h +// +// Desc: Interface to the parser to get current time. This is useful for +// multifile playback. +// +// Copyright (c) 1996 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +const + IID_IAMParse : TGUID = (D1:$c47a3420;D2:$005c;D3:$11d2;D4:($90,$38,$00,$a0,$c9,$69,$72,$98)); +{$EXTERNALSYM IID_IAMParse} + +type +// Parser interface - supported by MPEG-2 splitter filter + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMParse;'} + {$EXTERNALSYM IAMParse} + IAMParse = interface(IUnknown) + ['{c47a3420-005c-11d2-9038-00a0c9697298}'] + (*** IAMParse methods ***) + function GetParseTime(out prtCurrent: TReferenceTime): HResult; stdcall; + function SetParseTime(rtCurrent: TReferenceTime): HResult; stdcall; + function Flush: HResult; stdcall; + end; + +//------------------------------------------------------------------------------ +// File: AudEvCod.h +// +// Desc: List of Audio device error event codes and the expected params. +// +// Copyright (c) 1999 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +const + EC_SND_DEVICE_ERROR_BASE = $0200; + {$EXTERNALSYM EC_SND_DEVICE_ERROR_BASE} + +type + _tagSND_DEVICE_ERROR = ( + {$IFNDEF COMPILER6_UP} + SNDDEV_ERROR_INVALID_0, + SNDDEV_ERROR_Open, + {$ELSE} + SNDDEV_ERROR_Open = 1, + {$ENDIF} + SNDDEV_ERROR_Close, + SNDDEV_ERROR_GetCaps, + SNDDEV_ERROR_PrepareHeader, + SNDDEV_ERROR_UnprepareHeader, + SNDDEV_ERROR_Reset, + SNDDEV_ERROR_Restart, + SNDDEV_ERROR_GetPosition, + SNDDEV_ERROR_Write, + SNDDEV_ERROR_Pause, + SNDDEV_ERROR_Stop, + SNDDEV_ERROR_Start, + SNDDEV_ERROR_AddBuffer, + SNDDEV_ERROR_Query + ); + {$EXTERNALSYM _tagSND_DEVICE_ERROR} + SNDDEV_ERR = _tagSND_DEVICE_ERROR; + {$EXTERNALSYM SNDDEV_ERR} + TSndDevErr = SNDDEV_ERR; + +// Sound device error event codes +// ============================== +// +// All audio device error events are always passed on to the application, and are +// never processed by the filter graph + +const + EC_SNDDEV_IN_ERROR = EC_SND_DEVICE_ERROR_BASE + $00; + {$EXTERNALSYM EC_SNDDEV_IN_ERROR} + EC_SNDDEV_OUT_ERROR = EC_SND_DEVICE_ERROR_BASE + $01; + {$EXTERNALSYM EC_SNDDEV_OUT_ERROR} +// Parameters: ( DWORD, DWORD) +// lParam1 is an enum SND_DEVICE_ERROR which notifies the app how the device was +// being accessed when the failure occurred. +// +// lParam2 is the error returned from the sound device call. + +//------------------------------------------------------------------------------ +// File: ATSMedia.h +// +// Desc: Broadcast Driver Architecture Media Definitions for ATSC +// +// Copyright (c) 1996 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +//=========================================================================== +// +// ATSC Network Type +// +//=========================================================================== + +const + BDANETWORKTYPE_ATSC : TGUID = '{71985F51-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM BDANETWORKTYPE_ATSC} + +//------------------------------------------------------------------------------ +// File: MediaErr.h +// +// Desc: Shell error codes +// +// Copyright (c) 1999 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ +const + DMO_E_INVALIDSTREAMINDEX = HResult($80040201); + {$EXTERNALSYM DMO_E_INVALIDSTREAMINDEX} + DMO_E_INVALIDTYPE = HResult($80040202); + {$EXTERNALSYM DMO_E_INVALIDTYPE} + DMO_E_TYPE_NOT_SET = HResult($80040203); + {$EXTERNALSYM DMO_E_TYPE_NOT_SET} + DMO_E_NOTACCEPTING = HResult($80040204); + {$EXTERNALSYM DMO_E_NOTACCEPTING} + DMO_E_TYPE_NOT_ACCEPTED = HResult($80040205); + {$EXTERNALSYM DMO_E_TYPE_NOT_ACCEPTED} + DMO_E_NO_MORE_ITEMS = HResult($80040206); + {$EXTERNALSYM DMO_E_NO_MORE_ITEMS} + +//------------------------------------------------------------------------------ +// File: MedParam.h +// Desc: Definition of the IMediaParams and associated interfaces. These +// interfaces are designed to allow communication of curve-following +// behaviors for parameters of objects which require dynamic changes +// to their parameters at run time. All changes are specified by +// timestamp and curve type to ensure the parameters can be set +// at sufficient accuracy with predictable behavior on subsequent +// playback of the same curves. +// Copyright (c) 1999 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +const + IID_IMediaParamInfo : TGUID = '{6d6cbb60-a223-44aa-842f-a2f06750be6d}'; + {$EXTERNALSYM IID_IMediaParamInfo} + IID_IMediaParams : TGUID = '{6d6cbb61-a223-44aa-842f-a2f06750be6e}'; + {$EXTERNALSYM IID_IMediaParams} + + GUID_TIME_REFERENCE : TGUID = (D1:$93ad712b;D2:$daa0;D3:$4ffe;D4:($bc,$81,$b0,$ce,$50,$f ,$cd,$d9)); + {$EXTERNALSYM GUID_TIME_REFERENCE} + GUID_TIME_MUSIC : TGUID = (D1:$574c49d ;D2:$5b04;D3:$4b15;D4:($a5,$42,$ae,$28,$20,$30,$11,$7b)); + {$EXTERNALSYM GUID_TIME_MUSIC} + GUID_TIME_SAMPLES : TGUID = (D1:$a8593d05;D2:$c43 ;D3:$4984;D4:($9a,$63,$97,$af,$9e,$2 ,$c4,$c0)); + {$EXTERNALSYM GUID_TIME_SAMPLES} + +type + MP_DATA = {$IFDEF TYPE_IDENTITY}type {$ENDIF} Single; + {$EXTERNALSYM MP_DATA} + MPData = MP_DATA; + + _MP_Type = ( + MPT_INT, + MPT_FLOAT, + MPT_BOOL, + MPT_ENUM, + MPT_MAX + ); + {$EXTERNALSYM _MP_Type} + MP_TYPE = _MP_Type; + {$EXTERNALSYM MP_TYPE} + TMPTYPE = MP_TYPE; + +const + MPBOOL_TRUE = 1; + {$EXTERNALSYM MPBOOL_TRUE} + MPBOOL_FALSE = 0; + {$EXTERNALSYM MPBOOL_FALSE} + +type + MP_CURVE_TYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM MP_CURVE_TYPE} + MPCurveType = MP_CURVE_TYPE; + const + MP_CURVE_JUMP = $1; + {$EXTERNALSYM MP_CURVE_JUMP} + MP_CURVE_LINEAR = $2; + {$EXTERNALSYM MP_CURVE_LINEAR} + MP_CURVE_SQUARE = $4; + {$EXTERNALSYM MP_CURVE_SQUARE} + MP_CURVE_INVSQUARE = $8; + {$EXTERNALSYM MP_CURVE_INVSQUARE} + MP_CURVE_SINE = $10; + {$EXTERNALSYM MP_CURVE_SINE} + +type + MP_CAPS = {$IFDEF TYPE_IDENTITY}type {$ENDIF} DWORD; + {$EXTERNALSYM MP_CAPS} + MPCaps = MP_CAPS; + const + MP_CAPS_CURVE_JUMP = MP_CURVE_JUMP; + {$EXTERNALSYM MP_CAPS_CURVE_JUMP} + MP_CAPS_CURVE_LINEAR = MP_CURVE_LINEAR; + {$EXTERNALSYM MP_CAPS_CURVE_LINEAR} + MP_CAPS_CURVE_SQUARE = MP_CURVE_SQUARE; + {$EXTERNALSYM MP_CAPS_CURVE_SQUARE} + MP_CAPS_CURVE_INVSQUARE = MP_CURVE_INVSQUARE; + {$EXTERNALSYM MP_CAPS_CURVE_INVSQUARE} + MP_CAPS_CURVE_SINE = MP_CURVE_SINE; + {$EXTERNALSYM MP_CAPS_CURVE_SINE} + +type + _MP_PARAMINFO = record + mpType : TMPType; + mopCaps : MPCaps; + mpdMinValue : MPData; + mpdMaxValue : MPData; + mpdNeutralValue : MPData; + szUnitText : array[0..31] of WCHAR; + szLabel : array[0..31] of WCHAR; + end; + {$EXTERNALSYM _MP_PARAMINFO} + MP_PARAMINFO = _MP_PARAMINFO; + {$EXTERNALSYM MP_PARAMINFO} + TMPParamInfo = _MP_PARAMINFO; + +const + DWORD_ALLPARAMS = -1; + {$EXTERNALSYM DWORD_ALLPARAMS} + +type + MP_TIMEDATA = {$IFDEF TYPE_IDENTITY}type {$ENDIF} DWORD; + {$EXTERNALSYM MP_TIMEDATA} + MPTimeData = MP_TIMEDATA; + + MP_FLAGS = {$IFDEF TYPE_IDENTITY}type {$ENDIF} DWORD; + {$EXTERNALSYM MP_FLAGS} + MPFlags = MP_FLAGS; + +const + MPF_ENVLP_STANDARD = $0; + {$EXTERNALSYM MPF_ENVLP_STANDARD} + MPF_ENVLP_BEGIN_CURRENTVAL = $1; + {$EXTERNALSYM MPF_ENVLP_BEGIN_CURRENTVAL} + MPF_ENVLP_BEGIN_NEUTRALVAL = $2; + {$EXTERNALSYM MPF_ENVLP_BEGIN_NEUTRALVAL} + +type + _MP_ENVELOPE_SEGMENT = record + rtStart : TReferenceTime; + rtEnd : TReferenceTime; + valStart : MPData; + valEnd : MPData; + iCurve : MPCURVETYPE; + flags : MPFlags; + end; + {$EXTERNALSYM _MP_ENVELOPE_SEGMENT} + MP_ENVELOPE_SEGMENT = _MP_ENVELOPE_SEGMENT; + {$EXTERNALSYM MP_ENVELOPE_SEGMENT} + TMPEnvelopeSegment = _MP_ENVELOPE_SEGMENT; + + +const + MPF_PUNCHIN_REFTIME = $0; + {$EXTERNALSYM MPF_PUNCHIN_REFTIME} + MPF_PUNCHIN_NOW = $1; + {$EXTERNALSYM MPF_PUNCHIN_NOW} + MPF_PUNCHIN_STOPPED = $2; + {$EXTERNALSYM MPF_PUNCHIN_STOPPED} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaParamInfo;'} + {$EXTERNALSYM IMediaParamInfo} + IMediaParamInfo = interface(IUnknown) + ['{6d6cbb60-a223-44aa-842f-a2f06750be6d}'] + (*** IMediaParamInfo methods ***) + function GetParamCount(out pdwParams: DWORD): HResult; stdcall; + function GetParamInfo(dwParamIndex: DWORD; out pInfo: TMPPARAMINFO): HResult; stdcall; + function GetParamText(dwParamIndex: DWORD; out ppwchText: PWideChar): HResult; stdcall; + function GetNumTimeFormats(out pdwNumTimeFormats: DWORD): HResult; stdcall; + function GetSupportedTimeFormat(dwFormatIndex: DWORD; out pguidTimeFormat: TGUID): HResult; stdcall; + function GetCurrentTimeFormat(out pguidTimeFormat: TGUID; out pTimeData: MPTimeData): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaParams;'} + {$EXTERNALSYM IMediaParams} + IMediaParams = interface(IUnknown) + ['{6d6cbb61-a223-44aa-842f-a2f06750be6e}'] + (*** IMediaParams methods ***) + function GetParam(dwParamIndex: DWORD; out pValue: MPData): HResult; stdcall; + function SetParam(dwParamIndex: DWORD; value: MPData): HResult; stdcall; + function AddEnvelope(dwParamIndex, cSegments: DWORD; var pEnvelopeSegments: TMPENVELOPESEGMENT): HResult; stdcall; + function FlushEnvelope(dwParamIndex: DWORD; refTimeStart, refTimeEnd: TReferenceTime): HResult; stdcall; + function SetTimeFormat(const guidTimeFormat: TGUID; mpTimeData: MPTimeData): HResult; stdcall; + end; + +//------------------------------------------------------------------------------ +// File: mediaobj.h +// Desc: Define the interfaces for DirectX Media Objects. +// Copyright (c) 1999 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +const + IID_IMediaBuffer : TGUID = '{59eff8b9-938c-4a26-82f2-95cb84cdc837}'; + {$EXTERNALSYM IID_IMediaBuffer} + IID_IMediaObject : TGUID = '{d8ad0f58-5494-4102-97c5-ec798e59bcf4}'; + {$EXTERNALSYM IID_IMediaObject} + IID_IEnumDMO : TGUID = '{2c3cd98a-2bfa-4a53-9c27-5249ba64ba0f}'; + {$EXTERNALSYM IID_IEnumDMO} + IID_IMediaObjectInPlace : TGUID = '{651b9ad0-0fc7-4aa9-9538-d89931010741}'; + {$EXTERNALSYM IID_IMediaObjectInPlace} + IID_IDMOQualityControl : TGUID = '{65abea96-cf36-453f-af8a-705e98f16260}'; + {$EXTERNALSYM IID_IDMOQualityControl} + IID_IDMOVideoOutputOptimizations : TGUID = '{be8f4f4e-5b16-4d29-b350-7f6b5d9298ac}'; + {$EXTERNALSYM IID_IDMOVideoOutputOptimizations} + +type +// DMO_MEDIA_TYPE structure + DMO_MEDIA_TYPE = AM_MEDIA_TYPE; + {$EXTERNALSYM DMO_MEDIA_TYPE} + PDMOMediaType = ^TDMOMediaType; + TDMOMediaType = DMO_MEDIA_TYPE; + +const +// Per-buffer flags that apply to input buffers + DMO_INPUT_DATA_BUFFERF_SYNCPOINT = $1; + {$EXTERNALSYM DMO_INPUT_DATA_BUFFERF_SYNCPOINT} + DMO_INPUT_DATA_BUFFERF_TIME = $2; + {$EXTERNALSYM DMO_INPUT_DATA_BUFFERF_TIME} + DMO_INPUT_DATA_BUFFERF_TIMELENGTH = $4; + {$EXTERNALSYM DMO_INPUT_DATA_BUFFERF_TIMELENGTH} + +// Per-buffer flags that apply to output buffers. + DMO_OUTPUT_DATA_BUFFERF_SYNCPOINT = $1; + {$EXTERNALSYM DMO_OUTPUT_DATA_BUFFERF_SYNCPOINT} + DMO_OUTPUT_DATA_BUFFERF_TIME = $2; + {$EXTERNALSYM DMO_OUTPUT_DATA_BUFFERF_TIME} + DMO_OUTPUT_DATA_BUFFERF_TIMELENGTH = $4; + {$EXTERNALSYM DMO_OUTPUT_DATA_BUFFERF_TIMELENGTH} + // This flag means the object could have generated more data for this + // output stream, even with no additional input from any input stream, + // but the output buffer did not have sufficient room. + DMO_OUTPUT_DATA_BUFFERF_INCOMPLETE = $1000000; + {$EXTERNALSYM DMO_OUTPUT_DATA_BUFFERF_INCOMPLETE} + +// Flags returned by GetInputStatus() + // ACCEPT_DATA indicates that the input stream is ready to accept + // new data via ProcessInput(). + DMO_INPUT_STATUSF_ACCEPT_DATA = $1; + {$EXTERNALSYM DMO_INPUT_STATUSF_ACCEPT_DATA} + +// Flags returned by GetInputStreamInfo() + DMO_INPUT_STREAMF_WHOLE_SAMPLES = $1; + {$EXTERNALSYM DMO_INPUT_STREAMF_WHOLE_SAMPLES} + DMO_INPUT_STREAMF_SINGLE_SAMPLE_PER_BUFFER = $2; + {$EXTERNALSYM DMO_INPUT_STREAMF_SINGLE_SAMPLE_PER_BUFFER} + DMO_INPUT_STREAMF_FIXED_SAMPLE_SIZE = $4; + {$EXTERNALSYM DMO_INPUT_STREAMF_FIXED_SAMPLE_SIZE} + DMO_INPUT_STREAMF_HOLDS_BUFFERS = $8; + {$EXTERNALSYM DMO_INPUT_STREAMF_HOLDS_BUFFERS} + +// Flags returned by GetOutputStreamInfo() + DMO_OUTPUT_STREAMF_WHOLE_SAMPLES = $1; + {$EXTERNALSYM DMO_OUTPUT_STREAMF_WHOLE_SAMPLES} + DMO_OUTPUT_STREAMF_SINGLE_SAMPLE_PER_BUFFER = $2; + {$EXTERNALSYM DMO_OUTPUT_STREAMF_SINGLE_SAMPLE_PER_BUFFER} + DMO_OUTPUT_STREAMF_FIXED_SAMPLE_SIZE = $4; + {$EXTERNALSYM DMO_OUTPUT_STREAMF_FIXED_SAMPLE_SIZE} + DMO_OUTPUT_STREAMF_DISCARDABLE = $8; + {$EXTERNALSYM DMO_OUTPUT_STREAMF_DISCARDABLE} + DMO_OUTPUT_STREAMF_OPTIONAL = $10; + {$EXTERNALSYM DMO_OUTPUT_STREAMF_OPTIONAL} + +// SetType flags + DMO_SET_TYPEF_TEST_ONLY = $1; + {$EXTERNALSYM DMO_SET_TYPEF_TEST_ONLY} + DMO_SET_TYPEF_CLEAR = $2; + {$EXTERNALSYM DMO_SET_TYPEF_CLEAR} + +// Process Output Flags + DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER = $1; + {$EXTERNALSYM DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER} + +type +// Buffer wrapper interface + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaBuffer;'} + {$EXTERNALSYM IMediaBuffer} + IMediaBuffer = interface(IUnknown) + ['{59eff8b9-938c-4a26-82f2-95cb84cdc837}'] + (*** IMediaBuffer methods ***) + function SetLength(cbLength: DWORD): HResult; stdcall; + function GetMaxLength(out pcbMaxLength: DWORD): HResult; stdcall; + function GetBufferAndLength(out ppBuffer: PByte; // not filled if NULL + out pcbLength: DWORD // not filled if NULL + ): HResult; stdcall; + end; + + +// Output buffer info structure: one of these must be passed in for each +// output stream with every ProcessOutput() call +// All [out] fields should be +// assumed undefined if ProcessOutput() failed + PDMOOutputDataBuffer = ^TDMOOutputDataBuffer; + _DMO_OUTPUT_DATA_BUFFER = record + pBuffer : IMediaBuffer; // [in] can be NULL + // ProcessOutput() must set any appropriate flags and zero out the rest. + dwStatus : DWORD; // [out] DMO_OUTPUT_DATA_BUFFERF_XXX (INCOMPLETE, etc.) + // Each of these is valid if the corresponding flag is set in dwStatus + rtTimestamp : TReferenceTime; // [out] + rtTimelength : TReferenceTime; // [out] + end; + {$EXTERNALSYM _DMO_OUTPUT_DATA_BUFFER} + DMO_OUTPUT_DATA_BUFFER = _DMO_OUTPUT_DATA_BUFFER; + {$EXTERNALSYM DMO_OUTPUT_DATA_BUFFER} + TDMOOutputDataBuffer = _DMO_OUTPUT_DATA_BUFFER; + + PDMO_OUTPUT_DATA_BUFFER = ^_DMO_OUTPUT_DATA_BUFFER; + {$EXTERNALSYM PDMO_OUTPUT_DATA_BUFFER} + + PDMOOutputDataBufferArray = ^TDMOOutputDataBufferArray; + TDMOOutputDataBufferArray = array [0..0] of TDMOOutputDataBuffer; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaObject;'} + {$EXTERNALSYM IMediaObject} + IMediaObject = interface(IUnknown) + ['{d8ad0f58-5494-4102-97c5-ec798e59bcf4}'] + (*** IMediaObject methods ***) + function GetStreamCount(out pcInputStreams, pcOutputStreams: DWORD): HResult; stdcall; + function GetInputStreamInfo(dwInputStreamIndex: DWORD; out pdwFlags: DWORD): HResult; stdcall; + function GetOutputStreamInfo(dwOutputStreamIndex: DWORD; out pdwFlags: DWORD): HResult; stdcall; + function GetInputType(dwInputStreamIndex, dwTypeIndex: DWORD; out pmt: TDMOMediaType): HResult; stdcall; + function GetOutputType(dwOutputStreamIndex, dwTypeIndex: DWORD; out pmt: TDMOMediaType): HResult; stdcall; + function SetInputType(dwInputStreamIndex: DWORD; const pmt: PDMOMediaType; dwFlags: DWORD): HResult; stdcall; + function SetOutputType(dwOutputStreamIndex: DWORD; const pmt: PDMOMediaType; dwFlags: DWORD): HResult; stdcall; + function GetInputCurrentType(dwInputStreamIndex: DWORD; out pmt: TDMOMediaType): HResult; stdcall; + function GetOutputCurrentType(dwOutputStreamIndex: DWORD; out pmt: TDMOMediaType): HResult; stdcall; + function GetInputSizeInfo(dwInputStreamIndex: DWORD; out pcbSize, pcbMaxLookahead, pcbAlignment: DWORD): HResult; stdcall; + function GetOutputSizeInfo(dwOutputStreamIndex: DWORD; out pcbSize, pcbAlignment: DWORD): HResult; stdcall; + function GetInputMaxLatency(dwInputStreamIndex: DWORD; out prtMaxLatency: TReferenceTime): HResult; stdcall; + function SetInputMaxLatency(dwInputStreamIndex: DWORD; rtMaxLatency: TReferenceTime): HResult; stdcall; + function Flush: HResult; stdcall; + function Discontinuity(dwInputStreamIndex: DWORD): HResult; stdcall; + function AllocateStreamingResources: HResult; stdcall; + function FreeStreamingResources: HResult; stdcall; + function GetInputStatus(dwInputStreamIndex: DWORD; out dwFlags: DWORD): HResult; stdcall; + function ProcessInput(dwInputStreamIndex: DWORD; pBuffer: IMediaBuffer; dwFlags: DWORD; + rtTimestamp, rtTimelength: TReferenceTime): HResult; stdcall; + function ProcessOutput(dwFlags, cOutputBufferCount: DWORD; var pOutputBuffers: TDMOOutputDataBufferArray; + out pdwStatus: DWORD): HResult; stdcall; + function Lock(bLock: longint): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IEnumDMO;'} + {$EXTERNALSYM IEnumDMO} + IEnumDMO = interface(IUnknown) + ['{2c3cd98a-2bfa-4a53-9c27-5249ba64ba0f}'] + (*** IEnumDMO methods ***) + function Next(cItemsToFetch: DWORD; out pCLSID: TGUID; out Names: PWideChar; + pcItemsFetched: PDWORD): HResult; stdcall; + function Skip(cItemsToSkip: DWORD): HResult; stdcall; + function Reset: HResult; stdcall; + function Clone(out ppEnum: IEnumDMO): HResult; stdcall; + end; + +const + DMO_INPLACE_NORMAL = $0; + {$EXTERNALSYM DMO_INPLACE_NORMAL} + DMO_INPLACE_ZERO = $1; + {$EXTERNALSYM DMO_INPLACE_ZERO} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IMediaObjectInPlace;'} + {$EXTERNALSYM IMediaObjectInPlace} + IMediaObjectInPlace = interface(IUnknown) + ['{651b9ad0-0fc7-4aa9-9538-d89931010741}'] + (*** IMediaObjectInPlace methods ***) + function Process(ulSize: ULONG; {in/out} pData: Pointer; refTimeStart: TReferenceTime; + dwFlags: DWORD): HResult; stdcall; + function Clone(out ppMediaObject: IMediaObjectInPlace): HResult; stdcall; + function GetLatency(out pLatencyTime: TReferenceTime): HResult; stdcall; + end; + +const + DMO_QUALITY_STATUS_ENABLED = $1; + {$EXTERNALSYM DMO_QUALITY_STATUS_ENABLED} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IDMOQualityControl;'} + {$EXTERNALSYM IDMOQualityControl} + IDMOQualityControl = interface(IUnknown) + ['{65abea96-cf36-453f-af8a-705e98f16260}'] + (*** IDMOQualityControl methods ***) + function SetNow(rtNow: TReferenceTime): HResult; stdcall; + function SetStatus(dwFlags: DWORD): HResult; stdcall; + function GetStatus(out pdwFlags: DWORD): HResult; stdcall; + end; + +const + DMO_VOSF_NEEDS_PREVIOUS_SAMPLE = $1; + {$EXTERNALSYM DMO_VOSF_NEEDS_PREVIOUS_SAMPLE} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IDMOVideoOutputOptimizations;'} + {$EXTERNALSYM IDMOVideoOutputOptimizations} + IDMOVideoOutputOptimizations = interface(IUnknown) + ['{be8f4f4e-5b16-4d29-b350-7f6b5d9298ac}'] + (*** IDMOVideoOutputOptimizations methods ***) + function QueryOperationModePreferences(ulOutputStreamIndex: ULONG; + var pdwRequestedCapabilities: DWORD): HResult; stdcall; + function SetOperationMode(ulOutputStreamIndex: ULONG; + dwEnabledFeatures: DWORD): HResult; stdcall; + function GetCurrentOperationMode(ulOutputStreamIndex: ULONG; + var pdwEnabledFeatures: DWORD): HResult; stdcall; + function GetCurrentSampleRequirements(ulOutputStreamIndex: ULONG; + var pdwRequestedFeatures: DWORD): HResult; stdcall; + end; + +(************************************************************************ +* * +* dmodshow.h -- This module defines the DirectMusic core API's * +* * +* Copyright (c) 1998, Microsoft Corp. All rights reserved. * +* * +************************************************************************) +const + IID_IDMOWrapperFilter : TGUID = '{52d6f586-9f0f-4824-8fc8-e32ca04930c2}'; + {$EXTERNALSYM IID_IDMOWrapperFilter} + CLSID_DMOWrapperFilter : TGUID = '{94297043-bd82-4dfd-b0de-8177739c6d20}'; + {$EXTERNALSYM CLSID_DMOWrapperFilter} + CLSID_DMOFilterCategory : TGUID = '{bcd5796c-bd52-4d30-ab76-70f975b89199}'; + {$EXTERNALSYM CLSID_DMOFilterCategory} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IDMOWrapperFilter;'} + {$EXTERNALSYM IDMOWrapperFilter} + IDMOWrapperFilter = interface(IUnknown) + ['{52d6f586-9f0f-4824-8fc8-e32ca04930c2}'] + (*** IDMOWrapperFilter methods ***) + function Init(const clsidDMO, catDMO: TGUID): HResult; stdcall; + end; + +//------------------------------------------------------------------------------ +// File: DMOReg.h +// +// Desc: +// +// Copyright (c) 1999 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +const + DMOCATEGORY_AUDIO_DECODER : TGUID = '{57f2db8b-e6bb-4513-9d43-dcd2a6593125}'; + {$EXTERNALSYM DMOCATEGORY_AUDIO_DECODER} + DMOCATEGORY_AUDIO_ENCODER : TGUID = '{33D9A761-90C8-11d0-BD43-00A0C911CE86}'; + {$EXTERNALSYM DMOCATEGORY_AUDIO_ENCODER} + DMOCATEGORY_VIDEO_DECODER : TGUID = '{4a69b442-28be-4991-969c-b500adf5d8a8}'; + {$EXTERNALSYM DMOCATEGORY_VIDEO_DECODER} + DMOCATEGORY_VIDEO_ENCODER : TGUID = '{33D9A760-90C8-11d0-BD43-00A0C911CE86}'; + {$EXTERNALSYM DMOCATEGORY_VIDEO_ENCODER} + DMOCATEGORY_AUDIO_EFFECT : TGUID = '{f3602b3f-0592-48df-a4cd-674721e7ebeb}'; + {$EXTERNALSYM DMOCATEGORY_AUDIO_EFFECT} + DMOCATEGORY_VIDEO_EFFECT : TGUID = '{d990ee14-776c-4723-be46-3da2f56f10b9}'; + {$EXTERNALSYM DMOCATEGORY_VIDEO_EFFECT} + DMOCATEGORY_AUDIO_CAPTURE_EFFECT : TGUID = '{f665aaba-3e09-4920-aa5f-219811148f09}'; + {$EXTERNALSYM DMOCATEGORY_AUDIO_CAPTURE_EFFECT} + +// Acoustic Echo Canceller {BF963D80-C559-11D0-8A2B-00A0C9255AC1} +// Matches KSNODETYPE_ACOUSTIC_ECHO_CANCEL in ksmedia.h + DMOCATEGORY_ACOUSTIC_ECHO_CANCEL : TGUID = '{BF963D80-C559-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM DMOCATEGORY_ACOUSTIC_ECHO_CANCEL} + +// Noise Supression {E07F903F-62FD-4e60-8CDD-DEA7236665B5} +// Matches KSNODETYPE_AUDIO_NOISE_SUPPRESS in post Windows ME DDK's ksmedia.h + DMOCATEGORY_AUDIO_NOISE_SUPPRESS : TGUID = '{E07F903F-62FD-4e60-8CDD-DEA7236665B5}'; + {$EXTERNALSYM DMOCATEGORY_AUDIO_NOISE_SUPPRESS} + +// Automatic Gain Control {E88C9BA0-C557-11D0-8A2B-00A0C9255AC1} +// Matches KSNODETYPE_AGC in ksmedia.h + DMOCATEGORY_AGC : TGUID = '{E88C9BA0-C557-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM DMOCATEGORY_AGC} + +type + PDMOPartialMediaType = ^TDMOPartialMediaType; + _DMO_PARTIAL_MEDIATYPE = record + type_ : TGUID; + subtype : TGUID; + end; + {$EXTERNALSYM _DMO_PARTIAL_MEDIATYPE} + DMO_PARTIAL_MEDIATYPE = _DMO_PARTIAL_MEDIATYPE; + {$EXTERNALSYM DMO_PARTIAL_MEDIATYPE} + PDMO_PARTIAL_MEDIATYPE = ^DMO_PARTIAL_MEDIATYPE; + {$EXTERNALSYM PDMO_PARTIAL_MEDIATYPE} + TDMOPartialMediaType = _DMO_PARTIAL_MEDIATYPE; + +const + DMO_REGISTERF_IS_KEYED = $00000001; + {$EXTERNALSYM DMO_REGISTERF_IS_KEYED} + DMO_ENUMF_INCLUDE_KEYED = $00000001; + {$EXTERNALSYM DMO_ENUMF_INCLUDE_KEYED} + +type + TDMOName = array[0..79] of WCHAR; + + function DMORegister(szName: PWideChar; const clsidDMO, guidCategory: TGUID; dwFlags: DWORD; // DMO_REGISTERF_XXX + // Register all mediatypes supported by the object. This carries no + // information about which combinations of input/output types would + // actually work. + cInTypes: DWORD; const pInTypes: PDMO_PARTIAL_MEDIATYPE; cOutTypes: DWORD; + const pOutTypes: PDMO_PARTIAL_MEDIATYPE): HResult; stdcall; + {$EXTERNALSYM DMORegister} + + function DMOUnregister(const clsidDMO, + guidCategory: TGUID// optional - GUID_NULL means unregister from all + ): HResult; stdcall; + {$EXTERNALSYM DMOUnregister} + + + function DMOEnum( + const guidCategory: TGUID; // GUID_NULL for "all" + dwFlags: DWORD; // DMO_ENUMF_XXX + // + // Enumerate only objects that support at least one of the specified input types + // and at least one of the specified output types. If no input types are specified, + // enumerate objects regardless of what input types they support. Same for + // output types. + // + cInTypes: DWORD; + pInTypes: PDMO_PARTIAL_MEDIATYPE; // can be NULL only of ulInTypes = 0 + cOutTypes: DWORD; + pOutTypes: PDMO_PARTIAL_MEDIATYPE; // can be NULL only of ulOutTypes = 0 + // + // Output parameter - this receives a pointer to the DMO CLSID enumerator + // + out ppEnum: IEnumDMO): HResult; stdcall; + {$EXTERNALSYM DMOEnum} + + function DMOGetTypes( + const clsidDMO: TGUID; + ulInputTypesRequested: ULONG; + pulInputTypesSupplied: PULONG; + pInputTypes: PDMO_PARTIAL_MEDIATYPE; + ulOutputTypesRequested: ULONG; + pulOutputTypesSupplied: PULONG; + pOutputTypes: PDMO_PARTIAL_MEDIATYPE): HResult; stdcall; + {$EXTERNALSYM DMOGetTypes} + + function DMOGetName(const clsidDMO: TGUID; szName: TDMOName): HResult; stdcall; + {$EXTERNALSYM DMOGetName} + +//------------------------------------------------------------------------------ +// File: DMORt.h +// +// Desc: Miscellaneous runtime support for DirectShow Media Objects +// +// Copyright (c) 1999 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + +// Mediatype helpers. MoInitMediaType() goes with MoFreeMediaType(), +// MoCreateMediaType() goes with MoDeleteMediaType() - don't mix ! + +// Takes a pointer to an already allocated DMO_MEDIA_TYPE structure, allocates +// a format block of cbFormat bytes, and sets appropriate members of +// DMO_MEDIA_TYPE to point to the newly allocated format block. Also +// initializes the IUnknown pointer inside DMO_MEDIA_TYPE to NULL. +// +// The format block allocated by MoInitMediaType must be freed by calling +// MoFreeMediaType(). + function MoInitMediaType(pmt: PDMOMediaType; cbFormat: DWORD): HResult; stdcall; + {$EXTERNALSYM MoInitMediaType} + +// Frees the format block and releases any IUnknown, but does not free the +// DMO_MEDIA_TYPE structure itself. Input parameter must point to an +// DMO_MEDIA_TYPE structure previously initialized by MoInitMediaType(). + function MoFreeMediaType(pmt: PDMOMediaType): HResult; stdcall; + {$EXTERNALSYM MoFreeMediaType} + +// Copies the DMO_MEDIA_TYPE members. Also duplicates the format block and +// the IUnknown pointer. Both parameters must point to valid DMO_MEDIA_TYPE +// structures. Target structure must be later freed using MoFreeMediaType(). + function MoCopyMediaType(out pmtDest: TDMOMediaType; const pmtSrc: PDMOMediaType): HResult; stdcall; + {$EXTERNALSYM MoCopyMediaType} + +// Allocates a new DMO_MEDIA_TYPE structure and initializes it just like +// MoInitMediaType. I.e., this function allocates both the format block +// and the DMO_MEDIA_TYPE structure itself. Pointer to DMO_MEDIA_TYPE is +// returned as *ppmt. +// +// DMO_MEDIA_TYPE structures allocated by MoCreateMediaType() must be freed +// by calling MoDeleteMediaType(). + function MoCreateMediaType(out ppmt: PDMOMediaType; cbFormat: DWORD): HResult; stdcall; + {$EXTERNALSYM MoCreateMediaType} + +// Frees any format block, releases any IUnknown, and deletes the +// DMO_MEDIA_TYPE structure itself. The input parameter must point to an +// DMO_MEDIA_TYPE structure previously allocated by MoCreateMediaType(). + function MoDeleteMediaType(pmt: PDMOMediaType): HResult; stdcall; + {$EXTERNALSYM MoDeleteMediaType} + +// Allocates a new DMO_MEDIA_TYPE structure and copies pmtSrc into it like +// MoCopyMediaType. I.e., this function allocates a new DMO_MEDIA_TYPE struct +// as well as a new format block for the target mediatype. Trager mediatype +// must later be freed using MoDeleteMediaType(). + function MoDuplicateMediaType(out ppmtDest: PDMOMediaType; const pmtSrc: PDMOMediaType): HResult; stdcall; + {$EXTERNALSYM MoDuplicateMediaType} + +{=============================================================================== + * + * Copyright (C) Microsoft Corporation, 1996 - 1999 + * + * Module Name: ks.h + * Abstract: + * Windows Driver Model/Connection and Streaming Architecture (WDM-CSA) + * core definitions. + * + * Note : All _NTDDK_ specific definitions have been removed from original file + * because never used in DX8SDK. + ===============================================================================} +const +//=========================================================================== + IOCTL_KS_PROPERTY = DWORD(3080195); + {$EXTERNALSYM IOCTL_KS_PROPERTY} + IOCTL_KS_ENABLE_EVENT = DWORD(3080199); + {$EXTERNALSYM IOCTL_KS_ENABLE_EVENT} + IOCTL_KS_DISABLE_EVENT = DWORD(3080203); + {$EXTERNALSYM IOCTL_KS_DISABLE_EVENT} + IOCTL_KS_METHOD = DWORD(3080207); + {$EXTERNALSYM IOCTL_KS_METHOD} + IOCTL_KS_WRITE_STREAM = DWORD(3112979); + {$EXTERNALSYM IOCTL_KS_WRITE_STREAM} + IOCTL_KS_READ_STREAM = DWORD(3096599); + {$EXTERNALSYM IOCTL_KS_READ_STREAM} + IOCTL_KS_RESET_STATE = DWORD(3080219); + {$EXTERNALSYM IOCTL_KS_RESET_STATE} +//=========================================================================== + +type + KSRESET = ( + KSRESET_BEGIN, + KSRESET_END + ); + {$EXTERNALSYM KSRESET} + TKSReset = KSRESET; + + KSSTATE = ( + KSSTATE_STOP, + KSSTATE_ACQUIRE, + KSSTATE_PAUSE, + KSSTATE_RUN + ); + {$EXTERNALSYM KSSTATE} + PKSSTATE = ^KSSTATE; + {$EXTERNALSYM PKSSTATE} + TKSState = KSSTATE; + +const + KSPRIORITY_LOW = $00000001; + {$EXTERNALSYM KSPRIORITY_LOW} + KSPRIORITY_NORMAL = $40000000; + {$EXTERNALSYM KSPRIORITY_NORMAL} + KSPRIORITY_HIGH = $80000000; + {$EXTERNALSYM KSPRIORITY_HIGH} + KSPRIORITY_EXCLUSIVE = $FFFFFFFF; + {$EXTERNALSYM KSPRIORITY_EXCLUSIVE} + +type + KSPRIORITY = record + PriorityClass : ULONG; + PrioritySubClass : ULONG; + end; + {$EXTERNALSYM KSPRIORITY} + PKSPRIORITY = ^KSPRIORITY; + {$EXTERNALSYM PKSPRIORITY} + TKSPriority = KSPRIORITY; + + KSIDENTIFIER = record + case Integer of + 0: ( + Set_ : TGUID; + Id : ULONG; + Flags : ULONG); + 1: ( + Alignment : int64); + end; + {$EXTERNALSYM KSIDENTIFIER} + PKSIDENTIFIER = ^KSIDENTIFIER; + {$EXTERNALSYM PKSIDENTIFIER} + TKSIdentifier = KSIDENTIFIER; + + KSPROPERTY = {$IFDEF TYPE_IDENTITY}type {$ENDIF} KSIDENTIFIER; + {$EXTERNALSYM KSPROPERTY} + PKSPROPERTY = ^KSPROPERTY; + {$EXTERNALSYM PKSPROPERTY} + KSMETHOD = PKSPROPERTY; + {$EXTERNALSYM KSMETHOD} + PKSMETHOD = ^KSMETHOD; + {$EXTERNALSYM PKSMETHOD} + KSEVENT = PKSMETHOD; + {$EXTERNALSYM KSEVENT} + PKSEVENT = ^KSEVENT; + {$EXTERNALSYM PKSEVENT} + +const + KSMETHOD_TYPE_NONE = $00000000; + {$EXTERNALSYM KSMETHOD_TYPE_NONE} + KSMETHOD_TYPE_READ = $00000001; + {$EXTERNALSYM KSMETHOD_TYPE_READ} + KSMETHOD_TYPE_WRITE = $00000002; + {$EXTERNALSYM KSMETHOD_TYPE_WRITE} + KSMETHOD_TYPE_MODIFY = $00000003; + {$EXTERNALSYM KSMETHOD_TYPE_MODIFY} + KSMETHOD_TYPE_SOURCE = $00000004; + {$EXTERNALSYM KSMETHOD_TYPE_SOURCE} + + KSMETHOD_TYPE_SEND = $00000001; + {$EXTERNALSYM KSMETHOD_TYPE_SEND} + KSMETHOD_TYPE_SETSUPPORT = $00000100; + {$EXTERNALSYM KSMETHOD_TYPE_SETSUPPORT} + KSMETHOD_TYPE_BASICSUPPORT = $00000200; + {$EXTERNALSYM KSMETHOD_TYPE_BASICSUPPORT} + + KSMETHOD_TYPE_TOPOLOGY = $10000000; + {$EXTERNALSYM KSMETHOD_TYPE_TOPOLOGY} + + KSPROPERTY_TYPE_GET = $00000001; + {$EXTERNALSYM KSPROPERTY_TYPE_GET} + KSPROPERTY_TYPE_SET = $00000002; + {$EXTERNALSYM KSPROPERTY_TYPE_SET} + KSPROPERTY_TYPE_SETSUPPORT = $00000100; + {$EXTERNALSYM KSPROPERTY_TYPE_SETSUPPORT} + KSPROPERTY_TYPE_BASICSUPPORT = $00000200; + {$EXTERNALSYM KSPROPERTY_TYPE_BASICSUPPORT} + KSPROPERTY_TYPE_RELATIONS = $00000400; + {$EXTERNALSYM KSPROPERTY_TYPE_RELATIONS} + KSPROPERTY_TYPE_SERIALIZESET = $00000800; + {$EXTERNALSYM KSPROPERTY_TYPE_SERIALIZESET} + KSPROPERTY_TYPE_UNSERIALIZESET = $00001000; + {$EXTERNALSYM KSPROPERTY_TYPE_UNSERIALIZESET} + KSPROPERTY_TYPE_SERIALIZERAW = $00002000; + {$EXTERNALSYM KSPROPERTY_TYPE_SERIALIZERAW} + KSPROPERTY_TYPE_UNSERIALIZERAW = $00004000; + {$EXTERNALSYM KSPROPERTY_TYPE_UNSERIALIZERAW} + KSPROPERTY_TYPE_SERIALIZESIZE = $00008000; + {$EXTERNALSYM KSPROPERTY_TYPE_SERIALIZESIZE} + KSPROPERTY_TYPE_DEFAULTVALUES = $00010000; + {$EXTERNALSYM KSPROPERTY_TYPE_DEFAULTVALUES} + + KSPROPERTY_TYPE_TOPOLOGY = $10000000; + {$EXTERNALSYM KSPROPERTY_TYPE_TOPOLOGY} + +type + PKSPNode = ^TKSPNode; + KSP_NODE = record + Property_ : KSPROPERTY; + NodeId : ULONG; + Reserved : ULONG; + end; + {$EXTERNALSYM KSP_NODE} + PKSP_NODE = ^KSP_NODE; + {$EXTERNALSYM PKSP_NODE} + TKSPNode = KSP_NODE; + + PKSMNode = ^TKSMNode; + KSM_NODE = record + Method : KSMETHOD; + NodeId : ULONG; + Reserved : ULONG; + end; + {$EXTERNALSYM KSM_NODE} + PKSM_NODE = ^KSM_NODE; + {$EXTERNALSYM PKSM_NODE} + TKSMNode = KSM_NODE; + + PKSENode = ^TKSENode; + KSE_NODE = record + Event : KSEVENT; + NodeId : ULONG; + Reserved : ULONG; + end; + {$EXTERNALSYM KSE_NODE} + PKSE_NODE = ^KSE_NODE; + {$EXTERNALSYM PKSE_NODE} + TKSENode = KSE_NODE; + +const + KSPROPTYPESETID_General : TGUID = '{97E99BA0-BDEA-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSPROPTYPESETID_General} + +type + PKSMultipleItem = ^TKSMultipleItem; + KSMULTIPLE_ITEM = record + Size : ULONG; + Count : ULONG; + end; + {$EXTERNALSYM KSMULTIPLE_ITEM} + PKSMULTIPLE_ITEM = ^KSMULTIPLE_ITEM; + {$EXTERNALSYM PKSMULTIPLE_ITEM} + TKSMultipleItem = KSMULTIPLE_ITEM; + + PKSPropertyDescription = ^TKSPropertyDescription; + KSPROPERTY_DESCRIPTION = record + AccessFlags : ULONG; + DescriptionSize : ULONG; + PropTypeSet : TKSIDENTIFIER; + MembersListCount : ULONG; + Reserved : ULONG; + end; + {$EXTERNALSYM KSPROPERTY_DESCRIPTION} + PKSPROPERTY_DESCRIPTION = ^KSPROPERTY_DESCRIPTION; + {$EXTERNALSYM PKSPROPERTY_DESCRIPTION} + TKSPropertyDescription = KSPROPERTY_DESCRIPTION; + +const + KSPROPERTY_MEMBER_RANGES = $00000001; + {$EXTERNALSYM KSPROPERTY_MEMBER_RANGES} + KSPROPERTY_MEMBER_STEPPEDRANGES = $00000002; + {$EXTERNALSYM KSPROPERTY_MEMBER_STEPPEDRANGES} + KSPROPERTY_MEMBER_VALUES = $00000003; + {$EXTERNALSYM KSPROPERTY_MEMBER_VALUES} + + KSPROPERTY_MEMBER_FLAG_DEFAULT = $00000001; + {$EXTERNALSYM KSPROPERTY_MEMBER_FLAG_DEFAULT} + +type + PKSPropertyMembersHeader = ^TKSPropertyMembersHeader; + KSPROPERTY_MEMBERSHEADER = record + MembersFlags : ULONG; + MembersSize : ULONG; + MembersCount : ULONG; + Flags : ULONG; + end; + {$EXTERNALSYM KSPROPERTY_MEMBERSHEADER} + PKSPROPERTY_MEMBERSHEADER = ^KSPROPERTY_MEMBERSHEADER; + {$EXTERNALSYM PKSPROPERTY_MEMBERSHEADER} + TKSPropertyMembersHeader = KSPROPERTY_MEMBERSHEADER; + + PKSPropertyBoundsLong = ^TKSPropertyBoundsLong; + KSPROPERTY_BOUNDS_LONG = record + case Integer of + 0: ( + SignedMinimum : Longint; + SignedMaximum : Longint); + 1: ( + UnsignedMinimum : ULONG; + UnsignedMaximum : ULONG); + end; + {$EXTERNALSYM KSPROPERTY_BOUNDS_LONG} + PKSPROPERTY_BOUNDS_LONG = ^KSPROPERTY_BOUNDS_LONG; + {$EXTERNALSYM PKSPROPERTY_BOUNDS_LONG} + TKSPropertyBoundsLong = KSPROPERTY_BOUNDS_LONG; + + PKSPropertyBoundsLongLong = ^TKSPropertyBoundsLongLong; + KSPROPERTY_BOUNDS_LONGLONG = record + case Integer of + 0: ( + SignedMinimum : TLargeInteger; + SignedMaximum : TLargeInteger); + 1: ( + UnsignedMinimum : TULargeInteger; + UnsignedMaximum : TULargeInteger); + end; + {$EXTERNALSYM KSPROPERTY_BOUNDS_LONGLONG} + PKSPROPERTY_BOUNDS_LONGLONG = ^KSPROPERTY_BOUNDS_LONGLONG; + {$EXTERNALSYM PKSPROPERTY_BOUNDS_LONGLONG} + TKSPropertyBoundsLongLong = KSPROPERTY_BOUNDS_LONGLONG; + + PKSPropertySteppingLong = ^TKSPropertySteppingLong; + KSPROPERTY_STEPPING_LONG = record + SteppingDelta : ULONG; + Reserved : ULONG; + Bounds : TKSPropertyBoundsLong; + end; + {$EXTERNALSYM KSPROPERTY_STEPPING_LONG} + PKSPROPERTY_STEPPING_LONG = ^KSPROPERTY_STEPPING_LONG; + {$EXTERNALSYM PKSPROPERTY_STEPPING_LONG} + TKSPropertySteppingLong = KSPROPERTY_STEPPING_LONG; + + PKSPropertySteppingLongLong = ^TKSPropertySteppingLongLong; + KSPROPERTY_STEPPING_LONGLONG = record + SteppingDelta : TULargeInteger; + Bounds : TKSPropertyBoundsLongLong; + end; + {$EXTERNALSYM KSPROPERTY_STEPPING_LONGLONG} + PKSPROPERTY_STEPPING_LONGLONG = KSPROPERTY_STEPPING_LONGLONG; + {$EXTERNALSYM PKSPROPERTY_STEPPING_LONGLONG} + TKSPropertySteppingLongLong = KSPROPERTY_STEPPING_LONGLONG; + +//=========================================================================== + PKSWORKER = pointer; + {$EXTERNALSYM PKSWORKER} + + KSEVENTDATA = record + NotificationType : ULONG; + case integer of + 0: ( // EventHandle + Event : THandle; + Reserved : array[0..1] of ULONG); + 1: ( // SemaphoreHandle + Semaphore : THandle; + Reserved_ : ULONG; + Adjustment : Longint); + 2: ( // Alignment + Unused : Pointer; + Alignment : array[0..1] of Longint); + end; + {$EXTERNALSYM KSEVENTDATA} + PKSEVENTDATA = ^KSEVENTDATA; + {$EXTERNALSYM PKSEVENTDATA} + TKSEventData = KSEVENTDATA; + +const + KSEVENTF_EVENT_HANDLE = $00000001; + {$EXTERNALSYM KSEVENTF_EVENT_HANDLE} + KSEVENTF_SEMAPHORE_HANDLE = $00000002; + {$EXTERNALSYM KSEVENTF_SEMAPHORE_HANDLE} + + KSEVENT_TYPE_ENABLE = $00000001; + {$EXTERNALSYM KSEVENT_TYPE_ENABLE} + KSEVENT_TYPE_ONESHOT = $00000002; + {$EXTERNALSYM KSEVENT_TYPE_ONESHOT} + KSEVENT_TYPE_ENABLEBUFFERED = $00000004; + {$EXTERNALSYM KSEVENT_TYPE_ENABLEBUFFERED} + KSEVENT_TYPE_SETSUPPORT = $00000100; + {$EXTERNALSYM KSEVENT_TYPE_SETSUPPORT} + KSEVENT_TYPE_BASICSUPPORT = $00000200; + {$EXTERNALSYM KSEVENT_TYPE_BASICSUPPORT} + KSEVENT_TYPE_QUERYBUFFER = $00000400; + {$EXTERNALSYM KSEVENT_TYPE_QUERYBUFFER} + + KSEVENT_TYPE_TOPOLOGY = $10000000; + {$EXTERNALSYM KSEVENT_TYPE_TOPOLOGY} + +type + KSQUERYBUFFER = record + Event : KSEVENT; + EventData : PKSEVENTDATA; + Reserved : Pointer; + end; + {$EXTERNALSYM KSQUERYBUFFER} + PKSQUERYBUFFER = ^KSQUERYBUFFER; + {$EXTERNALSYM PKSQUERYBUFFER} + TKSQueryBuffer = KSQUERYBUFFER; + + KSRELATIVEEVENT = record + Size : ULONG; + Flags : ULONG; + case integer of + 0: ( ObjectHandle : THandle; + Reserved : Pointer; + Event : KSEVENT; + EventData : TKSEVENTDATA); + 1: ( ObjectPointer : Pointer); + + end; + {$EXTERNALSYM KSRELATIVEEVENT} + TKSRelativeEvent = KSRELATIVEEVENT; + +const + KSRELATIVEEVENT_FLAG_HANDLE = $00000001; + {$EXTERNALSYM KSRELATIVEEVENT_FLAG_HANDLE} + KSRELATIVEEVENT_FLAG_POINTER = $00000002; + {$EXTERNALSYM KSRELATIVEEVENT_FLAG_POINTER} + +//=========================================================================== + +type + PKSEventTimeMark = ^TKSEventTimeMark; + KSEVENT_TIME_MARK = record + EventData : TKSEVENTDATA; + MarkTime : int64; + end; + {$EXTERNALSYM KSEVENT_TIME_MARK} + PKSEVENT_TIME_MARK = ^KSEVENT_TIME_MARK; + {$EXTERNALSYM PKSEVENT_TIME_MARK} + TKSEventTimeMark = KSEVENT_TIME_MARK; + + PKSEventTimeInterval = ^TKSEventTimeInterval; + KSEVENT_TIME_INTERVAL = record + EventData : TKSEVENTDATA; + TimeBase : int64; + Interval : int64; + end; + {$EXTERNALSYM KSEVENT_TIME_INTERVAL} + PKSEVENT_TIME_INTERVAL = ^KSEVENT_TIME_INTERVAL; + {$EXTERNALSYM PKSEVENT_TIME_INTERVAL} + TKSEventTimeInterval = KSEVENT_TIME_INTERVAL; + + KSINTERVAL = record + TimeBase : int64; + Interval : int64; + end; + {$EXTERNALSYM KSINTERVAL} + PKSINTERVAL = ^KSINTERVAL; + {$EXTERNALSYM PKSINTERVAL} + TKSInterval = KSINTERVAL; + +//=========================================================================== +const + KSPROPSETID_General : TGUID = '{1464EDA5-6A8F-11D1-9AA7-00A0C9223196}'; + {$EXTERNALSYM KSPROPSETID_General} + +type + KSPROPERTY_GENERAL = ( + {$EXTERNALSYM KSPROPERTY_GENERAL} + KSPROPERTY_GENERAL_COMPONENTID + ); + TKSPropertyGeneral = KSPROPERTY_GENERAL; + + KSCOMPONENTID = record + Manufacturer : TGUID; + Product : TGUID; + Component : TGUID; + Name : TGUID; + Version : ULONG; + Revision : ULONG; + end; + {$EXTERNALSYM KSCOMPONENTID} + PKSCOMPONENTID = ^KSCOMPONENTID; + {$EXTERNALSYM PKSCOMPONENTID} + TKSComponentID = KSCOMPONENTID; + +const + KSMETHODSETID_StreamIo : TGUID = '{65D003CA-1523-11D2-B27A-00A0C9223196}'; + {$EXTERNALSYM KSMETHODSETID_StreamIo} + +type + KSMETHOD_STREAMIO = ( + KSMETHOD_STREAMIO_READ, + KSMETHOD_STREAMIO_WRITE + ); + {$EXTERNALSYM KSMETHOD_STREAMIO} + TKSMethodStreamIO = KSMETHOD_STREAMIO; + +const + KSPROPSETID_MediaSeeking : TGUID = '{EE904F0C-D09B-11D0-ABE9-00A0C9223196}'; + {$EXTERNALSYM KSPROPSETID_MediaSeeking} + +type + KSPROPERTY_MEDIASEEKING = ( + KSPROPERTY_MEDIASEEKING_CAPABILITIES, + KSPROPERTY_MEDIASEEKING_FORMATS, + KSPROPERTY_MEDIASEEKING_TIMEFORMAT, + KSPROPERTY_MEDIASEEKING_POSITION, + KSPROPERTY_MEDIASEEKING_STOPPOSITION, + KSPROPERTY_MEDIASEEKING_POSITIONS, + KSPROPERTY_MEDIASEEKING_DURATION, + KSPROPERTY_MEDIASEEKING_AVAILABLE, + KSPROPERTY_MEDIASEEKING_PREROLL, + KSPROPERTY_MEDIASEEKING_CONVERTTIMEFORMAT + ); + {$EXTERNALSYM KSPROPERTY_MEDIASEEKING} + TKSPropertyMediaSeeking = KSPROPERTY_MEDIASEEKING; + + KS_SEEKING_FLAGS = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM KS_SEEKING_FLAGS} + const + KS_SEEKING_NoPositioning = $0; + {$EXTERNALSYM KS_SEEKING_NoPositioning} + KS_SEEKING_AbsolutePositioning = $1; + {$EXTERNALSYM KS_SEEKING_AbsolutePositioning} + KS_SEEKING_RelativePositioning = $2; + {$EXTERNALSYM KS_SEEKING_RelativePositioning} + KS_SEEKING_IncrementalPositioning = $3; + {$EXTERNALSYM KS_SEEKING_IncrementalPositioning} + KS_SEEKING_PositioningBitsMask = $3; + {$EXTERNALSYM KS_SEEKING_PositioningBitsMask} + KS_SEEKING_SeekToKeyFrame = $4; + {$EXTERNALSYM KS_SEEKING_SeekToKeyFrame} + KS_SEEKING_ReturnTime = $8; + {$EXTERNALSYM KS_SEEKING_ReturnTime} + +type + KS_SEEKING_CAPABILITIES = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM KS_SEEKING_CAPABILITIES} + const + KS_SEEKING_CanSeekAbsolute = $1; + {$EXTERNALSYM KS_SEEKING_CanSeekAbsolute} + KS_SEEKING_CanSeekForwards = $2; + {$EXTERNALSYM KS_SEEKING_CanSeekForwards} + KS_SEEKING_CanSeekBackwards = $4; + {$EXTERNALSYM KS_SEEKING_CanSeekBackwards} + KS_SEEKING_CanGetCurrentPos = $8; + {$EXTERNALSYM KS_SEEKING_CanGetCurrentPos} + KS_SEEKING_CanGetStopPos = $10; + {$EXTERNALSYM KS_SEEKING_CanGetStopPos} + KS_SEEKING_CanGetDuration = $20; + {$EXTERNALSYM KS_SEEKING_CanGetDuration} + KS_SEEKING_CanPlayBackwards = $40; + {$EXTERNALSYM KS_SEEKING_CanPlayBackwards} + +type + PKSPropertyPositions = ^TKSPropertyPositions; + KSPROPERTY_POSITIONS = record + Current : int64; + Stop : int64; + CurrentFlags : KS_SEEKING_FLAGS; + StopFlags : KS_SEEKING_FLAGS; + end; + {$EXTERNALSYM KSPROPERTY_POSITIONS} + PKSPROPERTY_POSITIONS = ^KSPROPERTY_POSITIONS; + {$EXTERNALSYM PKSPROPERTY_POSITIONS} + TKSPropertyPositions = KSPROPERTY_POSITIONS; + + PKSPropertyMediaAvailable = ^TKSPropertyMediaAvailable; + KSPROPERTY_MEDIAAVAILABLE = record + Earliest : int64; + Latest : int64; + end; + {$EXTERNALSYM KSPROPERTY_MEDIAAVAILABLE} + PKSPROPERTY_MEDIAAVAILABLE = ^KSPROPERTY_MEDIAAVAILABLE; + {$EXTERNALSYM PKSPROPERTY_MEDIAAVAILABLE} + TKSPropertyMediaAvailable = KSPROPERTY_MEDIAAVAILABLE; + + PKSPTimeFormat = ^TKSPTimeFormat; + KSP_TIMEFORMAT = record + Property_ : KSPROPERTY; + SourceFormat : TGUID; + TargetFormat : TGUID; + Time : int64; + end; + {$EXTERNALSYM KSP_TIMEFORMAT} + PKSP_TIMEFORMAT = ^KSP_TIMEFORMAT; + {$EXTERNALSYM PKSP_TIMEFORMAT} + TKSPTimeFormat = KSP_TIMEFORMAT; + +//=========================================================================== + +const + KSPROPSETID_Topology : TGUID = '{720D4AC0-7533-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSPROPSETID_Topology} + +type + KSPROPERTY_TOPOLOGY = ( + KSPROPERTY_TOPOLOGY_CATEGORIES, + KSPROPERTY_TOPOLOGY_NODES, + KSPROPERTY_TOPOLOGY_CONNECTIONS, + KSPROPERTY_TOPOLOGY_NAME + ); + {$EXTERNALSYM KSPROPERTY_TOPOLOGY} + TKSPropertyTopology = KSPROPERTY_TOPOLOGY; + +const + KSCATEGORY_BRIDGE : TGUID = '{085AFF00-62CE-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSCATEGORY_BRIDGE} + KSCATEGORY_CAPTURE : TGUID = '{65E8773D-8F56-11D0-A3B9-00A0C9223196}'; + {$EXTERNALSYM KSCATEGORY_CAPTURE} + KSCATEGORY_RENDER : TGUID = '{65E8773E-8F56-11D0-A3B9-00A0C9223196}'; + {$EXTERNALSYM KSCATEGORY_RENDER} + KSCATEGORY_MIXER : TGUID = '{AD809C00-7B88-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSCATEGORY_MIXER} + KSCATEGORY_SPLITTER : TGUID = '{0A4252A0-7E70-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSCATEGORY_SPLITTER} + KSCATEGORY_DATACOMPRESSOR : TGUID = '{1E84C900-7E70-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSCATEGORY_DATACOMPRESSOR} + KSCATEGORY_DATADECOMPRESSOR : TGUID = '{2721AE20-7E70-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSCATEGORY_DATADECOMPRESSOR} + KSCATEGORY_DATATRANSFORM : TGUID = '{2EB07EA0-7E70-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSCATEGORY_DATATRANSFORM} + KSCATEGORY_COMMUNICATIONSTRANSFORM : TGUID = '{CF1DDA2C-9743-11D0-A3EE-00A0C9223196}'; + {$EXTERNALSYM KSCATEGORY_COMMUNICATIONSTRANSFORM} + KSCATEGORY_INTERFACETRANSFORM : TGUID = '{CF1DDA2D-9743-11D0-A3EE-00A0C9223196}'; + {$EXTERNALSYM KSCATEGORY_INTERFACETRANSFORM} + KSCATEGORY_MEDIUMTRANSFORM : TGUID = '{CF1DDA2E-9743-11D0-A3EE-00A0C9223196}'; + {$EXTERNALSYM KSCATEGORY_MEDIUMTRANSFORM} + KSCATEGORY_FILESYSTEM : TGUID = '{760FED5E-9357-11D0-A3CC-00A0C9223196}'; + {$EXTERNALSYM KSCATEGORY_FILESYSTEM} + +// KSNAME_Clock + KSCATEGORY_CLOCK : TGUID = '{53172480-4791-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSCATEGORY_CLOCK} + KSCATEGORY_PROXY : TGUID = '{97EBAACA-95BD-11D0-A3EA-00A0C9223196}'; + {$EXTERNALSYM KSCATEGORY_PROXY} + KSCATEGORY_QUALITY : TGUID = '{97EBAACB-95BD-11D0-A3EA-00A0C9223196}'; + {$EXTERNALSYM KSCATEGORY_QUALITY} + +type + PKSTopologyConnection = ^TKSTopologyConnection; + KSTOPOLOGY_CONNECTION = record + FromNode : ULONG; + FromNodePin : ULONG; + ToNode : ULONG; + ToNodePin : ULONG; + end; + {$EXTERNALSYM KSTOPOLOGY_CONNECTION} + PKSTOPOLOGY_CONNECTION = ^KSTOPOLOGY_CONNECTION; + {$EXTERNALSYM PKSTOPOLOGY_CONNECTION} + TKSTopologyConnection = KSTOPOLOGY_CONNECTION; + + KSTOPOLOGY = record + CategoriesCount : ULONG; + Categories : PGUID; + TopologyNodesCount : ULONG; + TopologyNodes : PGUID; + TopologyConnectionsCount : ULONG; + TopologyConnections : PKSTOPOLOGY_CONNECTION; + TopologyNodesNames : PGUID; + Reserved : ULONG; + end; + {$EXTERNALSYM KSTOPOLOGY} + PKSTOPOLOGY = ^KSTOPOLOGY; + {$EXTERNALSYM PKSTOPOLOGY} + TKSTopology = KSTOPOLOGY; + +const + KSFILTER_NODE = ULONG(-1); + {$EXTERNALSYM KSFILTER_NODE} + KSALL_NODES = ULONG(-1); + {$EXTERNALSYM KSALL_NODES} + +type + PKSNodeCreate = ^TKSNodeCreate; + KSNODE_CREATE = record + CreateFlags : ULONG; + Node : ULONG; + end; + {$EXTERNALSYM KSNODE_CREATE} + PKSNODE_CREATE = ^KSNODE_CREATE; + {$EXTERNALSYM PKSNODE_CREATE} + TKSNodeCreate = KSNODE_CREATE; + +//=========================================================================== +const +// TIME_FORMAT_NONE + KSTIME_FORMAT_NONE : TGUID = '{00000000-0000-0000-0000-000000000000}'; + {$EXTERNALSYM KSTIME_FORMAT_NONE} + +// TIME_FORMAT_FRAME + KSTIME_FORMAT_FRAME : TGUID = '{7b785570-8c82-11cf-bc0c-00aa00ac74f6}'; + {$EXTERNALSYM KSTIME_FORMAT_FRAME} + +// TIME_FORMAT_BYTE + KSTIME_FORMAT_BYTE : TGUID = '{7b785571-8c82-11cf-bc0c-00aa00ac74f6}'; + {$EXTERNALSYM KSTIME_FORMAT_BYTE} + +// TIME_FORMAT_SAMPLE + KSTIME_FORMAT_SAMPLE : TGUID = '{7b785572-8c82-11cf-bc0c-00aa00ac74f6}'; + {$EXTERNALSYM KSTIME_FORMAT_SAMPLE} + +// TIME_FORMAT_FIELD + KSTIME_FORMAT_FIELD : TGUID = '{7b785573-8c82-11cf-bc0c-00aa00ac74f6}'; + {$EXTERNALSYM KSTIME_FORMAT_FIELD} + +// TIME_FORMAT_MEDIA_TIME + KSTIME_FORMAT_MEDIA_TIME : TGUID = '{7b785574-8c82-11cf-bc0c-00aa00ac74f6}'; + {$EXTERNALSYM KSTIME_FORMAT_MEDIA_TIME} + +//=========================================================================== + +type + PKSPIN_INTERFACE = ^KSPIN_INTERFACE; + {$EXTERNALSYM PKSPIN_INTERFACE} + KSPIN_INTERFACE = KSIDENTIFIER; + {$EXTERNALSYM KSPIN_INTERFACE} + + PKSPinInterface = PKSPIN_INTERFACE; + TKSPinInterface = KSPIN_INTERFACE; + +const + KSINTERFACESETID_Standard : TGUID = '{1A8766A0-62CE-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSINTERFACESETID_Standard} + +type + KSINTERFACE_STANDARD = ( + KSINTERFACE_STANDARD_STREAMING, + KSINTERFACE_STANDARD_LOOPED_STREAMING, + KSINTERFACE_STANDARD_CONTROL + ); + {$EXTERNALSYM KSINTERFACE_STANDARD} + TKSInterfaceStandard = KSINTERFACE_STANDARD; + +const + KSINTERFACESETID_FileIo : TGUID = '{8C6F932C-E771-11D0-B8FF-00A0C9223196}'; + {$EXTERNALSYM KSINTERFACESETID_FileIo} + +type + KSINTERFACE_FILEIO = ( + KSINTERFACE_FILEIO_STREAMING + ); + {$EXTERNALSYM KSINTERFACE_FILEIO} + TKSInterfaceFileIO = KSINTERFACE_FILEIO; + +//=========================================================================== +const + KSMEDIUM_TYPE_ANYINSTANCE = 0; + {$EXTERNALSYM KSMEDIUM_TYPE_ANYINSTANCE} + + KSMEDIUMSETID_Standard : TGUID = '{4747B320-62CE-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSMEDIUMSETID_Standard} + +//For compatibility only + KSMEDIUM_STANDARD_DEVIO = KSMEDIUM_TYPE_ANYINSTANCE; + {$EXTERNALSYM KSMEDIUM_STANDARD_DEVIO} + +//=========================================================================== + + KSPROPSETID_Pin : TGUID = '{8C134960-51AD-11CF-878A-94F801C10000}'; + {$EXTERNALSYM KSPROPSETID_Pin} + +type + KSPROPERTY_PIN = ( + KSPROPERTY_PIN_CINSTANCES, + KSPROPERTY_PIN_CTYPES, + KSPROPERTY_PIN_DATAFLOW, + KSPROPERTY_PIN_DATARANGES, + KSPROPERTY_PIN_DATAINTERSECTION, + KSPROPERTY_PIN_INTERFACES, + KSPROPERTY_PIN_MEDIUMS, + KSPROPERTY_PIN_COMMUNICATION, + KSPROPERTY_PIN_GLOBALCINSTANCES, + KSPROPERTY_PIN_NECESSARYINSTANCES, + KSPROPERTY_PIN_PHYSICALCONNECTION, + KSPROPERTY_PIN_CATEGORY, + KSPROPERTY_PIN_NAME, + KSPROPERTY_PIN_CONSTRAINEDDATARANGES, + KSPROPERTY_PIN_PROPOSEDATAFORMAT + ); + {$EXTERNALSYM KSPROPERTY_PIN} + TKSPropertyPin = KSPROPERTY_PIN; + + PKSPPin = ^TKSPPin; + KSP_PIN = record + Property_ : KSPROPERTY; + PinId : ULONG; + Reserved : ULONG; + end; + {$EXTERNALSYM KSP_PIN} + PKSP_PIN = ^KSP_PIN; + {$EXTERNALSYM PKSP_PIN} + TKSPPin = KSP_PIN; + +const + KSINSTANCE_INDETERMINATE = ULONG(-1); + {$EXTERNALSYM KSINSTANCE_INDETERMINATE} + +type + PKSPinCInstance = ^TKSPinCInstance; + KSPIN_CINSTANCES = record + PossibleCount : ULONG; + CurrentCount : ULONG; + end; + {$EXTERNALSYM KSPIN_CINSTANCES} + PKSPIN_CINSTANCES = ^KSPIN_CINSTANCES; + {$EXTERNALSYM PKSPIN_CINSTANCES} + TKSPinCInstance = KSPIN_CINSTANCES; + + + PKSPinDataFlow = ^TKSPinDataFlow; + KSPIN_DATAFLOW = ( + KSPIN_DATAFLOW_Invalid, + KSPIN_DATAFLOW_IN, + KSPIN_DATAFLOW_OUT + ); + {$EXTERNALSYM KSPIN_DATAFLOW} + PKSPIN_DATAFLOW = ^KSPIN_DATAFLOW; + {$EXTERNALSYM PKSPIN_DATAFLOW} + TKSPinDataFlow = KSPIN_DATAFLOW; + +const + KSDATAFORMAT_BIT_TEMPORAL_COMPRESSION = 0; + {$EXTERNALSYM KSDATAFORMAT_BIT_TEMPORAL_COMPRESSION} + KSDATAFORMAT_TEMPORAL_COMPRESSION = (1 shl KSDATAFORMAT_BIT_TEMPORAL_COMPRESSION); + {$EXTERNALSYM KSDATAFORMAT_TEMPORAL_COMPRESSION} + KSDATAFORMAT_BIT_ATTRIBUTES = 1; + {$EXTERNALSYM KSDATAFORMAT_BIT_ATTRIBUTES} + KSDATAFORMAT_ATTRIBUTES = (1 shl KSDATAFORMAT_BIT_ATTRIBUTES); + {$EXTERNALSYM KSDATAFORMAT_ATTRIBUTES} + + KSDATARANGE_BIT_ATTRIBUTES = 1; + {$EXTERNALSYM KSDATARANGE_BIT_ATTRIBUTES} + KSDATARANGE_ATTRIBUTES = (1 shl KSDATARANGE_BIT_ATTRIBUTES); + {$EXTERNALSYM KSDATARANGE_ATTRIBUTES} + KSDATARANGE_BIT_REQUIRED_ATTRIBUTES = 2; + {$EXTERNALSYM KSDATARANGE_BIT_REQUIRED_ATTRIBUTES} + KSDATARANGE_REQUIRED_ATTRIBUTES = (1 shl KSDATARANGE_BIT_REQUIRED_ATTRIBUTES); + {$EXTERNALSYM KSDATARANGE_REQUIRED_ATTRIBUTES} + +type + KSDATAFORMAT = record + case integer of + 0: ( + FormatSize : ULONG; + Flags : ULONG; + SampleSize : ULONG; + Reserved : ULONG; + MajorFormat : TGUID; + SubFormat : TGUID; + Specifier : TGUID); + 1: ( + Alignment : int64); + end; + {$EXTERNALSYM KSDATAFORMAT} + PKSDATAFORMAT = ^KSDATAFORMAT; + {$EXTERNALSYM PKSDATAFORMAT} + TKSDataFormat = KSDATAFORMAT; + + PKSDATARANGE = ^KSDATARANGE; + {$EXTERNALSYM PKSDATARANGE} + KSDATARANGE = KSDATAFORMAT; + {$EXTERNALSYM KSDATARANGE} + + TKSDataRange = KSDATARANGE; + +const + KSATTRIBUTE_REQUIRED = $00000001; + {$EXTERNALSYM KSATTRIBUTE_REQUIRED} + +type + KSATTRIBUTE = record + Size : ULONG; + Flags : ULONG; + Attribute : TGUID; + end; + {$EXTERNALSYM KSATTRIBUTE} + PKSATTRIBUTE = ^KSATTRIBUTE; + {$EXTERNALSYM PKSATTRIBUTE} + TKSAttribute = KSATTRIBUTE; + + PKSPinCommunication = ^TKSPinCommunication; + KSPIN_COMMUNICATION = ( + KSPIN_COMMUNICATION_NONE, + KSPIN_COMMUNICATION_SINK, + KSPIN_COMMUNICATION_SOURCE, + KSPIN_COMMUNICATION_BOTH, + KSPIN_COMMUNICATION_BRIDGE + ); + {$EXTERNALSYM KSPIN_COMMUNICATION} + PKSPIN_COMMUNICATION = ^KSPIN_COMMUNICATION; + {$EXTERNALSYM PKSPIN_COMMUNICATION} + TKSPinCommunication = KSPIN_COMMUNICATION; + + PKSPIN_MEDIUM = ^KSPIN_MEDIUM; + {$EXTERNALSYM PKSPIN_MEDIUM} + KSPIN_MEDIUM = KSIDENTIFIER; + {$EXTERNALSYM KSPIN_MEDIUM} + + PKSPinMedium = PKSPIN_MEDIUM; + TKSPinMedium = KSPIN_MEDIUM; + + PKSPinConnect = ^TKSPinConnect; + KSPIN_CONNECT = record + Interface_ : TKSPinInterface; + Medium : TKSPinMedium; + PinId : ULONG; + PinToHandle : THandle; + Priority : TKSPriority; + end; + {$EXTERNALSYM KSPIN_CONNECT} + PKSPIN_CONNECT = KSPIN_CONNECT; + {$EXTERNALSYM PKSPIN_CONNECT} + TKSPinConnect = KSPIN_CONNECT; + + PKSPinPhysicalConnection = ^TKSPinPhysicalConnection; + KSPIN_PHYSICALCONNECTION = record + Size : ULONG; + Pin : ULONG; + SymbolicLinkName : array[0..0] of WCHAR; + end; + {$EXTERNALSYM KSPIN_PHYSICALCONNECTION} + PKSPIN_PHYSICALCONNECTION = KSPIN_PHYSICALCONNECTION; + {$EXTERNALSYM PKSPIN_PHYSICALCONNECTION} + TKSPinPhysicalConnection = KSPIN_PHYSICALCONNECTION; + +const + KSNAME_Filter : TGUID = '{9b365890-165f-11d0-a195-0020afd156e4}'; + {$EXTERNALSYM KSNAME_Filter} + KSSTRING_Filter = '{9B365890-165F-11D0-A195-0020AFD156E4}'; + {$EXTERNALSYM KSSTRING_Filter} + + KSNAME_Pin : TGUID = '{146F1A80-4791-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSNAME_Pin} + KSSTRING_Pin = '{146F1A80-4791-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSSTRING_Pin} + + KSNAME_Clock : TGUID = '{53172480-4791-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSNAME_Clock} + KSSTRING_Clock = '{53172480-4791-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSSTRING_Clock} + + KSNAME_Allocator : TGUID = '{642F5D00-4791-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSNAME_Allocator} + KSSTRING_Allocator = '{642F5D00-4791-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSSTRING_Allocator} + + KSSTRING_AllocatorEx = '{091BB63B-603F-11D1-B067-00A0C9062802}'; + {$EXTERNALSYM KSSTRING_AllocatorEx} + + KSNAME_TopologyNode : TGUID = '{0621061A-EE75-11D0-B915-00A0C9223196}'; + {$EXTERNALSYM KSNAME_TopologyNode} + KSSTRING_TopologyNode = '{0621061A-EE75-11D0-B915-00A0C9223196}'; + {$EXTERNALSYM KSSTRING_TopologyNode} + +//=========================================================================== + +// MEDIATYPE_NULL +const + KSDATAFORMAT_TYPE_WILDCARD : TGUID = '{00000000-0000-0000-0000-000000000000}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_WILDCARD} + +// MEDIASUBTYPE_NULL + KSDATAFORMAT_SUBTYPE_WILDCARD : TGUID = '{00000000-0000-0000-0000-000000000000}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_WILDCARD} + +// MEDIATYPE_Stream + KSDATAFORMAT_TYPE_STREAM : TGUID = '{E436EB83-524F-11CE-9F53-0020AF0BA770}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_STREAM} + +// MEDIASUBTYPE_None + KSDATAFORMAT_SUBTYPE_NONE : TGUID = '{E436EB8E-524F-11CE-9F53-0020AF0BA770}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_NONE} + + KSDATAFORMAT_SPECIFIER_WILDCARD : TGUID = '{00000000-0000-0000-0000-000000000000}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_WILDCARD} + + KSDATAFORMAT_SPECIFIER_FILENAME : TGUID = '{AA797B40-E974-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_FILENAME} + KSDATAFORMAT_SPECIFIER_FILEHANDLE: TGUID = '{65E8773C-8F56-11D0-A3B9-00A0C9223196}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_FILEHANDLE} + +// FORMAT_None + KSDATAFORMAT_SPECIFIER_NONE : TGUID = '{0F6417D6-C318-11D0-A43F-00A0C9223196}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_NONE} + +//=========================================================================== + + KSPROPSETID_Quality : TGUID = '{D16AD380-AC1A-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSPROPSETID_Quality} + +type + KSPROPERTY_QUALITY = ( + KSPROPERTY_QUALITY_REPORT, + KSPROPERTY_QUALITY_ERROR + ); + {$EXTERNALSYM KSPROPERTY_QUALITY} + TKSPropertyQuality = KSPROPERTY_QUALITY; + +//=========================================================================== +const + KSPROPSETID_Connection : TGUID = '{1D58C920-AC9B-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSPROPSETID_Connection} +type + KSPROPERTY_CONNECTION = ( + KSPROPERTY_CONNECTION_STATE, + KSPROPERTY_CONNECTION_PRIORITY, + KSPROPERTY_CONNECTION_DATAFORMAT, + KSPROPERTY_CONNECTION_ALLOCATORFRAMING, + KSPROPERTY_CONNECTION_PROPOSEDATAFORMAT, + KSPROPERTY_CONNECTION_ACQUIREORDERING, + KSPROPERTY_CONNECTION_ALLOCATORFRAMING_EX, + KSPROPERTY_CONNECTION_STARTAT + ); + {$EXTERNALSYM KSPROPERTY_CONNECTION} + TKSPropertyConnection = KSPROPERTY_CONNECTION; + +//=========================================================================== +// +// pins flags +// +const + KSALLOCATOR_REQUIREMENTF_INPLACE_MODIFIER = $00000001; + {$EXTERNALSYM KSALLOCATOR_REQUIREMENTF_INPLACE_MODIFIER} + KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY = $00000002; + {$EXTERNALSYM KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY} + KSALLOCATOR_REQUIREMENTF_FRAME_INTEGRITY = $00000004; + {$EXTERNALSYM KSALLOCATOR_REQUIREMENTF_FRAME_INTEGRITY} + KSALLOCATOR_REQUIREMENTF_MUST_ALLOCATE = $00000008; + {$EXTERNALSYM KSALLOCATOR_REQUIREMENTF_MUST_ALLOCATE} + KSALLOCATOR_REQUIREMENTF_PREFERENCES_ONLY = $80000000; + {$EXTERNALSYM KSALLOCATOR_REQUIREMENTF_PREFERENCES_ONLY} + + KSALLOCATOR_OPTIONF_COMPATIBLE = $00000001; + {$EXTERNALSYM KSALLOCATOR_OPTIONF_COMPATIBLE} + KSALLOCATOR_OPTIONF_SYSTEM_MEMORY = $00000002; + {$EXTERNALSYM KSALLOCATOR_OPTIONF_SYSTEM_MEMORY} + KSALLOCATOR_OPTIONF_VALID = $00000003; + {$EXTERNALSYM KSALLOCATOR_OPTIONF_VALID} +// +// pins extended framing flags +// + KSALLOCATOR_FLAG_PARTIAL_READ_SUPPORT = $00000010; + {$EXTERNALSYM KSALLOCATOR_FLAG_PARTIAL_READ_SUPPORT} + KSALLOCATOR_FLAG_DEVICE_SPECIFIC = $00000020; + {$EXTERNALSYM KSALLOCATOR_FLAG_DEVICE_SPECIFIC} + KSALLOCATOR_FLAG_CAN_ALLOCATE = $00000040; + {$EXTERNALSYM KSALLOCATOR_FLAG_CAN_ALLOCATE} + KSALLOCATOR_FLAG_INSIST_ON_FRAMESIZE_RATIO = $00000080; + {$EXTERNALSYM KSALLOCATOR_FLAG_INSIST_ON_FRAMESIZE_RATIO} +// +// allocator pipes flags +// +// there is at least one data modification in a pipe + KSALLOCATOR_FLAG_NO_FRAME_INTEGRITY = $00000100; + {$EXTERNALSYM KSALLOCATOR_FLAG_NO_FRAME_INTEGRITY} + KSALLOCATOR_FLAG_MULTIPLE_OUTPUT = $00000200; + {$EXTERNALSYM KSALLOCATOR_FLAG_MULTIPLE_OUTPUT} + KSALLOCATOR_FLAG_CYCLE = $00000400; + {$EXTERNALSYM KSALLOCATOR_FLAG_CYCLE} + KSALLOCATOR_FLAG_ALLOCATOR_EXISTS = $00000800; + {$EXTERNALSYM KSALLOCATOR_FLAG_ALLOCATOR_EXISTS} +// there is no framing dependency between neighbouring pipes. + KSALLOCATOR_FLAG_INDEPENDENT_RANGES = $00001000; + {$EXTERNALSYM KSALLOCATOR_FLAG_INDEPENDENT_RANGES} + KSALLOCATOR_FLAG_ATTENTION_STEPPING = $00002000; + {$EXTERNALSYM KSALLOCATOR_FLAG_ATTENTION_STEPPING} + + +// +// old Framing structure +// +type + PKSAllocatorFraming = ^TKSAllocatorFraming; + KSALLOCATOR_FRAMING = record + case integer of + 0: ( + OptionsFlags : ULONG); // allocator options (create) + 1: ( + RequirementsFlags : ULONG; // allocation requirements (query) + PoolType : ULONG; + Frames : ULONG; // total number of allowable outstanding frames + FrameSize : ULONG; // total size of frame + FileAlignment : ULONG; + Reserved : ULONG); + end; + {$EXTERNALSYM KSALLOCATOR_FRAMING} + PKSALLOCATOR_FRAMING = ^KSALLOCATOR_FRAMING; + {$EXTERNALSYM PKSALLOCATOR_FRAMING} + TKSAllocatorFraming = KSALLOCATOR_FRAMING; + +// +// new Framing structure, eventually will replace KSALLOCATOR_FRAMING. +// + PKSFramingRange = ^TKSFramingRange; + KS_FRAMING_RANGE = record + MinFrameSize : ULONG; + MaxFrameSize : ULONG; + Stepping : ULONG; + end; + {$EXTERNALSYM KS_FRAMING_RANGE} + PKS_FRAMING_RANGE = ^KS_FRAMING_RANGE; + {$EXTERNALSYM PKS_FRAMING_RANGE} + TKSFramingRange = KS_FRAMING_RANGE; + + PKSFramingRangeWeighted = ^TKSFramingRangeWeighted; + KS_FRAMING_RANGE_WEIGHTED = record + Range : TKSFramingRange; + InPlaceWeight : ULONG; + NotInPlaceWeight : ULONG; + end; + {$EXTERNALSYM KS_FRAMING_RANGE_WEIGHTED} + PKS_FRAMING_RANGE_WEIGHTED = ^KS_FRAMING_RANGE_WEIGHTED; + {$EXTERNALSYM PKS_FRAMING_RANGE_WEIGHTED} + TKSFramingRangeWeighted = KS_FRAMING_RANGE_WEIGHTED; + + PKSCompression = ^TKSCompression; + KS_COMPRESSION = record + RatioNumerator : ULONG; // compression/expansion ratio + RatioDenominator : ULONG; + RatioConstantMargin : ULONG; + end; + {$EXTERNALSYM KS_COMPRESSION} + PKS_COMPRESSION = ^KS_COMPRESSION; + {$EXTERNALSYM PKS_COMPRESSION} + TKSCompression = KS_COMPRESSION; + +// +// memory types and buses are repeated in each entry. +// easiest to use but takes a little more memory than the varsize layout pin\memories\buses\ranges. +// + pksframingitem = ^tksframingitem; + ks_framing_item = record + MemoryType : TGUID; + BusType : TGUID; + MemoryFlags : ULONG; + BusFlags : ULONG; + Flags : ULONG; + Frames : ULONG; // total number of allowable outstanding frames + FileAlignment : ULONG; + MemoryTypeWeight : ULONG; // this memory type Weight pin-wide + PhysicalRange : TKSFramingRange; + FramingRange : TKSFramingRangeWeighted; + end; + {$EXTERNALSYM KS_FRAMING_ITEM} + PKS_FRAMING_ITEM = ^KS_FRAMING_ITEM; + {$EXTERNALSYM PKS_FRAMING_ITEM} + TKSFramingItem = KS_FRAMING_ITEM; + + PKSAllocatorFramingEx = ^TKSAllocatorFramingEx; + KSALLOCATOR_FRAMING_EX = record + CountItems : ULONG; // count of FramingItem-s below. + PinFlags : ULONG; + OutputCompression : TKSCompression; + PinWeight : ULONG; // this pin framing's Weight graph-wide + FramingItem : array[0..0] of TKSFramingItem; + end; + {$EXTERNALSYM KSALLOCATOR_FRAMING_EX} + PKSALLOCATOR_FRAMING_EX = ^KSALLOCATOR_FRAMING_EX; + {$EXTERNALSYM PKSALLOCATOR_FRAMING_EX} + TKSAllocatorFramingEx = KSALLOCATOR_FRAMING_EX; + +// +// define memory type GUIDs +// +const + KSMEMORY_TYPE_WILDCARD : TGUID = '{00000000-0000-0000-0000-000000000000}'; + {$EXTERNALSYM KSMEMORY_TYPE_WILDCARD} + KSMEMORY_TYPE_DONT_CARE : TGUID = '{00000000-0000-0000-0000-000000000000}'; + {$EXTERNALSYM KSMEMORY_TYPE_DONT_CARE} + KS_TYPE_DONT_CARE : TGUID = '{00000000-0000-0000-0000-000000000000}'; + {$EXTERNALSYM KS_TYPE_DONT_CARE} + + KSMEMORY_TYPE_SYSTEM : TGUID = '{091bb638-603f-11d1-b067-00a0c9062802}'; + {$EXTERNALSYM KSMEMORY_TYPE_SYSTEM} + KSMEMORY_TYPE_USER : TGUID = '{8cb0fc28-7893-11d1-b069-00a0c9062802}'; + {$EXTERNALSYM KSMEMORY_TYPE_USER} + KSMEMORY_TYPE_KERNEL_PAGED : TGUID = '{d833f8f8-7894-11d1-b069-00a0c9062802}'; + {$EXTERNALSYM KSMEMORY_TYPE_KERNEL_PAGED} + KSMEMORY_TYPE_KERNEL_NONPAGED : TGUID = '{4a6d5fc4-7895-11d1-b069-00a0c9062802}'; + {$EXTERNALSYM KSMEMORY_TYPE_KERNEL_NONPAGED} + +// old KS clients did not specify the device memory type + KSMEMORY_TYPE_DEVICE_UNKNOWN : TGUID = '{091bb639-603f-11d1-b067-00a0c9062802}'; + {$EXTERNALSYM KSMEMORY_TYPE_DEVICE_UNKNOWN} + +// +// Helper framing macros. +// +{#define DECLARE_SIMPLE_FRAMING_EX(FramingExName, MemoryType, Flags, Frames, Alignment, MinFrameSize, MaxFrameSize) \ + const KSALLOCATOR_FRAMING_EX FramingExName = \ + {\ + 1, \ + 0, \ + {\ + 1, \ + 1, \ + 0 \ + }//, \ +// 0, \ + {\ + {\ + MemoryType, \ + STATIC_KS_TYPE_DONT_CARE, \ + 0, \ + 0, \ + Flags, \ + Frames, \ + Alignment, \ + 0, \ + {\ + 0, \ + (ULONG)-1, \ + 1 \ + }//, \ + {\ + {\ + MinFrameSize, \ + MaxFrameSize, \ + 1 \ + }//, \ + // 0, \ + // 0 \ + // }\ + // }\ + // }\ + // } + +{#define SetDefaultKsCompression(KsCompressionPointer) \ +{\ + KsCompressionPointer->RatioNumerator = 1;\ + KsCompressionPointer->RatioDenominator = 1;\ + KsCompressionPointer->RatioConstantMargin = 0;\ +} + +{#define SetDontCareKsFramingRange(KsFramingRangePointer) \ +{\ + KsFramingRangePointer->MinFrameSize = 0;\ + KsFramingRangePointer->MaxFrameSize = (ULONG) -1;\ + KsFramingRangePointer->Stepping = 1;\ +} + +{#define SetKsFramingRange(KsFramingRangePointer, P_MinFrameSize, P_MaxFrameSize) \ +{\ + KsFramingRangePointer->MinFrameSize = P_MinFrameSize;\ + KsFramingRangePointer->MaxFrameSize = P_MaxFrameSize;\ + KsFramingRangePointer->Stepping = 1;\ +} + +{#define SetKsFramingRangeWeighted(KsFramingRangeWeightedPointer, P_MinFrameSize, P_MaxFrameSize) \ +{\ + KS_FRAMING_RANGE *KsFramingRange = &KsFramingRangeWeightedPointer->Range;\ + SetKsFramingRange(KsFramingRange, P_MinFrameSize, P_MaxFrameSize);\ + KsFramingRangeWeightedPointer->InPlaceWeight = 0;\ + KsFramingRangeWeightedPointer->NotInPlaceWeight = 0;\ +} + +{#define INITIALIZE_SIMPLE_FRAMING_EX(FramingExPointer, P_MemoryType, P_Flags, P_Frames, P_Alignment, P_MinFrameSize, P_MaxFrameSize) \ +{\ + KS_COMPRESSION *KsCompression = &FramingExPointer->OutputCompression;\ + KS_FRAMING_RANGE *KsFramingRange = &FramingExPointer->FramingItem[0].PhysicalRange;\ + KS_FRAMING_RANGE_WEIGHTED *KsFramingRangeWeighted = &FramingExPointer->FramingItem[0].FramingRange;\ + FramingExPointer->CountItems = 1;\ + FramingExPointer->PinFlags = 0;\ + SetDefaultKsCompression(KsCompression);\ + FramingExPointer->PinWeight = 0;\ + FramingExPointer->FramingItem[0].MemoryType = P_MemoryType;\ + FramingExPointer->FramingItem[0].BusType = KS_TYPE_DONT_CARE;\ + FramingExPointer->FramingItem[0].MemoryFlags = 0;\ + FramingExPointer->FramingItem[0].BusFlags = 0;\ + FramingExPointer->FramingItem[0].Flags = P_Flags;\ + FramingExPointer->FramingItem[0].Frames = P_Frames;\ + FramingExPointer->FramingItem[0].FileAlignment = P_Alignment;\ + FramingExPointer->FramingItem[0].MemoryTypeWeight = 0;\ + SetDontCareKsFramingRange(KsFramingRange);\ + SetKsFramingRangeWeighted(KsFramingRangeWeighted, P_MinFrameSize, P_MaxFrameSize);\ +} + + KSEVENTSETID_StreamAllocator : TGUID = '{75d95571-073c-11d0-a161-0020afd156e4}'; + {$EXTERNALSYM KSEVENTSETID_StreamAllocator} + +type + KSEVENT_STREAMALLOCATOR = ( + KSEVENT_STREAMALLOCATOR_INTERNAL_FREEFRAME, + KSEVENT_STREAMALLOCATOR_FREEFRAME + ); + {$EXTERNALSYM KSEVENT_STREAMALLOCATOR} + TKSEventStreamAllocator = KSEVENT_STREAMALLOCATOR; + +const + KSMETHODSETID_StreamAllocator : TGUID = '{cf6e4341-ec87-11cf-a130-0020afd156e4}'; + {$EXTERNALSYM KSMETHODSETID_StreamAllocator} + +type + KSMETHOD_STREAMALLOCATOR = ( + KSMETHOD_STREAMALLOCATOR_ALLOC, + KSMETHOD_STREAMALLOCATOR_FREE + ); + {$EXTERNALSYM KSMETHOD_STREAMALLOCATOR} + TKSMethodStreamAllocation = KSMETHOD_STREAMALLOCATOR; + +{#define DEFINE_KSMETHOD_ITEM_STREAMALLOCATOR_ALLOC(Handler)\ + DEFINE_KSMETHOD_ITEM(\ + KSMETHOD_STREAMALLOCATOR_ALLOC,\ + KSMETHOD_TYPE_WRITE,\ + (Handler),\ + sizeof(KSMETHOD),\ + sizeof(PVOID),\ + NULL) + +#define DEFINE_KSMETHOD_ITEM_STREAMALLOCATOR_FREE(Handler)\ + DEFINE_KSMETHOD_ITEM(\ + KSMETHOD_STREAMALLOCATOR_FREE,\ + KSMETHOD_TYPE_READ,\ + (Handler),\ + sizeof(KSMETHOD),\ + sizeof(PVOID),\ + NULL) + +#define DEFINE_KSMETHOD_ALLOCATORSET(AllocatorSet, MethodAlloc, MethodFree)\ +DEFINE_KSMETHOD_TABLE(AllocatorSet) {\ + DEFINE_KSMETHOD_ITEM_STREAMALLOCATOR_ALLOC(MethodAlloc),\ + DEFINE_KSMETHOD_ITEM_STREAMALLOCATOR_FREE(MethodFree)\ +} +const + KSPROPSETID_StreamAllocator : TGUID = '{cf6e4342-ec87-11cf-a130-0020afd156e4}'; + {$EXTERNALSYM KSPROPSETID_StreamAllocator} + +type + PKSStreamAllocatorStatus = ^TKSStreamAllocatorStatus; + KSSTREAMALLOCATOR_STATUS = record + Framing : TKSAllocatorFraming; + AllocatedFrames : ULONG; + Reserved : ULONG; + end; + {$EXTERNALSYM KSSTREAMALLOCATOR_STATUS} + PKSSTREAMALLOCATOR_STATUS = ^KSSTREAMALLOCATOR_STATUS; + {$EXTERNALSYM PKSSTREAMALLOCATOR_STATUS} + TKSStreamAllocatorStatus = KSSTREAMALLOCATOR_STATUS; + + PKSStreamAllocatorStatusEx = ^TKSStreamAllocatorStatusEx; + KSSTREAMALLOCATOR_STATUS_EX = record + Framing : TKSAllocatorFramingEx; + AllocatedFrames : ULONG; + Reserved : ULONG; + end; + {$EXTERNALSYM KSSTREAMALLOCATOR_STATUS_EX} + PKSSTREAMALLOCATOR_STATUS_EX = ^KSSTREAMALLOCATOR_STATUS_EX; + {$EXTERNALSYM PKSSTREAMALLOCATOR_STATUS_EX} + TKSStreamAllocatorStatusEx = KSSTREAMALLOCATOR_STATUS_EX; + +const + KSSTREAM_HEADER_OPTIONSF_SPLICEPOINT = $00000001; + {$EXTERNALSYM KSSTREAM_HEADER_OPTIONSF_SPLICEPOINT} + KSSTREAM_HEADER_OPTIONSF_PREROLL = $00000002; + {$EXTERNALSYM KSSTREAM_HEADER_OPTIONSF_PREROLL} + KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY = $00000004; + {$EXTERNALSYM KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY} + KSSTREAM_HEADER_OPTIONSF_TYPECHANGED = $00000008; + {$EXTERNALSYM KSSTREAM_HEADER_OPTIONSF_TYPECHANGED} + KSSTREAM_HEADER_OPTIONSF_TIMEVALID = $00000010; + {$EXTERNALSYM KSSTREAM_HEADER_OPTIONSF_TIMEVALID} + KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY = $00000040; + {$EXTERNALSYM KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY} + KSSTREAM_HEADER_OPTIONSF_FLUSHONPAUSE = $00000080; + {$EXTERNALSYM KSSTREAM_HEADER_OPTIONSF_FLUSHONPAUSE} + KSSTREAM_HEADER_OPTIONSF_DURATIONVALID = $00000100; + {$EXTERNALSYM KSSTREAM_HEADER_OPTIONSF_DURATIONVALID} + KSSTREAM_HEADER_OPTIONSF_ENDOFSTREAM = $00000200; + {$EXTERNALSYM KSSTREAM_HEADER_OPTIONSF_ENDOFSTREAM} + KSSTREAM_HEADER_OPTIONSF_LOOPEDDATA = $80000000; + {$EXTERNALSYM KSSTREAM_HEADER_OPTIONSF_LOOPEDDATA} + +type + KSTIME = record + Time : int64; + Numerator : ULONG; + Denominator : ULONG; + end; + {$EXTERNALSYM KSTIME} + PKSTIME = ^KSTIME; + {$EXTERNALSYM PKSTIME} + TKSTime = KSTIME; + + PKSStreamHeader = ^TKSStreamHeader; + KSSTREAM_HEADER = record + Size : ULONG; + TypeSpecificFlags : ULONG; + PresentationTime : TKSTIME; + Duration : int64; + FrameExtent : ULONG; + DataUsed : ULONG; + Data : Pointer; + OptionsFlags : ULONG; +//#if _WIN64 +// Reserved : ULONG; +//#endif + end; + {$EXTERNALSYM KSSTREAM_HEADER} + PKSSTREAM_HEADER = ^KSSTREAM_HEADER; + {$EXTERNALSYM PKSSTREAM_HEADER} + TKSStreamHeader = KSSTREAM_HEADER; + +const + KSPROPSETID_StreamInterface : TGUID = '{1fdd8ee1-9cd3-11d0-82aa-0000f822fe8a}'; + {$EXTERNALSYM KSPROPSETID_StreamInterface} +type + KSPROPERTY_STREAMINTERFACE = ( + KSPROPERTY_STREAMINTERFACE_HEADERSIZE + ); + {$EXTERNALSYM KSPROPERTY_STREAMINTERFACE} + TKSPropertyStreamInterface = KSPROPERTY_STREAMINTERFACE; + +{#define DEFINE_KSPROPERTY_ITEM_STREAMINTERFACE_HEADERSIZE( GetHandler )\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAMINTERFACE_HEADERSIZE,\ + (GetHandler),\ + sizeof(KSPROPERTY),\ + sizeof(ULONG),\ + NULL, NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_STREAMINTERFACESET(StreamInterfaceSet,\ + HeaderSizeHandler)\ +DEFINE_KSPROPERTY_TABLE(StreamInterfaceSet) {\ + DEFINE_KSPROPERTY_ITEM_STREAMINTERFACE_HEADERSIZE( HeaderSizeHandler )\ +} +const + KSPROPSETID_Stream : TGUId = '{65aaba60-98ae-11cf-a10d-0020afd156e4}'; + {$EXTERNALSYM KSPROPSETID_Stream} + +type + KSPROPERTY_STREAM = ( + KSPROPERTY_STREAM_ALLOCATOR, + KSPROPERTY_STREAM_QUALITY, + KSPROPERTY_STREAM_DEGRADATION, + KSPROPERTY_STREAM_MASTERCLOCK, + KSPROPERTY_STREAM_TIMEFORMAT, + KSPROPERTY_STREAM_PRESENTATIONTIME, + KSPROPERTY_STREAM_PRESENTATIONEXTENT, + KSPROPERTY_STREAM_FRAMETIME, + KSPROPERTY_STREAM_RATECAPABILITY, + KSPROPERTY_STREAM_RATE, + KSPROPERTY_STREAM_PIPE_ID + ); + {$EXTERNALSYM KSPROPERTY_STREAM} + TKSPropertyStream = KSPROPERTY_STREAM; + +{#define DEFINE_KSPROPERTY_ITEM_STREAM_ALLOCATOR(GetHandler, SetHandler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_ALLOCATOR,\ + (GetHandler),\ + sizeof(KSPROPERTY),\ + sizeof(HANDLE),\ + (SetHandler),\ + NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_QUALITY(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_QUALITY,\ + (Handler),\ + sizeof(KSPROPERTY),\ + sizeof(KSQUALITY_MANAGER),\ + NULL, NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_DEGRADATION(GetHandler, SetHandler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_DEGRADATION,\ + (GetHandler),\ + sizeof(KSPROPERTY),\ + 0,\ + (SetHandler),\ + NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_MASTERCLOCK(GetHandler, SetHandler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_MASTERCLOCK,\ + (GetHandler),\ + sizeof(KSPROPERTY),\ + sizeof(HANDLE),\ + (SetHandler),\ + NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_TIMEFORMAT(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_TIMEFORMAT,\ + (Handler),\ + sizeof(KSPROPERTY),\ + sizeof(GUID),\ + NULL, NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_PRESENTATIONTIME(GetHandler, SetHandler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_PRESENTATIONTIME,\ + (GetHandler),\ + sizeof(KSPROPERTY),\ + sizeof(KSTIME),\ + (SetHandler),\ + NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_PRESENTATIONEXTENT(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_PRESENTATIONEXTENT,\ + (Handler),\ + sizeof(KSPROPERTY),\ + sizeof(LONGLONG),\ + NULL, NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_FRAMETIME(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_FRAMETIME,\ + (Handler),\ + sizeof(KSPROPERTY),\ + sizeof(KSFRAMETIME),\ + NULL, NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_RATECAPABILITY(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_RATECAPABILITY,\ + (Handler),\ + sizeof(KSRATE_CAPABILITY),\ + sizeof(KSRATE),\ + NULL, NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_RATE(GetHandler, SetHandler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_RATE,\ + (GetHandler),\ + sizeof(KSPROPERTY),\ + sizeof(KSRATE),\ + (SetHandler),\ + NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_STREAM_PIPE_ID(GetHandler, SetHandler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_STREAM_PIPE_ID,\ + (GetHandler),\ + sizeof(KSPROPERTY),\ + sizeof(HANDLE),\ + (SetHandler),\ + NULL, 0, NULL, NULL, 0) } + + PKSQualityManager = ^TKSQualityManager; + KSQUALITY_MANAGER = record + QualityManager : THandle; + Context : Pointer; + end; + {$EXTERNALSYM KSQUALITY_MANAGER} + PKSQUALITY_MANAGER = ^KSQUALITY_MANAGER; + {$EXTERNALSYM PKSQUALITY_MANAGER} + TKSQualityManager = KSQUALITY_MANAGER; + + KSFRAMETIME = record + Duration : int64; + FrameFlags : ULONG; + Reserved : ULONG; + end; + {$EXTERNALSYM KSFRAMETIME} + PKSFRAMETIME = ^KSFRAMETIME; + {$EXTERNALSYM PKSFRAMETIME} + TKSFrameTime = KSFRAMETIME; +const + KSFRAMETIME_VARIABLESIZE = $00000001; + {$EXTERNALSYM KSFRAMETIME_VARIABLESIZE} + +type + KSRATE = record + {$EXTERNALSYM KSRATE} + PresentationStart : int64; + Duration : int64; + Interface_ : TKSPinInterface; + Rate : Longint; + Flags : ULONG; + end; + PKSRATE = ^KSRATE; + {$EXTERNALSYM PKSRATE} + TKSRate = KSRATE; + +const + KSRATE_NOPRESENTATIONSTART = $00000001; + {$EXTERNALSYM KSRATE_NOPRESENTATIONSTART} + KSRATE_NOPRESENTATIONDURATION = $00000002; + {$EXTERNALSYM KSRATE_NOPRESENTATIONDURATION} + +type + PKSRateCapability = ^TKSRateCapability; + KSRATE_CAPABILITY = record + Property_ : KSPROPERTY; + Rate : TKSRATE; + end; + {$EXTERNALSYM KSRATE_CAPABILITY} + PKSRATE_CAPABILITY = ^KSRATE_CAPABILITY; + {$EXTERNALSYM PKSRATE_CAPABILITY} + TKSRateCapability = KSRATE_CAPABILITY; + +const + KSPROPSETID_Clock : TGUID = '{DF12A4C0-AC17-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSPROPSETID_Clock} + +// +// Performs a x*y/z operation on 64 bit quantities by splitting the operation. The equation +// is simplified with respect to adding in the remainder for the upper 32 bits. +// +// (xh * 10000000 / Frequency) * 2^32 + ((((xh * 10000000) % Frequency) * 2^32 + (xl * 10000000)) / Frequency) +// + NANOSECONDS = 10000000; + {$EXTERNALSYM NANOSECONDS} +{#define KSCONVERT_PERFORMANCE_TIME(Frequency, PerformanceTime) \ + ((((ULONGLONG)(ULONG)(PerformanceTime).HighPart * NANOSECONDS / (Frequency)) << 32) + \ + ((((((ULONGLONG)(ULONG)(PerformanceTime).HighPart * NANOSECONDS) % (Frequency)) << 32) + \ + ((ULONGLONG)(PerformanceTime).LowPart * NANOSECONDS)) / (Frequency)))} + +type + PKSClockCreate = ^TKSClockCreate; + KSCLOCK_CREATE = record + CreateFlags : ULONG; + end; + {$EXTERNALSYM KSCLOCK_CREATE} + PKSCLOCK_CREATE = ^KSCLOCK_CREATE; + {$EXTERNALSYM PKSCLOCK_CREATE} + TKSClockCreate = KSCLOCK_CREATE; + + PKSCorrelatedTime = ^TKSCorrelatedTime; + KSCORRELATED_TIME = record + Time : int64; + SystemTime : int64; + end; + {$EXTERNALSYM KSCORRELATED_TIME} + PKSCORRELATED_TIME = ^KSCORRELATED_TIME; + {$EXTERNALSYM PKSCORRELATED_TIME} + TKSCorrelatedTime = KSCORRELATED_TIME; + + KSRESOLUTION = record + Granularity : int64; + Error : int64; + end; + {$EXTERNALSYM KSRESOLUTION} + PKSRESOLUTION = ^KSRESOLUTION; + {$EXTERNALSYM PKSRESOLUTION} + TKSResolution = KSRESOLUTION; + + KSPROPERTY_CLOCK = ( + KSPROPERTY_CLOCK_TIME, + KSPROPERTY_CLOCK_PHYSICALTIME, + KSPROPERTY_CLOCK_CORRELATEDTIME, + KSPROPERTY_CLOCK_CORRELATEDPHYSICALTIME, + KSPROPERTY_CLOCK_RESOLUTION, + KSPROPERTY_CLOCK_STATE + ); + {$EXTERNALSYM KSPROPERTY_CLOCK} + TKSPropertyClock = KSPROPERTY_CLOCK; + +const + KSEVENTSETID_Clock : TGUID = '{364D8E20-62C7-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSEVENTSETID_Clock} + +type + KSEVENT_CLOCK_POSITION = ( + KSEVENT_CLOCK_INTERVAL_MARK, + KSEVENT_CLOCK_POSITION_MARK + ); + {$EXTERNALSYM KSEVENT_CLOCK_POSITION} + TKSEventClockPosition = KSEVENT_CLOCK_POSITION; + +const + KSEVENTSETID_Connection : TGUID = '{7f4bcbe0-9ea5-11cf-a5d6-28db04c10000}'; + {$EXTERNALSYM KSEVENTSETID_Connection} + +type + KSEVENT_CONNECTION = ( + KSEVENT_CONNECTION_POSITIONUPDATE, + KSEVENT_CONNECTION_DATADISCONTINUITY, + KSEVENT_CONNECTION_TIMEDISCONTINUITY, + KSEVENT_CONNECTION_PRIORITY, + KSEVENT_CONNECTION_ENDOFSTREAM + ); + {$EXTERNALSYM KSEVENT_CONNECTION} + TKSEventConnection = KSEVENT_CONNECTION; + + KSQUALITY = record + Context : Pointer; + Proportion : ULONG; + DeltaTime : int64; + end; + {$EXTERNALSYM KSQUALITY} + PKSQUALITY = ^KSQUALITY; + {$EXTERNALSYM PKSQUALITY} + TKSQuality = KSQUALITY; + + KSERROR = record + {$EXTERNALSYM KSERROR} + Context : Pointer; + Status : ULONG; + end; + PKSERROR = ^KSERROR; + {$EXTERNALSYM PKSERROR} + TKSError = KSERROR; + + PKSDEGRADE = ^KSDEGRADE; + {$EXTERNALSYM PKSDEGRADE} + KSDEGRADE = KSIDENTIFIER; + {$EXTERNALSYM KSDEGRADE} + + TKSDegrade = KSDEGRADE; + +const + KSDEGRADESETID_Standard : TGUID = '{9F564180-704C-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSDEGRADESETID_Standard} + +type + KSDEGRADE_STANDARD = ( + KSDEGRADE_STANDARD_SAMPLE, + KSDEGRADE_STANDARD_QUALITY, + KSDEGRADE_STANDARD_COMPUTATION, + KSDEGRADE_STANDARD_SKIP + ); + {$EXTERNALSYM KSDEGRADE_STANDARD} + TKSDegradeStandard = KSDEGRADE_STANDARD; + +//#if !defined( PACK_PRAGMAS_NOT_SUPPORTED ) +//#include +//#endif + + KSPROPERTY_SERIALHDR = record + PropertySet : TGUID; + Count : ULONG; + end; + {$EXTERNALSYM KSPROPERTY_SERIALHDR} + PKSPROPERTY_SERIALHDR = ^KSPROPERTY_SERIALHDR; + {$EXTERNALSYM PKSPROPERTY_SERIALHDR} + TKSPropertySerialHDR = KSPROPERTY_SERIALHDR; + +//#if !defined( PACK_PRAGMAS_NOT_SUPPORTED ) +//#include +//#endif + + PKSPropertySerial = ^TKSPropertySerial; + KSPROPERTY_SERIAL = record + PropTypeSet : TKSIdentifier; + Id : ULONG; + PropertyLength : ULONG; + end; + {$EXTERNALSYM KSPROPERTY_SERIAL} + PKSPROPERTY_SERIAL = ^KSPROPERTY_SERIAL; + {$EXTERNALSYM PKSPROPERTY_SERIAL} + TKSPropertySerial = KSPROPERTY_SERIAL; + +//=========================================================================== +// +// exported prototypes + + +// From WinNT.h (H.GOURVEST) +// Define the access mask as a longword sized structure divided up as +// follows: +// +// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 +// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +// +---------------+---------------+-------------------------------+ +// |G|G|G|G|Res'd|A| StandardRights| SpecificRights | +// |R|W|E|A| |S| | | +// +-+-------------+---------------+-------------------------------+ +// +// typedef struct _ACCESS_MASK { +// WORD SpecificRights; +// BYTE StandardRights; +// BYTE AccessSystemAcl : 1; +// BYTE Reserved : 3; +// BYTE GenericAll : 1; +// BYTE GenericExecute : 1; +// BYTE GenericWrite : 1; +// BYTE GenericRead : 1; +// } ACCESS_MASK; +// typedef ACCESS_MASK *PACCESS_MASK; +// +// but to make life simple for programmer's we'll allow them to specify +// a desired access mask by simply OR'ing together mulitple single rights +// and treat an access mask as a DWORD. For example +// +// DesiredAccess = DELETE | READ_CONTROL +// +// So we'll declare ACCESS_MASK as DWORD +// + + function KsCreateAllocator(ConnectionHandle: THandle; + AllocatorFraming: PKSAllocatorFraming; + out AllocatorHandle: PHandle): DWORD; stdcall; + {$EXTERNALSYM KsCreateAllocator} + + function KsCreateClock(ConnectionHandle: THandle; + ClockCreate: PKSClockCreate; + out ClockHandle: PHandle): DWORD; stdcall; + {$EXTERNALSYM KsCreateClock} + + function KsCreatePin(FilterHandle: THandle; + Connect: PKSPinConnect; + DesiredAccess: ACCESS_MASK ; + out ConnectionHandle: PHandle): DWORD; stdcall; + {$EXTERNALSYM KsCreatePin} + + function KsCreateTopologyNode(ParentHandle: THandle; + NodeCreate: PKSNodeCreate; + DesiredAccess: ACCESS_MASK; + out NodeHandle: PHandle): DWORD; stdcall; + {$EXTERNALSYM KsCreateTopologyNode} + +{=============================================================================== +* +* Copyright (C) Microsoft Corporation, 1996 - 1999 +* Module Name: ksproxy.h +* Abstract : Interface definitions for WDM-CSA proxy filters. +* +*==============================================================================} +const + IID_IKsObject : TGUID = (D1:$423c13a2;D2:$2070;D3:$11d0;D4:($9e,$f7,$00,$aa,$00,$a2,$16,$a1)); + {$EXTERNALSYM IID_IKsObject} + STATIC_IID_IKsObject : TGUID = (D1:$423c13a2;D2:$2070;D3:$11d0;D4:($9e,$f7,$00,$aa,$00,$a2,$16,$a1)); + {$EXTERNALSYM STATIC_IID_IKsObject} + + IID_IKsPinEx : TGUID = (D1:$7bb38260;D2:$d19c;D3:$11d2;D4:($b3,$8a,$00,$a0,$c9,$5e,$c2,$2e)); + {$EXTERNALSYM IID_IKsPinEx} + STATIC_IID_IKsPinEx : TGUID = (D1:$7bb38260;D2:$d19c;D3:$11d2;D4:($b3,$8a,$00,$a0,$c9,$5e,$c2,$2e)); + {$EXTERNALSYM STATIC_IID_IKsPinEx} + + IID_IKsPinPipe : TGUID = (D1:$e539cd90;D2:$a8b4;D3:$11d1;D4:($81,$89,$00,$a0,$c9,$06,$28,$02)); + {$EXTERNALSYM IID_IKsPinPipe} + STATIC_IID_IKsPinPipe : TGUID = (D1:$e539cd90;D2:$a8b4;D3:$11d1;D4:($81,$89,$00,$a0,$c9,$06,$28,$02)); + {$EXTERNALSYM STATIC_IID_IKsPinPipe} + + IID_IKsDataTypeCompletion : TGUID = (D1:$827D1A0E;D2:$0F73;D3:$11D2;D4:($B2,$7A,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM IID_IKsDataTypeCompletion} + STATIC_IID_IKsDataTypeCompletion : TGUID = (D1:$827D1A0E;D2:$0F73;D3:$11D2;D4:($B2,$7A,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM STATIC_IID_IKsDataTypeCompletion} + + IID_IKsClockPropertySet : TGUID = (D1:$5C5CBD84;D2:$E755;D3:$11D0;D4:($AC,$18,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM IID_IKsClockPropertySet} + STATIC_IID_IKsClockPropertySet : TGUID = (D1:$5C5CBD84;D2:$E755;D3:$11D0;D4:($AC,$18,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM STATIC_IID_IKsClockPropertySet} + + IID_IKsAllocator : TGUID = (D1:$8da64899;D2:$c0d9;D3:$11d0;D4:($84,$13,$00,$00,$f8,$22,$fe,$8a)); + {$EXTERNALSYM IID_IKsAllocator} + STATIC_IID_IKsAllocator : TGUID = (D1:$8da64899;D2:$c0d9;D3:$11d0;D4:($84,$13,$00,$00,$f8,$22,$fe,$8a)); + {$EXTERNALSYM STATIC_IID_IKsAllocator} + + IID_IKsAllocatorEx : TGUID = (D1:$091bb63a;D2:$603f;D3:$11d1;D4:($b0,$67,$00,$a0,$c9,$06,$28,$02)); + {$EXTERNALSYM IID_IKsAllocatorEx} + STATIC_IID_IKsAllocatorEx : TGUID = (D1:$091bb63a;D2:$603f;D3:$11d1;D4:($b0,$67,$00,$a0,$c9,$06,$28,$02)); + {$EXTERNALSYM STATIC_IID_IKsAllocatorEx} + + IID_IKsTopology : TGUID = (D1:$28F54683;D2:$06FD;D3:$11D2;D4:($B2,$7A,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM IID_IKsTopology} + STATIC_IID_IKsTopology : TGUID = (D1:$28F54683;D2:$06FD;D3:$11D2;D4:($B2,$7A,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM STATIC_IID_IKsTopology} + + IID_IKsAggregateControl : TGUID = (D1:$7F40EAC0;D2:$3947;D3:$11D2;D4:($87,$4E,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM IID_IKsAggregateControl} + STATIC_IID_IKsAggregateControl : TGUID = (D1:$7F40EAC0;D2:$3947;D3:$11D2;D4:($87,$4E,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM STATIC_IID_IKsAggregateControl} + + CLSID_Proxy : TGUID = (D1:$17CCA71B;D2:$ECD7;D3:$11D0;D4:($B9,$08,$00,$A0,$C9,$22,$31,$96)); + {$EXTERNALSYM CLSID_Proxy} + + IID_IKsQualityForwarder : TGUID = '{97EBAACB-95BD-11D0-A3EA-00A0C9223196}'; + {$EXTERNALSYM IID_IKsQualityForwarder} + STATIC_IID_IKsQualityForwarder : TGUID = '{97EBAACB-95BD-11D0-A3EA-00A0C9223196}'; + {$EXTERNALSYM STATIC_IID_IKsQualityForwarder} + + IID_IKsNotifyEvent : TGUID = '{412bd695-f84b-46c1-ac73-54196dbc8fa7}'; + {$EXTERNALSYM IID_IKsNotifyEvent} + +type + KSALLOCATORMODE = ( + KsAllocatorMode_User, + KsAllocatorMode_Kernel + ); + {$EXTERNALSYM KSALLOCATORMODE} + TKSAllocatorMode = KSALLOCATORMODE; + + PFramingProp = ^TFramingProp; + FRAMING_PROP = ( + FramingProp_Uninitialized, + FramingProp_None, + FramingProp_Old, + FramingProp_Ex + ); + {$EXTERNALSYM FRAMING_PROP} + PFRAMING_PROP = ^FRAMING_PROP; + {$EXTERNALSYM PFRAMING_PROP} + TFramingProp = FRAMING_PROP; + + FRAMING_CACHE_OPS = ( + Framing_Cache_Update, // request to bypass cache when read/write + Framing_Cache_ReadLast, + Framing_Cache_ReadOrig, + Framing_Cache_Write + ); + {$EXTERNALSYM FRAMING_CACHE_OPS} + TFramingCacheOps = FRAMING_CACHE_OPS; + + OPTIMAL_WEIGHT_TOTALS = record + MinTotalNominator : int64; + MaxTotalNominator : int64; + TotalDenominator : int64; + end; + {$EXTERNALSYM OPTIMAL_WEIGHT_TOTALS} + TOptimalWeightTotals = OPTIMAL_WEIGHT_TOTALS; + +// +// allocators strategy is defined by graph manager +// +const + AllocatorStrategy_DontCare = 0; + {$EXTERNALSYM AllocatorStrategy_DontCare} + +// +// what to optimize +// + AllocatorStrategy_MinimizeNumberOfFrames = $00000001; + {$EXTERNALSYM AllocatorStrategy_MinimizeNumberOfFrames} + AllocatorStrategy_MinimizeFrameSize = $00000002; + {$EXTERNALSYM AllocatorStrategy_MinimizeFrameSize} + AllocatorStrategy_MinimizeNumberOfAllocators = $00000004; + {$EXTERNALSYM AllocatorStrategy_MinimizeNumberOfAllocators} + AllocatorStrategy_MaximizeSpeed = $00000008; + {$EXTERNALSYM AllocatorStrategy_MaximizeSpeed} + +// +// factors (flags) defining the Pipes properties +// + PipeFactor_None = 0; + {$EXTERNALSYM PipeFactor_None} + PipeFactor_UserModeUpstream = $00000001; + {$EXTERNALSYM PipeFactor_UserModeUpstream} + PipeFactor_UserModeDownstream = $00000002; + {$EXTERNALSYM PipeFactor_UserModeDownstream} + PipeFactor_MemoryTypes = $00000004; + {$EXTERNALSYM PipeFactor_MemoryTypes} + PipeFactor_Flags = $00000008; + {$EXTERNALSYM PipeFactor_Flags} + PipeFactor_PhysicalRanges = $00000010; + {$EXTERNALSYM PipeFactor_PhysicalRanges} + PipeFactor_OptimalRanges = $00000020; + {$EXTERNALSYM PipeFactor_OptimalRanges} + PipeFactor_FixedCompression = $00000040; + {$EXTERNALSYM PipeFactor_FixedCompression} + PipeFactor_UnknownCompression = $00000080; + {$EXTERNALSYM PipeFactor_UnknownCompression} + PipeFactor_Buffers = $00000100; + {$EXTERNALSYM PipeFactor_Buffers} + PipeFactor_Align = $00000200; + {$EXTERNALSYM PipeFactor_Align} + + PipeFactor_PhysicalEnd = $00000400; + {$EXTERNALSYM PipeFactor_PhysicalEnd} + PipeFactor_LogicalEnd = $00000800; + {$EXTERNALSYM PipeFactor_LogicalEnd} + +type + PIPE_STATE = ( + PipeState_DontCare, + PipeState_RangeNotFixed, + PipeState_RangeFixed, + PipeState_CompressionUnknown, + PipeState_Finalized + ); + {$EXTERNALSYM PIPE_STATE} + TPipeState = PIPE_STATE; + +// +// pipe dimensions relative to BeginPin. +// + PPipeDimensions = ^TPipeDimensions; + PIPE_DIMENSIONS = record + AllocatorPin : TKSCompression; + MaxExpansionPin : TKSCompression; + EndPin : TKSCompression; + end; + {$EXTERNALSYM PIPE_DIMENSIONS} + PPIPE_DIMENSIONS = ^PIPE_DIMENSIONS; + {$EXTERNALSYM PPIPE_DIMENSIONS} + TPipeDimensions = PIPE_DIMENSIONS; + + PPipeAllocatorPlace = ^TPipeAllocatorPlace; + PIPE_ALLOCATOR_PLACE = ( + Pipe_Allocator_None, + Pipe_Allocator_FirstPin, + Pipe_Allocator_LastPin, + Pipe_Allocator_MiddlePin + ); + {$EXTERNALSYM PIPE_ALLOCATOR_PLACE} + PPIPE_ALLOCATOR_PLACE = ^PIPE_ALLOCATOR_PLACE; + {$EXTERNALSYM PPIPE_ALLOCATOR_PLACE} + TPipeAllocatorPlace = PIPE_ALLOCATOR_PLACE; + + PKSLogicalMemoryType = ^TKSLogicalMemoryType; + KS_LogicalMemoryType = ( + KS_MemoryTypeDontCare, + KS_MemoryTypeKernelPaged, + KS_MemoryTypeKernelNonPaged, + KS_MemoryTypeDeviceHostMapped, + KS_MemoryTypeDeviceSpecific, + KS_MemoryTypeUser, + KS_MemoryTypeAnyHost + ); + {$EXTERNALSYM KS_LogicalMemoryType} + PKS_LogicalMemoryType = ^KS_LogicalMemoryType; + {$EXTERNALSYM PKS_LogicalMemoryType} + TKSLogicalMemoryType = KS_LogicalMemoryType; + + PIPE_TERMINATION = record + Flags : ULONG; + OutsideFactors : ULONG; + Weigth : ULONG; // outside weight + PhysicalRange : TKSFramingRange; + OptimalRange : TKSFramingRangeWeighted; + Compression : TKSCompression; // relative to the connected pin on a neighboring filter. + end; + {$EXTERNALSYM PIPE_TERMINATION} + TPipeTermination = PIPE_TERMINATION; + + IKsAllocatorEx = interface; + +// +// extended allocator properties +// + PAllocatorPropertiesEx = ^TAllocatorPropertiesEx; + ALLOCATOR_PROPERTIES_EX = record + cBuffers : longint; + cbBuffer : longint; + cbAlign : longint; + cbPrefix : longint; +// new part + MemoryType : TGUID; + BusType : TGUID; // one of the buses this pipe is using + State : TPipeState; + Input : TPipeTermination; + Output : TPipeTermination; + Strategy : ULONG; + Flags : ULONG; + Weight : ULONG; + LogicalMemoryType : TKSLogicalMemoryType; + AllocatorPlace : TPipeAllocatorPlace; + Dimensions : TPipeDimensions; + PhysicalRange : TKSFramingRange; // on allocator pin + PrevSegment : IKsAllocatorEx; // doubly-linked list of KS allocators + CountNextSegments : ULONG; // possible multiple dependent pipes + NextSegments : IKsAllocatorEx; + InsideFactors : ULONG; // existing factors (different from "don't care") + NumberPins : ULONG; + end; + {$EXTERNALSYM ALLOCATOR_PROPERTIES_EX} + PALLOCATOR_PROPERTIES_EX =^ALLOCATOR_PROPERTIES_EX; + {$EXTERNALSYM PALLOCATOR_PROPERTIES_EX} + TAllocatorPropertiesEx = ALLOCATOR_PROPERTIES_EX; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsClockPropertySet;'} + {$EXTERNALSYM IKsClockPropertySet} + IKsClockPropertySet = interface(IUnknown) + ['{5C5CBD84-E755-11D0-AC18-00A0C9223196}'] + (*** IKsClockPropertySet methods ***) + procedure KsGetTime(out Time: int64); stdcall; + procedure KsSetTime(Time: int64); stdcall; + procedure KsGetPhysicalTime(out Time: int64); stdcall; + procedure KsSetPhysicalTime(Time: int64); stdcall; + procedure KsGetCorrelatedTime(out CorrelatedTime: TKSCorrelatedTime); stdcall; + procedure KsSetCorrelatedTime(CorrelatedTime: TKSCorrelatedTime); stdcall; + procedure KsGetCorrelatedPhysicalTime(out CorrelatedTime: TKSCorrelatedTime); stdcall; + procedure KsSetCorrelatedPhysicalTime(CorrelatedTime: TKSCorrelatedTime); stdcall; + procedure KsGetResolution(out Resolution: TKSResolution); stdcall; + procedure KsGetState(out State: TKSState); stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsAllocator;'} + {$EXTERNALSYM IKsAllocator} + IKsAllocator = interface(IUnknown) + ['{8da64899-c0d9-11d0-8413-0000f822fe8a}'] + (*** IKsAllocator methods ***) + function KsGetAllocatorHandle: THandle; stdcall; + function KsGetAllocatorMode: TKSALLOCATORMODE; stdcall; + procedure KsGetAllocatorStatus(AllocatorStatus: PKSSTREAMALLOCATOR_STATUS); stdcall; + procedure KsSetAllocatorMode(Mode: TKSALLOCATORMODE); stdcall; + end; + + IKsPin = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsAllocatorEx;'} + {$EXTERNALSYM IKsAllocatorEx} + IKsAllocatorEx = interface(IKsAllocator) + ['{091bb63a-603f-11d1-b067-00a0c9062802}'] + (*** IKsAllocatorEx methods ***) + function KsGetProperties: TAllocatorPropertiesEx; stdcall; + procedure KsSetProperties(PROPERTIES: PALLOCATOR_PROPERTIES_EX); stdcall; + procedure KsSetAllocatorHandle(AllocatorHandle: THandle); stdcall; + function KsCreateAllocatorAndGetHandle(KsPin: IKsPin): THandle; stdcall; + end; + + KSPEEKOPERATION = ( + KsPeekOperation_PeekOnly, + KsPeekOperation_AddRef + ); + {$EXTERNALSYM KSPEEKOPERATION} + TKSPeekOperation = KSPEEKOPERATION; + + IKsInterfaceHandler = interface; + IKsDataTypeHandler = interface; + + KSIOOPERATION = ( + KsIoOperation_Write, + KsIoOperation_Read + ); + {$EXTERNALSYM KSIOOPERATION} + TKSIOOperation = KSIOOPERATION; + + PKSStreamSegment = ^TKSStreamSegment; + KSSTREAM_SEGMENT = record + KsInterfaceHandler : IKsInterfaceHandler; + KsDataTypeHandler : IKsDataTypeHandler; + IoOperation : TKSIOOPERATION; + CompletionEvent : THandle; + end; + {$EXTERNALSYM KSSTREAM_SEGMENT} + PKSSTREAM_SEGMENT = ^KSSTREAM_SEGMENT; + {$EXTERNALSYM PKSSTREAM_SEGMENT} + TKSStreamSegment = KSSTREAM_SEGMENT; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsPin;'} + {$EXTERNALSYM IKsPin} + IKsPin = interface(IUnknown) + ['{b61178d1-a2d9-11cf-9e53-00aa00a216a1}'] + (*** IKsPin methods ***) + // [pjh, 2003-07-14] fix wrong translation + function KsQueryMediums(out MediumList: PKSMULTIPLE_ITEM): HResult; stdcall; + function KsQueryInterfaces(InterfaceList: PKSMULTIPLE_ITEM): HResult; stdcall; + function KsCreateSinkPinHandle(Interface_: TKSPinInterface; Medium: TKSPinMedium): HResult; stdcall; + function KsGetCurrentCommunication(Communication: PKSPIN_COMMUNICATION; + Interface_: PKSPIN_INTERFACE; Medium: PKSPIN_MEDIUM): HResult; stdcall; + function KsPropagateAcquire: HResult; stdcall; + function KsDeliver(Sample: IMediaSample; Flags: ULONG): HResult; stdcall; + function KsMediaSamplesCompleted(StreamSegment: PKSSTREAM_SEGMENT): HResult; stdcall; + function KsPeekAllocator(Operation: TKSPEEKOPERATION): IMemAllocator; stdcall; + function KsReceiveAllocator(MemAllocator: IMemAllocator): HResult; stdcall; + function KsRenegotiateAllocator: HResult; stdcall; + function KsIncrementPendingIoCount: Longint; stdcall; + function KsDecrementPendingIoCount: Longint; stdcall; + function KsQualityNotify(Proportion: ULONG; TimeDelta: TReferenceTime): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsPinEx;'} + {$EXTERNALSYM IKsPinEx} + IKsPinEx = interface(IKsPin) + ['{7bb38260-d19c-11d2-b38a-00a0c95ec22e}'] + (*** IKsPinEx methods ***) + procedure KsNotifyError(Sample: IMediaSample; hr: HResult); + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsPinPipe;'} + {$EXTERNALSYM IKsPinPipe} + IKsPinPipe = interface(IUnknown) + ['{e539cd90-a8b4-11d1-8189-00a0c9062802}'] + (*** IKsPinPipe methods ***) + procedure KsGetPinFramingCache(FramingEx: PKSALLOCATOR_FRAMING_EX; + FramingProp: PFRAMING_PROP; Option: TFramingCacheOps); stdcall; + procedure KsSetPinFramingCache(FramingEx: PKSALLOCATOR_FRAMING_EX; + FramingProp: PFRAMING_PROP; Option: TFramingCacheOps); stdcall; + function KsGetConnectedPin: IPin; stdcall; + function KsGetPipe(Operation: TKSPEEKOPERATION): IKsAllocatorEx; stdcall; + procedure KsSetPipe(KsAllocator: IKsAllocatorEx); stdcall; + function KsGetPipeAllocatorFlag: ULONG; stdcall; + procedure KsSetPipeAllocatorFlag(Flag: ULONG); stdcall; + function KsGetPinBusCache: TGUID; stdcall; + procedure KsSetPinBusCache(const Bus: TGUID); stdcall; + // very useful methods for tracing. + function KsGetPinName: PWideChar; stdcall; + function KsGetFilterName: PWideChar; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsPinFactory;'} + {$EXTERNALSYM IKsPinFactory} + IKsPinFactory = interface(IUnknown) + ['{CD5EBE6B-8B6E-11D1-8AE0-00A0C9223196}'] + (*** IKsPinFactory methods ***) + procedure KsPinFactory(PinFactory: PULONG); stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsDataTypeHandler;'} + {$EXTERNALSYM IKsDataTypeHandler} + IKsDataTypeHandler = interface(IUnknown) + ['{5ffbaa02-49a3-11d0-9f36-00aa00a216a1}'] + (*** IKsDataTypeHandler methods ***) + procedure KsCompleteIoOperation(Sample: IMediaSample; StreamHeader: Pointer; + IoOperation: TKSIOOPERATION; Cancelled: BOOL); stdcall; + procedure KsIsMediaTypeInRanges(DataRanges: Pointer); stdcall; + procedure KsPrepareIoOperation(Sample: IMediaSample; StreamHeader: Pointer; + IoOperation: TKSIOOPERATION); stdcall; + procedure KsQueryExtendedSize(var ExtendedSize: ULONG); stdcall; + procedure KsSetMediaType(const AmMediaType: TAMMediaType); stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsDataTypeCompletion;'} + {$EXTERNALSYM IKsDataTypeCompletion} + IKsDataTypeCompletion = interface(IUnknown) + ['{827D1A0E-0F73-11D2-B27A-00A0C9223196}'] + (*** IKsDataTypeCompletion methods ***) + procedure KsCompleteMediaType(FilterHandle: THandle; PinFactoryId: ULONG; + var AmMediaType: TAMMediaType); stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsInterfaceHandler;'} + {$EXTERNALSYM IKsInterfaceHandler} + IKsInterfaceHandler = interface(IUnknown) + ['{D3ABC7E0-9A61-11d0-A40D-00A0C9223196}'] + (*** IKsInterfaceHandler methods ***) + procedure KsSetPin(KsPin: IKsPin); stdcall; + procedure KsProcessMediaSamples(KsDataTypeHandler: IKsDataTypeHandler; + SampleList: IMediaSample; SampleCount: PLongint; + IoOperation: TKSIOOPERATION; StreamSegment: PKSSTREAM_SEGMENT); stdcall; + procedure KsCompleteIo(StreamSegment: PKSSTREAM_SEGMENT); stdcall; + end; + + +// +// This structure definition is the common header required by the proxy to +// dispatch the stream segment to the interface handler. Interface handlers +// will create extended structures to include other information such as +// media samples, extended header size and so on. + + + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsObject;'} + {$EXTERNALSYM IKsObject} + IKsObject = interface(IUnknown) + ['{423c13a2-2070-11d0-9ef7-00aa00a216a1}'] + (*** IKsObject methods ***) + function KsGetObjectHandle: THandle; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsQualityForwarder;'} + {$EXTERNALSYM IKsQualityForwarder} + IKsQualityForwarder = interface(IUnknown) + ['{97ebaacb-95bd-11d0-a3ea-00a0c9223196}'] + (*** IKsQualityForwarder methods ***) + procedure KsFlushClient(Pin: IKsPin); stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsNotifyEvent;'} + {$EXTERNALSYM IKsNotifyEvent} + IKsNotifyEvent = interface(IUnknown) + ['{412bd695-f84b-46c1-ac73-54196dbc8fa7}'] + (*** IKsNotifyEvent methods ***) + procedure KsNotifyEvent(Event,lParam1, lParam2: ULONG); stdcall; + end; + + function KsResolveRequiredAttributes(DataRange: PKSDATARANGE; + {OPTIONAL}Attributes: PKSMULTIPLE_ITEM): HResult; stdcall; + {$EXTERNALSYM KsResolveRequiredAttributes} + + function KsOpenDefaultDevice(Category: TGUID; Access: ACCESS_MASK; + DeviceHandle: PHANDLE): HResult; stdcall; + {$EXTERNALSYM KsOpenDefaultDevice} + + function KsSynchronousDeviceControl(Handle: THandle; IoControl: ULONG; + InBuffer: Pointer; InLength: ULONG; OutBuffer: Pointer; + OutLength: ULONG; BytesReturned: PULONG): HResult; stdcall; + {$EXTERNALSYM KsSynchronousDeviceControl} + + function KsGetMultiplePinFactoryItems(FilterHandle: THandle; PinFactoryId: ULONG; + PropertyId: ULONG; Items: Pointer): HResult; stdcall; + {$EXTERNALSYM KsGetMultiplePinFactoryItems} + + function KsGetMediaTypeCount(FilterHandle: THandle; PinFactoryId: ULONG; + out MediaTypeCount: ULONG): HResult; stdcall; + {$EXTERNALSYM KsGetMediaTypeCount} + + function KsGetMediaType(Position: integer; out AmMediaType: TAMMediaType; + FilterHandle: THandle; PinFactoryId: ULONG): HResult; stdcall; + {$EXTERNALSYM KsGetMediaType} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsAggregateControl;'} + {$EXTERNALSYM IKsAggregateControl} + IKsAggregateControl = interface(IUnknown) + ['{7F40EAC0-3947-11D2-874E-00A0C9223196}'] + (*** IKsAggregateControl methods ***) + procedure KsAddAggregate(const AggregateClass: TGUID); stdcall; + procedure KsRemoveAggregate(const AggregateClass: TGUID); stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsTopology;'} + {$EXTERNALSYM IKsTopology} + IKsTopology = interface(IUnknown) + ['{28F54683-06FD-11D2-B27A-00A0C9223196}'] + (*** IKsTopology methods ***) + procedure CreateNodeInstance(NodeId: ULONG; Flags: ULONG; DesiredAccess: ACCESS_MASK; + {OPTIONAL}UnkOuter: IUnknown; const InterfaceId: TGUID; out Interface_); stdcall; + end; + + {***************************************************************************** + * Copyright (C) Microsoft Corporation, 1996 - 2000 * + * * + * Module Name: ksmedia.h * + * * + * Abstract: WDM-CSA Multimedia Definitions. * + * * + *****************************************************************************} + + PKSMultipleDataProp = ^TKSMultipleDataProp; + KSMULTIPLE_DATA_PROP = record + Property_ : KSPROPERTY; + MultipleItem : TKSMultipleItem; + end; + {$EXTERNALSYM KSMULTIPLE_DATA_PROP} + PKSMULTIPLE_DATA_PROP = ^KSMULTIPLE_DATA_PROP; + {$EXTERNALSYM PKSMULTIPLE_DATA_PROP} + TKSMultipleDataProp = KSMULTIPLE_DATA_PROP; + +const + KSMEDIUMSETID_MidiBus : TGUID = '{05908040-3246-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSMEDIUMSETID_MidiBus} + KSMEDIUMSETID_VPBus : TGUID = '{A18C15EC-CE43-11D0-ABE7-00A0C9223196}'; + {$EXTERNALSYM KSMEDIUMSETID_VPBus} + KSINTERFACESETID_Media : TGUID = '{3A13EB40-30A7-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSINTERFACESETID_Media} + +type + KSINTERFACE_MEDIA = ( + KSINTERFACE_MEDIA_MUSIC, + KSINTERFACE_MEDIA_WAVE_BUFFERED, + KSINTERFACE_MEDIA_WAVE_QUEUED + ); + {$EXTERNALSYM KSINTERFACE_MEDIA} + TKSInterfaceMedia = KSINTERFACE_MEDIA; + +// USB Terminals +//#define INIT_USB_TERMINAL(guid, id)\ +{\ + (guid)->Data1 = 0xDFF219E0 + (USHORT)(id);\ + (guid)->Data2 = 0xF70F;\ + (guid)->Data3 = 0x11D0;\ + (guid)->Data4[0] = 0xb9;\ + (guid)->Data4[1] = 0x17;\ + (guid)->Data4[2] = 0x00;\ + (guid)->Data4[3] = 0xa0;\ + (guid)->Data4[4] = 0xc9;\ + (guid)->Data4[5] = 0x22;\ + (guid)->Data4[6] = 0x31;\ + (guid)->Data4[7] = 0x96;\ +} + +{#define EXTRACT_USB_TERMINAL(guid)\ + (USHORT)((guid)->Data1 - 0xDFF219E0) +#define DEFINE_USB_TERMINAL_GUID(id)\ + 0xDFF219E0+(USHORT)(id), 0xF70F, 0x11D0, 0xB9, 0x17, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} +const + KSNODETYPE_MICROPHONE : TGUID = '{DFF21BE1-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_MICROPHONE} + KSNODETYPE_DESKTOP_MICROPHONE : TGUID = '{DFF21BE2-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_DESKTOP_MICROPHONE} + KSNODETYPE_PERSONAL_MICROPHONE : TGUID = '{DFF21BE3-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_PERSONAL_MICROPHONE} + KSNODETYPE_OMNI_DIRECTIONAL_MICROPHONE : TGUID = '{DFF21BE4-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_OMNI_DIRECTIONAL_MICROPHONE} + KSNODETYPE_MICROPHONE_ARRAY : TGUID = '{DFF21BE5-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_MICROPHONE_ARRAY} + KSNODETYPE_PROCESSING_MICROPHONE_ARRAY : TGUID = '{DFF21BE6-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_PROCESSING_MICROPHONE_ARRAY} + KSCATEGORY_MICROPHONE_ARRAY_PROCESSOR : TGUID = '{830a44f2-a32d-476b-be97-42845673b35a}'; + {$EXTERNALSYM KSCATEGORY_MICROPHONE_ARRAY_PROCESSOR} + KSNODETYPE_SPEAKER : TGUID = '{DFF21CE1-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_SPEAKER} + KSNODETYPE_HEADPHONES : TGUID = '{DFF21CE2-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_HEADPHONES} + KSNODETYPE_HEAD_MOUNTED_DISPLAY_AUDIO : TGUID = '{DFF21CE3-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_HEAD_MOUNTED_DISPLAY_AUDIO} + KSNODETYPE_DESKTOP_SPEAKER : TGUID = '{DFF21CE4-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_DESKTOP_SPEAKER} + KSNODETYPE_ROOM_SPEAKER : TGUID = '{DFF21CE5-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_ROOM_SPEAKER} + KSNODETYPE_COMMUNICATION_SPEAKER : TGUID = '{DFF21CE6-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_COMMUNICATION_SPEAKER} + KSNODETYPE_LOW_FREQUENCY_EFFECTS_SPEAKER : TGUID = '{DFF21CE7-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_LOW_FREQUENCY_EFFECTS_SPEAKER} + KSNODETYPE_HANDSET : TGUID = '{DFF21DE1-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_HANDSET} + KSNODETYPE_HEADSET : TGUID = '{DFF21DE2-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_HEADSET} + KSNODETYPE_SPEAKERPHONE_NO_ECHO_REDUCTION : TGUID = '{DFF21DE3-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_SPEAKERPHONE_NO_ECHO_REDUCTION} + KSNODETYPE_ECHO_SUPPRESSING_SPEAKERPHONE : TGUID = '{DFF21DE4-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_ECHO_SUPPRESSING_SPEAKERPHONE} + KSNODETYPE_ECHO_CANCELING_SPEAKERPHONE : TGUID = '{DFF21DE5-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_ECHO_CANCELING_SPEAKERPHONE} + KSNODETYPE_PHONE_LINE : TGUID = '{DFF21EE1-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_PHONE_LINE} + KSNODETYPE_TELEPHONE : TGUID = '{DFF21EE2-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_TELEPHONE} + KSNODETYPE_DOWN_LINE_PHONE : TGUID = '{DFF21EE3-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_DOWN_LINE_PHONE} + KSNODETYPE_ANALOG_CONNECTOR : TGUID = '{DFF21FE1-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_ANALOG_CONNECTOR} + KSNODETYPE_DIGITAL_AUDIO_INTERFACE : TGUID = '{DFF21FE2-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_DIGITAL_AUDIO_INTERFACE} + KSNODETYPE_LINE_CONNECTOR : TGUID = '{DFF21FE3-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_LINE_CONNECTOR} + KSNODETYPE_LEGACY_AUDIO_CONNECTOR : TGUID = '{DFF21FE4-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_LEGACY_AUDIO_CONNECTOR} + KSNODETYPE_SPDIF_INTERFACE : TGUID = '{DFF21FE5-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_SPDIF_INTERFACE} + KSNODETYPE_1394_DA_STREAM : TGUID = '{DFF21FE6-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_1394_DA_STREAM} + KSNODETYPE_1394_DV_STREAM_SOUNDTRACK : TGUID = '{DFF21FE7-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_1394_DV_STREAM_SOUNDTRACK} + KSNODETYPE_LEVEL_CALIBRATION_NOISE_SOURCE : TGUID = '{DFF220E1-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_LEVEL_CALIBRATION_NOISE_SOURCE} + KSNODETYPE_EQUALIZATION_NOISE : TGUID = '{DFF220E2-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_EQUALIZATION_NOISE} + KSNODETYPE_CD_PLAYER : TGUID = '{DFF220E3-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_CD_PLAYER} + KSNODETYPE_DAT_IO_DIGITAL_AUDIO_TAPE : TGUID = '{DFF220E4-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_DAT_IO_DIGITAL_AUDIO_TAPE} + KSNODETYPE_DCC_IO_DIGITAL_COMPACT_CASSETTE : TGUID = '{DFF220E5-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_DCC_IO_DIGITAL_COMPACT_CASSETTE} + KSNODETYPE_MINIDISK : TGUID = '{DFF220E6-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_MINIDISK} + KSNODETYPE_ANALOG_TAPE : TGUID = '{DFF220E7-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_ANALOG_TAPE} + KSNODETYPE_PHONOGRAPH : TGUID = '{DFF220E8-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_PHONOGRAPH} + KSNODETYPE_VCR_AUDIO : TGUID = '{DFF220E9-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_VCR_AUDIO} + KSNODETYPE_VIDEO_DISC_AUDIO : TGUID = '{DFF220EA-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_VIDEO_DISC_AUDIO} + KSNODETYPE_DVD_AUDIO : TGUID = '{DFF220EB-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_DVD_AUDIO} + KSNODETYPE_TV_TUNER_AUDIO : TGUID = '{DFF220EC-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_TV_TUNER_AUDIO} + KSNODETYPE_SATELLITE_RECEIVER_AUDIO : TGUID = '{DFF220ED-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_SATELLITE_RECEIVER_AUDIO} + KSNODETYPE_CABLE_TUNER_AUDIO : TGUID = '{DFF220EE-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_CABLE_TUNER_AUDIO} + KSNODETYPE_DSS_AUDIO : TGUID = '{DFF220EF-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_DSS_AUDIO} + KSNODETYPE_RADIO_RECEIVER : TGUID = '{DFF220F0-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_RADIO_RECEIVER} + KSNODETYPE_RADIO_TRANSMITTER : TGUID = '{DFF220F1-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_RADIO_TRANSMITTER} + KSNODETYPE_MULTITRACK_RECORDER : TGUID = '{DFF220F2-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_MULTITRACK_RECORDER} + KSNODETYPE_SYNTHESIZER : TGUID = '{DFF220F3-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_SYNTHESIZER} +// Microsoft's WDMAUD virtual swsynth pin name guid + KSNODETYPE_SWSYNTH : TGUID = '{423274A0-8B81-11D1-A050-0000F8004788}'; + {$EXTERNALSYM KSNODETYPE_SWSYNTH} +// Microsoft's SWMIDI midi pin and node name guid + KSNODETYPE_SWMIDI : TGUID = '{CB9BEFA0-A251-11D1-A050-0000F8004788}'; + {$EXTERNALSYM KSNODETYPE_SWMIDI} + KSNODETYPE_DRM_DESCRAMBLE : TGUID = '{FFBB6E3F-CCFE-4D84-90D9-421418B03A8E}'; + {$EXTERNALSYM KSNODETYPE_DRM_DESCRAMBLE} +// General categories + KSCATEGORY_AUDIO : TGUID = '{6994AD04-93EF-11D0-A3CC-00A0C9223196}'; + {$EXTERNALSYM KSCATEGORY_AUDIO} + KSCATEGORY_VIDEO : TGUID = '{6994AD05-93EF-11D0-A3CC-00A0C9223196}'; + {$EXTERNALSYM KSCATEGORY_VIDEO} + KSCATEGORY_TEXT : TGUID = '{6994AD06-93EF-11D0-A3CC-00A0C9223196}'; + {$EXTERNALSYM KSCATEGORY_TEXT} + KSCATEGORY_NETWORK : TGUID = '{67C9CC3C-69C4-11D2-8759-00A0C9223196}'; + {$EXTERNALSYM KSCATEGORY_NETWORK} + KSCATEGORY_TOPOLOGY : TGUID = '{DDA54A40-1E4C-11D1-A050-405705C10000}'; + {$EXTERNALSYM KSCATEGORY_TOPOLOGY} + KSCATEGORY_VIRTUAL : TGUID = '{3503EAC4-1F26-11D1-8AB0-00A0C9223196}'; + {$EXTERNALSYM KSCATEGORY_VIRTUAL} + KSCATEGORY_ACOUSTIC_ECHO_CANCEL : TGUID = '{BF963D80-C559-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSCATEGORY_ACOUSTIC_ECHO_CANCEL} + KSCATEGORY_SYSAUDIO : TGUID = '{A7C7A5B1-5AF3-11D1-9CED-00A024BF0407}'; + {$EXTERNALSYM KSCATEGORY_SYSAUDIO} + KSCATEGORY_WDMAUD : TGUID = '{3E227E76-690D-11D2-8161-0000F8775BF1}'; + {$EXTERNALSYM KSCATEGORY_WDMAUD} + KSCATEGORY_AUDIO_GFX : TGUID = '{9BAF9572-340C-11D3-ABDC-00A0C90AB16F}'; + {$EXTERNALSYM KSCATEGORY_AUDIO_GFX} + KSCATEGORY_AUDIO_SPLITTER : TGUID = '{9EA331FA-B91B-45F8-9285-BD2BC77AFCDE}'; + {$EXTERNALSYM KSCATEGORY_AUDIO_SPLITTER} + + KSCATEGORY_SYNTHESIZER : TGUID = '{DFF220F3-F70F-11D0-B917-00A0C9223196}'; //KSNODETYPE_SYNTHESIZER + {$EXTERNALSYM KSCATEGORY_SYNTHESIZER} + KSCATEGORY_DRM_DESCRAMBLE : TGUID = '{FFBB6E3F-CCFE-4D84-90D9-421418B03A8E}'; //KSNODETYPE_DRM_DESCRAMBLE + {$EXTERNALSYM KSCATEGORY_DRM_DESCRAMBLE} + + KSCATEGORY_AUDIO_DEVICE : TGUID = '{FBF6F530-07B9-11D2-A71E-0000F8004788}'; + {$EXTERNALSYM KSCATEGORY_AUDIO_DEVICE} + KSCATEGORY_PREFERRED_WAVEOUT_DEVICE : TGUID = '{D6C5066E-72C1-11D2-9755-0000F8004788}'; + {$EXTERNALSYM KSCATEGORY_PREFERRED_WAVEOUT_DEVICE} + KSCATEGORY_PREFERRED_WAVEIN_DEVICE : TGUID = '{D6C50671-72C1-11D2-9755-0000F8004788}'; + {$EXTERNALSYM KSCATEGORY_PREFERRED_WAVEIN_DEVICE} + KSCATEGORY_PREFERRED_MIDIOUT_DEVICE : TGUID = '{D6C50674-72C1-11D2-9755-0000F8004788}'; + {$EXTERNALSYM KSCATEGORY_PREFERRED_MIDIOUT_DEVICE} +// Special pin category for wdmaud + KSCATEGORY_WDMAUD_USE_PIN_NAME : TGUID = '{47A4FA20-A251-11D1-A050-0000F8004788}'; + {$EXTERNALSYM KSCATEGORY_WDMAUD_USE_PIN_NAME} +// Escalante Platform Interface + KSCATEGORY_ESCALANTE_PLATFORM_DRIVER : TGUID = '{74f3aea8-9768-11d1-8e07-00a0c95ec22e}'; + {$EXTERNALSYM KSCATEGORY_ESCALANTE_PLATFORM_DRIVER} +// -- major types --- + +// 'vids' == MEDIATYPE_Video, + KSDATAFORMAT_TYPE_VIDEO : TGUID = '{73646976-0000-0010-8000-00aa00389b71}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_VIDEO} +// 'auds' == MEDIATYPE_Audio + KSDATAFORMAT_TYPE_AUDIO : TGUID = '{73647561-0000-0010-8000-00aa00389b71}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_AUDIO} +// 'txts' == MEDIATYPE_Text + KSDATAFORMAT_TYPE_TEXT : TGUID = '{73747874-0000-0010-8000-00aa00389b71}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_TEXT} + +{#if !defined( DEFINE_WAVEFORMATEX_GUID ) +#define DEFINE_WAVEFORMATEX_GUID(x) (USHORT)(x), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 +#endif} + + KSDATAFORMAT_SUBTYPE_WAVEFORMATEX : TGUID = '{00000000-0000-0010-8000-00aa00389b71}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_WAVEFORMATEX} + +//#define INIT_WAVEFORMATEX_GUID(Guid, x)\ +{\ + *(Guid) = KSDATAFORMAT_SUBTYPE_WAVEFORMATEX;\ + (Guid)->Data1 = (USHORT)(x);\ +} + +{#define EXTRACT_WAVEFORMATEX_ID(Guid)\ + (USHORT)((Guid)->Data1) + +#define IS_VALID_WAVEFORMATEX_GUID(Guid)\ + (!memcmp(((PUSHORT)&KSDATAFORMAT_SUBTYPE_WAVEFORMATEX) + 1, ((PUSHORT)(Guid)) + 1, sizeof(GUID) - sizeof(USHORT))) + +#if !defined(INIT_MMREG_MID)} +//{d5a47fa7-6d98-11d1-a21a-00a0c9223196} +//#define INIT_MMREG_MID(guid, id)\ +{\ + (guid)->Data1 = 0xd5a47fa7 + (USHORT)(id);\ + (guid)->Data2 = 0x6d98;\ + (guid)->Data3 = 0x11d1;\ + (guid)->Data4[0] = 0xa2;\ + (guid)->Data4[1] = 0x1a;\ + (guid)->Data4[2] = 0x00;\ + (guid)->Data4[3] = 0xa0;\ + (guid)->Data4[4] = 0xc9;\ + (guid)->Data4[5] = 0x22;\ + (guid)->Data4[6] = 0x31;\ + (guid)->Data4[7] = 0x96;\ +} +{#define EXTRACT_MMREG_MID(guid)\ + (USHORT)((guid)->Data1 - 0xd5a47fa7) +#define DEFINE_MMREG_MID_GUID(id)\ + 0xd5a47fa7+(USHORT)(id), 0x6d98, 0x11d1, 0xa2, 0x1a, 0x00, 0xa0, 0xc9, 0x22, 0x31, 0x96 + +#define IS_COMPATIBLE_MMREG_MID(guid)\ + (((guid)->Data1 >= 0xd5a47fa7) &&\ + ((guid)->Data1 < 0xd5a47fa7 + 0xffff) &&\ + ((guid)->Data2 == 0x6d98) &&\ + ((guid)->Data3 == 0x11d1) &&\ + ((guid)->Data4[0] == 0xa2) &&\ + ((guid)->Data4[1] == 0x1a) &&\ + ((guid)->Data4[2] == 0x00) &&\ + ((guid)->Data4[3] == 0xa0) &&\ + ((guid)->Data4[4] == 0xc9) &&\ + ((guid)->Data4[5] == 0x22) &&\ + ((guid)->Data4[6] == 0x31) &&\ + ((guid)->Data4[7] == 0x96)) +#endif // !defined(INIT_MMREG_MID) + +#if !defined(INIT_MMREG_PID) +//{e36dc2ac-6d9a-11d1-a21a-00a0c9223196} +//#define INIT_MMREG_PID(guid, id)\ +{\ + (guid)->Data1 = 0xe36dc2ac + (USHORT)(id);\ + (guid)->Data2 = 0x6d9a;\ + (guid)->Data3 = 0x11d1;\ + (guid)->Data4[0] = 0xa2;\ + (guid)->Data4[1] = 0x1a;\ + (guid)->Data4[2] = 0x00;\ + (guid)->Data4[3] = 0xa0;\ + (guid)->Data4[4] = 0xc9;\ + (guid)->Data4[5] = 0x22;\ + (guid)->Data4[6] = 0x31;\ + (guid)->Data4[7] = 0x96;\ +} +{#define EXTRACT_MMREG_PID(guid)\ + (USHORT)((guid)->Data1 - 0xe36dc2ac) +#define DEFINE_MMREG_PID_GUID(id)\ + 0xe36dc2ac+(USHORT)(id), 0x6d9a, 0x11d1, 0xa2, 0x1a, 0x00, 0xa0, 0xc9, 0x22, 0x31, 0x96 + +#define IS_COMPATIBLE_MMREG_PID(guid)\ + (((guid)->Data1 >= 0xe36dc2ac) &&\ + ((guid)->Data1 < 0xe36dc2ac + 0xffff) &&\ + ((guid)->Data2 == 0x6d9a) &&\ + ((guid)->Data3 == 0x11d1) &&\ + ((guid)->Data4[0] == 0xa2) &&\ + ((guid)->Data4[1] == 0x1a) &&\ + ((guid)->Data4[2] == 0x00) &&\ + ((guid)->Data4[3] == 0xa0) &&\ + ((guid)->Data4[4] == 0xc9) &&\ + ((guid)->Data4[5] == 0x22) &&\ + ((guid)->Data4[6] == 0x31) &&\ + ((guid)->Data4[7] == 0x96)) +#endif // !defined(INIT_MMREG_PID)} + + KSDATAFORMAT_SUBTYPE_ANALOG : TGUID = '{6dba3190-67bd-11cf-a0f7-0020afd156e4}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_ANALOG} + KSDATAFORMAT_SUBTYPE_PCM : TGUID = '{00000001-0000-0010-8000-00aa00389b71}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_PCM} + KSDATAFORMAT_SUBTYPE_IEEE_FLOAT : TGUID = '{00000003-0000-0010-8000-00aa00389b71}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_IEEE_FLOAT} + KSDATAFORMAT_SUBTYPE_DRM : TGUID = '{00000009-0000-0010-8000-00aa00389b71}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_DRM} + KSDATAFORMAT_SUBTYPE_ALAW : TGUID = '{00000006-0000-0010-8000-00aa00389b71}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_ALAW} + KSDATAFORMAT_SUBTYPE_MULAW : TGUID = '{00000007-0000-0010-8000-00aa00389b71}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_MULAW} + KSDATAFORMAT_SUBTYPE_ADPCM : TGUID = '{00000002-0000-0010-8000-00aa00389b71}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_ADPCM} + KSDATAFORMAT_SUBTYPE_MPEG : TGUID = '{00000050-0000-0010-8000-00aa00389b71}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_MPEG} + KSDATAFORMAT_SPECIFIER_VC_ID : TGUID = '{AD98D184-AAC3-11D0-A41C-00A0C9223196}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_VC_ID} + KSDATAFORMAT_SPECIFIER_WAVEFORMATEX : TGUID = '{05589f81-c356-11ce-bf01-00aa0055595a}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_WAVEFORMATEX} + KSDATAFORMAT_SPECIFIER_DSOUND : TGUID = '{518590a2-a184-11d0-8522-00c04fd9baf3}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_DSOUND} + +type + PKSDataFormatWaveFormatEx = ^TKSDataFormatWaveFormatEx; + KSDATAFORMAT_WAVEFORMATEX = record + DataFormat : TKSDATAFORMAT; + WaveFormatEx : TWAVEFORMATEX; + end; + {$EXTERNALSYM KSDATAFORMAT_WAVEFORMATEX} + PKSDATAFORMAT_WAVEFORMATEX = ^KSDATAFORMAT_WAVEFORMATEX; + {$EXTERNALSYM PKSDATAFORMAT_WAVEFORMATEX} + TKSDataFormatWaveFormatEx = KSDATAFORMAT_WAVEFORMATEX; + + // + // The WAVEFORMATEXTENSIBLE structure defines the format of waveform-audio data for formats having more than two channels. + // This structure is part of the Platform SDK and is not declared in Dsound.h. It is included here for convenience. + // + TWaveFormatExtensibleSamples = record + case byte of + 0: (wValidBitsPerSample : Word); // bits of precision + 1: (wSamplesPerBlock : Word); // valid if wBitsPerSample = 0 + 2: (wReserved : Word); // If neither applies, set to zero. + end; + {$EXTERNALSYM TWaveFormatExtensibleSamples} + + PWaveFormatExtensible = ^TWaveFormatExtensible; + WAVEFORMATEXTENSIBLE = record + Format: TWaveFormatEx; + Samples: TWaveFormatExtensibleSamples; + dwChannelMask : DWORD; // which channels are present in stream + SubFormat : TGUID; + end; + {$EXTERNALSYM WAVEFORMATEXTENSIBLE} + TWaveFormatExtensible = WAVEFORMATEXTENSIBLE; + +const + WAVE_FORMAT_EXTENSIBLE = $FFFE; + {$EXTERNALSYM WAVE_FORMAT_EXTENSIBLE} + +type +// DirectSound buffer description + PKSDSoundBufferDesc = ^TKSDSoundBufferDesc; + KSDSOUND_BUFFERDESC = record + Flags : ULONG; + Control : ULONG; + WaveFormatEx : TWAVEFORMATEX; + end; + {$EXTERNALSYM KSDSOUND_BUFFERDESC} + PKSDSOUND_BUFFERDESC = ^KSDSOUND_BUFFERDESC; + {$EXTERNALSYM PKSDSOUND_BUFFERDESC} + TKSDSoundBufferDesc = KSDSOUND_BUFFERDESC; + +// DirectSound format + PKSDataFormatDSound = ^TKSDataFormatDSound; + KSDATAFORMAT_DSOUND = record + DataFormat :TKSDataFormat; + BufferDesc :TKSDSoundBufferDesc; + end; + {$EXTERNALSYM KSDATAFORMAT_DSOUND} + PKSDATAFORMAT_DSOUND = ^KSDATAFORMAT_DSOUND; + {$EXTERNALSYM PKSDATAFORMAT_DSOUND} + TKSDataFormatDSound = KSDATAFORMAT_DSOUND; + +const +// DirectSound buffer flags + KSDSOUND_BUFFER_PRIMARY = $00000001; + {$EXTERNALSYM KSDSOUND_BUFFER_PRIMARY} + KSDSOUND_BUFFER_STATIC = $00000002; + {$EXTERNALSYM KSDSOUND_BUFFER_STATIC} + KSDSOUND_BUFFER_LOCHARDWARE = $00000004; + {$EXTERNALSYM KSDSOUND_BUFFER_LOCHARDWARE} + KSDSOUND_BUFFER_LOCSOFTWARE = $00000008; + {$EXTERNALSYM KSDSOUND_BUFFER_LOCSOFTWARE} + +// DirectSound buffer control flags + KSDSOUND_BUFFER_CTRL_3D = $00000001; + {$EXTERNALSYM KSDSOUND_BUFFER_CTRL_3D} + KSDSOUND_BUFFER_CTRL_FREQUENCY = $00000002; + {$EXTERNALSYM KSDSOUND_BUFFER_CTRL_FREQUENCY} + KSDSOUND_BUFFER_CTRL_PAN = $00000004; + {$EXTERNALSYM KSDSOUND_BUFFER_CTRL_PAN} + KSDSOUND_BUFFER_CTRL_VOLUME = $00000008; + {$EXTERNALSYM KSDSOUND_BUFFER_CTRL_VOLUME} + KSDSOUND_BUFFER_CTRL_POSITIONNOTIFY = $00000010; + {$EXTERNALSYM KSDSOUND_BUFFER_CTRL_POSITIONNOTIFY} + + KSDSOUND_BUFFER_CTRL_HRTF_3D = $40000000; + {$EXTERNALSYM KSDSOUND_BUFFER_CTRL_HRTF_3D} + +type + PKSAudioPosition = ^TKSAudioPosition; + KSAUDIO_POSITION = record + PlayOffset :int64; + WriteOffset :int64; + end; + {$EXTERNALSYM KSAUDIO_POSITION} + PKSAUDIO_POSITION = ^KSAUDIO_POSITION; + {$EXTERNALSYM PKSAUDIO_POSITION} + TKSAudioPosition = KSAUDIO_POSITION; + +// DirectSound3D FIR context +// PKSDS3DITDParams = ^TKSDS3DITDParams; +// KSDS3D_ITD_PARAMS = record +// Channel : longint; +// VolSmoothScale : single; +// TotalDryAttenuation : single; +// TotalWetAttenuation : single; +// SmoothFrequency : longint; +// Delay : longint; +// end; +// {$EXTERNALSYM KSDS3D_ITD_PARAMS} +// PKSDS3D_ITD_PARAMS = ^KSDS3D_ITD_PARAMS; +// {$EXTERNALSYM PKSDS3D_ITD_PARAMS} +// TKSDS3DITDParams = KSDS3D_ITD_PARAMS; + +// PKSDS3DITDParamsMsg = ^TKSDS3DITDParamsMsg; +// KSDS3D_ITD_PARAMS_MSG = record +// Enabled :ULONG; +// LeftParams :TKSDS3DITDParams; +// RightParams :TKSDS3DITDParams; +// Reserved :ULONG; +// end; +// {$EXTERNALSYM KSDS3D_ITD_PARAMS_MSG} +// PKSDS3D_ITD_PARAMS_MSG = ^KSDS3D_ITD_PARAMS_MSG; +// {$EXTERNALSYM PKSDS3D_ITD_PARAMS_MSG} +// TKSDS3DITDParamsMsg = KSDS3D_ITD_PARAMS_MSG; + +// DirectSound3D HRTF messages + +// PKSDS3DHRTFParamsMsg = ^TKSDS3DHRTFParamsMsg; +// KSDS3D_HRTF_PARAMS_MSG = record +// Size :ULONG; // This is the size of the struct in bytes +// Enabled :ULONG; +// SwapChannels :BOOL; +// ZeroAzimuth :BOOL; +// CrossFadeOutput :BOOL; +// FilterSize :ULONG; // This is the additional size of the filter coeff in bytes +// end; +// {$EXTERNALSYM KSDS3D_HRTF_PARAMS_MSG} +// PKSDS3D_HRTF_PARAMS_MSG = ^KSDS3D_HRTF_PARAMS_MSG; +// {$EXTERNALSYM PKSDS3D_HRTF_PARAMS_MSG} +// TKSDS3DHRTFParamsMsg = KSDS3D_HRTF_PARAMS_MSG; + +// HRTF filter quality levels +// KSDS3D_HRTF_FILTER_QUALITY = ( +// FULL_FILTER, +// LIGHT_FILTER, +// KSDS3D_FILTER_QUALITY_COUNT +// ); +// {$EXTERNALSYM KSDS3D_HRTF_FILTER_QUALITY} +// TKSDS3DHRTFFilterQuality = KSDS3D_HRTF_FILTER_QUALITY; + +// PKSDS3DHRTFInitMsg = ^TKSDS3DHRTFInitMsg; +// KSDS3D_HRTF_INIT_MSG = record +// Size : ULONG; // This is the size of the struct in bytes +// Quality : TKSDS3DHRTFFilterQuality; +// SampleRate : single; +// MaxFilterSize : ULONG; +// FilterTransientMuteLength : ULONG; +// FilterOverlapBufferLength : ULONG; +// OutputOverlapBufferLength : ULONG; +// Reserved : ULONG; +// end; +// {$EXTERNALSYM KSDS3D_HRTF_INIT_MSG} +// PKSDS3D_HRTF_INIT_MSG = ^KSDS3D_HRTF_INIT_MSG; +// {$EXTERNALSYM PKSDS3D_HRTF_INIT_MSG} +// TKSDS3DHRTFInitMsg = KSDS3D_HRTF_INIT_MSG; + +// Coefficient formats +// KSDS3D_HRTF_COEFF_FORMAT = ( +// FLOAT_COEFF, +// SHORT_COEFF, +// KSDS3D_COEFF_COUNT +// ); +// {$EXTERNALSYM KSDS3D_HRTF_COEFF_FORMAT} +// TKSDS3DHRTFCoeffFormat = KSDS3D_HRTF_COEFF_FORMAT; + +//// Filter methods +// KSDS3D_HRTF_FILTER_METHOD = ( +// DIRECT_FORM, +// CASCADE_FORM, +// KSDS3D_FILTER_METHOD_COUNT +// ); +// {$EXTERNALSYM KSDS3D_HRTF_FILTER_METHOD} +// TKSDS3DHRTFFilterMethod = KSDS3D_HRTF_FILTER_METHOD; + +// Filter methods +// KSDS3D_HRTF_FILTER_VERSION = ( +// DS3D_HRTF_VERSION_1 +// ); +// {$EXTERNALSYM KSDS3D_HRTF_FILTER_VERSION} +// TKSDS3DHRTFFilterVersion = KSDS3D_HRTF_FILTER_VERSION; + +// PKSDS3DHRTFFilterFormatMsg = ^TKSDS3DHRTFFilterFormatMsg; +// KSDS3D_HRTF_FILTER_FORMAT_MSG = record +// FilterMethod : TKSDS3DHRTFFilterMethod; +// CoeffFormat : TKSDS3DHRTFCoeffFormat; +// Version : TKSDS3DHRTFFilterVersion; +// Reserved : ULONG; +// end; +// {$EXTERNALSYM KSDS3D_HRTF_FILTER_FORMAT_MSG} +// PKSDS3D_HRTF_FILTER_FORMAT_MSG = ^KSDS3D_HRTF_FILTER_FORMAT_MSG; +// {$EXTERNALSYM PKSDS3D_HRTF_FILTER_FORMAT_MSG} +// TKSDS3DHRTFFilterFormatMsg = KSDS3D_HRTF_FILTER_FORMAT_MSG; + +//=========================================================================== +// DirectSound3D HAL + + + _DS3DVECTOR = record + case integer of + 0: ( + x : single; + y : single; + z : single); + 1: ( + dvX : single; + dvY : single; + dvZ : single); + end; + {$EXTERNALSYM _DS3DVECTOR} + DS3DVECTOR = _DS3DVECTOR; + {$EXTERNALSYM DS3DVECTOR} + PDS3DVECTOR = ^DS3DVECTOR; + {$EXTERNALSYM PDS3DVECTOR} + TDS3DVector = DS3DVECTOR; + +//=========================================================================== +//=========================================================================== + +// KSPROPSETID_DirectSound3DListener : {437B3414-D060-11d0-8583-00C04FD9BAF3} +const + KSPROPSETID_DirectSound3DListener : TGUID = '{437b3414-d060-11d0-8583-00c04fd9baf3}'; + {$EXTERNALSYM KSPROPSETID_DirectSound3DListener} + +type + KSPROPERTY_DIRECTSOUND3DLISTENER = ( + KSPROPERTY_DIRECTSOUND3DLISTENER_ALL, + KSPROPERTY_DIRECTSOUND3DLISTENER_POSITION, + KSPROPERTY_DIRECTSOUND3DLISTENER_VELOCITY, + KSPROPERTY_DIRECTSOUND3DLISTENER_ORIENTATION, + KSPROPERTY_DIRECTSOUND3DLISTENER_DISTANCEFACTOR, + KSPROPERTY_DIRECTSOUND3DLISTENER_ROLLOFFFACTOR, + KSPROPERTY_DIRECTSOUND3DLISTENER_DOPPLERFACTOR, + KSPROPERTY_DIRECTSOUND3DLISTENER_BATCH, + KSPROPERTY_DIRECTSOUND3DLISTENER_ALLOCATION + ); + {$EXTERNALSYM KSPROPERTY_DIRECTSOUND3DLISTENER} + TKSPropertyDirectSound3DListener = KSPROPERTY_DIRECTSOUND3DLISTENER; + + PKSDS3DListenerAll = ^TKSDS3DListenerAll; + KSDS3D_LISTENER_ALL = record + Position : TDS3DVECTOR; + Velocity : TDS3DVECTOR; + OrientFront : TDS3DVECTOR; + OrientTop : TDS3DVECTOR; + DistanceFactor : single; + RolloffFactor : single; + DopplerFactor : single; + end; + {$EXTERNALSYM KSDS3D_LISTENER_ALL} + PKSDS3D_LISTENER_ALL = ^KSDS3D_LISTENER_ALL; + {$EXTERNALSYM PKSDS3D_LISTENER_ALL} + TKSDS3DListenerAll = KSDS3D_LISTENER_ALL; + + + KSDS3D_LISTENER_ORIENTATION = record + Front : TDS3DVECTOR; + Top : TDS3DVECTOR; + end; + {$EXTERNALSYM KSDS3D_LISTENER_ORIENTATION} + PKSDS3D_LISTENER_ORIENTATION = ^KSDS3D_LISTENER_ORIENTATION; + {$EXTERNALSYM PKSDS3D_LISTENER_ORIENTATION} + TKSDS3DListenerOrientation = KSDS3D_LISTENER_ORIENTATION; + +//=========================================================================== +//=========================================================================== +// KSPROPSETID_DirectSound3DBuffer : {437B3411-D060-11d0-8583-00C04FD9BAF3} +const + KSPROPSETID_DirectSound3DBuffer : TGUID = '{437B3411-D060-11d0-8583-00C04FD9BAF3}'; + {$EXTERNALSYM KSPROPSETID_DirectSound3DBuffer} + +type + KSPROPERTY_DIRECTSOUND3DBUFFER = ( + KSPROPERTY_DIRECTSOUND3DBUFFER_ALL, + KSPROPERTY_DIRECTSOUND3DBUFFER_POSITION, + KSPROPERTY_DIRECTSOUND3DBUFFER_VELOCITY, + KSPROPERTY_DIRECTSOUND3DBUFFER_CONEANGLES, + KSPROPERTY_DIRECTSOUND3DBUFFER_CONEORIENTATION, + KSPROPERTY_DIRECTSOUND3DBUFFER_CONEOUTSIDEVOLUME, + KSPROPERTY_DIRECTSOUND3DBUFFER_MINDISTANCE, + KSPROPERTY_DIRECTSOUND3DBUFFER_MAXDISTANCE, + KSPROPERTY_DIRECTSOUND3DBUFFER_MODE + ); + {$EXTERNALSYM KSPROPERTY_DIRECTSOUND3DBUFFER} + TKSPropertyDirectSound3DBuffer = KSPROPERTY_DIRECTSOUND3DBUFFER; + + KSDS3D_BUFFER_ALL = record + Position : TDS3DVECTOR; + Velocity : TDS3DVECTOR; + InsideConeAngle : ULONG; + OutsideConeAngle : ULONG; + ConeOrientation : TDS3DVECTOR; + ConeOutsideVolume : longint; + MinDistance : single; + MaxDistance : single; + Mode : ULONG; + end; + {$EXTERNALSYM KSDS3D_BUFFER_ALL} + PKSDS3D_BUFFER_ALL = ^KSDS3D_BUFFER_ALL; + {$EXTERNALSYM PKSDS3D_BUFFER_ALL} + TKSDS3DBufferAll = KSDS3D_BUFFER_ALL; + + KSDS3D_BUFFER_CONE_ANGLES = record + InsideConeAngle : ULONG; + OutsideConeAngle : ULONG; + end; + {$EXTERNALSYM KSDS3D_BUFFER_CONE_ANGLES} + PKSDS3D_BUFFER_CONE_ANGLES = ^KSDS3D_BUFFER_CONE_ANGLES; + {$EXTERNALSYM PKSDS3D_BUFFER_CONE_ANGLES} + TKSDS3DBufferConeAngles = KSDS3D_BUFFER_CONE_ANGLES; + +const + KSAUDIO_STEREO_SPEAKER_GEOMETRY_HEADPHONE = -1; + {$EXTERNALSYM KSAUDIO_STEREO_SPEAKER_GEOMETRY_HEADPHONE} + KSAUDIO_STEREO_SPEAKER_GEOMETRY_MIN = 5; + {$EXTERNALSYM KSAUDIO_STEREO_SPEAKER_GEOMETRY_MIN} + KSAUDIO_STEREO_SPEAKER_GEOMETRY_NARROW = 10; + {$EXTERNALSYM KSAUDIO_STEREO_SPEAKER_GEOMETRY_NARROW} + KSAUDIO_STEREO_SPEAKER_GEOMETRY_WIDE = 20; + {$EXTERNALSYM KSAUDIO_STEREO_SPEAKER_GEOMETRY_WIDE} + KSAUDIO_STEREO_SPEAKER_GEOMETRY_MAX = 180; + {$EXTERNALSYM KSAUDIO_STEREO_SPEAKER_GEOMETRY_MAX} + + KSDSOUND_3D_MODE_NORMAL = $00000000; + {$EXTERNALSYM KSDSOUND_3D_MODE_NORMAL} + KSDSOUND_3D_MODE_HEADRELATIVE = $00000001; + {$EXTERNALSYM KSDSOUND_3D_MODE_HEADRELATIVE} + KSDSOUND_3D_MODE_DISABLE = $00000002; + {$EXTERNALSYM KSDSOUND_3D_MODE_DISABLE} + +type + KSDATARANGE_AUDIO = record + DataRange : TKSDataRange; + MaximumChannels : ULONG; + MinimumBitsPerSample : ULONG; + MaximumBitsPerSample : ULONG; + MinimumSampleFrequency : ULONG; + MaximumSampleFrequency : ULONG; + end; + {$EXTERNALSYM KSDATARANGE_AUDIO} + PKSDATARANGE_AUDIO = ^KSDATARANGE_AUDIO; + {$EXTERNALSYM PKSDATARANGE_AUDIO} + TKSDataRangeAudio = KSDATARANGE_AUDIO; + +//--------------------------------------------------------------------------- +const + KSDATAFORMAT_SUBTYPE_RIFF : TGUID = '{4995DAEE-9EE6-11D0-A40E-00A0C9223196}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_RIFF} + KSDATAFORMAT_SUBTYPE_RIFFWAVE : TGUID = '{e436eb8b-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_RIFFWAVE} + +//=========================================================================== +//=========================================================================== + + KSPROPSETID_Bibliographic : TGUID = '{07BA150E-E2B1-11D0-AC17-00A0C9223196}'; + {$EXTERNALSYM KSPROPSETID_Bibliographic} + +//Repeatable tags contain all entries within the property, each preceeded by length +type + KSPROPERTY_BIBLIOGRAPHIC = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC} + const + KSPROPERTY_BIBLIOGRAPHIC_LEADER = 'RDL '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_LEADER} + KSPROPERTY_BIBLIOGRAPHIC_LCCN = '010 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_LCCN} + KSPROPERTY_BIBLIOGRAPHIC_ISBN = '020 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_ISBN} + KSPROPERTY_BIBLIOGRAPHIC_ISSN = '220 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_ISSN} + KSPROPERTY_BIBLIOGRAPHIC_CATALOGINGSOURCE = '040 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_CATALOGINGSOURCE} + KSPROPERTY_BIBLIOGRAPHIC_MAINPERSONALNAME = '001 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_MAINPERSONALNAME} + KSPROPERTY_BIBLIOGRAPHIC_MAINCORPORATEBODY = '011 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_MAINCORPORATEBODY} + KSPROPERTY_BIBLIOGRAPHIC_MAINMEETINGNAME = '111 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_MAINMEETINGNAME} + KSPROPERTY_BIBLIOGRAPHIC_MAINUNIFORMTITLE = '031 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_MAINUNIFORMTITLE} + KSPROPERTY_BIBLIOGRAPHIC_UNIFORMTITLE = '042 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_UNIFORMTITLE} + KSPROPERTY_BIBLIOGRAPHIC_TITLESTATEMENT = '542 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_TITLESTATEMENT} + KSPROPERTY_BIBLIOGRAPHIC_VARYINGFORMTITLE = '642 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_VARYINGFORMTITLE} + KSPROPERTY_BIBLIOGRAPHIC_PUBLICATION = '062 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_PUBLICATION} + KSPROPERTY_BIBLIOGRAPHIC_PHYSICALDESCRIPTION = '003 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_PHYSICALDESCRIPTION} + KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYTITLE = '044 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYTITLE} + KSPROPERTY_BIBLIOGRAPHIC_SERIESSTATEMENT = '094 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_SERIESSTATEMENT} + KSPROPERTY_BIBLIOGRAPHIC_GENERALNOTE = '005 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_GENERALNOTE} + KSPROPERTY_BIBLIOGRAPHIC_BIBLIOGRAPHYNOTE = '405 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_BIBLIOGRAPHYNOTE} + KSPROPERTY_BIBLIOGRAPHIC_CONTENTSNOTE = '505 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_CONTENTSNOTE} + KSPROPERTY_BIBLIOGRAPHIC_CREATIONCREDIT = '805 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_CREATIONCREDIT} + KSPROPERTY_BIBLIOGRAPHIC_CITATION = '015 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_CITATION} + KSPROPERTY_BIBLIOGRAPHIC_PARTICIPANT = '115 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_PARTICIPANT} + KSPROPERTY_BIBLIOGRAPHIC_SUMMARY = '025 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_SUMMARY} + KSPROPERTY_BIBLIOGRAPHIC_TARGETAUDIENCE = '125 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_TARGETAUDIENCE} + KSPROPERTY_BIBLIOGRAPHIC_ADDEDFORMAVAILABLE = '035 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_ADDEDFORMAVAILABLE} + KSPROPERTY_BIBLIOGRAPHIC_SYSTEMDETAILS = '835 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_SYSTEMDETAILS} + KSPROPERTY_BIBLIOGRAPHIC_AWARDS = '685 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_AWARDS} + KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYPERSONALNAME = '006 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYPERSONALNAME} + KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYTOPICALTERM = '056 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYTOPICALTERM} + KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYGEOGRAPHIC = '156 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYGEOGRAPHIC} + KSPROPERTY_BIBLIOGRAPHIC_INDEXTERMGENRE = '556 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_INDEXTERMGENRE} + KSPROPERTY_BIBLIOGRAPHIC_INDEXTERMCURRICULUM = '856 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_INDEXTERMCURRICULUM} + KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYUNIFORMTITLE = '037 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYUNIFORMTITLE} + KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYRELATED = '047 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYRELATED} + KSPROPERTY_BIBLIOGRAPHIC_SERIESSTATEMENTPERSONALNAME = '008 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_SERIESSTATEMENTPERSONALNAME} + KSPROPERTY_BIBLIOGRAPHIC_SERIESSTATEMENTUNIFORMTITLE = '038 '; + {$EXTERNALSYM KSPROPERTY_BIBLIOGRAPHIC_SERIESSTATEMENTUNIFORMTITLE} + + KSPROPSETID_TopologyNode : TGUID = '{45FFAAA1-6E1B-11D0-BCF2-444553540000}'; + {$EXTERNALSYM KSPROPSETID_TopologyNode} + +type + KSPROPERTY_TOPOLOGYNODE = ( + {$IFNDEF COMPILER6_UP} + KSPROPERTY_TOPOLOGYNODE_INVALID_0, + KSPROPERTY_TOPOLOGYNODE_ENABLE, + KSPROPERTY_TOPOLOGYNODE_RESET + {$ELSE} + KSPROPERTY_TOPOLOGYNODE_ENABLE = 1, + KSPROPERTY_TOPOLOGYNODE_RESET = 2 + {$ENDIF} + ); + {$EXTERNALSYM KSPROPERTY_TOPOLOGYNODE} + TKSPropertyTopologyNode = KSPROPERTY_TOPOLOGYNODE; + +//=========================================================================== +const + KSPROPSETID_DrmAudioStream : TGUID = '{2F2C8DDD-4198-4fac-BA29-61BB05B7DE06}'; + {$EXTERNALSYM KSPROPSETID_DrmAudioStream} + +type + KSPROPERTY_DRMAUDIOSTREAM = ( + KSPROPERTY_DRMAUDIOSTREAM_CONTENTID, + KSPROPERTY_DRMAUDIOSTREAM_AUTHENTICATEFUNCTION + ); + {$EXTERNALSYM KSPROPERTY_DRMAUDIOSTREAM} + TKSPRopertyDRMAudioStream = KSPROPERTY_DRMAUDIOSTREAM; + +//=========================================================================== +const + KSPROPSETID_Audio : TGUID = '{45FFAAA0-6E1B-11D0-BCF2-444553540000}'; + {$EXTERNALSYM KSPROPSETID_Audio} + +type + KSPROPERTY_AUDIO = ( + {$IFNDEF COMPILER6_UP} + KSPROPERTY_AUDIO_INVALID_0, + KSPROPERTY_AUDIO_LATENCY, + {$ELSE} + KSPROPERTY_AUDIO_LATENCY = 1, + {$ENDIF} + KSPROPERTY_AUDIO_COPY_PROTECTION, + KSPROPERTY_AUDIO_CHANNEL_CONFIG, + KSPROPERTY_AUDIO_VOLUMELEVEL, + KSPROPERTY_AUDIO_POSITION, + KSPROPERTY_AUDIO_DYNAMIC_RANGE, + KSPROPERTY_AUDIO_QUALITY, + KSPROPERTY_AUDIO_SAMPLING_RATE, + KSPROPERTY_AUDIO_DYNAMIC_SAMPLING_RATE, + KSPROPERTY_AUDIO_MIX_LEVEL_TABLE, + KSPROPERTY_AUDIO_MIX_LEVEL_CAPS, + KSPROPERTY_AUDIO_MUX_SOURCE, + KSPROPERTY_AUDIO_MUTE, + KSPROPERTY_AUDIO_BASS, + KSPROPERTY_AUDIO_MID, + KSPROPERTY_AUDIO_TREBLE, + KSPROPERTY_AUDIO_BASS_BOOST, + KSPROPERTY_AUDIO_EQ_LEVEL, + KSPROPERTY_AUDIO_NUM_EQ_BANDS, + KSPROPERTY_AUDIO_EQ_BANDS, + KSPROPERTY_AUDIO_AGC, + KSPROPERTY_AUDIO_DELAY, + KSPROPERTY_AUDIO_LOUDNESS, + KSPROPERTY_AUDIO_WIDE_MODE, + KSPROPERTY_AUDIO_WIDENESS, + KSPROPERTY_AUDIO_REVERB_LEVEL, + KSPROPERTY_AUDIO_CHORUS_LEVEL, + KSPROPERTY_AUDIO_DEV_SPECIFIC, + KSPROPERTY_AUDIO_DEMUX_DEST, + KSPROPERTY_AUDIO_STEREO_ENHANCE, + KSPROPERTY_AUDIO_MANUFACTURE_GUID, + KSPROPERTY_AUDIO_PRODUCT_GUID, + KSPROPERTY_AUDIO_CPU_RESOURCES, + KSPROPERTY_AUDIO_STEREO_SPEAKER_GEOMETRY, + KSPROPERTY_AUDIO_SURROUND_ENCODE, + KSPROPERTY_AUDIO_3D_INTERFACE, + KSPROPERTY_AUDIO_PEAKMETER, + KSPROPERTY_AUDIO_ALGORITHM_INSTANCE + ); + {$EXTERNALSYM KSPROPERTY_AUDIO} + TKSPropertyAudio = KSPROPERTY_AUDIO; + +// Audio quality constants +const + KSAUDIO_QUALITY_WORST = $0; + {$EXTERNALSYM KSAUDIO_QUALITY_WORST} + KSAUDIO_QUALITY_PC = $1; + {$EXTERNALSYM KSAUDIO_QUALITY_PC} + KSAUDIO_QUALITY_BASIC = $2; + {$EXTERNALSYM KSAUDIO_QUALITY_BASIC} + KSAUDIO_QUALITY_ADVANCED = $3; + {$EXTERNALSYM KSAUDIO_QUALITY_ADVANCED} + +// Audio CPU resource constants + KSAUDIO_CPU_RESOURCES_NOT_HOST_CPU = $00000000; + {$EXTERNALSYM KSAUDIO_CPU_RESOURCES_NOT_HOST_CPU} + KSAUDIO_CPU_RESOURCES_HOST_CPU = $7FFFFFFF; + {$EXTERNALSYM KSAUDIO_CPU_RESOURCES_HOST_CPU} + +type + PKSAudioCopyProtection = ^TKSAudioCopyProtection; + KSAUDIO_COPY_PROTECTION = record + fCopyrighted : BOOL; + fOriginal : BOOL; + end; + {$EXTERNALSYM KSAUDIO_COPY_PROTECTION} + PKSAUDIO_COPY_PROTECTION = ^KSAUDIO_COPY_PROTECTION; + {$EXTERNALSYM PKSAUDIO_COPY_PROTECTION} + TKSAudioCopyProtection = KSAUDIO_COPY_PROTECTION; + + PKSAudioChannelConfig = ^TKSAudioChannelConfig; + KSAUDIO_CHANNEL_CONFIG = record + ActiveSpeakerPositions : Longint; + end; + {$EXTERNALSYM KSAUDIO_CHANNEL_CONFIG} + PKSAUDIO_CHANNEL_CONFIG = ^KSAUDIO_CHANNEL_CONFIG; + {$EXTERNALSYM PKSAUDIO_CHANNEL_CONFIG} + TKSAudioChannelConfig = KSAUDIO_CHANNEL_CONFIG; + +// Speaker Positions: +const + SPEAKER_FRONT_LEFT = $1; + {$EXTERNALSYM SPEAKER_FRONT_LEFT} + SPEAKER_FRONT_RIGHT = $2; + {$EXTERNALSYM SPEAKER_FRONT_RIGHT} + SPEAKER_FRONT_CENTER = $4; + {$EXTERNALSYM SPEAKER_FRONT_CENTER} + SPEAKER_LOW_FREQUENCY = $8; + {$EXTERNALSYM SPEAKER_LOW_FREQUENCY} + SPEAKER_BACK_LEFT = $10; + {$EXTERNALSYM SPEAKER_BACK_LEFT} + SPEAKER_BACK_RIGHT = $20; + {$EXTERNALSYM SPEAKER_BACK_RIGHT} + SPEAKER_FRONT_LEFT_OF_CENTER = $40; + {$EXTERNALSYM SPEAKER_FRONT_LEFT_OF_CENTER} + SPEAKER_FRONT_RIGHT_OF_CENTER = $80; + {$EXTERNALSYM SPEAKER_FRONT_RIGHT_OF_CENTER} + SPEAKER_BACK_CENTER = $100; + {$EXTERNALSYM SPEAKER_BACK_CENTER} + SPEAKER_SIDE_LEFT = $200; + {$EXTERNALSYM SPEAKER_SIDE_LEFT} + SPEAKER_SIDE_RIGHT = $400; + {$EXTERNALSYM SPEAKER_SIDE_RIGHT} + SPEAKER_TOP_CENTER = $800; + {$EXTERNALSYM SPEAKER_TOP_CENTER} + SPEAKER_TOP_FRONT_LEFT = $1000; + {$EXTERNALSYM SPEAKER_TOP_FRONT_LEFT} + SPEAKER_TOP_FRONT_CENTER = $2000; + {$EXTERNALSYM SPEAKER_TOP_FRONT_CENTER} + SPEAKER_TOP_FRONT_RIGHT = $4000; + {$EXTERNALSYM SPEAKER_TOP_FRONT_RIGHT} + SPEAKER_TOP_BACK_LEFT = $8000; + {$EXTERNALSYM SPEAKER_TOP_BACK_LEFT} + SPEAKER_TOP_BACK_CENTER = $10000; + {$EXTERNALSYM SPEAKER_TOP_BACK_CENTER} + SPEAKER_TOP_BACK_RIGHT = $20000; + {$EXTERNALSYM SPEAKER_TOP_BACK_RIGHT} + +// Bit mask locations reserved for future use + SPEAKER_RESERVED = $7FFC0000; + {$EXTERNALSYM SPEAKER_RESERVED} + +// Used to specify that any possible permutation of speaker configurations + SPEAKER_ALL = $80000000; + {$EXTERNALSYM SPEAKER_ALL} + +// DirectSound Speaker Config + KSAUDIO_SPEAKER_MONO = (SPEAKER_FRONT_CENTER); + {$EXTERNALSYM KSAUDIO_SPEAKER_MONO} + KSAUDIO_SPEAKER_STEREO = (SPEAKER_FRONT_LEFT or SPEAKER_FRONT_RIGHT); + {$EXTERNALSYM KSAUDIO_SPEAKER_STEREO} + KSAUDIO_SPEAKER_QUAD = (SPEAKER_FRONT_LEFT or SPEAKER_FRONT_RIGHT or + SPEAKER_BACK_LEFT or SPEAKER_BACK_RIGHT); + {$EXTERNALSYM KSAUDIO_SPEAKER_QUAD} + KSAUDIO_SPEAKER_SURROUND = (SPEAKER_FRONT_LEFT or SPEAKER_FRONT_RIGHT or + SPEAKER_FRONT_CENTER or SPEAKER_BACK_CENTER); + {$EXTERNALSYM KSAUDIO_SPEAKER_SURROUND} + KSAUDIO_SPEAKER_5POINT1 = (SPEAKER_FRONT_LEFT or SPEAKER_FRONT_RIGHT or + SPEAKER_FRONT_CENTER or SPEAKER_LOW_FREQUENCY or + SPEAKER_BACK_LEFT or SPEAKER_BACK_RIGHT); + {$EXTERNALSYM KSAUDIO_SPEAKER_5POINT1} + KSAUDIO_SPEAKER_7POINT1 = (SPEAKER_FRONT_LEFT or SPEAKER_FRONT_RIGHT or + SPEAKER_FRONT_CENTER or SPEAKER_LOW_FREQUENCY or + SPEAKER_BACK_LEFT or SPEAKER_BACK_RIGHT or + SPEAKER_FRONT_LEFT_OF_CENTER or SPEAKER_FRONT_RIGHT_OF_CENTER); + {$EXTERNALSYM KSAUDIO_SPEAKER_7POINT1} + KSAUDIO_SPEAKER_5POINT1_SURROUND = (SPEAKER_FRONT_LEFT or SPEAKER_FRONT_RIGHT or + SPEAKER_FRONT_CENTER or SPEAKER_LOW_FREQUENCY or + SPEAKER_SIDE_LEFT or SPEAKER_SIDE_RIGHT); + {$EXTERNALSYM KSAUDIO_SPEAKER_5POINT1_SURROUND} + KSAUDIO_SPEAKER_7POINT1_SURROUND = (SPEAKER_FRONT_LEFT or SPEAKER_FRONT_RIGHT or + SPEAKER_FRONT_CENTER or SPEAKER_LOW_FREQUENCY or + SPEAKER_BACK_LEFT or SPEAKER_BACK_RIGHT or + SPEAKER_SIDE_LEFT or SPEAKER_SIDE_RIGHT); + {$EXTERNALSYM KSAUDIO_SPEAKER_7POINT1_SURROUND} +// The following are obsolete 5.1 and 7.1 settings (they lack side speakers). Note this means +// that the default 5.1 and 7.1 settings (KSAUDIO_SPEAKER_5POINT1 and KSAUDIO_SPEAKER_7POINT1 are +// similarly obsolete but are unchanged for compatibility reasons). + KSAUDIO_SPEAKER_5POINT1_BACK = KSAUDIO_SPEAKER_5POINT1; + {$EXTERNALSYM KSAUDIO_SPEAKER_5POINT1_BACK} + KSAUDIO_SPEAKER_7POINT1_WIDE = KSAUDIO_SPEAKER_7POINT1; + {$EXTERNALSYM KSAUDIO_SPEAKER_7POINT1_WIDE} + + +// DVD Speaker Positions + KSAUDIO_SPEAKER_GROUND_FRONT_LEFT = SPEAKER_FRONT_LEFT; + {$EXTERNALSYM KSAUDIO_SPEAKER_GROUND_FRONT_LEFT} + KSAUDIO_SPEAKER_GROUND_FRONT_CENTER = SPEAKER_FRONT_CENTER; + {$EXTERNALSYM KSAUDIO_SPEAKER_GROUND_FRONT_CENTER} + KSAUDIO_SPEAKER_GROUND_FRONT_RIGHT = SPEAKER_FRONT_RIGHT; + {$EXTERNALSYM KSAUDIO_SPEAKER_GROUND_FRONT_RIGHT} + KSAUDIO_SPEAKER_GROUND_REAR_LEFT = SPEAKER_BACK_LEFT; + {$EXTERNALSYM KSAUDIO_SPEAKER_GROUND_REAR_LEFT} + KSAUDIO_SPEAKER_GROUND_REAR_RIGHT = SPEAKER_BACK_RIGHT; + {$EXTERNALSYM KSAUDIO_SPEAKER_GROUND_REAR_RIGHT} + KSAUDIO_SPEAKER_TOP_MIDDLE = SPEAKER_TOP_CENTER; + {$EXTERNALSYM KSAUDIO_SPEAKER_TOP_MIDDLE} + KSAUDIO_SPEAKER_SUPER_WOOFER = SPEAKER_LOW_FREQUENCY; + {$EXTERNALSYM KSAUDIO_SPEAKER_SUPER_WOOFER} + +type + PKSAudioDynamicRange = ^TKSAudioDynamicRange; + KSAUDIO_DYNAMIC_RANGE = record + QuietCompression : ULONG; + LoudCompression : ULONG; + end; + {$EXTERNALSYM KSAUDIO_DYNAMIC_RANGE} + PKSAUDIO_DYNAMIC_RANGE = ^KSAUDIO_DYNAMIC_RANGE; + {$EXTERNALSYM PKSAUDIO_DYNAMIC_RANGE} + TKSAudioDynamicRange = KSAUDIO_DYNAMIC_RANGE; + + PKSAudioMixLevel = ^TKSAudioMixLevel; + KSAUDIO_MIXLEVEL = record + Mute : BOOL; + Level : Longint; + end; + {$EXTERNALSYM KSAUDIO_MIXLEVEL} + PKSAUDIO_MIXLEVEL = ^KSAUDIO_MIXLEVEL; + {$EXTERNALSYM PKSAUDIO_MIXLEVEL} + TKSAudioMixLevel = KSAUDIO_MIXLEVEL; + + PKSAudioMixCaps = ^TKSAudioMixCaps; + KSAUDIO_MIX_CAPS = record + Mute : BOOL; + Minimum : longint; + Maximum : longint; + Reset : longint; + end; + {$EXTERNALSYM KSAUDIO_MIX_CAPS} + PKSAUDIO_MIX_CAPS = ^KSAUDIO_MIX_CAPS; + {$EXTERNALSYM PKSAUDIO_MIX_CAPS} + TKSAudioMixCaps = KSAUDIO_MIX_CAPS; + + PKSaudioMixcapTable = ^TKSaudioMixcapTable; + KSAUDIO_MIXCAP_TABLE = record + InputChannels : ULONG; + OutputChannels : ULONG; + Capabilities : array[0..0] of TKSAudioMixCaps; + end; + {$EXTERNALSYM KSAUDIO_MIXCAP_TABLE} + PKSAUDIO_MIXCAP_TABLE = ^KSAUDIO_MIXCAP_TABLE; + {$EXTERNALSYM PKSAUDIO_MIXCAP_TABLE} + TKSaudioMixcapTable = KSAUDIO_MIXCAP_TABLE; + + SE_TECHNIQUE = ( + SE_TECH_NONE, + SE_TECH_ANALOG_DEVICES_PHAT, + SE_TECH_CREATIVE, + SE_TECH_NATIONAL_SEMI, + SE_TECH_YAMAHA_YMERSION, + SE_TECH_BBE, + SE_TECH_CRYSTAL_SEMI, + SE_TECH_QSOUND_QXPANDER, + SE_TECH_SPATIALIZER, + SE_TECH_SRS, + SE_TECH_PLATFORM_TECH, + SE_TECH_AKM, + SE_TECH_AUREAL, + SE_TECH_AZTECH, + SE_TECH_BINAURA, + SE_TECH_ESS_TECH, + SE_TECH_HARMAN_VMAX, + SE_TECH_NVIDEA, + SE_TECH_PHILIPS_INCREDIBLE, + SE_TECH_TEXAS_INST, + SE_TECH_VLSI_TECH + ); + {$EXTERNALSYM SE_TECHNIQUE} + TSETechnique = SE_TECHNIQUE; + + PKSAudioStereoEnhance = ^TKSAudioStereoEnhance; + KSAUDIO_STEREO_ENHANCE = record + Technique : TSETechnique; + Center : ULONG; + Depth : ULONG; + Reserved : ULONG; + end; + {$EXTERNALSYM KSAUDIO_STEREO_ENHANCE} + PKSAUDIO_STEREO_ENHANCE = ^KSAUDIO_STEREO_ENHANCE; + {$EXTERNALSYM PKSAUDIO_STEREO_ENHANCE} + TKSAudioStereoEnhance = KSAUDIO_STEREO_ENHANCE; + +//=========================================================================== +// Topology Node Type GUIDs +const + KSNODETYPE_DAC : TGUID = '{507AE360-C554-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_DAC} + KSNODETYPE_ADC : TGUID = '{4D837FE0-C555-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_ADC} + KSNODETYPE_SRC : TGUID = '{9DB7B9E0-C555-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_SRC} + KSNODETYPE_SUPERMIX : TGUID = '{E573ADC0-C555-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_SUPERMIX} + KSNODETYPE_MUX : TGUID = '{2CEAF780-C556-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_MUX} + KSNODETYPE_DEMUX : TGUID = '{C0EB67D4-E807-11D0-958A-00C04FB925D3}'; + {$EXTERNALSYM KSNODETYPE_DEMUX} + KSNODETYPE_SUM : TGUID = '{DA441A60-C556-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_SUM} + KSNODETYPE_MUTE : TGUID = '{02B223C0-C557-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_MUTE} + KSNODETYPE_VOLUME : TGUID = '{3A5ACC00-C557-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_VOLUME} + KSNODETYPE_TONE : TGUID = '{7607E580-C557-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_TONE} + KSNODETYPE_EQUALIZER : TGUID = '{9D41B4A0-C557-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_EQUALIZER} + KSNODETYPE_AGC : TGUID = '{E88C9BA0-C557-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_AGC} + KSNODETYPE_NOISE_SUPPRESS : TGUID = '{E07F903F-62FD-4e60-8CDD-DEA7236665B5}'; + {$EXTERNALSYM KSNODETYPE_NOISE_SUPPRESS} + KSNODETYPE_DELAY : TGUID = '{144981E0-C558-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_DELAY} + KSNODETYPE_LOUDNESS : TGUID = '{41887440-C558-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_LOUDNESS} + KSNODETYPE_PROLOGIC_DECODER : TGUID = '{831C2C80-C558-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_PROLOGIC_DECODER} + KSNODETYPE_STEREO_WIDE : TGUID = '{A9E69800-C558-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_STEREO_WIDE} + KSNODETYPE_STEREO_ENHANCE : TGUID = '{AF6878AC-E83F-11D0-958A-00C04FB925D3}'; + {$EXTERNALSYM KSNODETYPE_STEREO_ENHANCE} + KSNODETYPE_REVERB : TGUID = '{EF0328E0-C558-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_REVERB} + KSNODETYPE_CHORUS : TGUID = '{20173F20-C559-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_CHORUS} + KSNODETYPE_3D_EFFECTS : TGUID = '{55515860-C559-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_3D_EFFECTS} + + KSNODETYPE_ACOUSTIC_ECHO_CANCEL : TGUID = '{BF963D80-C559-11D0-8A2B-00A0C9255AC1}'; //KSCATEGORY_ACOUSTIC_ECHO_CANCEL + {$EXTERNALSYM KSNODETYPE_ACOUSTIC_ECHO_CANCEL} + KSNODETYPE_MICROPHONE_ARRAY_PROCESSOR : TGUID = '{830a44f2-a32d-476b-be97-42845673b35a}'; //KSCATEGORY_MICROPHONE_ARRAY_PROCESSOR + {$EXTERNALSYM KSNODETYPE_MICROPHONE_ARRAY_PROCESSOR} + + KSNODETYPE_DEV_SPECIFIC : TGUID = '{941C7AC0-C559-11D0-8A2B-00A0C9255AC1}'; + {$EXTERNALSYM KSNODETYPE_DEV_SPECIFIC} + KSNODETYPE_SURROUND_ENCODER : TGUID = '{8074C5B2-3C66-11D2-B45A-3078302C2030}'; + {$EXTERNALSYM KSNODETYPE_SURROUND_ENCODER} + KSNODETYPE_PEAKMETER : TGUID = '{A085651E-5F0D-4b36-A869-D195D6AB4B9E}'; + {$EXTERNALSYM KSNODETYPE_PEAKMETER} + +//=========================================================================== +// Topology Node Name GUIDs for common audio nodes + KSAUDFNAME_BASS : TGUID = '{185FEDE0-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_BASS} + KSAUDFNAME_TREBLE : TGUID = '{185FEDE1-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_TREBLE} + KSAUDFNAME_3D_STEREO : TGUID = '{185FEDE2-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_3D_STEREO} + KSAUDFNAME_MASTER_VOLUME : TGUID = '{185FEDE3-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_MASTER_VOLUME} + KSAUDFNAME_MASTER_MUTE : TGUID = '{185FEDE4-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_MASTER_MUTE} + KSAUDFNAME_WAVE_VOLUME : TGUID = '{185FEDE5-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_WAVE_VOLUME} + KSAUDFNAME_WAVE_MUTE : TGUID = '{185FEDE6-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_WAVE_MUTE} + KSAUDFNAME_MIDI_VOLUME : TGUID = '{185FEDE7-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_MIDI_VOLUME} + KSAUDFNAME_MIDI_MUTE : TGUID = '{185FEDE8-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_MIDI_MUTE} + KSAUDFNAME_CD_VOLUME : TGUID = '{185FEDE9-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_CD_VOLUME} + KSAUDFNAME_CD_MUTE : TGUID = '{185FEDEA-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_CD_MUTE} + KSAUDFNAME_LINE_VOLUME : TGUID = '{185FEDEB-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_LINE_VOLUME} + KSAUDFNAME_LINE_MUTE : TGUID = '{185FEDEC-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_LINE_MUTE} + KSAUDFNAME_MIC_VOLUME : TGUID = '{185FEDED-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_MIC_VOLUME} + KSAUDFNAME_MIC_MUTE : TGUID = '{185FEDEE-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_MIC_MUTE} + KSAUDFNAME_RECORDING_SOURCE : TGUID = '{185FEDEF-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_RECORDING_SOURCE} + KSAUDFNAME_PC_SPEAKER_VOLUME : TGUID = '{185FEDF0-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_PC_SPEAKER_VOLUME} + KSAUDFNAME_PC_SPEAKER_MUTE : TGUID = '{185FEDF1-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_PC_SPEAKER_MUTE} + KSAUDFNAME_MIDI_IN_VOLUME : TGUID = '{185FEDF2-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_MIDI_IN_VOLUME} + KSAUDFNAME_CD_IN_VOLUME : TGUID = '{185FEDF3-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_CD_IN_VOLUME} + KSAUDFNAME_LINE_IN_VOLUME : TGUID = '{185FEDF4-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_LINE_IN_VOLUME} + KSAUDFNAME_MIC_IN_VOLUME : TGUID = '{185FEDF5-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_MIC_IN_VOLUME} + KSAUDFNAME_WAVE_IN_VOLUME : TGUID = '{185FEDF6-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_WAVE_IN_VOLUME} + KSAUDFNAME_VOLUME_CONTROL : TGUID = '{185FEDF7-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_VOLUME_CONTROL} + KSAUDFNAME_MIDI : TGUID = '{185FEDF8-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_MIDI} + KSAUDFNAME_LINE_IN : TGUID = '{185FEDF9-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_LINE_IN} + KSAUDFNAME_RECORDING_CONTROL : TGUID = '{185FEDFA-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_RECORDING_CONTROL} + KSAUDFNAME_CD_AUDIO : TGUID = '{185FEDFB-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_CD_AUDIO} + KSAUDFNAME_AUX_VOLUME : TGUID = '{185FEDFC-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_AUX_VOLUME} + KSAUDFNAME_AUX_MUTE : TGUID = '{185FEDFD-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_AUX_MUTE} + KSAUDFNAME_AUX : TGUID = '{185FEDFE-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_AUX} + KSAUDFNAME_PC_SPEAKER : TGUID = '{185FEDFF-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_PC_SPEAKER} + KSAUDFNAME_WAVE_OUT_MIX : TGUID = '{185FEE00-9905-11D1-95A9-00C04FB925D3}'; + {$EXTERNALSYM KSAUDFNAME_WAVE_OUT_MIX} + KSAUDFNAME_MONO_OUT : TGUID = '{F9B41DC3-96E2-11d2-AC4C-00C04F8EFB68}'; + {$EXTERNALSYM KSAUDFNAME_MONO_OUT} + KSAUDFNAME_STEREO_MIX : TGUID = '{00DFF077-96E3-11d2-AC4C-00C04F8EFB68}'; + {$EXTERNALSYM KSAUDFNAME_STEREO_MIX} + KSAUDFNAME_MONO_MIX : TGUID = '{00DFF078-96E3-11d2-AC4C-00C04F8EFB68}'; + {$EXTERNALSYM KSAUDFNAME_MONO_MIX} + KSAUDFNAME_MONO_OUT_VOLUME : TGUID = '{1AD247EB-96E3-11d2-AC4C-00C04F8EFB68}'; + {$EXTERNALSYM KSAUDFNAME_MONO_OUT_VOLUME} + KSAUDFNAME_MONO_OUT_MUTE : TGUID = '{1AD247EC-96E3-11d2-AC4C-00C04F8EFB68}'; + {$EXTERNALSYM KSAUDFNAME_MONO_OUT_MUTE} + KSAUDFNAME_STEREO_MIX_VOLUME : TGUID = '{1AD247ED-96E3-11d2-AC4C-00C04F8EFB68}'; + {$EXTERNALSYM KSAUDFNAME_STEREO_MIX_VOLUME} + KSAUDFNAME_STEREO_MIX_MUTE : TGUID = '{22B0EAFD-96E3-11d2-AC4C-00C04F8EFB68}'; + {$EXTERNALSYM KSAUDFNAME_STEREO_MIX_MUTE} + KSAUDFNAME_MONO_MIX_VOLUME : TGUID = '{22B0EAFE-96E3-11d2-AC4C-00C04F8EFB68}'; + {$EXTERNALSYM KSAUDFNAME_MONO_MIX_VOLUME} + KSAUDFNAME_MONO_MIX_MUTE : TGUID = '{2BC31D69-96E3-11d2-AC4C-00C04F8EFB68}'; + {$EXTERNALSYM KSAUDFNAME_MONO_MIX_MUTE} + KSAUDFNAME_MICROPHONE_BOOST : TGUID = '{2BC31D6A-96E3-11d2-AC4C-00C04F8EFB68}'; + {$EXTERNALSYM KSAUDFNAME_MICROPHONE_BOOST} + KSAUDFNAME_ALTERNATE_MICROPHONE : TGUID = '{2BC31D6B-96E3-11d2-AC4C-00C04F8EFB68}'; + {$EXTERNALSYM KSAUDFNAME_ALTERNATE_MICROPHONE} + KSAUDFNAME_3D_DEPTH : TGUID = '{63FF5747-991F-11d2-AC4D-00C04F8EFB68}'; + {$EXTERNALSYM KSAUDFNAME_3D_DEPTH} + KSAUDFNAME_3D_CENTER : TGUID = '{9F0670B4-991F-11d2-AC4D-00C04F8EFB68}'; + {$EXTERNALSYM KSAUDFNAME_3D_CENTER} + KSAUDFNAME_VIDEO_VOLUME : TGUID = '{9B46E708-992A-11d2-AC4D-00C04F8EFB68}'; + {$EXTERNALSYM KSAUDFNAME_VIDEO_VOLUME} + KSAUDFNAME_VIDEO_MUTE : TGUID = '{9B46E709-992A-11d2-AC4D-00C04F8EFB68}'; + {$EXTERNALSYM KSAUDFNAME_VIDEO_MUTE} + KSAUDFNAME_VIDEO : TGUID = '{915DAEC4-A434-11d2-AC52-00C04F8EFB68}'; + {$EXTERNALSYM KSAUDFNAME_VIDEO} + KSAUDFNAME_PEAKMETER : TGUID = '{57E24340-FC5B-4612-A562-72B11A29DFAE}'; + {$EXTERNALSYM KSAUDFNAME_PEAKMETER} + +// Internal topology node pin definitions + + KSNODEPIN_STANDARD_IN = 1; + {$EXTERNALSYM KSNODEPIN_STANDARD_IN} + KSNODEPIN_STANDARD_OUT = 0; + {$EXTERNALSYM KSNODEPIN_STANDARD_OUT} + + KSNODEPIN_SUM_MUX_IN = 1; // can be >= 1 + {$EXTERNALSYM KSNODEPIN_SUM_MUX_IN} + KSNODEPIN_SUM_MUX_OUT = 0; + {$EXTERNALSYM KSNODEPIN_SUM_MUX_OUT} + + KSNODEPIN_DEMUX_IN = 0; + {$EXTERNALSYM KSNODEPIN_DEMUX_IN} + KSNODEPIN_DEMUX_OUT = 1; // can be >= 1 + {$EXTERNALSYM KSNODEPIN_DEMUX_OUT} + + KSNODEPIN_AEC_RENDER_IN = 1; + {$EXTERNALSYM KSNODEPIN_AEC_RENDER_IN} + KSNODEPIN_AEC_RENDER_OUT = 0; + {$EXTERNALSYM KSNODEPIN_AEC_RENDER_OUT} + KSNODEPIN_AEC_CAPTURE_IN = 2; + {$EXTERNALSYM KSNODEPIN_AEC_CAPTURE_IN} + KSNODEPIN_AEC_CAPTURE_OUT = 3; + {$EXTERNALSYM KSNODEPIN_AEC_CAPTURE_OUT} + +//=========================================================================== +//=========================================================================== + + KSMETHODSETID_Wavetable : TGUID = '{DCEF31EB-D907-11D0-9583-00C04FB925D3}'; + {$EXTERNALSYM KSMETHODSETID_Wavetable} + +type + KSMETHOD_WAVETABLE = ( + KSMETHOD_WAVETABLE_WAVE_ALLOC, + KSMETHOD_WAVETABLE_WAVE_FREE, + KSMETHOD_WAVETABLE_WAVE_FIND, + KSMETHOD_WAVETABLE_WAVE_WRITE + ); + {$EXTERNALSYM KSMETHOD_WAVETABLE} + TKSMethodWavetable = KSMETHOD_WAVETABLE; + + PKSWaveTableWaveDesc = ^TKSWaveTableWaveDesc; + KSWAVETABLE_WAVE_DESC = record + Identifier : TKSIdentifier; // wave identifier + Size : ULONG; // wave size + Looped : BOOL; // wave looped flag + LoopPoint : ULONG; // wave loop point + InROM : BOOL; // wave InROM flag + Format : TKSDataFormat; // wave format + end; + {$EXTERNALSYM KSWAVETABLE_WAVE_DESC} + PKSWAVETABLE_WAVE_DESC = ^KSWAVETABLE_WAVE_DESC; + {$EXTERNALSYM PKSWAVETABLE_WAVE_DESC} + TKSWaveTableWaveDesc = KSWAVETABLE_WAVE_DESC; + +//=========================================================================== +//=========================================================================== + +// +// Property sets and items +// + +//=========================================================================== +//=========================================================================== + +const + KSPROPSETID_Itd3d : TGUID = '{6429f090-9fd9-11d0-a75b-00a0c90365e3}'; + {$EXTERNALSYM KSPROPSETID_Itd3d} + +//type +// KSPROPERTY_ITD3D = ( +// KSPROPERTY_ITD3D_PARAMS +// ); +// {$EXTERNALSYM KSPROPERTY_ITD3D} +// TKSPropertyITD3D = KSPROPERTY_ITD3D; + +//=========================================================================== +//=========================================================================== +const + KSPROPSETID_Hrtf3d: TGUID = '{b66decb0-a083-11d0-851e-00c04fd9baf3}'; + {$EXTERNALSYM KSPROPSETID_Hrtf3d} + +//type +// KSPROPERTY_HRTF3D = ( +// KSPROPERTY_HRTF3D_PARAMS, +// KSPROPERTY_HRTF3D_INITIALIZE, +// KSPROPERTY_HRTF3D_FILTER_FORMAT +// ); +// {$EXTERNALSYM KSPROPERTY_HRTF3D} +// TKSPropertyHRTF3D = KSPROPERTY_HRTF3D; + +//=========================================================================== +//=========================================================================== +const + KSPROPSETID_Wave_Queued : TGUID = '{16a15b10-16f0-11d0-a195-0020afd156e4}'; + {$EXTERNALSYM KSPROPSETID_Wave_Queued} + + KSPROPERTY_WAVE_QUEUED_POSITION = $00000001; + {$EXTERNALSYM KSPROPERTY_WAVE_QUEUED_POSITION} + + KSMETHODSETID_Wave_Queued : TGUID = '{7432c160-8827-11cf-a102-0020afd156e4}'; + {$EXTERNALSYM KSMETHODSETID_Wave_Queued} + + KSMETHOD_WAVE_QUEUED_BREAKLOOP = $00000001; + {$EXTERNALSYM KSMETHOD_WAVE_QUEUED_BREAKLOOP} + + KSPROPSETID_Wave : TGUID = '{924e54b0-630f-11cf-ada7-08003e30494a}'; + {$EXTERNALSYM KSPROPSETID_Wave} + +type + KSPROPERTY_WAVE = ( + KSPROPERTY_WAVE_COMPATIBLE_CAPABILITIES, + KSPROPERTY_WAVE_INPUT_CAPABILITIES, + KSPROPERTY_WAVE_OUTPUT_CAPABILITIES, + KSPROPERTY_WAVE_BUFFER, + KSPROPERTY_WAVE_FREQUENCY, + KSPROPERTY_WAVE_VOLUME, + KSPROPERTY_WAVE_PAN + ); + {$EXTERNALSYM KSPROPERTY_WAVE} + TKSPropertyWave = KSPROPERTY_WAVE; + + PKSWaveCompatCaps = ^TKSWaveCompatCaps; + KSWAVE_COMPATCAPS = record + ulDeviceType : ULONG; + end; + {$EXTERNALSYM KSWAVE_COMPATCAPS} + PKSWAVE_COMPATCAPS = ^KSWAVE_COMPATCAPS; + {$EXTERNALSYM PKSWAVE_COMPATCAPS} + TKSWaveCompatCaps = KSWAVE_COMPATCAPS; + +const + KSWAVE_COMPATCAPS_INPUT = $00000000; + {$EXTERNALSYM KSWAVE_COMPATCAPS_INPUT} + KSWAVE_COMPATCAPS_OUTPUT = $00000001; + {$EXTERNALSYM KSWAVE_COMPATCAPS_OUTPUT} + +type + PKSWaveInputCapabilities = ^TKSWaveInputCapabilities; + KSWAVE_INPUT_CAPABILITIES = record + MaximumChannelsPerConnection : ULONG; + MinimumBitsPerSample : ULONG; + MaximumBitsPerSample : ULONG; + MinimumSampleFrequency : ULONG; + MaximumSampleFrequency : ULONG; + TotalConnections : ULONG; + ActiveConnections : ULONG; + end; + {$EXTERNALSYM KSWAVE_INPUT_CAPABILITIES} + PKSWAVE_INPUT_CAPABILITIES = ^KSWAVE_INPUT_CAPABILITIES; + {$EXTERNALSYM PKSWAVE_INPUT_CAPABILITIES} + TKSWaveInputCapabilities = KSWAVE_INPUT_CAPABILITIES; + + PKSWaveOutputCapabilities = ^TKSWaveOutputCapabilities; + KSWAVE_OUTPUT_CAPABILITIES = record + MaximumChannelsPerConnection : ULONG; + MinimumBitsPerSample : ULONG; + MaximumBitsPerSample : ULONG; + MinimumSampleFrequency : ULONG; + MaximumSampleFrequency : ULONG; + TotalConnections : ULONG; + StaticConnections : ULONG; + StreamingConnections : ULONG; + ActiveConnections : ULONG; + ActiveStaticConnections : ULONG; + ActiveStreamingConnections : ULONG; + Total3DConnections : ULONG; + Static3DConnections : ULONG; + Streaming3DConnections : ULONG; + Active3DConnections : ULONG; + ActiveStatic3DConnections : ULONG; + ActiveStreaming3DConnections : ULONG; + TotalSampleMemory : ULONG; + FreeSampleMemory : ULONG; + LargestFreeContiguousSampleMemory : ULONG; + end; + {$EXTERNALSYM KSWAVE_OUTPUT_CAPABILITIES} + PKSWAVE_OUTPUT_CAPABILITIES = ^KSWAVE_OUTPUT_CAPABILITIES; + {$EXTERNALSYM PKSWAVE_OUTPUT_CAPABILITIES} + TKSWaveOutputCapabilities = KSWAVE_OUTPUT_CAPABILITIES; + + PKSWaveVolume = ^TKSWaveVolume; + KSWAVE_VOLUME = record + LeftAttenuation : longint; + RightAttenuation : longint; + end; + {$EXTERNALSYM KSWAVE_VOLUME} + PKSWAVE_VOLUME = ^KSWAVE_VOLUME; + {$EXTERNALSYM PKSWAVE_VOLUME} + TKSWaveVolume = KSWAVE_VOLUME; + +const + KSWAVE_BUFFER_ATTRIBUTEF_LOOPING = $00000001; + {$EXTERNALSYM KSWAVE_BUFFER_ATTRIBUTEF_LOOPING} + KSWAVE_BUFFER_ATTRIBUTEF_STATIC = $00000002; + {$EXTERNALSYM KSWAVE_BUFFER_ATTRIBUTEF_STATIC} + +type + PKSWaveBuffer = ^TKSWaveBuffer; + KSWAVE_BUFFER = record + Attributes : ULONG; + BufferSize : ULONG; + BufferAddress : Pointer; + end; + {$EXTERNALSYM KSWAVE_BUFFER} + PKSWAVE_BUFFER = ^KSWAVE_BUFFER; + {$EXTERNALSYM PKSWAVE_BUFFER} + TKSWaveBuffer = KSWAVE_BUFFER; + +//=========================================================================== +//=========================================================================== +const + KSMUSIC_TECHNOLOGY_PORT : TGUID = '{86C92E60-62E8-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSMUSIC_TECHNOLOGY_PORT} + KSMUSIC_TECHNOLOGY_SQSYNTH : TGUID = '{0ECF4380-62E9-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSMUSIC_TECHNOLOGY_SQSYNTH} + KSMUSIC_TECHNOLOGY_FMSYNTH : TGUID = '{252C5C80-62E9-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSMUSIC_TECHNOLOGY_FMSYNTH} + KSMUSIC_TECHNOLOGY_WAVETABLE : TGUID = '{394EC7C0-62E9-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSMUSIC_TECHNOLOGY_WAVETABLE} + KSMUSIC_TECHNOLOGY_SWSYNTH : TGUID = '{37407736-3620-11D1-85D3-0000F8754380}'; + {$EXTERNALSYM KSMUSIC_TECHNOLOGY_SWSYNTH} + KSPROPSETID_WaveTable : TGUID = '{8539E660-62E9-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSPROPSETID_WaveTable} + +type + KSPROPERTY_WAVETABLE = ( + KSPROPERTY_WAVETABLE_LOAD_SAMPLE, + KSPROPERTY_WAVETABLE_UNLOAD_SAMPLE, + KSPROPERTY_WAVETABLE_MEMORY, + KSPROPERTY_WAVETABLE_VERSION + ); + {$EXTERNALSYM KSPROPERTY_WAVETABLE} + TKSPropertyWaveTable = KSPROPERTY_WAVETABLE; + + PKSDataRangeMusic = ^TKSDataRangeMusic; + KSDATARANGE_MUSIC = record + DataRange : TKSDataRange; + Technology : TGUID; + Channels : ULONG; + Notes : ULONG; + ChannelMask : ULONG; + end; + {$EXTERNALSYM KSDATARANGE_MUSIC} + PKSDATARANGE_MUSIC = ^KSDATARANGE_MUSIC; + {$EXTERNALSYM PKSDATARANGE_MUSIC} + TKSDataRangeMusic = KSDATARANGE_MUSIC; + +//=========================================================================== +const + KSEVENTSETID_Cyclic : TGUID = '{142C1AC0-072A-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSEVENTSETID_Cyclic} + +type + KSEVENT_CYCLIC_TIME = ( + KSEVENT_CYCLIC_TIME_INTERVAL + ); + {$EXTERNALSYM KSEVENT_CYCLIC_TIME} + TKSEventCyclicTime = KSEVENT_CYCLIC_TIME; + +const + KSPROPSETID_Cyclic: TGUID = '{3FFEAEA0-2BEE-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSPROPSETID_Cyclic} + +type + KSPROPERTY_CYCLIC = ( + KSPROPERTY_CYCLIC_POSITION + ); + {$EXTERNALSYM KSPROPERTY_CYCLIC} + TKSPropertyCyclic = KSPROPERTY_CYCLIC; + +//=========================================================================== +const + KSEVENTSETID_AudioControlChange: TGUID = '{E85E9698-FA2F-11D1-95BD-00C04FB925D3}'; + {$EXTERNALSYM KSEVENTSETID_AudioControlChange} + +type + KSEVENT_AUDIO_CONTROL_CHANGE = ( + KSEVENT_CONTROL_CHANGE + ); + {$EXTERNALSYM KSEVENT_AUDIO_CONTROL_CHANGE} + TKSEventAudioControlChange = KSEVENT_AUDIO_CONTROL_CHANGE; + +//=========================================================================== +const + KSEVENTSETID_LoopedStreaming : TGUID = '{4682B940-C6EF-11D0-96D8-00AA0051E51D}'; + {$EXTERNALSYM KSEVENTSETID_LoopedStreaming} + +type + KSEVENT_LOOPEDSTREAMING = ( + KSEVENT_LOOPEDSTREAMING_POSITION + ); + {$EXTERNALSYM KSEVENT_LOOPEDSTREAMING} + TKSEventLoopedStreaming = KSEVENT_LOOPEDSTREAMING; + + PLoopedStreamingPositionEventData = ^TLoopedStreamingPositionEventData; + LOOPEDSTREAMING_POSITION_EVENT_DATA = record + KsEventData : TKSEVENTDATA; + Position : int64; + end; + {$EXTERNALSYM LOOPEDSTREAMING_POSITION_EVENT_DATA} + PLOOPEDSTREAMING_POSITION_EVENT_DATA = ^LOOPEDSTREAMING_POSITION_EVENT_DATA; + {$EXTERNALSYM PLOOPEDSTREAMING_POSITION_EVENT_DATA} + TLoopedStreamingPositionEventData = LOOPEDSTREAMING_POSITION_EVENT_DATA; + +const + KSEVENTSETID_Sysaudio : TGUID = '{04800320-4491-11D1-A050-405705C10000}'; + {$EXTERNALSYM KSEVENTSETID_Sysaudio} + +type + KSEVENT_SYSAUDIO = ( + KSEVENT_SYSAUDIO_ADDREMOVE_DEVICE, + KSEVENT_SYSAUDIO_CHANGE_DEVICE + ); + {$EXTERNALSYM KSEVENT_SYSAUDIO} + TKSEventSysAudio = KSEVENT_SYSAUDIO; + +const + KSPROPSETID_Sysaudio : TGUID = '{CBE3FAA0-CC75-11D0-B465-00001A1818E6}'; + {$EXTERNALSYM KSPROPSETID_Sysaudio} + +type + KSPROPERTY_SYSAUDIO = ( + KSPROPERTY_SYSAUDIO_DEVICE_Invalid, + KSPROPERTY_SYSAUDIO_DEVICE_COUNT, + KSPROPERTY_SYSAUDIO_DEVICE_FRIENDLY_NAME, + KSPROPERTY_SYSAUDIO_DEVICE_INSTANCE, + KSPROPERTY_SYSAUDIO_DEVICE_INTERFACE_NAME, + KSPROPERTY_SYSAUDIO_SELECT_GRAPH, + KSPROPERTY_SYSAUDIO_CREATE_VIRTUAL_SOURCE, + KSPROPERTY_SYSAUDIO_DEVICE_DEFAULT, + KSPROPERTY_SYSAUDIO_ALWAYS_CREATE_VIRTUAL_SOURCE, + KSPROPERTY_SYSAUDIO_ADDREMOVE_LOCK, + KSPROPERTY_SYSAUDIO_ADDREMOVE_UNLOCK, + KSPROPERTY_SYSAUDIO_RENDER_PIN_INSTANCES, + KSPROPERTY_SYSAUDIO_RENDER_CONNECTION_INDEX, + KSPROPERTY_SYSAUDIO_CREATE_VIRTUAL_SOURCE_ONLY, + KSPROPERTY_SYSAUDIO_INSTANCE_INFO, + KSPROPERTY_SYSAUDIO_PREFERRED_DEVICE, + KSPROPERTY_SYSAUDIO_COMPONENT_ID, + KSPROPERTY_SYSAUDIO_ADDREMOVE_GFX + ); + {$EXTERNALSYM KSPROPERTY_SYSAUDIO} + TKSPropertySysAudio = KSPROPERTY_SYSAUDIO; + + PSysAudioCreateVirtualSource = ^TSysAudioCreateVirtualSource; + SYSAUDIO_CREATE_VIRTUAL_SOURCE = record + Property_ : KSPROPERTY; + PinCategory : TGUID; + PinName : TGUID; + end; + {$EXTERNALSYM SYSAUDIO_CREATE_VIRTUAL_SOURCE} + PSYSAUDIO_CREATE_VIRTUAL_SOURCE = ^SYSAUDIO_CREATE_VIRTUAL_SOURCE; + {$EXTERNALSYM PSYSAUDIO_CREATE_VIRTUAL_SOURCE} + TSysAudioCreateVirtualSource = SYSAUDIO_CREATE_VIRTUAL_SOURCE; + + PSysAudioSelectGraph = ^TSysAudioSelectGraph; + SYSAUDIO_SELECT_GRAPH = record + Property_ : KSPROPERTY; + PinId : ULONG; + NodeId : ULONG; + Flags : ULONG; + Reserved : ULONG; + end; + {$EXTERNALSYM SYSAUDIO_SELECT_GRAPH} + PSYSAUDIO_SELECT_GRAPH = ^SYSAUDIO_SELECT_GRAPH; + {$EXTERNALSYM PSYSAUDIO_SELECT_GRAPH} + TSysAudioSelectGraph = SYSAUDIO_SELECT_GRAPH; + + PSysAudioInstanceInfo = ^TSysAudioInstanceInfo; + SYSAUDIO_INSTANCE_INFO = record + Property_ : KSPROPERTY; + Flags : ULONG; + DeviceNumber : ULONG; + end; + {$EXTERNALSYM SYSAUDIO_INSTANCE_INFO} + PSYSAUDIO_INSTANCE_INFO = ^SYSAUDIO_INSTANCE_INFO; + {$EXTERNALSYM PSYSAUDIO_INSTANCE_INFO} + TSysAudioInstanceInfo = SYSAUDIO_INSTANCE_INFO; + +const + SYSAUDIO_FLAGS_DONT_COMBINE_PINS = $00000001; + {$EXTERNALSYM SYSAUDIO_FLAGS_DONT_COMBINE_PINS} + +type + SYSAUDIO_PREFERRED_DEVICE = record + Property_ : KSPROPERTY; + Flags : ULONG; + Index : ULONG; // KSPROPERTY_SYSAUDIO_DEFAULT_TYPE + end; + {$EXTERNALSYM SYSAUDIO_PREFERRED_DEVICE} + PSYSAUDIO_PREFERRED_DEVICE = ^SYSAUDIO_PREFERRED_DEVICE; + {$EXTERNALSYM PSYSAUDIO_PREFERRED_DEVICE} + TSysAudioPreferredDevice = SYSAUDIO_PREFERRED_DEVICE; + +const + SYSAUDIO_FLAGS_CLEAR_PREFERRED = $00000002; + {$EXTERNALSYM SYSAUDIO_FLAGS_CLEAR_PREFERRED} + +type + KSPROPERTY_SYSAUDIO_DEFAULT_TYPE = ( // preferred device index + KSPROPERTY_SYSAUDIO_NORMAL_DEFAULT, + KSPROPERTY_SYSAUDIO_PLAYBACK_DEFAULT, + KSPROPERTY_SYSAUDIO_RECORD_DEFAULT, + KSPROPERTY_SYSAUDIO_MIDI_DEFAULT, + KSPROPERTY_SYSAUDIO_MIXER_DEFAULT + ); + {$EXTERNALSYM KSPROPERTY_SYSAUDIO_DEFAULT_TYPE} + TKSPropertySysAudioDefaultType = KSPROPERTY_SYSAUDIO_DEFAULT_TYPE; + +const + KSPROPSETID_Sysaudio_Pin : TGUID = '{A3A53220-C6E4-11D0-B465-00001A1818E6}'; + {$EXTERNALSYM KSPROPSETID_Sysaudio_Pin} + +type + KSPROPERTY_SYSAUDIO_PIN = ( + KSPROPERTY_SYSAUDIO_TOPOLOGY_CONNECTION_INDEX, + KSPROPERTY_SYSAUDIO_ATTACH_VIRTUAL_SOURCE, + KSPROPERTY_SYSAUDIO_PIN_VOLUME_NODE + ); + {$EXTERNALSYM KSPROPERTY_SYSAUDIO_PIN} + TKSPropertySysAudioPin = KSPROPERTY_SYSAUDIO_PIN; + + PSysAudioAttachVirtualSource = ^TSysAudioAttachVirtualSource; + SYSAUDIO_ATTACH_VIRTUAL_SOURCE = record + Property_ : KSPROPERTY; + MixerPinId : ULONG; + Reserved : ULONG; + end; + {$EXTERNALSYM SYSAUDIO_ATTACH_VIRTUAL_SOURCE} + PSYSAUDIO_ATTACH_VIRTUAL_SOURCE = ^SYSAUDIO_ATTACH_VIRTUAL_SOURCE; + {$EXTERNALSYM PSYSAUDIO_ATTACH_VIRTUAL_SOURCE} + TSysAudioAttachVirtualSource = SYSAUDIO_ATTACH_VIRTUAL_SOURCE; + + KSNODEPROPERTY = record + Property_ : KSPROPERTY; + NodeId : ULONG; + Reserved : ULONG; + end; + {$EXTERNALSYM KSNODEPROPERTY} + PKSNODEPROPERTY = ^KSNODEPROPERTY; + {$EXTERNALSYM PKSNODEPROPERTY} + TKSNodeProperty = KSNODEPROPERTY; + + PKSNodePropertyAudioChannel = ^TKSNodePropertyAudioChannel; + KSNODEPROPERTY_AUDIO_CHANNEL = record + NodeProperty : TKSNODEPROPERTY; + Channel : Longint; // value to get or set + Reserved : ULONG; + end; + {$EXTERNALSYM KSNODEPROPERTY_AUDIO_CHANNEL} + PKSNODEPROPERTY_AUDIO_CHANNEL = ^KSNODEPROPERTY_AUDIO_CHANNEL; + {$EXTERNALSYM PKSNODEPROPERTY_AUDIO_CHANNEL} + TKSNodePropertyAudioChannel = KSNODEPROPERTY_AUDIO_CHANNEL; + + PKSNodePropertyAudioDevSpecific = ^TKSNodePropertyAudioDevSpecific; + KSNODEPROPERTY_AUDIO_DEV_SPECIFIC = record + NodeProperty :TKSNODEPROPERTY; + DevSpecificId :ULONG; + DeviceInfo :ULONG; + Length :ULONG; + end; + {$EXTERNALSYM KSNODEPROPERTY_AUDIO_DEV_SPECIFIC} + PKSNODEPROPERTY_AUDIO_DEV_SPECIFIC = ^KSNODEPROPERTY_AUDIO_DEV_SPECIFIC; + {$EXTERNALSYM PKSNODEPROPERTY_AUDIO_DEV_SPECIFIC} + TKSNodePropertyAudioDevSpecific = KSNODEPROPERTY_AUDIO_DEV_SPECIFIC; + + PKSNodePropertyAudio3DListenerp = ^TKSNodePropertyAudio3DListener; + KSNODEPROPERTY_AUDIO_3D_LISTENER = record + NodeProperty : TKSNODEPROPERTY; + ListenerId : pointer; + Reserved : ULONG; + end; + {$EXTERNALSYM KSNODEPROPERTY_AUDIO_3D_LISTENER} + PKSNODEPROPERTY_AUDIO_3D_LISTENER = ^KSNODEPROPERTY_AUDIO_3D_LISTENER; + {$EXTERNALSYM PKSNODEPROPERTY_AUDIO_3D_LISTENER} + TKSNodePropertyAudio3DListener = KSNODEPROPERTY_AUDIO_3D_LISTENER; + + PKSNodePropertyAudioProperty = ^TKSNodePropertyAudioProperty; + KSNODEPROPERTY_AUDIO_PROPERTY = record + NodeProperty : TKSNODEPROPERTY; + AppContext : Pointer; + Length : ULONG; + Reserved : ULONG; + end; + {$EXTERNALSYM KSNODEPROPERTY_AUDIO_PROPERTY} + PKSNODEPROPERTY_AUDIO_PROPERTY = ^KSNODEPROPERTY_AUDIO_PROPERTY; + {$EXTERNALSYM PKSNODEPROPERTY_AUDIO_PROPERTY} + TKSNodePropertyAudioProperty = KSNODEPROPERTY_AUDIO_PROPERTY; + +//=========================================================================== +const + KSPROPSETID_Linear : TGUID = '{5A2FFE80-16B9-11D0-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSPROPSETID_Linear} + +type + KSPROPERTY_LINEAR = ( + KSPROPERTY_LINEAR_POSITION + ); + {$EXTERNALSYM KSPROPERTY_LINEAR} + TKSPropertyLinear = KSPROPERTY_LINEAR; + +//=========================================================================== + +// +// Midi definitions +// + +// +// Formats +// +const + KSDATAFORMAT_TYPE_MUSIC : TGUID = '{E725D360-62CC-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_MUSIC} +// 'mids' == MEDIATYPE_Midi + KSDATAFORMAT_TYPE_MIDI : TGUID = '{7364696D-0000-0010-8000-00aa00389b71}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_MIDI} + KSDATAFORMAT_SUBTYPE_MIDI : TGUID = '{1D262760-E957-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_MIDI} + KSDATAFORMAT_SUBTYPE_MIDI_BUS : TGUID = '{2CA15FA0-6CFE-11CF-A5D6-28DB04C10000}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_MIDI_BUS} + KSDATAFORMAT_SUBTYPE_RIFFMIDI : TGUID = '{4995DAF0-9EE6-11D0-A40E-00A0C9223196}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_RIFFMIDI} + +// +// KSDATAFORMAT_SUBTYPE_DIRECTMUSIC +// see DMusicKS.h +// + +// WARNING! This structure MUST be dword aligned +// regardless of the number of data bytes. +type + KSMUSICFORMAT = record + TimeDeltaMs : ULONG ; // Delta Milliseconds from the previous midiformat + // in the packet. The first midiformat in the packet + // is a delta from the PTS in the KSSTREAM_HEADER. + ByteCount : ULONG ; // Number of bytes of data that follow this struct. + end; + {$EXTERNALSYM KSMUSICFORMAT} + PKSMUSICFORMAT = ^KSMUSICFORMAT; + {$EXTERNALSYM PKSMUSICFORMAT} + TKSMusicFormat = KSMUSICFORMAT; + +// +// This entire set of MPEG Standard/Dialect Guids are obsolete. Do not use them. +// +//==================================================================================================== +//==================================================================================================== +// The following official MPEG Formats, Subtypes and Specifiers are listed as required or optional +// These official MPEG GUIDs are the preferred method of supporting MPEG/AC-3 media types in new code. +// Older MPEG GUIDs should also be supported for compatibilty, but these new modes are still required. +//==================================================================================================== +//==================================================================================================== + +{ +This is a summary of what media types/specifiers will be required for all DVD+DSS+DVB+DTV MPEG decoders. +These media types are what the decoder driver must accept, hardware support for all of these media types +may or may not actually be provided by the decoder natively. These media types are intended to define +the "officially" supported MPEG/AC-3 media types that all WHQL certified decoders must implement. This +specifically includes driver and/or hardware support for all the required standards and dialects. + +All MPEG video decoders must support all of the MPEG video modes shown as [required] below. +All MPEG audio decoders must support all of the MPEG audio modes shown as [required] below. +All AC-3 audio decoders must support all of the AC-3 audio modes shown as [required] below. +The line items shown as [optional] need not be implemented, but are possible formats that might be implemented. + +Note that the input/output pin formats are defined by 2 or 3 GUIDs: TYPE, SUBTYPE, and maybe SPECIFIER. +The specifiers are included if the data format is a "dialect" that needs to be differentiated during decoding. +The decoder MUST be prepared to deal with ALL requests for _required_ "Standard" formats OR _required_ "Dialects". + +STATIC_KSDATAFORMAT_TYPE_STANDARD_ELEMENTARY_STREAM [required] + STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG1_VIDEO [required] + STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG1_VIDEO [optional] + STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG1_AUDIO [required] + STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG1_AUDIO [optional] + STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_VIDEO [required] + STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_VIDEO [required] + STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_AUDIO [required] + STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_AUDIO [optional] + STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_AC3_AUDIO [required] + STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_AC3_AUDIO [optional] +STATIC_KSDATAFORMAT_TYPE_STANDARD_PES_PACKET [required] + STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG1_VIDEO [optional] + STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG1_VIDEO [optional] + STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG1_AUDIO [optional] + STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG1_AUDIO [optional] + STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_VIDEO [required] + STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_VIDEO [required] + STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_AUDIO [required] + STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_AUDIO [required] + STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_AC3_AUDIO [required] + STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_AC3_AUDIO [optional] +STATIC_KSDATAFORMAT_TYPE_STANDARD_PACK_HEADER [required] + STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_VIDEO [required] + STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_VIDEO [required] + STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_AUDIO [required] + STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_AUDIO [optional] + STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_AC3_AUDIO [required] + STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_AC3_AUDIO [optional] + +Note that the SPECIFIER GUIDs normally identify particular versions of MPEG such as DSS and DVD. +This approach was taken to minimize the number of DSS/DVB/DVD/DTV etc. media SUBTYPES. +These specifiers are currently required to disambiguate MPEG syntax _parsing_ by the decoder +using alternate parsing routines or downloadable firmware or hardware decode settings. + +In the future these specifiers will be extended to cover new KS MPEG flavors such as DVB and DTV. +Thus, the optional specifiers will be subject to clarification and/or definition as they are needed. + +Important note: Per the ITU MPEG specs, MPEG 2 media may contain pure MPEG 1 syntax and +any "MPEG 2" PES packets may actually contain MPEG 1 payloads and MPEG 1 syntax. Some MPEG +broadcasts can revert from MPEG2 to MPEG1 format data at their discretion, without warning. + +CAUTION: Decoders MUST attempt to process MPEG data AS SOON AS POSSIBLE after reception. +In particular, elementary MPEG or MPEG PES packet streams should not be aggregated into DVD +"pack headers" internally before submission to the codec hardware if AT ALL POSSIBLE. The +reason is that mpeg data may need to be processed immediately but there may be no additional +MPEG data forthcoming to fill up the PES packet OR DVD "pack" in a timely fashion. This is +particularly true of MPEG dialects that utilize "repeat field signally" to reuse the last +decoded MPEG video field. + +} + +///////////////////////////////////////////////////////////////////////// +// The major data type GUIDs that define the data packet encapsulation // +///////////////////////////////////////////////////////////////////////// +const +// STATIC_KSDATAFORMAT_TYPE_STANDARD_ELEMENTARY_STREAM + KSDATAFORMAT_TYPE_STANDARD_ELEMENTARY_STREAM : TGUID = '{36523B11-8EE5-11d1-8CA3-0060B057664A}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_STANDARD_ELEMENTARY_STREAM} + +// STATIC_KSDATAFORMAT_TYPE_STANDARD_PES_PACKET + KSDATAFORMAT_TYPE_STANDARD_PES_PACKET : TGUID = '{36523B12-8EE5-11d1-8CA3-0060B057664A}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_STANDARD_PES_PACKET} + +// STATIC_KSDATAFORMAT_TYPE_STANDARD_PACK_HEADER + KSDATAFORMAT_TYPE_STANDARD_PACK_HEADER : TGUID = '{36523B13-8EE5-11d1-8CA3-0060B057664A}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_STANDARD_PACK_HEADER} + +/////////////////////////////////////////////////////////////////////////////// +// The minor data subtype GUIDs that define the exact class of the data type.// +/////////////////////////////////////////////////////////////////////////////// + +// STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG1_VIDEO + KSDATAFORMAT_SUBTYPE_STANDARD_MPEG1_VIDEO : TGUID = '{36523B21-8EE5-11d1-8CA3-0060B057664A}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_STANDARD_MPEG1_VIDEO} + +// STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG1_AUDIO + KSDATAFORMAT_SUBTYPE_STANDARD_MPEG1_AUDIO : TGUID = '{36523B22-8EE5-11d1-8CA3-0060B057664A}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_STANDARD_MPEG1_AUDIO} + +// STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_VIDEO + KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_VIDEO : TGUID = '{36523B23-8EE5-11d1-8CA3-0060B057664A}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_VIDEO} + +// STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_AUDIO + KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_AUDIO : TGUID = '{36523B24-8EE5-11d1-8CA3-0060B057664A}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_AUDIO} + +// STATIC_KSDATAFORMAT_SUBTYPE_STANDARD_AC3_AUDIO + KSDATAFORMAT_SUBTYPE_STANDARD_AC3_AUDIO : TGUID = '{36523B25-8EE5-11d1-8CA3-0060B057664A}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_STANDARD_AC3_AUDIO} + +/////////////////////////////////////////////////////////////////////////////// +// The low-level specifier GUIDs that define the flavor of the data subtype. // +// Some SUBTYPES, notably MPEG2_VIDEO, MPEG2_AUDIO have different dialects. // +// These specifiers are intended to be accompanied by a specifier structure. // +/////////////////////////////////////////////////////////////////////////////// + +// STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG1_VIDEO + KSDATAFORMAT_SPECIFIER_DIALECT_MPEG1_VIDEO : TGUID = '{36523B31-8EE5-11d1-8CA3-0060B057664A}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_DIALECT_MPEG1_VIDEO} + +// STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG1_AUDIO + KSDATAFORMAT_SPECIFIER_DIALECT_MPEG1_AUDIO : TGUID = '{36523B32-8EE5-11d1-8CA3-0060B057664A}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_DIALECT_MPEG1_AUDIO} + +// STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_VIDEO Associated with KS_MPEGVIDEOINFO2 defined later + KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_VIDEO : TGUID = '{36523B33-8EE5-11d1-8CA3-0060B057664A}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_VIDEO} + +// STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_AUDIO Associated with KS_MPEGAUDIOINFO defined later + KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_AUDIO : TGUID = '{36523B34-8EE5-11d1-8CA3-0060B057664A}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_AUDIO} + +// STATIC_KSDATAFORMAT_SPECIFIER_DIALECT_AC3_AUDIO + KSDATAFORMAT_SPECIFIER_DIALECT_AC3_AUDIO : TGUID = '{36523B35-8EE5-11d1-8CA3-0060B057664A}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_DIALECT_AC3_AUDIO} + +//==================================================================================================== +//==================================================================================================== +// *** COMPATIBILITY WARNING *** +// The *following* older DSS, MPEG, DVD & AC-3 GUID definitions are retained for backward compability. +// These MPEG GUIDs should also be supported for compatibilty, but the above newer modes are still required. +//==================================================================================================== +//==================================================================================================== + +// +// DSS definitions +// + + KSDATAFORMAT_SUBTYPE_DSS_VIDEO : TGUID = '{a0af4f81-e163-11d0-bad9-00609744111a}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_DSS_VIDEO} + KSDATAFORMAT_SUBTYPE_DSS_AUDIO : TGUID = '{a0af4f82-e163-11d0-bad9-00609744111a}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_DSS_AUDIO} + +// +// End of obsolete MPEG definitions. +// + +// +// mpeg 1 definitions +// + KSDATAFORMAT_SUBTYPE_MPEG1Packet : TGUID = '{e436eb80-524f-11ce-9F53-0020af0ba770}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_MPEG1Packet} + KSDATAFORMAT_SUBTYPE_MPEG1Payload : TGUID = '{e436eb81-524f-11ce-9F53-0020af0ba770}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_MPEG1Payload} + +// MEDIASUBTYPE_MPEG1Video + KSDATAFORMAT_SUBTYPE_MPEG1Video : TGUID = '{e436eb86-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_MPEG1Video} + +//FORMAT_MPEGVideo + KSDATAFORMAT_SPECIFIER_MPEG1_VIDEO : TGUID = '{05589f82-c356-11ce-bf01-00aa0055595a}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_MPEG1_VIDEO} + +// +// mpeg 2 definitions +// + KSDATAFORMAT_TYPE_MPEG2_PES : TGUID = '{e06d8020-db46-11cf-b4d1-00805f6cbbea}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_MPEG2_PES} + KSDATAFORMAT_TYPE_MPEG2_PROGRAM : TGUID = '{e06d8022-db46-11cf-b4d1-00805f6cbbea}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_MPEG2_PROGRAM} + KSDATAFORMAT_TYPE_MPEG2_TRANSPORT : TGUID = '{e06d8023-db46-11cf-b4d1-00805f6cbbea}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_MPEG2_TRANSPORT} + KSDATAFORMAT_SUBTYPE_MPEG2_VIDEO : TGUID = '{e06d8026-db46-11cf-b4d1-00805f6cbbea}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_MPEG2_VIDEO} + +// use MPEGVIDEOINFO2 (defined below) with KSDATAFORMAT_SPECIFIER_MPEG2_VIDEO + KSDATAFORMAT_SPECIFIER_MPEG2_VIDEO : TGUID = '{e06d80e3-db46-11cf-b4d1-00805f6cbbea}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_MPEG2_VIDEO} + +// +// Mpeg2 video properties +// + KSPROPSETID_Mpeg2Vid : TGUID = '{C8E11B60-0CC9-11D0-BD69-003505C103A9}'; + {$EXTERNALSYM KSPROPSETID_Mpeg2Vid} + +type + KSPROPERTY_MPEG2VID = ( + KSPROPERTY_MPEG2VID_MODES, // available output modes of decoder + KSPROPERTY_MPEG2VID_CUR_MODE, // current mode of the decoder + KSPROPERTY_MPEG2VID_4_3_RECT, // output coordinates for 4:3 source + KSPROPERTY_MPEG2VID_16_9_RECT, // output coordinates for 16:9 source + KSPROPERTY_MPEG2VID_16_9_PANSCAN // pan and scan vectors + ); + {$EXTERNALSYM KSPROPERTY_MPEG2VID} + TKSPropertyMPEG2Vid = KSPROPERTY_MPEG2VID; + +// +// bit field definitions for MPEG2 VIDEO mode +// +const + KSMPEGVIDMODE_PANSCAN = $0001; + {$EXTERNALSYM KSMPEGVIDMODE_PANSCAN} + KSMPEGVIDMODE_LTRBOX = $0002; + {$EXTERNALSYM KSMPEGVIDMODE_LTRBOX} + KSMPEGVIDMODE_SCALE = $0004; + {$EXTERNALSYM KSMPEGVIDMODE_SCALE} + +// +// rectangle definitions for the 4/3 and 16/9 cropping properties of +// the MPEG2Video decoder +// +type + PKSMPEGVidRect = ^TKSMPEGVidRect; + _KSMPEGVID_RECT = record + StartX : ULONG; + StartY : ULONG; + EndX : ULONG; + EndY : ULONG; + end; + {$EXTERNALSYM _KSMPEGVID_RECT} + KSMPEGVID_RECT = _KSMPEGVID_RECT; + {$EXTERNALSYM KSMPEGVID_RECT} + PKSMPEGVID_RECT = ^KSMPEGVID_RECT; + {$EXTERNALSYM PKSMPEGVID_RECT} + TKSMPEGVidRect = _KSMPEGVID_RECT; + +// +// Params for pan / scan +// + + +// +// MPEG2 Audio definition +// +const + KSDATAFORMAT_SUBTYPE_MPEG2_AUDIO : TGUID = '{e06d802b-db46-11cf-b4d1-00805f6cbbea}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_MPEG2_AUDIO} + KSDATAFORMAT_SPECIFIER_MPEG2_AUDIO : TGUID = '{e06d80e5-db46-11cf-b4d1-00805f6cbbea}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_MPEG2_AUDIO} + +// +// DVD LPCM Audio definition +// + + KSDATAFORMAT_SUBTYPE_LPCM_AUDIO : TGUID = '{e06d8032-db46-11cf-b4d1-00805f6cbbea}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_LPCM_AUDIO} + KSDATAFORMAT_SPECIFIER_LPCM_AUDIO : TGUID = '{e06d80e6-db46-11cf-b4d1-00805f6cbbea}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_LPCM_AUDIO} + +// +// AC-3 definition +// + + KSDATAFORMAT_SUBTYPE_AC3_AUDIO : TGUID = '{e06d802c-db46-11cf-b4d1-00805f6cbbea}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_AC3_AUDIO} + KSDATAFORMAT_SPECIFIER_AC3_AUDIO : TGUID = '{e06d80e4-db46-11cf-b4d1-00805f6cbbea}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_AC3_AUDIO} + KSPROPSETID_AC3 : TGUID = '{BFABE720-6E1F-11D0-BCF2-444553540000}'; + {$EXTERNALSYM KSPROPSETID_AC3} + +type + KSPROPERTY_AC3 = ( + KSPROPERTY_AC3_Invalid, + KSPROPERTY_AC3_ERROR_CONCEALMENT, + KSPROPERTY_AC3_ALTERNATE_AUDIO, + KSPROPERTY_AC3_DOWNMIX, + KSPROPERTY_AC3_BIT_STREAM_MODE, + KSPROPERTY_AC3_DIALOGUE_LEVEL, + KSPROPERTY_AC3_LANGUAGE_CODE, + KSPROPERTY_AC3_ROOM_TYPE + ); + {$EXTERNALSYM KSPROPERTY_AC3} + TKSPropertyAC3 = KSPROPERTY_AC3; + + + PKSAC3ErrorConcealment = ^TKSAC3ErrorConcealment; + KSAC3_ERROR_CONCEALMENT = record + fRepeatPreviousBlock : BOOL; + fErrorInCurrentBlock : BOOL; + end; + {$EXTERNALSYM KSAC3_ERROR_CONCEALMENT} + PKSAC3_ERROR_CONCEALMENT = ^KSAC3_ERROR_CONCEALMENT; + {$EXTERNALSYM PKSAC3_ERROR_CONCEALMENT} + TKSAC3ErrorConcealment = KSAC3_ERROR_CONCEALMENT; + + PKSAC3AlternateAudio = ^TKSAC3AlternateAudio; + KSAC3_ALTERNATE_AUDIO = record + fStereo : BOOL; + DualMode : ULONG; + end; + {$EXTERNALSYM KSAC3_ALTERNATE_AUDIO} + PKSAC3_ALTERNATE_AUDIO = ^KSAC3_ALTERNATE_AUDIO; + {$EXTERNALSYM PKSAC3_ALTERNATE_AUDIO} + TKSAC3AlternateAudio = KSAC3_ALTERNATE_AUDIO; + +const + KSAC3_ALTERNATE_AUDIO_1 = 1; + {$EXTERNALSYM KSAC3_ALTERNATE_AUDIO_1} + KSAC3_ALTERNATE_AUDIO_2 = 2; + {$EXTERNALSYM KSAC3_ALTERNATE_AUDIO_2} + KSAC3_ALTERNATE_AUDIO_BOTH = 3; + {$EXTERNALSYM KSAC3_ALTERNATE_AUDIO_BOTH} + +type + PKSAC3DownMix = ^TKSAC3DownMix; + KSAC3_DOWNMIX = record + fDownMix : BOOL; + fDolbySurround : BOOL; + end; + {$EXTERNALSYM KSAC3_DOWNMIX} + PKSAC3_DOWNMIX = ^KSAC3_DOWNMIX; + {$EXTERNALSYM PKSAC3_DOWNMIX} + TKSAC3DownMix = KSAC3_DOWNMIX; + + PKSAC3BitStreamMode = ^TKSAC3BitStreamMode; + KSAC3_BIT_STREAM_MODE = record + BitStreamMode : Longint; + end; + {$EXTERNALSYM KSAC3_BIT_STREAM_MODE} + PKSAC3_BIT_STREAM_MODE = ^KSAC3_BIT_STREAM_MODE; + {$EXTERNALSYM PKSAC3_BIT_STREAM_MODE} + TKSAC3BitStreamMode = KSAC3_BIT_STREAM_MODE; + +const + KSAC3_SERVICE_MAIN_AUDIO = 0; + {$EXTERNALSYM KSAC3_SERVICE_MAIN_AUDIO} + KSAC3_SERVICE_NO_DIALOG = 1; + {$EXTERNALSYM KSAC3_SERVICE_NO_DIALOG} + KSAC3_SERVICE_VISUALLY_IMPAIRED = 2; + {$EXTERNALSYM KSAC3_SERVICE_VISUALLY_IMPAIRED} + KSAC3_SERVICE_HEARING_IMPAIRED = 3; + {$EXTERNALSYM KSAC3_SERVICE_HEARING_IMPAIRED} + KSAC3_SERVICE_DIALOG_ONLY = 4; + {$EXTERNALSYM KSAC3_SERVICE_DIALOG_ONLY} + KSAC3_SERVICE_COMMENTARY = 5; + {$EXTERNALSYM KSAC3_SERVICE_COMMENTARY} + KSAC3_SERVICE_EMERGENCY_FLASH = 6; + {$EXTERNALSYM KSAC3_SERVICE_EMERGENCY_FLASH} + KSAC3_SERVICE_VOICE_OVER = 7; + {$EXTERNALSYM KSAC3_SERVICE_VOICE_OVER} + +type + PKSAC3DialogueLevel = ^TKSAC3DialogueLevel; + KSAC3_DIALOGUE_LEVEL = record + DialogueLevel : ULONG; + end; + {$EXTERNALSYM KSAC3_DIALOGUE_LEVEL} + PKSAC3_DIALOGUE_LEVEL = ^KSAC3_DIALOGUE_LEVEL; + {$EXTERNALSYM PKSAC3_DIALOGUE_LEVEL} + TKSAC3DialogueLevel = KSAC3_DIALOGUE_LEVEL; + + PKSAC3RoomType = ^TKSAC3RoomType; + KSAC3_ROOM_TYPE = record + fLargeRoom : BOOL; + end; + {$EXTERNALSYM KSAC3_ROOM_TYPE} + PKSAC3_ROOM_TYPE = ^KSAC3_ROOM_TYPE; + {$EXTERNALSYM PKSAC3_ROOM_TYPE} + TKSAC3RoomType = KSAC3_ROOM_TYPE; + +// +// DTS and SDDS definitions (media subtype GUIDs) +// +const + KSDATAFORMAT_SUBTYPE_DTS_AUDIO : TGUID = '{e06d8033-db46-11cf-b4d1-00805f6cbbea}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_DTS_AUDIO} + KSDATAFORMAT_SUBTYPE_SDDS_AUDIO : TGUID = '{e06d8034-db46-11cf-b4d1-00805f6cbbea}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_SDDS_AUDIO} + +// +// audio decoder output properties +// + + KSPROPSETID_AudioDecoderOut : TGUID = '{6ca6e020-43bd-11d0-bd6a-003505c103a9}'; + {$EXTERNALSYM KSPROPSETID_AudioDecoderOut} + +type + KSPROPERTY_AUDDECOUT = ( + KSPROPERTY_AUDDECOUT_MODES, // available output modes of decoder + KSPROPERTY_AUDDECOUT_CUR_MODE // current mode of the decoder + ); + {$EXTERNALSYM KSPROPERTY_AUDDECOUT} + TKSPropertyAuddecout = KSPROPERTY_AUDDECOUT; + +const + KSAUDDECOUTMODE_STEREO_ANALOG = $0001; + {$EXTERNALSYM KSAUDDECOUTMODE_STEREO_ANALOG} + KSAUDDECOUTMODE_PCM_51 = $0002; + {$EXTERNALSYM KSAUDDECOUTMODE_PCM_51} + KSAUDDECOUTMODE_SPDIFF = $0004; + {$EXTERNALSYM KSAUDDECOUTMODE_SPDIFF} + +// +// subpicture definition +// + + KSDATAFORMAT_SUBTYPE_SUBPICTURE : TGUID = '{e06d802d-db46-11cf-b4d1-00805f6cbbea}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_SUBPICTURE} + KSPROPSETID_DvdSubPic : TGUID = '{ac390460-43af-11d0-bd6a-003505c103a9}'; + {$EXTERNALSYM KSPROPSETID_DvdSubPic} + +type + KSPROPERTY_DVDSUBPIC = ( + KSPROPERTY_DVDSUBPIC_PALETTE, + KSPROPERTY_DVDSUBPIC_HLI, + KSPROPERTY_DVDSUBPIC_COMPOSIT_ON // TRUE for subpicture is displayed + ); + {$EXTERNALSYM KSPROPERTY_DVDSUBPIC} + TKSPropertyDVDSubPic = KSPROPERTY_DVDSUBPIC; + + PKSDVDYCrCb = ^TKSDVDYCrCb; + _KS_DVD_YCrCb = record + Reserved : byte; + Y : byte; + Cr : byte; + Cb : byte; + end; + {$EXTERNALSYM _KS_DVD_YCrCb} + KS_DVD_YCrCb = _KS_DVD_YCrCb; + {$EXTERNALSYM KS_DVD_YCrCb} + PKS_DVD_YCrCb = ^KS_DVD_YCrCb; + {$EXTERNALSYM PKS_DVD_YCrCb} + TKSDVDYCrCb = _KS_DVD_YCrCb; + +// The KS_DVD_YUV structure is now superseded by KS_DVD_YCrCb above and is +// here for backward compatibility only + + PKSDVDYUV = ^TKSDVDYUV; + _KS_DVD_YUV = record + Reserved : byte; + Y : byte; + V : byte; + U : byte; + end; + {$EXTERNALSYM _KS_DVD_YUV} + KS_DVD_YUV = _KS_DVD_YUV; + {$EXTERNALSYM KS_DVD_YUV} + PKS_DVD_YUV = ^KS_DVD_YUV; + {$EXTERNALSYM PKS_DVD_YUV} + TKSDVDYUV = _KS_DVD_YUV; + + PKSPropertySPPAL = ^TKSPropertySPPAL; + _KSPROPERTY_SPPAL = record + sppal : array[0..15] of TKSDVDYUV; + end; + {$EXTERNALSYM _KSPROPERTY_SPPAL} + KSPROPERTY_SPPAL = _KSPROPERTY_SPPAL; + {$EXTERNALSYM KSPROPERTY_SPPAL} + PKSPROPERTY_SPPAL = ^KSPROPERTY_SPPAL; + {$EXTERNALSYM PKSPROPERTY_SPPAL} + TKSPropertySPPAL = _KSPROPERTY_SPPAL; + + PKSColCon = ^TKSColCon; + _KS_COLCON = record + emph1col : byte; //:4; + emph2col : byte; //:4; + backcol : byte; //:4; + patcol : byte; //:4; + emph1con : byte; //:4; + emph2con : byte; //:4; + backcon : byte; //:4; + patcon : byte; //:4; + end; + {$EXTERNALSYM _KS_COLCON} + KS_COLCON = _KS_COLCON; + {$EXTERNALSYM KS_COLCON} + PKS_COLCON = ^KS_COLCON; + {$EXTERNALSYM PKS_COLCON} + TKSColCon = _KS_COLCON; + + PKSPropertySPHLI = ^TKSPropertySPHLI; + _KSPROPERTY_SPHLI = record + HLISS : WORD; + Reserved : WORD; + StartPTM : ULONG; // start presentation time in x/90000 + EndPTM : ULONG; // end PTM in x/90000 + StartX : WORD; + StartY : WORD; + StopX : WORD; + StopY : WORD; + ColCon : TKSColCon; // color contrast description (4 bytes as given in HLI) + end; + {$EXTERNALSYM _KSPROPERTY_SPHLI} + KSPROPERTY_SPHLI = _KSPROPERTY_SPHLI; + {$EXTERNALSYM KSPROPERTY_SPHLI} + PKSPROPERTY_SPHLI = ^KSPROPERTY_SPHLI; + {$EXTERNALSYM PKSPROPERTY_SPHLI} + TKSPropertySPHLI = _KSPROPERTY_SPHLI; + + PKSPROPERTY_COMPOSIT_ON = ^KSPROPERTY_COMPOSIT_ON; + {$EXTERNALSYM PKSPROPERTY_COMPOSIT_ON} + KSPROPERTY_COMPOSIT_ON = {$IFDEF TYPE_IDENTITY}type {$ENDIF} BOOL; + {$EXTERNALSYM KSPROPERTY_COMPOSIT_ON} + +const + KSPROPSETID_CopyProt : TGUID = '{0E8A0A40-6AEF-11D0-9ED0-00A024CA19B3}'; + {$EXTERNALSYM KSPROPSETID_CopyProt} + +type + KSPROPERTY_COPYPROT = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM KSPROPERTY_COPYPROT} + const + KSPROPERTY_DVDCOPY_CHLG_KEY = $01; + {$EXTERNALSYM KSPROPERTY_DVDCOPY_CHLG_KEY} + KSPROPERTY_DVDCOPY_DVD_KEY1 = $02; + {$EXTERNALSYM KSPROPERTY_DVDCOPY_DVD_KEY1} + KSPROPERTY_DVDCOPY_DEC_KEY2 = $03; + {$EXTERNALSYM KSPROPERTY_DVDCOPY_DEC_KEY2} + KSPROPERTY_DVDCOPY_TITLE_KEY = $04; + {$EXTERNALSYM KSPROPERTY_DVDCOPY_TITLE_KEY} + KSPROPERTY_COPY_MACROVISION = $05; + {$EXTERNALSYM KSPROPERTY_COPY_MACROVISION} + KSPROPERTY_DVDCOPY_REGION = $06; + {$EXTERNALSYM KSPROPERTY_DVDCOPY_REGION} + KSPROPERTY_DVDCOPY_SET_COPY_STATE = $07; + {$EXTERNALSYM KSPROPERTY_DVDCOPY_SET_COPY_STATE} + KSPROPERTY_DVDCOPY_DISC_KEY = $80; + {$EXTERNALSYM KSPROPERTY_DVDCOPY_DISC_KEY} + +type + PKSDVDCopyCHLGKey = ^TKSDVDCopyCHLGKey; + _KS_DVDCOPY_CHLGKEY = record + ChlgKey : array[0..9] of BYTE; + Reserved : array[0..1] of BYTE; + end; + {$EXTERNALSYM _KS_DVDCOPY_CHLGKEY} + KS_DVDCOPY_CHLGKEY = _KS_DVDCOPY_CHLGKEY; + {$EXTERNALSYM KS_DVDCOPY_CHLGKEY} + PKS_DVDCOPY_CHLGKEY = ^KS_DVDCOPY_CHLGKEY; + {$EXTERNALSYM PKS_DVDCOPY_CHLGKEY} + TKSDVDCopyCHLGKey = _KS_DVDCOPY_CHLGKEY; + + PKSDVDCopyBusKey = ^TKSDVDCopyBusKey; + _KS_DVDCOPY_BUSKEY = record + BusKey : array[0..4] of BYTE; + Reserved : array[0..0] of BYTE; + end; + {$EXTERNALSYM _KS_DVDCOPY_BUSKEY} + KS_DVDCOPY_BUSKEY = _KS_DVDCOPY_BUSKEY; + {$EXTERNALSYM KS_DVDCOPY_BUSKEY} + PKS_DVDCOPY_BUSKEY = ^KS_DVDCOPY_BUSKEY; + {$EXTERNALSYM PKS_DVDCOPY_BUSKEY} + TKSDVDCopyBusKey = _KS_DVDCOPY_BUSKEY; + + PKSDVDCopyDiscKey = ^TKSDVDCopyDiscKey; + _KS_DVDCOPY_DISCKEY = record + DiscKey : array[0..2047] of BYTE; + end; + {$EXTERNALSYM _KS_DVDCOPY_DISCKEY} + KS_DVDCOPY_DISCKEY = _KS_DVDCOPY_DISCKEY; + {$EXTERNALSYM KS_DVDCOPY_DISCKEY} + PKS_DVDCOPY_DISCKEY = ^KS_DVDCOPY_DISCKEY; + {$EXTERNALSYM PKS_DVDCOPY_DISCKEY} + TKSDVDCopyDiscKey = _KS_DVDCOPY_DISCKEY; + + PKSDVDCopyRegion = ^TKSDVDCopyRegion; + _KS_DVDCOPY_REGION = record + Reserved : UCHAR; + RegionData : UCHAR; + Reserved2 : array[0..1] of UCHAR; + end; + {$EXTERNALSYM _KS_DVDCOPY_REGION} + KS_DVDCOPY_REGION = _KS_DVDCOPY_REGION; + {$EXTERNALSYM KS_DVDCOPY_REGION} + PKS_DVDCOPY_REGION = ^KS_DVDCOPY_REGION; + {$EXTERNALSYM PKS_DVDCOPY_REGION} + TKSDVDCopyRegion = _KS_DVDCOPY_REGION; + + PKSDVDCopyTitleKey = ^TKSDVDCopyTitleKey; + _KS_DVDCOPY_TITLEKEY = record + KeyFlags : ULONG; + ReservedNT : array[0..1] of ULONG; + TitleKey : array[0..5] of UCHAR; + Reserved : array[0..1] of UCHAR; + end; + {$EXTERNALSYM _KS_DVDCOPY_TITLEKEY} + KS_DVDCOPY_TITLEKEY = _KS_DVDCOPY_TITLEKEY; + {$EXTERNALSYM KS_DVDCOPY_TITLEKEY} + PKS_DVDCOPY_TITLEKEY = ^KS_DVDCOPY_TITLEKEY; + {$EXTERNALSYM PKS_DVDCOPY_TITLEKEY} + TKSDVDCopyTitleKey = _KS_DVDCOPY_TITLEKEY; + + PKSCopyMacrovision = ^TKSCopyMacrovision; + _KS_COPY_MACROVISION = record + MACROVISIONLevel : ULONG; + end; + {$EXTERNALSYM _KS_COPY_MACROVISION} + KS_COPY_MACROVISION = _KS_COPY_MACROVISION; + {$EXTERNALSYM KS_COPY_MACROVISION} + PKS_COPY_MACROVISION = ^KS_COPY_MACROVISION; + {$EXTERNALSYM PKS_COPY_MACROVISION} + TKSCopyMacrovision = _KS_COPY_MACROVISION; + + PKSDVDCopySetCopyState = ^TKSDVDCopySetCopyState; + _KS_DVDCOPY_SET_COPY_STATE = record + DVDCopyState : ULONG; + end; + {$EXTERNALSYM _KS_DVDCOPY_SET_COPY_STATE} + KS_DVDCOPY_SET_COPY_STATE = _KS_DVDCOPY_SET_COPY_STATE; + {$EXTERNALSYM KS_DVDCOPY_SET_COPY_STATE} + PKS_DVDCOPY_SET_COPY_STATE = ^KS_DVDCOPY_SET_COPY_STATE; + {$EXTERNALSYM PKS_DVDCOPY_SET_COPY_STATE} + TKSDVDCopySetCopyState = _KS_DVDCOPY_SET_COPY_STATE; + + KS_DVDCOPYSTATE = ( + KS_DVDCOPYSTATE_INITIALIZE, // indicates we are starting a full + // copy protection sequence. + KS_DVDCOPYSTATE_INITIALIZE_TITLE, // indicates we are starting a title + // key copy protection sequence + KS_DVDCOPYSTATE_AUTHENTICATION_NOT_REQUIRED, + KS_DVDCOPYSTATE_AUTHENTICATION_REQUIRED, + KS_DVDCOPYSTATE_DONE + ); + {$EXTERNALSYM KS_DVDCOPYSTATE} + TKSDVDCopyState = KS_DVDCOPYSTATE; + + PKSCopyMacrovisionLevel = ^TKSCopyMacrovisionLevel; + KS_COPY_MACROVISION_LEVEL = ( + KS_MACROVISION_DISABLED, + KS_MACROVISION_LEVEL1, + KS_MACROVISION_LEVEL2, + KS_MACROVISION_LEVEL3 + ); + {$EXTERNALSYM KS_COPY_MACROVISION_LEVEL} + PKS_COPY_MACROVISION_LEVEL = ^KS_COPY_MACROVISION_LEVEL; + {$EXTERNALSYM PKS_COPY_MACROVISION_LEVEL} + TKSCopyMacrovisionLevel = KS_COPY_MACROVISION_LEVEL; + + +// +// CGMS Copy Protection Flags +// +const + KS_DVD_CGMS_RESERVED_MASK = $00000078; + {$EXTERNALSYM KS_DVD_CGMS_RESERVED_MASK} + + KS_DVD_CGMS_COPY_PROTECT_MASK = $00000018; + {$EXTERNALSYM KS_DVD_CGMS_COPY_PROTECT_MASK} + KS_DVD_CGMS_COPY_PERMITTED = $00000000; + {$EXTERNALSYM KS_DVD_CGMS_COPY_PERMITTED} + KS_DVD_CGMS_COPY_ONCE = $00000010; + {$EXTERNALSYM KS_DVD_CGMS_COPY_ONCE} + KS_DVD_CGMS_NO_COPY = $00000018; + {$EXTERNALSYM KS_DVD_CGMS_NO_COPY} + + KS_DVD_COPYRIGHT_MASK = $00000040; + {$EXTERNALSYM KS_DVD_COPYRIGHT_MASK} + KS_DVD_NOT_COPYRIGHTED = $00000000; + {$EXTERNALSYM KS_DVD_NOT_COPYRIGHTED} + KS_DVD_COPYRIGHTED = $00000040; + {$EXTERNALSYM KS_DVD_COPYRIGHTED} + + KS_DVD_SECTOR_PROTECT_MASK = $00000020; + {$EXTERNALSYM KS_DVD_SECTOR_PROTECT_MASK} + KS_DVD_SECTOR_NOT_PROTECTED = $00000000; + {$EXTERNALSYM KS_DVD_SECTOR_NOT_PROTECTED} + KS_DVD_SECTOR_PROTECTED = $00000020; + {$EXTERNALSYM KS_DVD_SECTOR_PROTECTED} + +//=========================================================================== +// The following MUST match the structures in WinGDI.h and AMVideo.h +//=========================================================================== + + KSCATEGORY_TVTUNER : TGUID = '{a799a800-a46d-11d0-a18c-00a02401dcd4}'; + {$EXTERNALSYM KSCATEGORY_TVTUNER} + KSCATEGORY_CROSSBAR : TGUID = '{a799a801-a46d-11d0-a18c-00a02401dcd4}'; + {$EXTERNALSYM KSCATEGORY_CROSSBAR} + KSCATEGORY_TVAUDIO : TGUID = '{a799a802-a46d-11d0-a18c-00a02401dcd4}'; + {$EXTERNALSYM KSCATEGORY_TVAUDIO} + KSCATEGORY_VPMUX : TGUID = '{a799a803-a46d-11d0-a18c-00a02401dcd4}'; + {$EXTERNALSYM KSCATEGORY_VPMUX} + KSCATEGORY_VBICODEC : TGUID = '{07dad660-22f1-11d1-a9f4-00c04fbbde8f}'; + {$EXTERNALSYM KSCATEGORY_VBICODEC} + + // SUBTYPE_VPVideo + KSDATAFORMAT_SUBTYPE_VPVideo : TGUID = '{5a9b6a40-1a22-11d1-bad9-00609744111a}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_VPVideo} + + // SUBTYPE_VPVBI + KSDATAFORMAT_SUBTYPE_VPVBI : TGUID = '{5a9b6a41-1a22-11d1-bad9-00609744111a}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_VPVBI} + + // FORMAT_VideoInfo + KSDATAFORMAT_SPECIFIER_VIDEOINFO : TGUID = '{05589f80-c356-11ce-bf01-00aa0055595a}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_VIDEOINFO} + + // FORMAT_VideoInfo2 + KSDATAFORMAT_SPECIFIER_VIDEOINFO2 : TGUID = '{f72a76A0-eb0a-11d0-ace4-0000c0cc16ba}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_VIDEOINFO2} + + // MEDIATYPE_AnalogVideo + KSDATAFORMAT_TYPE_ANALOGVIDEO : TGUID = '{0482dde1-7817-11cf-8a03-00aa006ecb65}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_ANALOGVIDEO} + + // FORMAT_AnalogVideo + KSDATAFORMAT_SPECIFIER_ANALOGVIDEO : TGUID = '{0482dde0-7817-11cf-8a03-00aa006ecb65}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_ANALOGVIDEO} + + // FORMAT_VBI + KSDATAFORMAT_SPECIFIER_VBI : TGUID = '{f72a76e0-eb0a-11d0-ace4-0000c0cc16ba}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_VBI} + + // MEDIATYPE_VBI + KSDATAFORMAT_TYPE_VBI : TGUID = '{f72a76e1-eb0a-11d0-ace4-0000c0cc16ba}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_VBI} + + // SUBTYPE_RAW8 + KSDATAFORMAT_SUBTYPE_RAW8 : TGUID = '{ca20d9a0-3e3e-11d1-9bf9-00c04fbbdebf}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_RAW8} + + // MEDIASUBTYPE_CC + KSDATAFORMAT_SUBTYPE_CC : TGUID = '{33214CC1-011F-11D2-B4B1-00A0D102CFBE}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_CC} + + // MEDIASUBTYPE_NABTS + KSDATAFORMAT_SUBTYPE_NABTS : TGUID = '{f72a76e2-eb0a-11d0-ace4-0000c0cc16ba}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_NABTS} + + // MEDIASUBTYPE_TELETEXT + KSDATAFORMAT_SUBTYPE_TELETEXT : TGUID = '{f72a76e3-eb0a-11d0-ace4-0000c0cc16ba}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_TELETEXT} + + +// constants for the biCompression field + KS_BI_RGB = 0; + {$EXTERNALSYM KS_BI_RGB} + KS_BI_RLE8 = 1; + {$EXTERNALSYM KS_BI_RLE8} + KS_BI_RLE4 = 2; + {$EXTERNALSYM KS_BI_RLE4} + KS_BI_BITFIELDS = 3; + {$EXTERNALSYM KS_BI_BITFIELDS} + +type + PKSRGBQuad = ^TKSRGBQuad; + tagKS_RGBQUAD = record // rgbq + rgbBlue : BYTE; + rgbGreen : BYTE; + rgbRed : BYTE; + rgbReserved : BYTE; + end; + {$EXTERNALSYM tagKS_RGBQUAD} + KS_RGBQUAD = tagKS_RGBQUAD; + {$EXTERNALSYM KS_RGBQUAD} + PKS_RGBQUAD = ^KS_RGBQUAD; + {$EXTERNALSYM PKS_RGBQUAD} + TKSRGBQuad = tagKS_RGBQUAD; + +// constants for palettes +const + KS_iPALETTE_COLORS = 256; // Maximum colours in palette + {$EXTERNALSYM KS_iPALETTE_COLORS} + KS_iEGA_COLORS = 16; // Number colours in EGA palette + {$EXTERNALSYM KS_iEGA_COLORS} + KS_iMASK_COLORS = 3; // Maximum three components + {$EXTERNALSYM KS_iMASK_COLORS} + KS_iTRUECOLOR = 16; // Minimum true colour device + {$EXTERNALSYM KS_iTRUECOLOR} + KS_iRED = 0; // Index position for RED mask + {$EXTERNALSYM KS_iRED} + KS_iGREEN = 1; // Index position for GREEN mask + {$EXTERNALSYM KS_iGREEN} + KS_iBLUE = 2; // Index position for BLUE mask + {$EXTERNALSYM KS_iBLUE} + KS_iPALETTE = 8; // Maximum colour depth using a palette + {$EXTERNALSYM KS_iPALETTE} + KS_iMAXBITS = 8; // Maximum bits per colour component + {$EXTERNALSYM KS_iMAXBITS} + KS_SIZE_EGA_PALETTE = (KS_iEGA_COLORS * sizeof(TKSRGBQUAD)); + {$EXTERNALSYM KS_SIZE_EGA_PALETTE} + KS_SIZE_PALETTE = (KS_iPALETTE_COLORS * sizeof(TKSRGBQUAD)); + {$EXTERNALSYM KS_SIZE_PALETTE} + +type + PKSBitmapInfoHeader = ^TKSBitmapInfoHeader; + tagKS_BITMAPINFOHEADER = record + biSize : DWORD; + biWidth : longint; + biHeight : longint; + biPlanes : WORD; + biBitCount : WORD; + biCompression : DWORD; + biSizeImage : DWORD; + biXPelsPerMeter : longint; + biYPelsPerMeter : longint; + biClrUsed : DWORD; + biClrImportant : DWORD; + end; + {$EXTERNALSYM tagKS_BITMAPINFOHEADER} + KS_BITMAPINFOHEADER = tagKS_BITMAPINFOHEADER; + {$EXTERNALSYM KS_BITMAPINFOHEADER} + PKS_BITMAPINFOHEADER = ^KS_BITMAPINFOHEADER; + {$EXTERNALSYM PKS_BITMAPINFOHEADER} + TKSBitmapInfoHeader = tagKS_BITMAPINFOHEADER; + +// Used for true colour images that also have a palette + + PKSTrueColorInfo = ^TKSTrueColorInfo; + tag_KS_TRUECOLORINFO = record + dwBitMasks : array[0..KS_iMASK_COLORS-1] of DWORD; + bmiColors : array[0..KS_iPALETTE_COLORS-1] of TKSRGBQUAD; + end; + {$EXTERNALSYM tag_KS_TRUECOLORINFO} + KS_TRUECOLORINFO = tag_KS_TRUECOLORINFO; + {$EXTERNALSYM KS_TRUECOLORINFO} + PKS_TRUECOLORINFO = ^KS_TRUECOLORINFO; + {$EXTERNALSYM PKS_TRUECOLORINFO} + TKSTrueColorInfo = tag_KS_TRUECOLORINFO; + +// KS_WIDTHBYTES(bits) ((DWORD)(((bits)+31) & (~31)) / 8) +// KS_DIBWIDTHBYTES(bi) (DWORD)KS_WIDTHBYTES((DWORD)(bi).biWidth * (DWORD)(bi).biBitCount) +// KS__DIBSIZE(bi) (KS_DIBWIDTHBYTES(bi) * (DWORD)(bi).biHeight) +// KS_DIBSIZE(bi) ((bi).biHeight < 0 ? (-1)*(KS__DIBSIZE(bi)) : KS__DIBSIZE(bi)) + +// typedef REFERENCE_TIME: int64; + +// The BITMAPINFOHEADER contains all the details about the video stream such +// as the actual image dimensions and their pixel depth. A source filter may +// also request that the sink take only a section of the video by providing a +// clipping rectangle in rcSource. In the worst case where the sink filter +// forgets to check this on connection it will simply render the whole thing +// which isn't a disaster. Ideally a sink filter will check the rcSource and +// if it doesn't support image extraction and the rectangle is not empty then +// it will reject the connection. A filter should use SetRectEmpty to reset a +// rectangle to all zeroes (and IsRectEmpty to later check the rectangle). +// The rcTarget specifies the destination rectangle for the video, for most +// source filters they will set this to all zeroes, a downstream filter may +// request that the video be placed in a particular area of the buffers it +// supplies in which case it will call QueryAccept with a non empty target + + PKSVideoInfoHeader = ^TKSVideoInfoHeader; + tagKS_VIDEOINFOHEADER = record + rcSource : TRECT; // The bit we really want to use + rcTarget : TRECT; // Where the video should go + dwBitRate : DWORD; // Approximate bit data rate + dwBitErrorRate : DWORD; // Bit error rate for this stream + AvgTimePerFrame : TReferenceTime; // Average time per frame (100ns units) + bmiHeader : TKSBitmapInfoHeader; + end; + {$EXTERNALSYM tagKS_VIDEOINFOHEADER} + KS_VIDEOINFOHEADER = tagKS_VIDEOINFOHEADER; + {$EXTERNALSYM KS_VIDEOINFOHEADER} + PKS_VIDEOINFOHEADER = ^KS_VIDEOINFOHEADER; + {$EXTERNALSYM PKS_VIDEOINFOHEADER} + TKSVideoInfoHeader = tagKS_VIDEOINFOHEADER; + +// !!! WARNING !!! +// DO NOT use the following structure unless you are sure that the BITMAPINFOHEADER +// has a normal biSize == sizeof(BITMAPINFOHEADER) ! +// !!! WARNING !!! + + PKSVideoInfo = ^TKSVideoInfo; + tagKS_VIDEOINFO = record + rcSource : TRECT; // The bit we really want to use + rcTarget : TRECT; // Where the video should go + dwBitRate : DWORD; // Approximate bit data rate + dwBitErrorRate : DWORD; // Bit error rate for this stream + AvgTimePerFrame : TReferenceTime; // Average time per frame (100ns units) + bmiHeader : TKSBitmapInfoHeader; + case integer of + 0: (bmiColors : array[0..KS_iPALETTE_COLORS-1] of TKSRGBQUAD); // Colour palette + 1: (dwBitMasks : array[0..KS_iMASK_COLORS-1] of DWORD); // True colour masks + 2: (TrueColorInfo : TKSTrueColorInfo); // Both of the above + end; + {$EXTERNALSYM tagKS_VIDEOINFO} + KS_VIDEOINFO = tagKS_VIDEOINFO; + {$EXTERNALSYM KS_VIDEOINFO} + PKS_VIDEOINFO = ^KS_VIDEOINFO; + {$EXTERNALSYM PKS_VIDEOINFO} + TKSVideoInfo = tagKS_VIDEOINFO; + +const + KS_SIZE_MASKS = (KS_iMASK_COLORS * sizeof(DWORD)); + {$EXTERNALSYM KS_SIZE_MASKS} +// KS_SIZE_PREHEADER = (FIELD_OFFSET(KS_VIDEOINFOHEADER,bmiHeader)) + +// For normal size +// #define KS_SIZE_VIDEOHEADER (sizeof(KS_BITMAPINFOHEADER) + KS_SIZE_PREHEADER) +// !!! for abnormal biSizes +//#define KS_SIZE_VIDEOHEADER(pbmi) ((pbmi)->bmiHeader.biSize + KS_SIZE_PREHEADER) + +// VBI +// Used for NABTS, CC, Intercast, +type + PKSVBIInfoHeader = ^TKSVBIInfoHeader; + tagKS_VBIINFOHEADER = record + StartLine : ULONG; // inclusive + EndLine : ULONG; // inclusive + SamplingFrequency : ULONG; // Hz. + MinLineStartTime : ULONG; // microSec * 100 from HSync LE + MaxLineStartTime : ULONG; // microSec * 100 from HSync LE + ActualLineStartTime : ULONG; // microSec * 100 from HSync LE + ActualLineEndTime : ULONG; // microSec * 100 from HSync LE + VideoStandard : ULONG; // KS_AnalogVideoStandard* + SamplesPerLine : ULONG; + StrideInBytes : ULONG; // May be > SamplesPerLine + BufferSize : ULONG; // Bytes + end; + {$EXTERNALSYM tagKS_VBIINFOHEADER} + KS_VBIINFOHEADER = tagKS_VBIINFOHEADER; + {$EXTERNALSYM KS_VBIINFOHEADER} + PKS_VBIINFOHEADER = ^KS_VBIINFOHEADER; + {$EXTERNALSYM PKS_VBIINFOHEADER} + TKSVBIInfoHeader = tagKS_VBIINFOHEADER; + +// VBI Sampling Rates +const + KS_VBIDATARATE_NABTS = 5727272; + {$EXTERNALSYM KS_VBIDATARATE_NABTS} + KS_VBIDATARATE_CC = 503493; // ~= 1/1.986125e-6 + {$EXTERNALSYM KS_VBIDATARATE_CC} + KS_VBISAMPLINGRATE_4X_NABTS = longint(4*KS_VBIDATARATE_NABTS); + {$EXTERNALSYM KS_VBISAMPLINGRATE_4X_NABTS} + KS_VBISAMPLINGRATE_47X_NABTS = longint(27000000); + {$EXTERNALSYM KS_VBISAMPLINGRATE_47X_NABTS} + KS_VBISAMPLINGRATE_5X_NABTS = longint(5*KS_VBIDATARATE_NABTS); + {$EXTERNALSYM KS_VBISAMPLINGRATE_5X_NABTS} + + KS_47NABTS_SCALER = KS_VBISAMPLINGRATE_47X_NABTS/KS_VBIDATARATE_NABTS; + {$EXTERNALSYM KS_47NABTS_SCALER} + +// Analog video variant - Use this when the format is FORMAT_AnalogVideo +// +// rcSource defines the portion of the active video signal to use +// rcTarget defines the destination rectangle +// both of the above are relative to the dwActiveWidth and dwActiveHeight fields +// dwActiveWidth is currently set to 720 for all formats (but could change for HDTV) +// dwActiveHeight is 483 for NTSC and 575 for PAL/SECAM (but could change for HDTV) +type + PKSAnalogVideoInfo = ^TKSAnalogVideoInfo; + tagKS_AnalogVideoInfo = record + rcSource : TRECT; // Width max is 720, height varies w/ TransmissionStd + rcTarget : TRECT; // Where the video should go + dwActiveWidth : DWORD; // Always 720 (CCIR-601 active samples per line) + dwActiveHeight : DWORD; // 483 for NTSC, 575 for PAL/SECAM + AvgTimePerFrame : TReferenceTime; // Normal ActiveMovie units (100 nS) + end; + {$EXTERNALSYM tagKS_AnalogVideoInfo} + KS_AnalogVideoInfo = tagKS_AnalogVideoInfo; + {$EXTERNALSYM KS_ANALOGVIDEOINFO} + PKS_ANALOGVIDEOINFO = ^KS_ANALOGVIDEOINFO; + {$EXTERNALSYM PKS_ANALOGVIDEOINFO} + TKSAnalogVideoInfo = tagKS_AnalogVideoInfo; + +//=========================================================================== +// Data packet passed on Analog video stream channel change +//=========================================================================== +const + KS_TVTUNER_CHANGE_BEGIN_TUNE = $0001; // Starting a tuning operation + {$EXTERNALSYM KS_TVTUNER_CHANGE_BEGIN_TUNE} + KS_TVTUNER_CHANGE_END_TUNE = $0002; // Ending a tuning operation + {$EXTERNALSYM KS_TVTUNER_CHANGE_END_TUNE} + +type + PKSTVTunerChangeInfo = ^TKSTVTunerChangeInfo; + tagKS_TVTUNER_CHANGE_INFO = record + dwFlags : DWORD; // KS_TVTUNER_CHANGE_* + dwCountryCode : DWORD; + dwAnalogVideoStandard : DWORD; // KS_AnalogVideoStandard + dwChannel : DWORD; + end; + {$EXTERNALSYM tagKS_TVTUNER_CHANGE_INFO} + KS_TVTUNER_CHANGE_INFO = tagKS_TVTUNER_CHANGE_INFO; + {$EXTERNALSYM KS_TVTUNER_CHANGE_INFO} + PKS_TVTUNER_CHANGE_INFO = ^KS_TVTUNER_CHANGE_INFO; + {$EXTERNALSYM PKS_TVTUNER_CHANGE_INFO} + TKSTVTunerChangeInfo = tagKS_TVTUNER_CHANGE_INFO; + +//=========================================================================== +// Video format blocks +//=========================================================================== + + KS_MPEG2Level = ( + KS_MPEG2Level_Low, + KS_MPEG2Level_Main, + KS_MPEG2Level_High1440, + KS_MPEG2Level_High + ); + {$EXTERNALSYM KS_MPEG2Level} + TKSMPEG2Level = KS_MPEG2Level; + + KS_MPEG2Profile = ( + KS_MPEG2Profile_Simple, + KS_MPEG2Profile_Main, + KS_MPEG2Profile_SNRScalable, + KS_MPEG2Profile_SpatiallyScalable, + KS_MPEG2Profile_High + ); + {$EXTERNALSYM KS_MPEG2Profile} + TKSMPEG2Profile = KS_MPEG2Profile; + +const + KS_INTERLACE_IsInterlaced = $00000001; // if 0, other interlace bits are irrelevent + {$EXTERNALSYM KS_INTERLACE_IsInterlaced} + KS_INTERLACE_1FieldPerSample = $00000002; // else 2 fields per media sample + {$EXTERNALSYM KS_INTERLACE_1FieldPerSample} + KS_INTERLACE_Field1First = $00000004; // else Field 2 is first; top field in PAL is field 1, top field in NTSC is field 2? + {$EXTERNALSYM KS_INTERLACE_Field1First} + KS_INTERLACE_UNUSED = $00000008; // + {$EXTERNALSYM KS_INTERLACE_UNUSED} + KS_INTERLACE_FieldPatternMask = $00000030; // use this mask with AMINTERLACE_FieldPat* + {$EXTERNALSYM KS_INTERLACE_FieldPatternMask} + KS_INTERLACE_FieldPatField1Only = $00000000; // Data never contains a Field2 + {$EXTERNALSYM KS_INTERLACE_FieldPatField1Only} + KS_INTERLACE_FieldPatField2Only = $00000010; // Data never contains a Field1 + {$EXTERNALSYM KS_INTERLACE_FieldPatField2Only} + KS_INTERLACE_FieldPatBothRegular = $00000020; // There will be a Field2 for every Field1 (required for Weave?) + {$EXTERNALSYM KS_INTERLACE_FieldPatBothRegular} + KS_INTERLACE_FieldPatBothIrregular = $00000030; // Random pattern of Field1s and Field2s + {$EXTERNALSYM KS_INTERLACE_FieldPatBothIrregular} + KS_INTERLACE_DisplayModeMask = $000000c0; + {$EXTERNALSYM KS_INTERLACE_DisplayModeMask} + KS_INTERLACE_DisplayModeBobOnly = $00000000; + {$EXTERNALSYM KS_INTERLACE_DisplayModeBobOnly} + KS_INTERLACE_DisplayModeWeaveOnly = $00000040; + {$EXTERNALSYM KS_INTERLACE_DisplayModeWeaveOnly} + KS_INTERLACE_DisplayModeBobOrWeave = $00000080; + {$EXTERNALSYM KS_INTERLACE_DisplayModeBobOrWeave} + + + + KS_MPEG2_DoPanScan = $00000001; //if set, the MPEG-2 video decoder should crop output image + {$EXTERNALSYM KS_MPEG2_DoPanScan} // based on pan-scan vectors in picture_display_extension + // and change the picture aspect ratio accordingly. + KS_MPEG2_DVDLine21Field1 = $00000002; //if set, the MPEG-2 decoder must be able to produce an output + {$EXTERNALSYM KS_MPEG2_DVDLine21Field1} // pin for DVD style closed caption data found in GOP layer of field 1 + KS_MPEG2_DVDLine21Field2 = $00000004; //if set, the MPEG-2 decoder must be able to produce an output + {$EXTERNALSYM KS_MPEG2_DVDLine21Field2} // pin for DVD style closed caption data found in GOP layer of field 2 + KS_MPEG2_SourceIsLetterboxed = $00000008; //if set, indicates that black bars have been encoded in the top + {$EXTERNALSYM KS_MPEG2_SourceIsLetterboxed} // and bottom of the video. + KS_MPEG2_FilmCameraMode = $00000010; //if set, indicates "film mode" used for 625/50 content. If cleared, + {$EXTERNALSYM KS_MPEG2_FilmCameraMode} // indicates that "camera mode" was used. + KS_MPEG2_LetterboxAnalogOut = $00000020; //if set and this stream is sent to an analog output, it should + {$EXTERNALSYM KS_MPEG2_LetterboxAnalogOut} + // be letterboxed. Streams sent to VGA should be letterboxed only by renderers. + KS_MPEG2_DSS_UserData = $00000040; //if set, the MPEG-2 decoder must process DSS style user data + {$EXTERNALSYM KS_MPEG2_DSS_UserData} + KS_MPEG2_DVB_UserData = $00000080; //if set, the MPEG-2 decoder must process DVB style user data + {$EXTERNALSYM KS_MPEG2_DVB_UserData} + KS_MPEG2_27MhzTimebase = $00000100; //if set, the PTS,DTS timestamps advance at 27MHz rather than 90KHz + {$EXTERNALSYM KS_MPEG2_27MhzTimebase} + +type + PKSVideoInfoHeader2 = ^TKSVideoInfoHeader2; + tagKS_VIDEOINFOHEADER2 = record + rcSource : TRECT; + rcTarget : TRECT; + dwBitRate : DWORD; + dwBitErrorRate : DWORD; + AvgTimePerFrame : TReferenceTime; + dwInterlaceFlags : DWORD; // use AMINTERLACE_* defines. Reject connection if undefined bits are not 0 + dwCopyProtectFlags : DWORD; // use AMCOPYPROTECT_* defines. Reject connection if undefined bits are not 0 + dwPictAspectRatioX : DWORD; // X dimension of picture aspect ratio, e.g. 16 for 16x9 display + dwPictAspectRatioY : DWORD; // Y dimension of picture aspect ratio, e.g. 9 for 16x9 display + dwReserved1 : DWORD; // must be 0; reject connection otherwise + dwReserved2 : DWORD; // must be 0; reject connection otherwise + bmiHeader : TKSBitmapInfoHeader; + end; + {$EXTERNALSYM tagKS_VIDEOINFOHEADER2} + KS_VIDEOINFOHEADER2 = tagKS_VIDEOINFOHEADER2; + {$EXTERNALSYM KS_VIDEOINFOHEADER2} + PKS_VIDEOINFOHEADER2 = ^KS_VIDEOINFOHEADER2; + {$EXTERNALSYM PKS_VIDEOINFOHEADER2} + TKSVideoInfoHeader2 = tagKS_VIDEOINFOHEADER2; + + PKSMPEG1VideoInfo = ^TKSMPEG1VideoInfo; + tagKS_MPEG1VIDEOINFO = record + hdr : TKSVideoInfoHeader ; // Compatible with VIDEOINFO + dwStartTimeCode : DWORD ; // 25-bit Group of pictures time code at start of data + cbSequenceHeader : DWORD ; // Length in bytes of bSequenceHeader + bSequenceHeader : array[0..0] of BYTE; // Sequence header including quantization matrices if any + end; + {$EXTERNALSYM tagKS_MPEG1VIDEOINFO} + KS_MPEG1VIDEOINFO = tagKS_MPEG1VIDEOINFO; + {$EXTERNALSYM KS_MPEG1VIDEOINFO} + PKS_MPEG1VIDEOINFO = ^KS_MPEG1VIDEOINFO; + {$EXTERNALSYM PKS_MPEG1VIDEOINFO} + TKSMPEG1VideoInfo = tagKS_MPEG1VIDEOINFO; + +const + KS_MAX_SIZE_MPEG1_SEQUENCE_INFO = 140; + {$EXTERNALSYM KS_MAX_SIZE_MPEG1_SEQUENCE_INFO} +// KS_SIZE_MPEG1VIDEOINFO(pv) (FIELD_OFFSET(KS_MPEG1VIDEOINFO, bSequenceHeader[0]) + (pv)->cbSequenceHeader) +// KS_MPEG1_SEQUENCE_INFO(pv) ((const BYTE *)(pv)->bSequenceHeader) + +type + PKSMPEGVideoInfo2 = ^TKSMPEGVideoInfo2; + tagKS_MPEGVIDEOINFO2 = record + hdr : TKSVideoInfoHeader2; + dwStartTimeCode : DWORD; // ?? not used for DVD ?? + cbSequenceHeader : DWORD; // is 0 for DVD (no sequence header) + dwProfile : DWORD; // use enum MPEG2Profile + dwLevel : DWORD; // use enum MPEG2Level + dwFlags : DWORD; // use AMMPEG2_* defines. Reject connection if undefined bits are not 0 + bSequenceHeader : array[0..0] of DWORD; // DWORD instead of Byte for alignment purposes + // For MPEG-2, if a sequence_header is included, the sequence_extension + // should also be included + end; + {$EXTERNALSYM tagKS_MPEGVIDEOINFO2} + KS_MPEGVIDEOINFO2 = tagKS_MPEGVIDEOINFO2; + {$EXTERNALSYM KS_MPEGVIDEOINFO2} + PKS_MPEGVIDEOINFO2 = ^KS_MPEGVIDEOINFO2; + {$EXTERNALSYM PKS_MPEGVIDEOINFO2} + TKSMPEGVideoInfo2 = tagKS_MPEGVIDEOINFO2; + +const +// KS_SIZE_MPEGVIDEOINFO2(pv) (FIELD_OFFSET(KS_MPEGVIDEOINFO2, bSequenceHeader[0]) + (pv)->cbSequenceHeader) +// KS_MPEG1_SEQUENCE_INFO(pv) ((const BYTE *)(pv)->bSequenceHeader) + +//=========================================================================== +// Audio format blocks +//=========================================================================== + +//if set, the PTS,DTS timestamps advance at 27MHz rather than 90KHz + KS_MPEGAUDIOINFO_27MhzTimebase = $00000001; + {$EXTERNALSYM KS_MPEGAUDIOINFO_27MhzTimebase} + +type + PKSMPEGAudioInfo = ^TKSMPEGAudioInfo; + tagKS_MPEAUDIOINFO = record + dwFlags : DWORD; // use KS_MPEGAUDIOINFO_* defines. Reject connection if undefined bits are not 0 + dwReserved1 : DWORD; // must be 0; reject connection otherwise + dwReserved2 : DWORD; // must be 0; reject connection otherwise + dwReserved3 : DWORD; // must be 0; reject connection otherwise + end; + {$EXTERNALSYM tagKS_MPEAUDIOINFO} + KS_MPEGAUDIOINFO = tagKS_MPEAUDIOINFO; + {$EXTERNALSYM KS_MPEGAUDIOINFO} + PKS_MPEGAUDIOINFO = ^KS_MPEGAUDIOINFO; + {$EXTERNALSYM PKS_MPEGAUDIOINFO} + TKSMPEGAudioInfo = tagKS_MPEAUDIOINFO; + +//=========================================================================== +// Video DATAFORMATs +//=========================================================================== + + PKSDataFormatVideoInfoHeader = ^TKSDataFormatVideoInfoHeader; + tagKS_DATAFORMAT_VIDEOINFOHEADER = record + DataFormat : TKSDataFormat; + VideoInfoHeader : TKSVideoInfoHeader; + end; + {$EXTERNALSYM tagKS_DATAFORMAT_VIDEOINFOHEADER} + KS_DATAFORMAT_VIDEOINFOHEADER = tagKS_DATAFORMAT_VIDEOINFOHEADER; + {$EXTERNALSYM KS_DATAFORMAT_VIDEOINFOHEADER} + PKS_DATAFORMAT_VIDEOINFOHEADER = ^KS_DATAFORMAT_VIDEOINFOHEADER; + {$EXTERNALSYM PKS_DATAFORMAT_VIDEOINFOHEADER} + TKSDataFormatVideoInfoHeader = tagKS_DATAFORMAT_VIDEOINFOHEADER; + + PKSDataFormatVideoInfoHeader2 = ^TKSDataFormatVideoInfoHeader2; + tagKS_DATAFORMAT_VIDEOINFOHEADER2 = record + DataFormat : TKSDataFormat; + VideoInfoHeader2 : TKSVideoInfoHeader2; + end; + {$EXTERNALSYM tagKS_DATAFORMAT_VIDEOINFOHEADER2} + KS_DATAFORMAT_VIDEOINFOHEADER2 = tagKS_DATAFORMAT_VIDEOINFOHEADER2; + {$EXTERNALSYM KS_DATAFORMAT_VIDEOINFOHEADER2} + PKS_DATAFORMAT_VIDEOINFOHEADER2 = ^KS_DATAFORMAT_VIDEOINFOHEADER2; + {$EXTERNALSYM PKS_DATAFORMAT_VIDEOINFOHEADER2} + TKSDataFormatVideoInfoHeader2 = tagKS_DATAFORMAT_VIDEOINFOHEADER2; + + PKSDataFormatVideoinfoPalette = ^TKSDataFormatVideoinfoPalette; + tagKS_DATAFORMAT_VIDEOINFO_PALETTE = record + DataFormat : TKSDataFormat; + VideoInfo : TKSVideoInfo; + end; + {$EXTERNALSYM tagKS_DATAFORMAT_VIDEOINFO_PALETTE} + KS_DATAFORMAT_VIDEOINFO_PALETTE = tagKS_DATAFORMAT_VIDEOINFO_PALETTE; + {$EXTERNALSYM KS_DATAFORMAT_VIDEOINFO_PALETTE} + PKS_DATAFORMAT_VIDEOINFO_PALETTE = ^KS_DATAFORMAT_VIDEOINFO_PALETTE; + {$EXTERNALSYM PKS_DATAFORMAT_VIDEOINFO_PALETTE} + TKSDataFormatVideoinfoPalette = tagKS_DATAFORMAT_VIDEOINFO_PALETTE; + + PKSDataFormatVBIInfoHeader = ^TKSDataFormatVBIInfoHeader; + tagKS_DATAFORMAT_VBIINFOHEADER = record + DataFormat : TKSDATAFORMAT; + VBIInfoHeader : TKSVBIInfoHeader; + end; + {$EXTERNALSYM tagKS_DATAFORMAT_VBIINFOHEADER} + KS_DATAFORMAT_VBIINFOHEADER = tagKS_DATAFORMAT_VBIINFOHEADER; + {$EXTERNALSYM KS_DATAFORMAT_VBIINFOHEADER} + PKS_DATAFORMAT_VBIINFOHEADER = ^KS_DATAFORMAT_VBIINFOHEADER; + {$EXTERNALSYM PKS_DATAFORMAT_VBIINFOHEADER} + TKSDataFormatVBIInfoHeader = tagKS_DATAFORMAT_VBIINFOHEADER; + + PKSVideoStreamConfigCaps = ^TKSVideoStreamConfigCaps; + _KS_VIDEO_STREAM_CONFIG_CAPS = record + guid : TGUID; // will be MEDIATYPE_Video + VideoStandard : ULONG; // logical OR of all AnalogVideoStandards + // supported + InputSize : TSIZE; // the inherent size of the incoming signal + // (every pixel unique) + MinCroppingSize : TSIZE; // smallest rcSrc cropping rect allowed + MaxCroppingSize : TSIZE; // largest rcSrc cropping rect allowed + CropGranularityX : integer; // granularity of cropping size + CropGranularityY : integer; + CropAlignX : integer; // alignment of cropping rect + CropAlignY : integer; + MinOutputSize : TSIZE; // smallest bitmap stream can produce + MaxOutputSize : TSIZE; // largest bitmap stream can produce + OutputGranularityX : integer; // granularity of output bitmap size + OutputGranularityY : integer; + StretchTapsX : integer; // 0, no stretch, 1 pix dup, 2 interp, ... + StretchTapsY : integer; // Describes quality of hardware scaler + ShrinkTapsX : integer; // + ShrinkTapsY : integer; // + MinFrameInterval : int64; // 100 nS units + MaxFrameInterval : int64; + MinBitsPerSecond : longint; + MaxBitsPerSecond : longint; + end; + {$EXTERNALSYM _KS_VIDEO_STREAM_CONFIG_CAPS} + KS_VIDEO_STREAM_CONFIG_CAPS = _KS_VIDEO_STREAM_CONFIG_CAPS; + {$EXTERNALSYM KS_VIDEO_STREAM_CONFIG_CAPS} + PKS_VIDEO_STREAM_CONFIG_CAPS = ^KS_VIDEO_STREAM_CONFIG_CAPS; + {$EXTERNALSYM PKS_VIDEO_STREAM_CONFIG_CAPS} + TKSVideoStreamConfigCaps = _KS_VIDEO_STREAM_CONFIG_CAPS; + +//=========================================================================== +// Video DATARANGEs +//=========================================================================== + + PKSDataRangeVideo = ^TKSDataRangeVideo; + tagKS_DATARANGE_VIDEO = record + DataRange : TKSDataRange; + bFixedSizeSamples : BOOL; // all samples same size? + bTemporalCompression : BOOL; // all I frames? + StreamDescriptionFlags : DWORD; // KS_VIDEO_DESC_* + MemoryAllocationFlags : DWORD; // KS_VIDEO_ALLOC_* + ConfigCaps : TKSVideoStreamConfigCaps; + VideoInfoHeader : TKSVideoInfoHeader; // default format + end; + {$EXTERNALSYM tagKS_DATARANGE_VIDEO} + KS_DATARANGE_VIDEO = tagKS_DATARANGE_VIDEO; + {$EXTERNALSYM KS_DATARANGE_VIDEO} + PKS_DATARANGE_VIDEO = ^KS_DATARANGE_VIDEO; + {$EXTERNALSYM PKS_DATARANGE_VIDEO} + TKSDataRangeVideo = tagKS_DATARANGE_VIDEO; + + PKSDataRangeVideo2 = ^TKSDataRangeVideo2; + tagKS_DATARANGE_VIDEO2 = record + DataRange : TKSDataRange; + bFixedSizeSamples : BOOL; // all samples same size? + bTemporalCompression : BOOL; // all I frames? + StreamDescriptionFlags : DWORD; // KS_VIDEO_DESC_* + MemoryAllocationFlags : DWORD; // KS_VIDEO_ALLOC_* + ConfigCaps : TKSVideoStreamConfigCaps; + VideoInfoHeader : TKSVideoInfoHeader2; // default format + end; + {$EXTERNALSYM tagKS_DATARANGE_VIDEO2} + KS_DATARANGE_VIDEO2 = tagKS_DATARANGE_VIDEO2; + {$EXTERNALSYM KS_DATARANGE_VIDEO2} + PKS_DATARANGE_VIDEO2 = ^KS_DATARANGE_VIDEO2; + {$EXTERNALSYM PKS_DATARANGE_VIDEO2} + TKSDataRangeVideo2 = tagKS_DATARANGE_VIDEO2; + + PKSDataRangeMPEG1Video = ^TKSDataRangeMPEG1Video; + tagKS_DATARANGE_MPEG1_VIDEO = record + DataRange : TKSDataRange ; + bFixedSizeSamples : BOOL ; // all samples same size? + bTemporalCompression : BOOL ; // all I frames? + StreamDescriptionFlags : DWORD ; // KS_VIDEO_DESC_* + MemoryAllocationFlags : DWORD ; // KS_VIDEO_ALLOC_* + ConfigCaps : TKSVideoStreamConfigCaps ; + VideoInfoHeader : TKSMPEG1VideoInfo ; // default format + end; + {$EXTERNALSYM tagKS_DATARANGE_MPEG1_VIDEO} + KS_DATARANGE_MPEG1_VIDEO = tagKS_DATARANGE_MPEG1_VIDEO; + {$EXTERNALSYM KS_DATARANGE_MPEG1_VIDEO} + PKS_DATARANGE_MPEG1_VIDEO = ^KS_DATARANGE_MPEG1_VIDEO; + {$EXTERNALSYM PKS_DATARANGE_MPEG1_VIDEO} + TKSDataRangeMPEG1Video = tagKS_DATARANGE_MPEG1_VIDEO; + + PKSDataRangeMPEG2Video = ^TKSDataRangeMPEG2Video; + tagKS_DATARANGE_MPEG2_VIDEO = record + DataRange : TKSDataRange; + bFixedSizeSamples : BOOL; // all samples same size? + bTemporalCompression : BOOL; // all I frames? + StreamDescriptionFlags : DWORD; // KS_VIDEO_DESC_* + MemoryAllocationFlags : DWORD; // KS_VIDEO_ALLOC_* + ConfigCaps : TKSVideoStreamConfigCaps; + VideoInfoHeader : TKSMPEGVideoInfo2; // default format + end; + {$EXTERNALSYM tagKS_DATARANGE_MPEG2_VIDEO} + KS_DATARANGE_MPEG2_VIDEO = tagKS_DATARANGE_MPEG2_VIDEO; + {$EXTERNALSYM KS_DATARANGE_MPEG2_VIDEO} + PKS_DATARANGE_MPEG2_VIDEO = ^KS_DATARANGE_MPEG2_VIDEO; + {$EXTERNALSYM PKS_DATARANGE_MPEG2_VIDEO} + TKSDataRangeMPEG2Video = tagKS_DATARANGE_MPEG2_VIDEO; + + PKSDataRangeVideoPalette = ^TKSDataRangeVideoPalette; + tagKS_DATARANGE_VIDEO_PALETTE = record + DataRange : TKSDataRange; + bFixedSizeSamples : BOOL; // all samples same size? + bTemporalCompression : BOOL; // all I frames? + StreamDescriptionFlags : DWORD; // KS_VIDEO_DESC_* + MemoryAllocationFlags : DWORD; // KS_VIDEO_ALLOC_* + ConfigCaps : TKSVideoStreamConfigCaps; + VideoInfo : TKSVideoInfo; // default format + end; + {$EXTERNALSYM tagKS_DATARANGE_VIDEO_PALETTE} + KS_DATARANGE_VIDEO_PALETTE = tagKS_DATARANGE_VIDEO_PALETTE; + {$EXTERNALSYM KS_DATARANGE_VIDEO_PALETTE} + PKS_DATARANGE_VIDEO_PALETTE = ^KS_DATARANGE_VIDEO_PALETTE; + {$EXTERNALSYM PKS_DATARANGE_VIDEO_PALETTE} + TKSDataRangeVideoPalette = tagKS_DATARANGE_VIDEO_PALETTE; + + PKSDataRangeVideoVBI = ^TKSDataRangeVideoVBI; + tagKS_DATARANGE_VIDEO_VBI = record + DataRange : TKSDataRange; + bFixedSizeSamples : BOOL; // all samples same size? + bTemporalCompression : BOOL; // all I frames? + StreamDescriptionFlags : DWORD; // KS_VIDEO_DESC_* + MemoryAllocationFlags : DWORD; // KS_VIDEO_ALLOC_* + ConfigCaps : TKSVideoStreamConfigCaps; + VBIInfoHeader : TKSVBIInfoHeader; // default format + end; + {$EXTERNALSYM tagKS_DATARANGE_VIDEO_VBI} + KS_DATARANGE_VIDEO_VBI = tagKS_DATARANGE_VIDEO_VBI; + {$EXTERNALSYM KS_DATARANGE_VIDEO_VBI} + PKS_DATARANGE_VIDEO_VBI = ^KS_DATARANGE_VIDEO_VBI; + {$EXTERNALSYM PKS_DATARANGE_VIDEO_VBI} + TKSDataRangeVideoVBI = tagKS_DATARANGE_VIDEO_VBI; + + PKSDataRangeAnalogVideo = ^TKSDataRangeAnalogVideo; + tagKS_DATARANGE_ANALOGVIDEO = record + DataRange : TKSDataRange; + AnalogVideoInfo : TKSAnalogVideoInfo; + end; + {$EXTERNALSYM tagKS_DATARANGE_ANALOGVIDEO} + KS_DATARANGE_ANALOGVIDEO = tagKS_DATARANGE_ANALOGVIDEO; + {$EXTERNALSYM KS_DATARANGE_ANALOGVIDEO} + PKS_DATARANGE_ANALOGVIDEO = ^KS_DATARANGE_ANALOGVIDEO; + {$EXTERNALSYM PKS_DATARANGE_ANALOGVIDEO} + TKSDataRangeAnalogVideo = tagKS_DATARANGE_ANALOGVIDEO; + +//=========================================================================== +// StreamDescriptionFlags +// +// These define the "purpose" of each video stream +//=========================================================================== +const + KS_VIDEOSTREAM_PREVIEW = $0001; // Preview stream + {$EXTERNALSYM KS_VIDEOSTREAM_PREVIEW} + KS_VIDEOSTREAM_CAPTURE = $0002; // Capture stream + {$EXTERNALSYM KS_VIDEOSTREAM_CAPTURE} + KS_VIDEOSTREAM_VBI = $0010; // Field1 VBI + {$EXTERNALSYM KS_VIDEOSTREAM_VBI} + KS_VIDEOSTREAM_NABTS = $0020; // Field1 NABTS + {$EXTERNALSYM KS_VIDEOSTREAM_NABTS} + KS_VIDEOSTREAM_CC = $0100; // Closed Captioning + {$EXTERNALSYM KS_VIDEOSTREAM_CC} + KS_VIDEOSTREAM_EDS = $0200; // Extended Data Services + {$EXTERNALSYM KS_VIDEOSTREAM_EDS} + KS_VIDEOSTREAM_TELETEXT = $0400; // Field1 Teletext only + {$EXTERNALSYM KS_VIDEOSTREAM_TELETEXT} + KS_VIDEOSTREAM_STILL = $1000; // Still image input + {$EXTERNALSYM KS_VIDEOSTREAM_STILL} + KS_VIDEOSTREAM_IS_VPE = $8000; // Is a VPE based stream? + {$EXTERNALSYM KS_VIDEOSTREAM_IS_VPE} + +// MemoryAllocationFlags + KS_VIDEO_ALLOC_VPE_SYSTEM = $0001; // VPE surface in system memory + {$EXTERNALSYM KS_VIDEO_ALLOC_VPE_SYSTEM} + KS_VIDEO_ALLOC_VPE_DISPLAY = $0002; // VPE surface in display memory + {$EXTERNALSYM KS_VIDEO_ALLOC_VPE_DISPLAY} + KS_VIDEO_ALLOC_VPE_AGP = $0004; // VPE surface in AGP memory + {$EXTERNALSYM KS_VIDEO_ALLOC_VPE_AGP} + +////////////////////////////////////////////////////////////// +// Capture driver VBI property sets +////////////////////////////////////////////////////////////// + +// {F162C607-7B35-496f-AD7F-2DCA3B46B718} + KSPROPSETID_VBICAP_PROPERTIES : TGUID = '{F162C607-7B35-496f-AD7F-2DCA3B46B718}'; + {$EXTERNALSYM KSPROPSETID_VBICAP_PROPERTIES} + +type + KSPROPERTY_VBICAP = ( + {$IFNDEF COMPILER6_UP} + KSPROPERTY_VBICAP_PROPERTIES_INVALID_0, + KSPROPERTY_VBICAP_PROPERTIES_PROTECTION + {$ELSE} + KSPROPERTY_VBICAP_PROPERTIES_PROTECTION = 1 + {$ENDIF} + ); + {$EXTERNALSYM KSPROPERTY_VBICAP} + TKSPropertyVBICap = KSPROPERTY_VBICAP; + + PVBICapPropertiesProtectionS = ^TVBICapPropertiesProtectionS; + _VBICAP_PROPERTIES_PROTECTION_S = record + Property_ : KSPROPERTY; + StreamIndex : ULONG; // Index of stream + Status : ULONG; + end; + {$EXTERNALSYM _VBICAP_PROPERTIES_PROTECTION_S} + VBICAP_PROPERTIES_PROTECTION_S = _VBICAP_PROPERTIES_PROTECTION_S; + {$EXTERNALSYM VBICAP_PROPERTIES_PROTECTION_S} + PVBICAP_PROPERTIES_PROTECTION_S = ^VBICAP_PROPERTIES_PROTECTION_S; + {$EXTERNALSYM PVBICAP_PROPERTIES_PROTECTION_S} + TVBICapPropertiesProtectionS = _VBICAP_PROPERTIES_PROTECTION_S; + +const + KS_VBICAP_PROTECTION_MV_PRESENT = $0001; + {$EXTERNALSYM KS_VBICAP_PROTECTION_MV_PRESENT} + KS_VBICAP_PROTECTION_MV_HARDWARE = $0002; + {$EXTERNALSYM KS_VBICAP_PROTECTION_MV_HARDWARE} + KS_VBICAP_PROTECTION_MV_DETECTED = $0004; + {$EXTERNALSYM KS_VBICAP_PROTECTION_MV_DETECTED} + + +//***************************************************************************/ +//* VBI Related GUIDs, structs and properties for codecs(generic, cc, nabts)*/ +//***************************************************************************/ + +/////////////////////////////////////////////////////////////////////////////////////// +// IP/NABTS Protocol Reserved Group IDs - Overall Range 0x800-0x8FF [Decimal 2048-2079] +// Intervening values(0-F) are used if there are multiple providers at a particular tier +/////////////////////////////////////////////////////////////////////////////////////// + +// Used by individual content creators in show footage/data + KS_NABTS_GROUPID_ORIGINAL_CONTENT_BASE = $800; + {$EXTERNALSYM KS_NABTS_GROUPID_ORIGINAL_CONTENT_BASE} + KS_NABTS_GROUPID_ORIGINAL_CONTENT_ADVERTISER_BASE = $810; + {$EXTERNALSYM KS_NABTS_GROUPID_ORIGINAL_CONTENT_ADVERTISER_BASE} + +// Used by production company in finished show data + KS_NABTS_GROUPID_PRODUCTION_COMPANY_CONTENT_BASE = $820; + {$EXTERNALSYM KS_NABTS_GROUPID_PRODUCTION_COMPANY_CONTENT_BASE} + KS_NABTS_GROUPID_PRODUCTION_COMPANY_ADVERTISER_BASE = $830; + {$EXTERNALSYM KS_NABTS_GROUPID_PRODUCTION_COMPANY_ADVERTISER_BASE} + +// Used by broadcast syndicates in syndicated show data + KS_NABTS_GROUPID_SYNDICATED_SHOW_CONTENT_BASE = $840; + {$EXTERNALSYM KS_NABTS_GROUPID_SYNDICATED_SHOW_CONTENT_BASE} + KS_NABTS_GROUPID_SYNDICATED_SHOW_ADVERTISER_BASE = $850; + {$EXTERNALSYM KS_NABTS_GROUPID_SYNDICATED_SHOW_ADVERTISER_BASE} + +// Used by tv networks in network television data + KS_NABTS_GROUPID_NETWORK_WIDE_CONTENT_BASE = $860; + {$EXTERNALSYM KS_NABTS_GROUPID_NETWORK_WIDE_CONTENT_BASE} + KS_NABTS_GROUPID_NETWORK_WIDE_ADVERTISER_BASE = $870; + {$EXTERNALSYM KS_NABTS_GROUPID_NETWORK_WIDE_ADVERTISER_BASE} + +// Used by telvision stations in local programming data + KS_NABTS_GROUPID_TELEVISION_STATION_CONTENT_BASE = $880; + {$EXTERNALSYM KS_NABTS_GROUPID_TELEVISION_STATION_CONTENT_BASE} + KS_NABTS_GROUPID_TELEVISION_STATION_ADVERTISER_BASE = $890; + {$EXTERNALSYM KS_NABTS_GROUPID_TELEVISION_STATION_ADVERTISER_BASE} + +// Used by cable system in cable head-end originated data + KS_NABTS_GROUPID_LOCAL_CABLE_SYSTEM_CONTENT_BASE = $8A0; + {$EXTERNALSYM KS_NABTS_GROUPID_LOCAL_CABLE_SYSTEM_CONTENT_BASE} + KS_NABTS_GROUPID_LOCAL_CABLE_SYSTEM_ADVERTISER_BASE = $8B0; + {$EXTERNALSYM KS_NABTS_GROUPID_LOCAL_CABLE_SYSTEM_ADVERTISER_BASE} + +// The values between 0x8C0 - 0x8EF are reserved for future expansion + +// Used by Microsoft for Testing purposes (0x8F0 - 0x8FF) + KS_NABTS_GROUPID_MICROSOFT_RESERVED_TEST_DATA_BASE = $8F0; + {$EXTERNALSYM KS_NABTS_GROUPID_MICROSOFT_RESERVED_TEST_DATA_BASE} + +////////////////////////////////////////////////////////////// +// Stream Format FEC-corrected NABTS bundles +////////////////////////////////////////////////////////////// + + KSDATAFORMAT_TYPE_NABTS : TGUID = '{E757BCA0-39AC-11d1-A9F5-00C04FBBDE8F}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_NABTS} + KSDATAFORMAT_SUBTYPE_NABTS_FEC : TGUID = '{E757BCA1-39AC-11d1-A9F5-00C04FBBDE8F}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_NABTS_FEC} + + +////////////////////////////////////////////////////////////// +// NABTS Bundle data structure definition +////////////////////////////////////////////////////////////// + + MAX_NABTS_VBI_LINES_PER_FIELD = 11; + {$EXTERNALSYM MAX_NABTS_VBI_LINES_PER_FIELD} + NABTS_LINES_PER_BUNDLE = 16; + {$EXTERNALSYM NABTS_LINES_PER_BUNDLE} + NABTS_PAYLOAD_PER_LINE = 28; + {$EXTERNALSYM NABTS_PAYLOAD_PER_LINE} + NABTS_BYTES_PER_LINE = 36; + {$EXTERNALSYM NABTS_BYTES_PER_LINE} + +type + PNABTSFecBuffer = ^TNABTSFecBuffer; + _NABTSFEC_BUFFER = record + dataSize : ULONG; + groupID : word; + Reserved : word; + data : array[0..(NABTS_LINES_PER_BUNDLE * NABTS_PAYLOAD_PER_LINE)-1] of UCHAR; + end; + {$EXTERNALSYM _NABTSFEC_BUFFER} + NABTSFEC_BUFFER = _NABTSFEC_BUFFER; + {$EXTERNALSYM NABTSFEC_BUFFER} + PNABTSFEC_BUFFER = ^NABTSFEC_BUFFER; + {$EXTERNALSYM PNABTSFEC_BUFFER} + TNABTSFecBuffer = _NABTSFEC_BUFFER; + +////////////////////////////////////////////////////////////// +// vbi codec filtering pin properties +////////////////////////////////////////////////////////////// +const + KSPROPSETID_VBICodecFiltering : TGUID = '{cafeb0ca-8715-11d0-bd6a-0035c0edbabe}'; + {$EXTERNALSYM KSPROPSETID_VBICodecFiltering} + +type + KSPROPERTY_VBICODECFILTERING = ( + {$IFNDEF COMPILER6_UP} + KSPROPERTY_VBICODECFILTERING_INVALID_0, + KSPROPERTY_VBICODECFILTERING_SCANLINES_REQUESTED_BIT_ARRAY, + {$ELSE} + KSPROPERTY_VBICODECFILTERING_SCANLINES_REQUESTED_BIT_ARRAY = 1, + {$ENDIF} + KSPROPERTY_VBICODECFILTERING_SCANLINES_DISCOVERED_BIT_ARRAY, + KSPROPERTY_VBICODECFILTERING_SUBSTREAMS_REQUESTED_BIT_ARRAY, + KSPROPERTY_VBICODECFILTERING_SUBSTREAMS_DISCOVERED_BIT_ARRAY, + KSPROPERTY_VBICODECFILTERING_STATISTICS + ); + {$EXTERNALSYM KSPROPERTY_VBICODECFILTERING} + TKSPropertyVBICodecFiltering = KSPROPERTY_VBICODECFILTERING; + + PVBICodecFilteringScanlines = ^TVBICodecFilteringScanlines; + _VBICODECFILTERING_SCANLINES = record + DwordBitArray : array[0..31] of DWORD; // An array of scanline bits 0..1024(32*32) + end; + {$EXTERNALSYM _VBICODECFILTERING_SCANLINES} + VBICODECFILTERING_SCANLINES = _VBICODECFILTERING_SCANLINES; + {$EXTERNALSYM VBICODECFILTERING_SCANLINES} + PVBICODECFILTERING_SCANLINES = ^VBICODECFILTERING_SCANLINES; + {$EXTERNALSYM PVBICODECFILTERING_SCANLINES} + TVBICodecFilteringScanlines = _VBICODECFILTERING_SCANLINES; + + PVBICodecFilteringNABTSSubStreams = ^TVBICodecFilteringNABTSSubStreams; + _VBICODECFILTERING_NABTS_SUBSTREAMS = record + SubstreamMask : array[0..127] of DWORD; // An array of 4096 bits (one for each NABTS GroupID) + end; + {$EXTERNALSYM _VBICODECFILTERING_NABTS_SUBSTREAMS} + VBICODECFILTERING_NABTS_SUBSTREAMS = _VBICODECFILTERING_NABTS_SUBSTREAMS; + {$EXTERNALSYM VBICODECFILTERING_NABTS_SUBSTREAMS} + PVBICODECFILTERING_NABTS_SUBSTREAMS = ^VBICODECFILTERING_NABTS_SUBSTREAMS; + {$EXTERNALSYM PVBICODECFILTERING_NABTS_SUBSTREAMS} + TVBICodecFilteringNABTSSubStreams = _VBICODECFILTERING_NABTS_SUBSTREAMS; + + PVBICodecFilteringCCSubStreams = ^TVBICodecFilteringCCSubStreams; + _VBICODECFILTERING_CC_SUBSTREAMS = record + SubstreamMask : DWORD; // An array of 32 bits (see KS_CC_SUBSTREAM *) + end; + {$EXTERNALSYM _VBICODECFILTERING_CC_SUBSTREAMS} + VBICODECFILTERING_CC_SUBSTREAMS = _VBICODECFILTERING_CC_SUBSTREAMS; + {$EXTERNALSYM VBICODECFILTERING_CC_SUBSTREAMS} + PVBICODECFILTERING_CC_SUBSTREAMS = ^VBICODECFILTERING_CC_SUBSTREAMS; + {$EXTERNALSYM PVBICODECFILTERING_CC_SUBSTREAMS} + TVBICodecFilteringCCSubStreams = _VBICODECFILTERING_CC_SUBSTREAMS; + +const + KS_CC_SUBSTREAM_ODD = $0001; + {$EXTERNALSYM KS_CC_SUBSTREAM_ODD} + KS_CC_SUBSTREAM_EVEN = $0002; + {$EXTERNALSYM KS_CC_SUBSTREAM_EVEN} + KS_CC_SUBSTREAM_SERVICE_MASK_DC1 = $00F0; // DataChannel1: CC1,CC3,T1,T3 + {$EXTERNALSYM KS_CC_SUBSTREAM_SERVICE_MASK_DC1} + KS_CC_SUBSTREAM_SERVICE_CC1 = $0010; + {$EXTERNALSYM KS_CC_SUBSTREAM_SERVICE_CC1} + KS_CC_SUBSTREAM_SERVICE_CC3 = $0020; + {$EXTERNALSYM KS_CC_SUBSTREAM_SERVICE_CC3} + KS_CC_SUBSTREAM_SERVICE_T1 = $0040; + {$EXTERNALSYM KS_CC_SUBSTREAM_SERVICE_T1} + KS_CC_SUBSTREAM_SERVICE_T3 = $0080; + {$EXTERNALSYM KS_CC_SUBSTREAM_SERVICE_T3} + KS_CC_SUBSTREAM_SERVICE_MASK_DC2 = $0F00; // DataChannel2: CC2,CC4,T2,T4 + {$EXTERNALSYM KS_CC_SUBSTREAM_SERVICE_MASK_DC2} + KS_CC_SUBSTREAM_SERVICE_CC2 = $0100; + {$EXTERNALSYM KS_CC_SUBSTREAM_SERVICE_CC2} + KS_CC_SUBSTREAM_SERVICE_CC4 = $0200; + {$EXTERNALSYM KS_CC_SUBSTREAM_SERVICE_CC4} + KS_CC_SUBSTREAM_SERVICE_T2 = $0400; + {$EXTERNALSYM KS_CC_SUBSTREAM_SERVICE_T2} + KS_CC_SUBSTREAM_SERVICE_T4 = $0800; + {$EXTERNALSYM KS_CC_SUBSTREAM_SERVICE_T4} + KS_CC_SUBSTREAM_SERVICE_XDS = $1000; + {$EXTERNALSYM KS_CC_SUBSTREAM_SERVICE_XDS} + +/////////////////////////////////////////////////////////////////// +// Hardware decoded CC stream format +/////////////////////////////////////////////////////////////////// + + CC_MAX_HW_DECODE_LINES = 12; + {$EXTERNALSYM CC_MAX_HW_DECODE_LINES} + +type + PCCBytePair = ^TCCBytePair; + _CC_BYTE_PAIR = record + Decoded : array[0..1] of BYTE; + Reserved : word; + end; + {$EXTERNALSYM _CC_BYTE_PAIR} + CC_BYTE_PAIR = _CC_BYTE_PAIR; + {$EXTERNALSYM CC_BYTE_PAIR} + PCC_BYTE_PAIR = ^CC_BYTE_PAIR; + {$EXTERNALSYM PCC_BYTE_PAIR} + TCCBytePair = _CC_BYTE_PAIR; + + PCCHWField = ^TCCHWField; + _CC_HW_FIELD = record + ScanlinesRequested : TVBICodecFilteringScanlines; + fieldFlags : ULONG; // KS_VBI_FLAG_FIELD1,2 + PictureNumber : int64; + Lines : array[0..CC_MAX_HW_DECODE_LINES-1] of TCCBytePair; + end; + {$EXTERNALSYM _CC_HW_FIELD} + CC_HW_FIELD = _CC_HW_FIELD; + {$EXTERNALSYM CC_HW_FIELD} + PCC_HW_FIELD = ^CC_HW_FIELD; + {$EXTERNALSYM PCC_HW_FIELD} + TCCHWField = _CC_HW_FIELD; + +/////////////////////////////////////////////////////////////////// +// Raw NABTS stream format (TYPE_NABTS, SUBTYPE_NABTS) +/////////////////////////////////////////////////////////////////// + +// These low-level structures are byte packed( -Zp1 ) + + PNABTSBufferLine = ^TNABTSBufferLine; + _NABTS_BUFFER_LINE = record + Confidence : BYTE; + Bytes : array[0..NABTS_BYTES_PER_LINE-1] of BYTE; + end; + {$EXTERNALSYM _NABTS_BUFFER_LINE} + NABTS_BUFFER_LINE = _NABTS_BUFFER_LINE; + {$EXTERNALSYM NABTS_BUFFER_LINE} + PNABTS_BUFFER_LINE = ^NABTS_BUFFER_LINE; + {$EXTERNALSYM PNABTS_BUFFER_LINE} + TNABTSBufferLine = _NABTS_BUFFER_LINE; + +const + NABTS_BUFFER_PICTURENUMBER_SUPPORT = 1; + {$EXTERNALSYM NABTS_BUFFER_PICTURENUMBER_SUPPORT} + +type + PNABTSBuffer = ^TNABTSBuffer; + _NABTS_BUFFER = record + ScanlinesRequested : TVBICodecFilteringScanlines; + PictureNumber : int64; + NabtsLines : array[0..MAX_NABTS_VBI_LINES_PER_FIELD-1] of TNABTSBufferLine; + end; + {$EXTERNALSYM _NABTS_BUFFER} + NABTS_BUFFER = _NABTS_BUFFER; + {$EXTERNALSYM NABTS_BUFFER} + PNABTS_BUFFER = ^NABTS_BUFFER; + {$EXTERNALSYM PNABTS_BUFFER} + TNABTSBuffer = _NABTS_BUFFER; + +////////////////////////////////////////////////////////////// +// WST Codec Teletext Media Sample Format +////////////////////////////////////////////////////////////// +const + WST_TVTUNER_CHANGE_BEGIN_TUNE = $1000; // Starting a tuning operation + {$EXTERNALSYM WST_TVTUNER_CHANGE_BEGIN_TUNE} + WST_TVTUNER_CHANGE_END_TUNE = $2000; // Ending a tuning operation + {$EXTERNALSYM WST_TVTUNER_CHANGE_END_TUNE} + + MAX_WST_VBI_LINES_PER_FIELD = 17; + {$EXTERNALSYM MAX_WST_VBI_LINES_PER_FIELD} + WST_BYTES_PER_LINE = 42; + {$EXTERNALSYM WST_BYTES_PER_LINE} + +type + PWSTBufferLine = ^TWSTBufferLine; + _WST_BUFFER_LINE = record + Confidence: BYTE; + Bytes : array[0..WST_BYTES_PER_LINE-1] of BYTE; + end; + {$EXTERNALSYM _WST_BUFFER_LINE} + WST_BUFFER_LINE = _WST_BUFFER_LINE; + {$EXTERNALSYM WST_BUFFER_LINE} + PWST_BUFFER_LINE = ^WST_BUFFER_LINE; + {$EXTERNALSYM PWST_BUFFER_LINE} + TWSTBufferLine = _WST_BUFFER_LINE; + + PWSTBuffer = ^TWSTBuffer; + _WST_BUFFER = record + ScanlinesRequested: TVBICodecFilteringScanlines; + WstLines: array[0..MAX_WST_VBI_LINES_PER_FIELD-1] of TWSTBufferLine; + end; + {$EXTERNALSYM _WST_BUFFER} + WST_BUFFER = _WST_BUFFER; + {$EXTERNALSYM WST_BUFFER} + PWST_BUFFER = ^WST_BUFFER; + {$EXTERNALSYM PWST_BUFFER} + TWSTBuffer = _WST_BUFFER; +// +// Common codec statistics +// + + PVBICodecFilteringStatisticsCommon = ^TVBICodecFilteringStatisticsCommon; + _VBICODECFILTERING_STATISTICS_COMMON = record + InputSRBsProcessed : DWORD; // upstream SRBs received + OutputSRBsProcessed : DWORD; // downstream SRBs sent + SRBsIgnored : DWORD; // SRBs ignored due to no requests + InputSRBsMissing : DWORD; // SRBs dropped upstream + OutputSRBsMissing : DWORD; // Output dropped because no SRB pending + OutputFailures : DWORD; // dropped because of other failure + InternalErrors : DWORD; // could not process due to int. failure + ExternalErrors : DWORD; // could not process due to ext. failure + InputDiscontinuities : DWORD; // discontinuities received + DSPFailures : DWORD; // DSP confidence failure + TvTunerChanges : DWORD; // number of received KS_TVTUNER_CHANGE_BEGIN_TUNE and KS_TVTUNER_CHANGE_END_TUNE pairs. + VBIHeaderChanges : DWORD; // number of received KS_VBI_FLAG_VBIINFOHEADER_CHANGE + LineConfidenceAvg : DWORD; // Average of all DSP confidence results + BytesOutput : DWORD; // Bytes sent downstream + end; + {$EXTERNALSYM _VBICODECFILTERING_STATISTICS_COMMON} + VBICODECFILTERING_STATISTICS_COMMON = _VBICODECFILTERING_STATISTICS_COMMON; + {$EXTERNALSYM VBICODECFILTERING_STATISTICS_COMMON} + PVBICODECFILTERING_STATISTICS_COMMON = ^VBICODECFILTERING_STATISTICS_COMMON; + {$EXTERNALSYM PVBICODECFILTERING_STATISTICS_COMMON} + TVBICodecFilteringStatisticsCommon = _VBICODECFILTERING_STATISTICS_COMMON; + + PVBICodecFilteringStatisticsCommonPin = ^TVBICodecFilteringStatisticsCommonPin; + _VBICODECFILTERING_STATISTICS_COMMON_PIN = record + SRBsProcessed : DWORD; // SRBs sent/received + SRBsIgnored : DWORD; // SRBs ignored due to filtering + SRBsMissing : DWORD; // SRBs not sent/received + InternalErrors : DWORD; // could not send/receive due to int. failure + ExternalErrors : DWORD; // could not send/receive due to ext. failure + Discontinuities : DWORD; // discontinuities received/sent + LineConfidenceAvg : DWORD; // Average of all DSP confidence results for this pin + BytesOutput : DWORD; // Bytes sent downstream + end; + {$EXTERNALSYM _VBICODECFILTERING_STATISTICS_COMMON_PIN} + VBICODECFILTERING_STATISTICS_COMMON_PIN = _VBICODECFILTERING_STATISTICS_COMMON_PIN; + {$EXTERNALSYM VBICODECFILTERING_STATISTICS_COMMON_PIN} + PVBICODECFILTERING_STATISTICS_COMMON_PIN = ^VBICODECFILTERING_STATISTICS_COMMON_PIN; + {$EXTERNALSYM PVBICODECFILTERING_STATISTICS_COMMON_PIN} + TVBICodecFilteringStatisticsCommonPin = _VBICODECFILTERING_STATISTICS_COMMON_PIN; + +// +// Codec-specific statistics - NABTS +// + + PVBICodecFilteringStatisticsNABTS = ^TVBICodecFilteringStatisticsNABTS; + _VBICODECFILTERING_STATISTICS_NABTS = record + Common : TVBICodecFilteringStatisticsCommon ; // Generic VBI statistics + FECBundleBadLines : DWORD; // Un-FEC-correctable lines + FECQueueOverflows : DWORD; // Number of times FEC queue overflowed + FECCorrectedLines : DWORD; // Lines CSUM corrected by FEC + FECUncorrectableLines : DWORD; // FEC input lines not CSUM correctable + BundlesProcessed : DWORD; // Bundles received from FEC + BundlesSent2IP : DWORD; // Bundles sent to IP driver + FilteredLines : DWORD; // Lines processed and then dropped + // because no one was interested + end; + {$EXTERNALSYM _VBICODECFILTERING_STATISTICS_NABTS} + VBICODECFILTERING_STATISTICS_NABTS = _VBICODECFILTERING_STATISTICS_NABTS; + {$EXTERNALSYM VBICODECFILTERING_STATISTICS_NABTS} + PVBICODECFILTERING_STATISTICS_NABTS = ^VBICODECFILTERING_STATISTICS_NABTS; + {$EXTERNALSYM PVBICODECFILTERING_STATISTICS_NABTS} + TVBICodecFilteringStatisticsNABTS = _VBICODECFILTERING_STATISTICS_NABTS; + + PVBICodecFilteringStatisticsNABTSPin = ^TVBICodecFilteringStatisticsNABTSPin; + _VBICODECFILTERING_STATISTICS_NABTS_PIN = record + Common : TVBICodecFilteringStatisticsCommonPin; // Generic VBI pin statistics + end; + {$EXTERNALSYM _VBICODECFILTERING_STATISTICS_NABTS_PIN} + VBICODECFILTERING_STATISTICS_NABTS_PIN = _VBICODECFILTERING_STATISTICS_NABTS_PIN; + {$EXTERNALSYM VBICODECFILTERING_STATISTICS_NABTS_PIN} + PVBICODECFILTERING_STATISTICS_NABTS_PIN = ^VBICODECFILTERING_STATISTICS_NABTS_PIN; + {$EXTERNALSYM PVBICODECFILTERING_STATISTICS_NABTS_PIN} + TVBICodecFilteringStatisticsNABTSPin = _VBICODECFILTERING_STATISTICS_NABTS_PIN; + +// +// Codec-specific statistics - Closed Caption +// + + PVBICodecFilteringStatisticsCC = ^TVBICodecFilteringStatisticsCC; + _VBICODECFILTERING_STATISTICS_CC = record + Common : TVBICodecFilteringStatisticsCommon; // Generic VBI statistics + end; + {$EXTERNALSYM _VBICODECFILTERING_STATISTICS_CC} + VBICODECFILTERING_STATISTICS_CC = _VBICODECFILTERING_STATISTICS_CC; + {$EXTERNALSYM VBICODECFILTERING_STATISTICS_CC} + PVBICODECFILTERING_STATISTICS_CC = ^VBICODECFILTERING_STATISTICS_CC; + {$EXTERNALSYM PVBICODECFILTERING_STATISTICS_CC} + TVBICodecFilteringStatisticsCC = _VBICODECFILTERING_STATISTICS_CC; + + PVBICodecFilteringStatisticsCCPin = ^TVBICodecFilteringStatisticsCCPin; + _VBICODECFILTERING_STATISTICS_CC_PIN = record + Common : TVBICodecFilteringStatisticsCommonPin; // Generic VBI pin statistics + end; + {$EXTERNALSYM _VBICODECFILTERING_STATISTICS_CC_PIN} + VBICODECFILTERING_STATISTICS_CC_PIN = _VBICODECFILTERING_STATISTICS_CC_PIN; + {$EXTERNALSYM VBICODECFILTERING_STATISTICS_CC_PIN} + PVBICODECFILTERING_STATISTICS_CC_PIN = ^VBICODECFILTERING_STATISTICS_CC_PIN; + {$EXTERNALSYM PVBICODECFILTERING_STATISTICS_CC_PIN} + TVBICodecFilteringStatisticsCCPin = _VBICODECFILTERING_STATISTICS_CC_PIN; + +// +// Codec-specific statistics - Closed Caption +// + + PVBICodecFilteringStatisticsTeletext = ^TVBICodecFilteringStatisticsTeletext; + _VBICODECFILTERING_STATISTICS_TELETEXT = record + Common: TVBICodecFilteringStatisticsCommon ; // Generic VBI statistics + end; + {$EXTERNALSYM _VBICODECFILTERING_STATISTICS_TELETEXT} + VBICODECFILTERING_STATISTICS_TELETEXT = _VBICODECFILTERING_STATISTICS_TELETEXT; + {$EXTERNALSYM VBICODECFILTERING_STATISTICS_TELETEXT} + PVBICODECFILTERING_STATISTICS_TELETEXT = ^VBICODECFILTERING_STATISTICS_TELETEXT; + {$EXTERNALSYM PVBICODECFILTERING_STATISTICS_TELETEXT} + TVBICodecFilteringStatisticsTeletext = _VBICODECFILTERING_STATISTICS_TELETEXT; + + PVBICodecFilteringStatisticsTeletextPin = ^TVBICodecFilteringStatisticsTeletextPin; + _VBICODECFILTERING_STATISTICS_TELETEXT_PIN = record + Common: TVBICodecFilteringStatisticsCommonPin ;// Generic VBI pin statistics + end; + {$EXTERNALSYM _VBICODECFILTERING_STATISTICS_TELETEXT_PIN} + VBICODECFILTERING_STATISTICS_TELETEXT_PIN = _VBICODECFILTERING_STATISTICS_TELETEXT_PIN; + {$EXTERNALSYM VBICODECFILTERING_STATISTICS_TELETEXT_PIN} + PVBICODECFILTERING_STATISTICS_TELETEXT_PIN = ^VBICODECFILTERING_STATISTICS_TELETEXT_PIN; + {$EXTERNALSYM PVBICODECFILTERING_STATISTICS_TELETEXT_PIN} + TVBICodecFilteringStatisticsTeletextPin = _VBICODECFILTERING_STATISTICS_TELETEXT_PIN; + +//////////////////////////////////////////////////////////////////////////// +// VBI codec property structures(based on KSPROPERTY_VBICODECFILTERING enum) +//////////////////////////////////////////////////////////////////////////// + +// *** Most codecs support this property +// KSPROPERTY_VBICODECFILTERING_SCANLINES_REQUESTED_BIT_ARRAY +// KSPROPERTY_VBICODECFILTERING_SCANLINES_DISCOVERED_BIT_ARRAY, + PKSPropertyVBICodecFilteringScanlinesS = ^TKSPropertyVBICodecFilteringScanlinesS; + KSPROPERTY_VBICODECFILTERING_SCANLINES_S = record + Property_ : KSPROPERTY; + Scanlines : TVBICodecFilteringScanlines; + end; + {$EXTERNALSYM KSPROPERTY_VBICODECFILTERING_SCANLINES_S} + PKSPROPERTY_VBICODECFILTERING_SCANLINES_S = ^KSPROPERTY_VBICODECFILTERING_SCANLINES_S; + {$EXTERNALSYM PKSPROPERTY_VBICODECFILTERING_SCANLINES_S} + TKSPropertyVBICodecFilteringScanlinesS = KSPROPERTY_VBICODECFILTERING_SCANLINES_S; + +// *** NABTS codecs support this property +// KSPROPERTY_VBICODECFILTERING_SUBSTREAMS_REQUESTED_BIT_ARRAY, +// KSPROPERTY_VBICODECFILTERING_SUBSTREAMS_DISCOVERED_BIT_ARRAY, + PKSPropertyVBICodecFilteringNABTSSubstreamsS = ^TKSPropertyVBICodecFilteringNABTSSubstreamsS; + KSPROPERTY_VBICODECFILTERING_NABTS_SUBSTREAMS_S = record + Property_ : KSPROPERTY; + Substreams : TVBICodecFilteringNABTSSubStreams; + end; + {$EXTERNALSYM KSPROPERTY_VBICODECFILTERING_NABTS_SUBSTREAMS_S} + PKSPROPERTY_VBICODECFILTERING_NABTS_SUBSTREAMS_S = ^KSPROPERTY_VBICODECFILTERING_NABTS_SUBSTREAMS_S; + {$EXTERNALSYM PKSPROPERTY_VBICODECFILTERING_NABTS_SUBSTREAMS_S} + TKSPropertyVBICodecFilteringNABTSSubstreamsS = KSPROPERTY_VBICODECFILTERING_NABTS_SUBSTREAMS_S; + +// *** Closed captioning codecs support this property +// KSPROPERTY_VBICODECFILTERING_SUBSTREAMS_REQUESTED_BIT_ARRAY, +// KSPROPERTY_VBICODECFILTERING_SUBSTREAMS_DISCOVERED_BIT_ARRAY, + PKSPropertyVBICodecFilteringCCSubstreamsS = ^TKSPropertyVBICodecFilteringCCSubstreamsS; + KSPROPERTY_VBICODECFILTERING_CC_SUBSTREAMS_S = record + Property_ : KSPROPERTY; + Substreams : TVBICodecFilteringCCSubStreams; + end; + {$EXTERNALSYM KSPROPERTY_VBICODECFILTERING_CC_SUBSTREAMS_S} + PKSPROPERTY_VBICODECFILTERING_CC_SUBSTREAMS_S = ^KSPROPERTY_VBICODECFILTERING_CC_SUBSTREAMS_S; + {$EXTERNALSYM PKSPROPERTY_VBICODECFILTERING_CC_SUBSTREAMS_S} + TKSPropertyVBICodecFilteringCCSubstreamsS = KSPROPERTY_VBICODECFILTERING_CC_SUBSTREAMS_S; + +// *** Most codecs support these versions of the global and pin properties +// KSPROPERTY_VBICODECFILTERING_STATISTICS + PKSPropertyVBICodecFilteringStatisticsCommonS = ^TKSPropertyVBICodecFilteringStatisticsCommonS; + KSPROPERTY_VBICODECFILTERING_STATISTICS_COMMON_S = record + Property_ : KSPROPERTY; + Statistics : TVBICodecFilteringStatisticsCommon; + end; + {$EXTERNALSYM KSPROPERTY_VBICODECFILTERING_STATISTICS_COMMON_S} + PKSPROPERTY_VBICODECFILTERING_STATISTICS_COMMON_S = ^KSPROPERTY_VBICODECFILTERING_STATISTICS_COMMON_S; + {$EXTERNALSYM PKSPROPERTY_VBICODECFILTERING_STATISTICS_COMMON_S} + TKSPropertyVBICodecFilteringStatisticsCommonS = KSPROPERTY_VBICODECFILTERING_STATISTICS_COMMON_S; + + PKSPropertyVBICodecFilteringStatisticsCommonPinS = ^TKSPropertyVBICodecFilteringStatisticsCommonPinS; + KSPROPERTY_VBICODECFILTERING_STATISTICS_COMMON_PIN_S = record + Property_ : KSPROPERTY; + Statistics : TVBICodecFilteringStatisticsCommonPin; + end; + {$EXTERNALSYM KSPROPERTY_VBICODECFILTERING_STATISTICS_COMMON_PIN_S} + PKSPROPERTY_VBICODECFILTERING_STATISTICS_COMMON_PIN_S = ^KSPROPERTY_VBICODECFILTERING_STATISTICS_COMMON_PIN_S; + {$EXTERNALSYM PKSPROPERTY_VBICODECFILTERING_STATISTICS_COMMON_PIN_S} + TKSPropertyVBICodecFilteringStatisticsCommonPinS = KSPROPERTY_VBICODECFILTERING_STATISTICS_COMMON_PIN_S; + +// *** NABTS codecs support this version of the global and pin properties +// KSPROPERTY_VBICODECFILTERING_STATISTICS + PKSPropertyVBICodecFilteringStatisticsNABTSS = ^TKSPropertyVBICodecFilteringStatisticsNABTSS; + KSPROPERTY_VBICODECFILTERING_STATISTICS_NABTS_S = record + Property_ : KSPROPERTY; + Statistics : TVBICodecFilteringStatisticsNABTS; + end; + {$EXTERNALSYM KSPROPERTY_VBICODECFILTERING_STATISTICS_NABTS_S} + PKSPROPERTY_VBICODECFILTERING_STATISTICS_NABTS_S = ^KSPROPERTY_VBICODECFILTERING_STATISTICS_NABTS_S; + {$EXTERNALSYM PKSPROPERTY_VBICODECFILTERING_STATISTICS_NABTS_S} + TKSPropertyVBICodecFilteringStatisticsNABTSS = KSPROPERTY_VBICODECFILTERING_STATISTICS_NABTS_S; + + PKSPropertyVBICodecFilteringStatisticsNABTSPinS = ^TKSPropertyVBICodecFilteringStatisticsNABTSPinS; + KSPROPERTY_VBICODECFILTERING_STATISTICS_NABTS_PIN_S = record + Property_ : KSPROPERTY; + Statistics : TVBICodecFilteringStatisticsNABTSPin; + end; + {$EXTERNALSYM KSPROPERTY_VBICODECFILTERING_STATISTICS_NABTS_PIN_S} + PKSPROPERTY_VBICODECFILTERING_STATISTICS_NABTS_PIN_S = ^KSPROPERTY_VBICODECFILTERING_STATISTICS_NABTS_PIN_S; + {$EXTERNALSYM PKSPROPERTY_VBICODECFILTERING_STATISTICS_NABTS_PIN_S} + TKSPropertyVBICodecFilteringStatisticsNABTSPinS = KSPROPERTY_VBICODECFILTERING_STATISTICS_NABTS_PIN_S; + +// *** Closed captioning codecs support this version of the global and pin properties +// KSPROPERTY_VBICODECFILTERING_STATISTICS + + PKSPropertyVBICodecFilteringStatisticsCCS = ^TKSPropertyVBICodecFilteringStatisticsCCS; + KSPROPERTY_VBICODECFILTERING_STATISTICS_CC_S = record + Property_ : KSPROPERTY; + Statistics : TVBICodecFilteringStatisticsCC; + end; + {$EXTERNALSYM KSPROPERTY_VBICODECFILTERING_STATISTICS_CC_S} + PKSPROPERTY_VBICODECFILTERING_STATISTICS_CC_S = ^KSPROPERTY_VBICODECFILTERING_STATISTICS_CC_S; + {$EXTERNALSYM PKSPROPERTY_VBICODECFILTERING_STATISTICS_CC_S} + TKSPropertyVBICodecFilteringStatisticsCCS = KSPROPERTY_VBICODECFILTERING_STATISTICS_CC_S; + + PKSPropertyVBICodecFilteringStatisticsCCPinS = ^TKSPropertyVBICodecFilteringStatisticsCCPinS; + KSPROPERTY_VBICODECFILTERING_STATISTICS_CC_PIN_S = record + Property_ : KSPROPERTY; + Statistics : TVBICodecFilteringStatisticsCCPin; + end; + {$EXTERNALSYM KSPROPERTY_VBICODECFILTERING_STATISTICS_CC_PIN_S} + PKSPROPERTY_VBICODECFILTERING_STATISTICS_CC_PIN_S = ^KSPROPERTY_VBICODECFILTERING_STATISTICS_CC_PIN_S; + {$EXTERNALSYM PKSPROPERTY_VBICODECFILTERING_STATISTICS_CC_PIN_S} + TKSPropertyVBICodecFilteringStatisticsCCPinS = KSPROPERTY_VBICODECFILTERING_STATISTICS_CC_PIN_S; + +// Standard Pin Names for the video capture filter +//=========================================================================== +const + PINNAME_VIDEO_CAPTURE : TGUID = '{FB6C4281-0353-11d1-905F-0000C0CC16BA}'; + {$EXTERNALSYM PINNAME_VIDEO_CAPTURE} + PINNAME_VIDEO_CC_CAPTURE : TGUID = '{1AAD8061-012D-11d2-B4B1-00A0D102CFBE}'; + {$EXTERNALSYM PINNAME_VIDEO_CC_CAPTURE} + PINNAME_VIDEO_NABTS_CAPTURE : TGUID = '{29703660-498A-11d2-B4B1-00A0D102CFBE}'; + {$EXTERNALSYM PINNAME_VIDEO_NABTS_CAPTURE} + PINNAME_VIDEO_PREVIEW : TGUID = '{FB6C4282-0353-11d1-905F-0000C0CC16BA}'; + {$EXTERNALSYM PINNAME_VIDEO_PREVIEW} + PINNAME_VIDEO_ANALOGVIDEOIN : TGUID = '{FB6C4283-0353-11d1-905F-0000C0CC16BA}'; + {$EXTERNALSYM PINNAME_VIDEO_ANALOGVIDEOIN} + PINNAME_VIDEO_VBI : TGUID = '{FB6C4284-0353-11d1-905F-0000C0CC16BA}'; + {$EXTERNALSYM PINNAME_VIDEO_VBI} + PINNAME_VIDEO_VIDEOPORT : TGUID = '{FB6C4285-0353-11d1-905F-0000C0CC16BA}'; + {$EXTERNALSYM PINNAME_VIDEO_VIDEOPORT} + PINNAME_VIDEO_NABTS : TGUID = '{FB6C4286-0353-11d1-905F-0000C0CC16BA}'; + {$EXTERNALSYM PINNAME_VIDEO_NABTS} + PINNAME_VIDEO_EDS : TGUID = '{FB6C4287-0353-11d1-905F-0000C0CC16BA}'; + {$EXTERNALSYM PINNAME_VIDEO_EDS} + PINNAME_VIDEO_TELETEXT : TGUID = '{FB6C4288-0353-11d1-905F-0000C0CC16BA}'; + {$EXTERNALSYM PINNAME_VIDEO_TELETEXT} + PINNAME_VIDEO_CC : TGUID = '{FB6C4289-0353-11d1-905F-0000C0CC16BA}'; + {$EXTERNALSYM PINNAME_VIDEO_CC} + PINNAME_VIDEO_STILL : TGUID = '{FB6C428A-0353-11d1-905F-0000C0CC16BA}'; + {$EXTERNALSYM PINNAME_VIDEO_STILL} + PINNAME_VIDEO_TIMECODE : TGUID = '{FB6C428B-0353-11d1-905F-0000C0CC16BA}'; + {$EXTERNALSYM PINNAME_VIDEO_TIMECODE} + PINNAME_VIDEO_VIDEOPORT_VBI : TGUID = '{FB6C428C-0353-11d1-905F-0000C0CC16BA}'; + {$EXTERNALSYM PINNAME_VIDEO_VIDEOPORT_VBI} + +//=========================================================================== +// KSSTREAM_HEADER extensions for digital video +//=========================================================================== + + KS_VIDEO_FLAG_FRAME = $0000; // Frame or Field (default is frame) + {$EXTERNALSYM KS_VIDEO_FLAG_FRAME} + KS_VIDEO_FLAG_FIELD1 = $0001; + {$EXTERNALSYM KS_VIDEO_FLAG_FIELD1} + KS_VIDEO_FLAG_FIELD2 = $0002; + {$EXTERNALSYM KS_VIDEO_FLAG_FIELD2} + + KS_VIDEO_FLAG_I_FRAME = $0000; // I, B, or P (default is I) + {$EXTERNALSYM KS_VIDEO_FLAG_I_FRAME} + KS_VIDEO_FLAG_P_FRAME = $0010; + {$EXTERNALSYM KS_VIDEO_FLAG_P_FRAME} + KS_VIDEO_FLAG_B_FRAME = $0020; + {$EXTERNALSYM KS_VIDEO_FLAG_B_FRAME} + +type + PKSFrameInfo = ^TKSFrameInfo; + tagKS_FRAME_INFO = record + ExtendedHeaderSize : ULONG; // Size of this extended header + dwFrameFlags : DWORD; // Field1, Field2, or Frame + PictureNumber : int64; + DropCount : int64; + + // The following are only set when using OverlayMixer + hDirectDraw : THandle; // user mode DDraw handle + hSurfaceHandle : THandle; // user mode surface handle + DirectDrawRect : TRECT; // portion of surface locked + // Reserved fields, never reference these + Reserved1 : DWORD; + Reserved2 : DWORD; + Reserved3 : DWORD; + Reserved4 : DWORD; + end; + {$EXTERNALSYM tagKS_FRAME_INFO} + KS_FRAME_INFO = tagKS_FRAME_INFO; + {$EXTERNALSYM KS_FRAME_INFO} + PKS_FRAME_INFO = ^KS_FRAME_INFO; + {$EXTERNALSYM PKS_FRAME_INFO} + TKSFrameInfo = tagKS_FRAME_INFO; + +//=========================================================================== +// KSSTREAM_HEADER extensions for VBI +//=========================================================================== +const + KS_VBI_FLAG_FIELD1 = $0001; + {$EXTERNALSYM KS_VBI_FLAG_FIELD1} + KS_VBI_FLAG_FIELD2 = $0002; + {$EXTERNALSYM KS_VBI_FLAG_FIELD2} + + KS_VBI_FLAG_MV_PRESENT = $0100; + {$EXTERNALSYM KS_VBI_FLAG_MV_PRESENT} + KS_VBI_FLAG_MV_HARDWARE = $0200; + {$EXTERNALSYM KS_VBI_FLAG_MV_HARDWARE} + KS_VBI_FLAG_MV_DETECTED = $0400; + {$EXTERNALSYM KS_VBI_FLAG_MV_DETECTED} + + KS_VBI_FLAG_TVTUNER_CHANGE = $0010; // TvTunerChangeInfo is valid + {$EXTERNALSYM KS_VBI_FLAG_TVTUNER_CHANGE} + KS_VBI_FLAG_VBIINFOHEADER_CHANGE = $0020; // VBIInfoHeader is valid + {$EXTERNALSYM KS_VBI_FLAG_VBIINFOHEADER_CHANGE} + +type + PKSVBIFrameInfo = ^TKSVBIFrameInfo; + tagKS_VBI_FRAME_INFO = record + ExtendedHeaderSize : ULONG; // Size of this extended header + dwFrameFlags : DWORD; // Field1, Field2, or Frame; & etc + PictureNumber : int64; // Test only? + DropCount : int64; // Test only? + dwSamplingFrequency : DWORD; + TvTunerChangeInfo : TKSTVTunerChangeInfo; + VBIInfoHeader : TKSVBIInfoHeader; + end; + {$EXTERNALSYM tagKS_VBI_FRAME_INFO} + KS_VBI_FRAME_INFO = tagKS_VBI_FRAME_INFO; + {$EXTERNALSYM KS_VBI_FRAME_INFO} + PKS_VBI_FRAME_INFO = ^KS_VBI_FRAME_INFO; + {$EXTERNALSYM PKS_VBI_FRAME_INFO} + TKSVBIFrameInfo = tagKS_VBI_FRAME_INFO; + + +//=========================================================================== +// Analog video formats, used with: +// Analog Video Decoders +// TVTuners +// Analog Video Encoders +// +// XXX_STANDARDS_SUPPORTED returns a bitmask +//=========================================================================== +const + KS_AnalogVideo_None = $00000000; // This is a digital sensor + {$EXTERNALSYM KS_AnalogVideo_None} + KS_AnalogVideo_NTSC_M = $00000001; // 75 IRE Setup + {$EXTERNALSYM KS_AnalogVideo_NTSC_M} + KS_AnalogVideo_NTSC_M_J = $00000002; // Japan, 0 IRE Setup + {$EXTERNALSYM KS_AnalogVideo_NTSC_M_J} + KS_AnalogVideo_NTSC_433 = $00000004; + {$EXTERNALSYM KS_AnalogVideo_NTSC_433} + KS_AnalogVideo_PAL_B = $00000010; + {$EXTERNALSYM KS_AnalogVideo_PAL_B} + KS_AnalogVideo_PAL_D = $00000020; + {$EXTERNALSYM KS_AnalogVideo_PAL_D} + KS_AnalogVideo_PAL_G = $00000040; + {$EXTERNALSYM KS_AnalogVideo_PAL_G} + KS_AnalogVideo_PAL_H = $00000080; + {$EXTERNALSYM KS_AnalogVideo_PAL_H} + KS_AnalogVideo_PAL_I = $00000100; + {$EXTERNALSYM KS_AnalogVideo_PAL_I} + KS_AnalogVideo_PAL_M = $00000200; + {$EXTERNALSYM KS_AnalogVideo_PAL_M} + KS_AnalogVideo_PAL_N = $00000400; + {$EXTERNALSYM KS_AnalogVideo_PAL_N} + KS_AnalogVideo_PAL_60 = $00000800; + {$EXTERNALSYM KS_AnalogVideo_PAL_60} + KS_AnalogVideo_SECAM_B = $00001000; + {$EXTERNALSYM KS_AnalogVideo_SECAM_B} + KS_AnalogVideo_SECAM_D = $00002000; + {$EXTERNALSYM KS_AnalogVideo_SECAM_D} + KS_AnalogVideo_SECAM_G = $00004000; + {$EXTERNALSYM KS_AnalogVideo_SECAM_G} + KS_AnalogVideo_SECAM_H = $00008000; + {$EXTERNALSYM KS_AnalogVideo_SECAM_H} + KS_AnalogVideo_SECAM_K = $00010000; + {$EXTERNALSYM KS_AnalogVideo_SECAM_K} + KS_AnalogVideo_SECAM_K1 = $00020000; + {$EXTERNALSYM KS_AnalogVideo_SECAM_K1} + KS_AnalogVideo_SECAM_L = $00040000; + {$EXTERNALSYM KS_AnalogVideo_SECAM_L} + KS_AnalogVideo_SECAM_L1 = $00080000; + {$EXTERNALSYM KS_AnalogVideo_SECAM_L1} + KS_AnalogVideo_PAL_N_COMBO = $00100000; + {$EXTERNALSYM KS_AnalogVideo_PAL_N_COMBO} + + + KS_AnalogVideo_NTSC_Mask = $00000007; + {$EXTERNALSYM KS_AnalogVideo_NTSC_Mask} + KS_AnalogVideo_PAL_Mask = $00100FF0; + {$EXTERNALSYM KS_AnalogVideo_PAL_Mask} + KS_AnalogVideo_SECAM_Mask = $000FF000; + {$EXTERNALSYM KS_AnalogVideo_SECAM_Mask} + +//=========================================================================== +// Property set definitions +// The comments show whether a given property is: +// R : READ only +// w : WRITE only +// RW : READ / WRITE +// O : Optional (return E_UNSUPPORTED if you don't handle this) +//=========================================================================== + + PROPSETID_ALLOCATOR_CONTROL : TGUID = '{53171960-148E-11d2-9979-0000C0CC16BA}'; + {$EXTERNALSYM PROPSETID_ALLOCATOR_CONTROL} + +type + KSPROPERTY_ALLOCATOR_CONTROL = ( + KSPROPERTY_ALLOCATOR_CONTROL_HONOR_COUNT, // R O (will allocate exactly this number of buffers) + KSPROPERTY_ALLOCATOR_CONTROL_SURFACE_SIZE // R O (return 2 DWORDs specifying surface size) + ); + {$EXTERNALSYM KSPROPERTY_ALLOCATOR_CONTROL} + TKSPropertyAllocatorControl = KSPROPERTY_ALLOCATOR_CONTROL; + +//=========================================================================== + +const + PROPSETID_VIDCAP_VIDEOPROCAMP : TGUID = '{C6E13360-30AC-11d0-A18C-00A0C9118956}'; + {$EXTERNALSYM PROPSETID_VIDCAP_VIDEOPROCAMP} + +type + KSPROPERTY_VIDCAP_VIDEOPROCAMP = ( + KSPROPERTY_VIDEOPROCAMP_BRIGHTNESS, // RW O + KSPROPERTY_VIDEOPROCAMP_CONTRAST, // RW O + KSPROPERTY_VIDEOPROCAMP_HUE, // RW O + KSPROPERTY_VIDEOPROCAMP_SATURATION, // RW O + KSPROPERTY_VIDEOPROCAMP_SHARPNESS, // RW O + KSPROPERTY_VIDEOPROCAMP_GAMMA, // RW O + KSPROPERTY_VIDEOPROCAMP_COLORENABLE, // RW O + KSPROPERTY_VIDEOPROCAMP_WHITEBALANCE, // RW O + KSPROPERTY_VIDEOPROCAMP_BACKLIGHT_COMPENSATION, // RW O + KSPROPERTY_VIDEOPROCAMP_GAIN, // RW O + KSPROPERTY_VIDEOPROCAMP_DIGITAL_MULTIPLIER, // RW O + KSPROPERTY_VIDEOPROCAMP_DIGITAL_MULTIPLIER_LIMIT,// RW O + KSPROPERTY_VIDEOPROCAMP_WHITEBALANCE_COMPONENT, // RW O + KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY // RW O + ); + {$EXTERNALSYM KSPROPERTY_VIDCAP_VIDEOPROCAMP} + TKSPropertyVidcapVideoProcAmp = KSPROPERTY_VIDCAP_VIDEOPROCAMP; + + PKSPropertyVideoProcAmpS = ^TKSPropertyVideoProcAmpS; + KSPROPERTY_VIDEOPROCAMP_S = record + Property_ : KSPROPERTY; + Value : longint; // Value to set or get + Flags : ULONG; // KSPROPERTY_VIDEOPROCAMP_FLAGS_* + Capabilities : ULONG; // KSPROPERTY_VIDEOPROCAMP_FLAGS_* + end; + {$EXTERNALSYM KSPROPERTY_VIDEOPROCAMP_S} + PKSPROPERTY_VIDEOPROCAMP_S = ^KSPROPERTY_VIDEOPROCAMP_S; + {$EXTERNALSYM PKSPROPERTY_VIDEOPROCAMP_S} + TKSPropertyVideoProcAmpS = KSPROPERTY_VIDEOPROCAMP_S; + + PKSPropertyVideoProcAmpNodeS = ^TKSPropertyVideoProcAmpNodeS; + KSPROPERTY_VIDEOPROCAMP_NODE_S = packed record + NodeProperty: KSP_NODE; + Value: Integer; // Value to set or get + Flags: ULONG; // KSPROPERTY_VIDEOPROCAMP_FLAGS_* + Capabilities: ULONG; // KSPROPERTY_VIDEOPROCAMP_FLAGS_* + end; + {$EXTERNALSYM KSPROPERTY_VIDEOPROCAMP_NODE_S} + PKSPROPERTY_VIDEOPROCAMP_NODE_S = ^KSPROPERTY_VIDEOPROCAMP_NODE_S; + {$EXTERNALSYM PKSPROPERTY_VIDEOPROCAMP_NODE_S} + TKSPropertyVideoProcAmpNodeS = KSPROPERTY_VIDEOPROCAMP_NODE_S; + + PKSPropertyVideoProcAmpS2 = ^TKSPropertyVideoProcAmpS2; + KSPROPERTY_VIDEOPROCAMP_S2 = packed record + Property_: KSPROPERTY; + Value1: Integer; + Flags: ULONG; + Capabilities: ULONG; + Value2: Integer; + end; + {$EXTERNALSYM KSPROPERTY_VIDEOPROCAMP_S2} + PKSPROPERTY_VIDEOPROCAMP_S2 = ^KSPROPERTY_VIDEOPROCAMP_S2; + {$EXTERNALSYM PKSPROPERTY_VIDEOPROCAMP_S2} + TKSPropertyVideoProcAmpS2 = KSPROPERTY_VIDEOPROCAMP_S2; + + PKSPropertyVideoProcAmpNodeS2 = ^TKSPropertyVideoProcAmpNodeS2; + KSPROPERTY_VIDEOPROCAMP_NODE_S2 = packed record + NodeProperty: KSP_NODE; + Value1: Integer; + Flags: ULONG; + Capabilities: ULONG; + Value2: Integer; + end; + {$EXTERNALSYM KSPROPERTY_VIDEOPROCAMP_NODE_S2} + PKSPROPERTY_VIDEOPROCAMP_NODE_S2 = ^KSPROPERTY_VIDEOPROCAMP_NODE_S2; + {$EXTERNALSYM PKSPROPERTY_VIDEOPROCAMP_NODE_S2} + TKSPropertyVideoProcAmpNodeS2 = KSPROPERTY_VIDEOPROCAMP_NODE_S2; + +const + KSPROPERTY_VIDEOPROCAMP_FLAGS_AUTO = $0001; + {$EXTERNALSYM KSPROPERTY_VIDEOPROCAMP_FLAGS_AUTO} + KSPROPERTY_VIDEOPROCAMP_FLAGS_MANUAL = $0002; + {$EXTERNALSYM KSPROPERTY_VIDEOPROCAMP_FLAGS_MANUAL} + +//=========================================================================== + + PROPSETID_VIDCAP_SELECTOR : TGUID = '{1ABDAECA-68B6-4F83-9371-B413907C7B9F}'; + {$EXTERNALSYM PROPSETID_VIDCAP_SELECTOR} + +type + PKSPropertyVidCapSelector = ^TKSPropertyVidCapSelector; + KSPROPERTY_VIDCAP_SELECTOR = ( + KSPROPERTY_SELECTOR_SOURCE_NODE_ID, // RW + KSPROPERTY_SELECTOR_NUM_SOURCES // R + ); + {$EXTERNALSYM KSPROPERTY_VIDCAP_SELECTOR} + PKSPROPERTY_VIDCAP_SELECTOR = ^KSPROPERTY_VIDCAP_SELECTOR; + {$EXTERNALSYM PKSPROPERTY_VIDCAP_SELECTOR} + TKSPropertyVidCapSelector = KSPROPERTY_VIDCAP_SELECTOR; + + PKSPropertySelectorS = ^TKSPropertySelectorS; + KSPROPERTY_SELECTOR_S = packed record + Property_: KSPROPERTY; + Value: Integer; // Value to set or get + Flags: ULONG; + Capabilities: ULONG; + end; + {$EXTERNALSYM KSPROPERTY_SELECTOR_S} + PKSPROPERTY_SELECTOR_S = ^KSPROPERTY_SELECTOR_S; + {$EXTERNALSYM PKSPROPERTY_SELECTOR_S} + TKSPropertySelectorS = KSPROPERTY_SELECTOR_S; + + PKSPropertySelectorNodeS = ^TKSPropertySelectorNodeS; + KSPROPERTY_SELECTOR_NODE_S = packed record + NodeProperty: KSP_NODE; + Value: Integer; // Value to set or get + Flags: ULONG; + Capabilities: ULONG; + end; + {$EXTERNALSYM KSPROPERTY_SELECTOR_NODE_S} + PKSPROPERTY_SELECTOR_NODE_S = ^KSPROPERTY_SELECTOR_NODE_S; + {$EXTERNALSYM PKSPROPERTY_SELECTOR_NODE_S} + TKSPropertySelectorNodeS = KSPROPERTY_SELECTOR_NODE_S; + +//=========================================================================== + +const + PROPSETID_TUNER : TGUID = '{6a2e0605-28e4-11d0-a18c-00a0c9118956}'; + {$EXTERNALSYM PROPSETID_TUNER} + +type + KSPROPERTY_TUNER = ( + KSPROPERTY_TUNER_CAPS, // R -overall device capabilities + KSPROPERTY_TUNER_MODE_CAPS, // R -capabilities in this mode + KSPROPERTY_TUNER_MODE, // RW -set a mode (TV, FM, AM, DSS) + KSPROPERTY_TUNER_STANDARD, // R -get TV standard (only if TV mode) + KSPROPERTY_TUNER_FREQUENCY, // RW -set/get frequency + KSPROPERTY_TUNER_INPUT, // RW -select an input + KSPROPERTY_TUNER_STATUS, // R -tuning status + KSPROPERTY_TUNER_IF_MEDIUM // R O-Medium for IF or Transport Pin + ); + {$EXTERNALSYM KSPROPERTY_TUNER} + TKSPropertyTuner = KSPROPERTY_TUNER; + + KSPROPERTY_TUNER_MODES = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM KSPROPERTY_TUNER_MODES} + const + KSPROPERTY_TUNER_MODE_TV = $0001; + {$EXTERNALSYM KSPROPERTY_TUNER_MODE_TV} + KSPROPERTY_TUNER_MODE_FM_RADIO = $0002; + {$EXTERNALSYM KSPROPERTY_TUNER_MODE_FM_RADIO} + KSPROPERTY_TUNER_MODE_AM_RADIO = $0004; + {$EXTERNALSYM KSPROPERTY_TUNER_MODE_AM_RADIO} + KSPROPERTY_TUNER_MODE_DSS = $0008; + {$EXTERNALSYM KSPROPERTY_TUNER_MODE_DSS} + KSPROPERTY_TUNER_MODE_ATSC = $0010; // also used for DVB-T, DVB-C + {$EXTERNALSYM KSPROPERTY_TUNER_MODE_ATSC} + +// Describes how the device tunes. Only one of these flags may be set +// in KSPROPERTY_TUNER_MODE_CAPS_S.Strategy + +// Describe how the driver should attempt to tune: +// EXACT: just go to the frequency specified (no fine tuning) +// FINE: (slow) do an exhaustive search for the best signal +// COARSE: (fast) use larger frequency jumps to just determine if any signal + +type + KS_TUNER_TUNING_FLAGS = ( + {$IFNDEF COMPILER6_UP} + KS_TUNER_TUNING_INVALID_0, + KS_TUNER_TUNING_EXACT, // No fine tuning + {$ELSE} + KS_TUNER_TUNING_EXACT = 1, + {$ENDIF} + KS_TUNER_TUNING_FINE, // Fine grained search + KS_TUNER_TUNING_COARSE // Coarse search + ); + {$EXTERNALSYM KS_TUNER_TUNING_FLAGS} + + KS_TUNER_STRATEGY = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM KS_TUNER_STRATEGY} + const + KS_TUNER_STRATEGY_PLL = $01; // Tune by PLL offset + {$EXTERNALSYM KS_TUNER_STRATEGY_PLL} + KS_TUNER_STRATEGY_SIGNAL_STRENGTH = $02; // Tune by signal strength + {$EXTERNALSYM KS_TUNER_STRATEGY_SIGNAL_STRENGTH} + KS_TUNER_STRATEGY_DRIVER_TUNES = $04; // Driver does fine tuning + {$EXTERNALSYM KS_TUNER_STRATEGY_DRIVER_TUNES} + +type + PKSPropertyTunerCapsS = ^TKSPropertyTunerCapsS; + KSPROPERTY_TUNER_CAPS_S = record + Property_ : KSPROPERTY ; + ModesSupported : ULONG ; // KS_PROPERTY_TUNER_MODES_* + VideoMedium : TKSPinMedium ; // GUID_NULL (no pin), or GUID + TVAudioMedium : TKSPinMedium ; // GUID_NULL (no pin), or GUID + RadioAudioMedium : TKSPinMedium ; // GUID_NULL (no pin), or GUID + end; + {$EXTERNALSYM KSPROPERTY_TUNER_CAPS_S} + PKSPROPERTY_TUNER_CAPS_S = ^KSPROPERTY_TUNER_CAPS_S; + {$EXTERNALSYM PKSPROPERTY_TUNER_CAPS_S} + TKSPropertyTunerCapsS = KSPROPERTY_TUNER_CAPS_S; + + PKSPropertyTunerIfMediumS = ^TKSPropertyTunerIfMediumS; + KSPROPERTY_TUNER_IF_MEDIUM_S = record + Property_ : KSPROPERTY; + IFMedium : TKSPinMedium; // GUID_NULL (no pin), or GUID + end; + {$EXTERNALSYM KSPROPERTY_TUNER_IF_MEDIUM_S} + PKSPROPERTY_TUNER_IF_MEDIUM_S = ^KSPROPERTY_TUNER_IF_MEDIUM_S; + {$EXTERNALSYM PKSPROPERTY_TUNER_IF_MEDIUM_S} + TKSPropertyTunerIfMediumS = KSPROPERTY_TUNER_IF_MEDIUM_S; + + PKSPropertyTunerModeCapsS = ^TKSPropertyTunerModeCapsS; + KSPROPERTY_TUNER_MODE_CAPS_S = record + Property_ : KSPROPERTY; + Mode : ULONG; // IN: KSPROPERTY_TUNER_MODE + StandardsSupported : ULONG; // KS_AnalogVideo_* (if TV or DSS) + MinFrequency : ULONG; // Hz + MaxFrequency : ULONG; // Hz + TuningGranularity : ULONG; // Hz + NumberOfInputs : ULONG; // count of inputs + SettlingTime : ULONG; // milliSeconds + Strategy : ULONG; // KS_TUNER_STRATEGY + end; + {$EXTERNALSYM KSPROPERTY_TUNER_MODE_CAPS_S} + PKSPROPERTY_TUNER_MODE_CAPS_S = ^KSPROPERTY_TUNER_MODE_CAPS_S; + {$EXTERNALSYM PKSPROPERTY_TUNER_MODE_CAPS_S} + TKSPropertyTunerModeCapsS = KSPROPERTY_TUNER_MODE_CAPS_S; + + PKSPropertyTunerModeS = ^TKSPropertyTunerModeS; + KSPROPERTY_TUNER_MODE_S = record + Property_ : KSPROPERTY; + Mode : ULONG; // IN: KSPROPERTY_TUNER_MODE + end; + {$EXTERNALSYM KSPROPERTY_TUNER_MODE_S} + PKSPROPERTY_TUNER_MODE_S = ^KSPROPERTY_TUNER_MODE_S; + {$EXTERNALSYM PKSPROPERTY_TUNER_MODE_S} + TKSPropertyTunerModeS = KSPROPERTY_TUNER_MODE_S; + + PKSPropertyTunerFrequencyS = ^TKSPropertyTunerFrequencyS; + KSPROPERTY_TUNER_FREQUENCY_S = record + Property_ : KSPROPERTY; + Frequency : ULONG; // Hz + LastFrequency : ULONG; // Hz (last known good) + TuningFlags : ULONG; // KS_TUNER_TUNING_FLAGS + VideoSubChannel : ULONG; // DSS + AudioSubChannel : ULONG; // DSS + Channel : ULONG; // VBI decoders + Country : ULONG; // VBI decoders + end; + {$EXTERNALSYM KSPROPERTY_TUNER_FREQUENCY_S} + PKSPROPERTY_TUNER_FREQUENCY_S = ^KSPROPERTY_TUNER_FREQUENCY_S; + {$EXTERNALSYM PKSPROPERTY_TUNER_FREQUENCY_S} + TKSPropertyTunerFrequencyS = KSPROPERTY_TUNER_FREQUENCY_S; + + PKSPropertyTunerStandardS = ^TKSPropertyTunerStandardS; + KSPROPERTY_TUNER_STANDARD_S = record + Property_ : KSPROPERTY; + Standard : ULONG; // KS_AnalogVideo_* + end; + {$EXTERNALSYM KSPROPERTY_TUNER_STANDARD_S} + PKSPROPERTY_TUNER_STANDARD_S = ^KSPROPERTY_TUNER_STANDARD_S; + {$EXTERNALSYM PKSPROPERTY_TUNER_STANDARD_S} + TKSPropertyTunerStandardS = KSPROPERTY_TUNER_STANDARD_S; + + PKSPropertyTunerInputS = ^TKSPropertyTunerInputS; + KSPROPERTY_TUNER_INPUT_S = record + Property_ : KSPROPERTY; + InputIndex : ULONG; // 0 to (n-1) inputs + end; + {$EXTERNALSYM KSPROPERTY_TUNER_INPUT_S} + PKSPROPERTY_TUNER_INPUT_S = ^KSPROPERTY_TUNER_INPUT_S; + {$EXTERNALSYM PKSPROPERTY_TUNER_INPUT_S} + TKSPropertyTunerInputS = KSPROPERTY_TUNER_INPUT_S; + + PKSPropertyTunerStatusS = ^TKSPropertyTunerStatusS; + KSPROPERTY_TUNER_STATUS_S = record + Property_ : KSPROPERTY; + CurrentFrequency : ULONG; // Hz + PLLOffset : ULONG; // if Strategy.KS_TUNER_STRATEGY_PLL + SignalStrength : ULONG; // if Stretegy.KS_TUNER_STRATEGY_SIGNAL_STRENGTH + Busy : ULONG; // TRUE if in the process of tuning + end; + {$EXTERNALSYM KSPROPERTY_TUNER_STATUS_S} + PKSPROPERTY_TUNER_STATUS_S = ^KSPROPERTY_TUNER_STATUS_S; + {$EXTERNALSYM PKSPROPERTY_TUNER_STATUS_S} + TKSPropertyTunerStatusS = KSPROPERTY_TUNER_STATUS_S; + +const + EVENTSETID_TUNER : TGUID = '{6a2e0606-28e4-11d0-a18c-00a0c9118956}'; + {$EXTERNALSYM EVENTSETID_TUNER} + +type + KSEVENT_TUNER = ( + KSEVENT_TUNER_CHANGED + ); + {$EXTERNALSYM KSEVENT_TUNER} + TKSEventTuner = KSEVENT_TUNER; + +//=========================================================================== + +// USB Video Class Definitions +const + KSNODETYPE_VIDEO_STREAMING : TGUID = '{DFF229E1-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_VIDEO_STREAMING} + KSNODETYPE_VIDEO_INPUT_TERMINAL : TGUID = '{DFF229E2-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_VIDEO_INPUT_TERMINAL} + KSNODETYPE_VIDEO_OUTPUT_TERMINAL : TGUID = '{DFF229E3-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_VIDEO_OUTPUT_TERMINAL} + KSNODETYPE_VIDEO_SELECTOR : TGUID = '{DFF229E4-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_VIDEO_SELECTOR} + KSNODETYPE_VIDEO_PROCESSING : TGUID = '{DFF229E5-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_VIDEO_PROCESSING} + KSNODETYPE_VIDEO_CAMERA_TERMINAL : TGUID = '{DFF229E6-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_VIDEO_CAMERA_TERMINAL} + KSNODETYPE_VIDEO_INPUT_MTT : TGUID = '{DFF229E7-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_VIDEO_INPUT_MTT} + KSNODETYPE_VIDEO_OUTPUT_MTT : TGUID = '{DFF229E8-F70F-11D0-B917-00A0C9223196}'; + {$EXTERNALSYM KSNODETYPE_VIDEO_OUTPUT_MTT} + +//=========================================================================== + +const + PROPSETID_VIDCAP_VIDEOENCODER : TGUID = '{6a2e0610-28e4-11d0-a18c-00a0c9118956}'; + {$EXTERNALSYM PROPSETID_VIDCAP_VIDEOENCODER} + +type + KSPROPERTY_VIDCAP_VIDEOENCODER = ( + KSPROPERTY_VIDEOENCODER_CAPS, // R + KSPROPERTY_VIDEOENCODER_STANDARD, // RW + KSPROPERTY_VIDEOENCODER_COPYPROTECTION, // RW O + KSPROPERTY_VIDEOENCODER_CC_ENABLE // RW O + ); + {$EXTERNALSYM KSPROPERTY_VIDCAP_VIDEOENCODER} + TKSPropertyVidCapVideoEncoder = KSPROPERTY_VIDCAP_VIDEOENCODER; + + PKSPropertyVideoEncoderS = ^TKSPropertyVideoEncoderS; + KSPROPERTY_VIDEOENCODER_S = record + Property_ : KSPROPERTY; + Value : longint; // value to get or set + Flags : ULONG; // + Capabilities : ULONG; // + end; + {$EXTERNALSYM KSPROPERTY_VIDEOENCODER_S} + PKSPROPERTY_VIDEOENCODER_S = ^KSPROPERTY_VIDEOENCODER_S; + {$EXTERNALSYM PKSPROPERTY_VIDEOENCODER_S} + TKSPropertyVideoEncoderS = KSPROPERTY_VIDEOENCODER_S; + +//=========================================================================== +const + PROPSETID_VIDCAP_VIDEODECODER : TGUID = '{C6E13350-30AC-11d0-A18C-00A0C9118956}'; + {$EXTERNALSYM PROPSETID_VIDCAP_VIDEODECODER} + +type + KSPROPERTY_VIDCAP_VIDEODECODER = ( + KSPROPERTY_VIDEODECODER_CAPS, // R + KSPROPERTY_VIDEODECODER_STANDARD, // RW + KSPROPERTY_VIDEODECODER_STATUS, // R + KSPROPERTY_VIDEODECODER_OUTPUT_ENABLE, // Rw O + KSPROPERTY_VIDEODECODER_VCR_TIMING // RW O + ); + {$EXTERNALSYM KSPROPERTY_VIDCAP_VIDEODECODER} + TKSPropertyVidCapVideoDecoder = KSPROPERTY_VIDCAP_VIDEODECODER; + + KS_VIDEODECODER_FLAGS = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM KS_VIDEODECODER_FLAGS} + const + KS_VIDEODECODER_FLAGS_CAN_DISABLE_OUTPUT = $0001; // VP Output can tri-stae + {$EXTERNALSYM KS_VIDEODECODER_FLAGS_CAN_DISABLE_OUTPUT} + KS_VIDEODECODER_FLAGS_CAN_USE_VCR_LOCKING = $0002; // VCR PLL timings + {$EXTERNALSYM KS_VIDEODECODER_FLAGS_CAN_USE_VCR_LOCKING} + KS_VIDEODECODER_FLAGS_CAN_INDICATE_LOCKED = $0004; // Can indicate valid signal + {$EXTERNALSYM KS_VIDEODECODER_FLAGS_CAN_INDICATE_LOCKED} + +type + PKSPropertyVideoDecoderCapsS = ^TKSPropertyVideoDecoderCapsS; + KSPROPERTY_VIDEODECODER_CAPS_S = record + Property_ : KSPROPERTY; + StandardsSupported : ULONG; // KS_AnalogVideo_* + Capabilities : ULONG; // KS_VIDEODECODER_FLAGS_* + SettlingTime : ULONG; // milliseconds + HSyncPerVSync : ULONG; // Number of HSync Pulses per VSync + end; + {$EXTERNALSYM KSPROPERTY_VIDEODECODER_CAPS_S} + PKSPROPERTY_VIDEODECODER_CAPS_S = ^KSPROPERTY_VIDEODECODER_CAPS_S; + {$EXTERNALSYM PKSPROPERTY_VIDEODECODER_CAPS_S} + TKSPropertyVideoDecoderCapsS = KSPROPERTY_VIDEODECODER_CAPS_S; + + PKSPropertyVideoDecoderStatusS = ^TKSPropertyVideoDecoderStatusS; + KSPROPERTY_VIDEODECODER_STATUS_S = record + Property_ : KSPROPERTY; + NumberOfLines : ULONG; // 525 or 625 lines detected + SignalLocked : ULONG; // TRUE if signal is locked + end; + {$EXTERNALSYM KSPROPERTY_VIDEODECODER_STATUS_S} + PKSPROPERTY_VIDEODECODER_STATUS_S = ^KSPROPERTY_VIDEODECODER_STATUS_S; + {$EXTERNALSYM PKSPROPERTY_VIDEODECODER_STATUS_S} + TKSPropertyVideoDecoderStatusS = KSPROPERTY_VIDEODECODER_STATUS_S; + + PKSPropertyVideoDecoderS = ^TKSPropertyVideoDecoderS; + KSPROPERTY_VIDEODECODER_S = record + Property_ : KSPROPERTY; + Value : ULONG; // Get or set a value + end; + {$EXTERNALSYM KSPROPERTY_VIDEODECODER_S} + PKSPROPERTY_VIDEODECODER_S = ^KSPROPERTY_VIDEODECODER_S; + {$EXTERNALSYM PKSPROPERTY_VIDEODECODER_S} + TKSPropertyVideoDecoderS = KSPROPERTY_VIDEODECODER_S; + +const + EVENTSETID_VIDEODECODER : TGUID = '{6a2e0621-28e4-11d0-a18c-00a0c9118956}'; + {$EXTERNALSYM EVENTSETID_VIDEODECODER} + +type + KSEVENT_VIDEODECODER = ( + KSEVENT_VIDEODECODER_CHANGED + ); + {$EXTERNALSYM KSEVENT_VIDEODECODER} + TKSEventVideoDecoder = KSEVENT_VIDEODECODER; + +//=========================================================================== +const + PROPSETID_VIDCAP_CAMERACONTROL : TGUID = '{C6E13370-30AC-11d0-A18C-00A0C9118956}'; + {$EXTERNALSYM PROPSETID_VIDCAP_CAMERACONTROL} + +type + KSPROPERTY_VIDCAP_CAMERACONTROL = ( + KSPROPERTY_CAMERACONTROL_PAN, // RW O + KSPROPERTY_CAMERACONTROL_TILT, // RW O + KSPROPERTY_CAMERACONTROL_ROLL, // RW O + KSPROPERTY_CAMERACONTROL_ZOOM, // RW O + KSPROPERTY_CAMERACONTROL_EXPOSURE, // RW O + KSPROPERTY_CAMERACONTROL_IRIS, // RW O + KSPROPERTY_CAMERACONTROL_FOCUS, // RW O + KSPROPERTY_CAMERACONTROL_SCANMODE, // RW O + KSPROPERTY_CAMERACONTROL_PRIVACY, // RW O + KSPROPERTY_CAMERACONTROL_PANTILT, // RW O + KSPROPERTY_CAMERACONTROL_PAN_RELATIVE, // RW O + KSPROPERTY_CAMERACONTROL_TILT_RELATIVE, // RW O + KSPROPERTY_CAMERACONTROL_ROLL_RELATIVE, // RW O + KSPROPERTY_CAMERACONTROL_ZOOM_RELATIVE, // RW O + KSPROPERTY_CAMERACONTROL_EXPOSURE_RELATIVE, // RW O + KSPROPERTY_CAMERACONTROL_IRIS_RELATIVE, // RW O + KSPROPERTY_CAMERACONTROL_FOCUS_RELATIVE, // RW O + KSPROPERTY_CAMERACONTROL_PANTILT_RELATIVE, // RW O + KSPROPERTY_CAMERACONTROL_FOCAL_LENGTH + ); + {$EXTERNALSYM KSPROPERTY_VIDCAP_CAMERACONTROL} + TKSPropertyVidCapCameraControl = KSPROPERTY_VIDCAP_CAMERACONTROL; + + PKSPropertyCameraControlS = ^TKSPropertyCameraControlS; + KSPROPERTY_CAMERACONTROL_S = record + Property_ : KSPROPERTY; + Value : longint; // value to get or set + Flags : ULONG; // KSPROPERTY_CAMERACONTROL_FLAGS_* + Capabilities : ULONG; // KSPROPERTY_CAMERACONTROL_FLAGS_* + end; + {$EXTERNALSYM KSPROPERTY_CAMERACONTROL_S} + PKSPROPERTY_CAMERACONTROL_S = ^KSPROPERTY_CAMERACONTROL_S; + {$EXTERNALSYM PKSPROPERTY_CAMERACONTROL_S} + TKSPropertyCameraControlS = KSPROPERTY_CAMERACONTROL_S; + + PKSPropertyCameraControlNodeS = ^TKSPropertyCameraControlNodeS; + KSPROPERTY_CAMERACONTROL_NODE_S = packed record + NodeProperty: KSP_NODE; + Value: Integer; // value to get or set + Flags: ULONG; // KSPROPERTY_CAMERACONTROL_FLAGS_* + Capabilities: ULONG; // KSPROPERTY_CAMERACONTROL_FLAGS_* + end; + {$EXTERNALSYM KSPROPERTY_CAMERACONTROL_NODE_S} + PKSPROPERTY_CAMERACONTROL_NODE_S = ^KSPROPERTY_CAMERACONTROL_NODE_S; + {$EXTERNALSYM PKSPROPERTY_CAMERACONTROL_NODE_S} + TKSPropertyCameraControlNodeS = KSPROPERTY_CAMERACONTROL_NODE_S; + + PKSPropertyCameraControlS2 = ^TKSPropertyCameraControlS2; + KSPROPERTY_CAMERACONTROL_S2 = packed record + Property_: KSPROPERTY; + Value1: Integer; + Flags: ULONG; + Capabilities: ULONG; + Value2: Integer; + end; + {$EXTERNALSYM KSPROPERTY_CAMERACONTROL_S2} + PKSPROPERTY_CAMERACONTROL_S2 = ^KSPROPERTY_CAMERACONTROL_S2; + {$EXTERNALSYM PKSPROPERTY_CAMERACONTROL_S2} + TKSPropertyCameraControlS2 = KSPROPERTY_CAMERACONTROL_S2; + + PKSPropertyCameraControlNodeS2 = ^TKSPropertyCameraControlNodeS2; + KSPROPERTY_CAMERACONTROL_NODE_S2 = packed record + NodeProperty: KSP_NODE ; + Value1: Integer; + Flags: ULONG; + Capabilities: ULONG; + Value2: Integer; + end; + {$EXTERNALSYM KSPROPERTY_CAMERACONTROL_NODE_S2} + PKSPROPERTY_CAMERACONTROL_NODE_S2 = ^KSPROPERTY_CAMERACONTROL_NODE_S2; + {$EXTERNALSYM PKSPROPERTY_CAMERACONTROL_NODE_S2} + TKSPropertyCameraControlNodeS2 = KSPROPERTY_CAMERACONTROL_NODE_S2; + + PKSPropertyCameraControlFocalLengthS = ^TKSPropertyCameraControlFocalLengthS; + KSPROPERTY_CAMERACONTROL_FOCAL_LENGTH_S = packed record + Property_: KSPROPERTY; + lOcularFocalLength: Integer; + lObjectiveFocalLengthMin: Integer; + lObjectiveFocalLengthMax: Integer; + end; + {$EXTERNALSYM KSPROPERTY_CAMERACONTROL_FOCAL_LENGTH_S} + PKSPROPERTY_CAMERACONTROL_FOCAL_LENGTH_S = ^KSPROPERTY_CAMERACONTROL_FOCAL_LENGTH_S; + {$EXTERNALSYM PKSPROPERTY_CAMERACONTROL_FOCAL_LENGTH_S} + TKSPropertyCameraControlFocalLengthS = KSPROPERTY_CAMERACONTROL_FOCAL_LENGTH_S; + + KSPROPERTY_CAMERACONTROL_NODE_FOCAL_LENGTH_S = packed record + NodeProperty: KSNODEPROPERTY; + lOcularFocalLength: Integer; + lObjectiveFocalLengthMin: Integer; + lObjectiveFocalLengthMax: Integer; + end; + {$EXTERNALSYM KSPROPERTY_CAMERACONTROL_NODE_FOCAL_LENGTH_S} + TKSPropertyCameraControlNodeFocalLengthS = KSPROPERTY_CAMERACONTROL_NODE_FOCAL_LENGTH_S; + +const + KSPROPERTY_CAMERACONTROL_FLAGS_AUTO = $0001; + {$EXTERNALSYM KSPROPERTY_CAMERACONTROL_FLAGS_AUTO} + KSPROPERTY_CAMERACONTROL_FLAGS_MANUAL = $0002; + {$EXTERNALSYM KSPROPERTY_CAMERACONTROL_FLAGS_MANUAL} + + KSPROPERTY_CAMERACONTROL_FLAGS_ABSOLUTE = $0000; + {$EXTERNALSYM KSPROPERTY_CAMERACONTROL_FLAGS_ABSOLUTE} + KSPROPERTY_CAMERACONTROL_FLAGS_RELATIVE = $0010; + {$EXTERNALSYM KSPROPERTY_CAMERACONTROL_FLAGS_RELATIVE} + +//=========================================================================== + + PROPSETID_VIDCAP_CROSSBAR : TGUID = '{6a2e0640-28e4-11d0-a18c-00a0c9118956}'; + {$EXTERNALSYM PROPSETID_VIDCAP_CROSSBAR} + +type + KSPROPERTY_VIDCAP_CROSSBAR = ( + KSPROPERTY_CROSSBAR_CAPS, // R + KSPROPERTY_CROSSBAR_PININFO, // R + KSPROPERTY_CROSSBAR_CAN_ROUTE, // R + KSPROPERTY_CROSSBAR_ROUTE // RW + ); + {$EXTERNALSYM KSPROPERTY_VIDCAP_CROSSBAR} + TKSPropertyVidCapCrossbar = KSPROPERTY_VIDCAP_CROSSBAR; + + PKSPropertyCrossbarCapsS = ^TKSPropertyCrossbarCapsS; + KSPROPERTY_CROSSBAR_CAPS_S = record + Property_ : KSPROPERTY; + NumberOfInputs : ULONG; // the number of audio and video input pins + NumberOfOutputs : ULONG; // the number of audio and video output pins + end; + {$EXTERNALSYM KSPROPERTY_CROSSBAR_CAPS_S} + PKSPROPERTY_CROSSBAR_CAPS_S = ^KSPROPERTY_CROSSBAR_CAPS_S; + {$EXTERNALSYM PKSPROPERTY_CROSSBAR_CAPS_S} + TKSPropertyCrossbarCapsS = KSPROPERTY_CROSSBAR_CAPS_S; + + PKSPropertyCrossbarPinInfoS = ^TKSPropertyCrossbarPinInfoS; + KSPROPERTY_CROSSBAR_PININFO_S = record + Property_ : KSPROPERTY; + Direction : TKSPinDataFlow; // KSPIN_DATAFLOW_IN or KSPIN_DATAFLOW_OUT? + Index : ULONG; // Which pin to return data for? + PinType : ULONG; // KS_PhysConn_Video_* or KS_PhysConn_Audio_* + RelatedPinIndex : ULONG; // For video pins, this is the related audio pin + Medium : TKSPinMedium; // Identifies the hardware connection + end; + {$EXTERNALSYM KSPROPERTY_CROSSBAR_PININFO_S} + PKSPROPERTY_CROSSBAR_PININFO_S = ^KSPROPERTY_CROSSBAR_PININFO_S; + {$EXTERNALSYM PKSPROPERTY_CROSSBAR_PININFO_S} + TKSPropertyCrossbarPinInfoS = KSPROPERTY_CROSSBAR_PININFO_S; + + PKSPropertyCrossbarRouteS = ^TKSPropertyCrossbarRouteS; + KSPROPERTY_CROSSBAR_ROUTE_S = record + Property_ : KSPROPERTY; + IndexInputPin : ULONG; // Zero based index of the input pin + IndexOutputPin : ULONG; // Zero based index of the output pin + CanRoute : ULONG; // returns non-zero on CAN_ROUTE if routing is possible + end; + {$EXTERNALSYM KSPROPERTY_CROSSBAR_ROUTE_S} + PKSPROPERTY_CROSSBAR_ROUTE_S = ^KSPROPERTY_CROSSBAR_ROUTE_S; + {$EXTERNALSYM PKSPROPERTY_CROSSBAR_ROUTE_S} + TKSPropertyCrossbarRouteS = KSPROPERTY_CROSSBAR_ROUTE_S; + +const + EVENTSETID_CROSSBAR : TGUID = '{6a2e0641-28e4-11d0-a18c-00a0c9118956}'; + {$EXTERNALSYM EVENTSETID_CROSSBAR} + +type + KSEVENT_CROSSBAR = ( + KSEVENT_CROSSBAR_CHANGED + ); + {$EXTERNALSYM KSEVENT_CROSSBAR} + TKSEventCrossbar = KSEVENT_CROSSBAR; + +// The following IDs should match the AM equivalents + KS_PhysicalConnectorType = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM KS_PhysicalConnectorType} + const + KS_PhysConn_Video_Tuner = 1; + {$EXTERNALSYM KS_PhysConn_Video_Tuner} + KS_PhysConn_Video_Composite = 2; + {$EXTERNALSYM KS_PhysConn_Video_Composite} + KS_PhysConn_Video_SVideo = 3; + {$EXTERNALSYM KS_PhysConn_Video_SVideo} + KS_PhysConn_Video_RGB = 4; + {$EXTERNALSYM KS_PhysConn_Video_RGB} + KS_PhysConn_Video_YRYBY = 5; + {$EXTERNALSYM KS_PhysConn_Video_YRYBY} + KS_PhysConn_Video_SerialDigital = 6; + {$EXTERNALSYM KS_PhysConn_Video_SerialDigital} + KS_PhysConn_Video_ParallelDigital = 7; + {$EXTERNALSYM KS_PhysConn_Video_ParallelDigital} + KS_PhysConn_Video_SCSI = 8; + {$EXTERNALSYM KS_PhysConn_Video_SCSI} + KS_PhysConn_Video_AUX = 9; + {$EXTERNALSYM KS_PhysConn_Video_AUX} + KS_PhysConn_Video_1394 = 10; + {$EXTERNALSYM KS_PhysConn_Video_1394} + KS_PhysConn_Video_USB = 11; + {$EXTERNALSYM KS_PhysConn_Video_USB} + KS_PhysConn_Video_VideoDecoder = 12; + {$EXTERNALSYM KS_PhysConn_Video_VideoDecoder} + KS_PhysConn_Video_VideoEncoder = 13; + {$EXTERNALSYM KS_PhysConn_Video_VideoEncoder} + KS_PhysConn_Video_SCART = 14; + {$EXTERNALSYM KS_PhysConn_Video_SCART} + KS_PhysConn_Audio_Tuner = 4096; + {$EXTERNALSYM KS_PhysConn_Audio_Tuner} + KS_PhysConn_Audio_Line = 4097; + {$EXTERNALSYM KS_PhysConn_Audio_Line} + KS_PhysConn_Audio_Mic = 4098; + {$EXTERNALSYM KS_PhysConn_Audio_Mic} + KS_PhysConn_Audio_AESDigital = 4099; + {$EXTERNALSYM KS_PhysConn_Audio_AESDigital} + KS_PhysConn_Audio_SPDIFDigital = 4100; + {$EXTERNALSYM KS_PhysConn_Audio_SPDIFDigital} + KS_PhysConn_Audio_SCSI = 4101; + {$EXTERNALSYM KS_PhysConn_Audio_SCSI} + KS_PhysConn_Audio_AUX = 4102; + {$EXTERNALSYM KS_PhysConn_Audio_AUX} + KS_PhysConn_Audio_1394 = 4103; + {$EXTERNALSYM KS_PhysConn_Audio_1394} + KS_PhysConn_Audio_USB = 4104; + {$EXTERNALSYM KS_PhysConn_Audio_USB} + KS_PhysConn_Audio_AudioDecoder = 4105; + {$EXTERNALSYM KS_PhysConn_Audio_AudioDecoder} + +//=========================================================================== + + PROPSETID_VIDCAP_TVAUDIO : TGUID = '{6a2e0650-28e4-11d0-a18c-00a0c9118956}'; + {$EXTERNALSYM PROPSETID_VIDCAP_TVAUDIO} + +type + KSPROPERTY_VIDCAP_TVAUDIO = ( + KSPROPERTY_TVAUDIO_CAPS, // R + KSPROPERTY_TVAUDIO_MODE, // RW + KSPROPERTY_TVAUDIO_CURRENTLY_AVAILABLE_MODES // R + ); + {$EXTERNALSYM KSPROPERTY_VIDCAP_TVAUDIO} + TKSPropertyVidCapTVAudio = KSPROPERTY_VIDCAP_TVAUDIO; + +const + KS_TVAUDIO_MODE_MONO = $0001; // Mono + {$EXTERNALSYM KS_TVAUDIO_MODE_MONO} + KS_TVAUDIO_MODE_STEREO = $0002; // Stereo + {$EXTERNALSYM KS_TVAUDIO_MODE_STEREO} + KS_TVAUDIO_MODE_LANG_A = $0010; // Primary language + {$EXTERNALSYM KS_TVAUDIO_MODE_LANG_A} + KS_TVAUDIO_MODE_LANG_B = $0020; // 2nd avail language + {$EXTERNALSYM KS_TVAUDIO_MODE_LANG_B} + KS_TVAUDIO_MODE_LANG_C = $0040; // 3rd avail language + {$EXTERNALSYM KS_TVAUDIO_MODE_LANG_C} + +type + PKSPropertyTVAudioCapsS = ^TKSPropertyTVAudioCapsS; + KSPROPERTY_TVAUDIO_CAPS_S = record + Property_ : KSPROPERTY; + Capabilities : ULONG; // Bitmask of KS_TVAUDIO_MODE_* + InputMedium : TKSPinMedium; + OutputMedium : TKSPinMedium; + end; + {$EXTERNALSYM KSPROPERTY_TVAUDIO_CAPS_S} + PKSPROPERTY_TVAUDIO_CAPS_S = ^KSPROPERTY_TVAUDIO_CAPS_S; + {$EXTERNALSYM PKSPROPERTY_TVAUDIO_CAPS_S} + TKSPropertyTVAudioCapsS = KSPROPERTY_TVAUDIO_CAPS_S; + + PKSPropertyTVAudioS = ^TKSPropertyTVAudioS; + KSPROPERTY_TVAUDIO_S = record + Property_ : KSPROPERTY; + Mode : ULONG; // KS_TVAUDIO_MODE_* + end; + {$EXTERNALSYM KSPROPERTY_TVAUDIO_S} + PKSPROPERTY_TVAUDIO_S = ^KSPROPERTY_TVAUDIO_S; + {$EXTERNALSYM PKSPROPERTY_TVAUDIO_S} + TKSPropertyTVAudioS = KSPROPERTY_TVAUDIO_S; + +const + KSEVENTSETID_VIDCAP_TVAUDIO : TGUID = '{6a2e0651-28e4-11d0-a18c-00a0c9118956}'; + {$EXTERNALSYM KSEVENTSETID_VIDCAP_TVAUDIO} + +type + KSEVENT_TVAUDIO = ( + KSEVENT_TVAUDIO_CHANGED + ); + {$EXTERNALSYM KSEVENT_TVAUDIO} + TKSEventTVAudio = KSEVENT_TVAUDIO; + +//=========================================================================== +const + PROPSETID_VIDCAP_VIDEOCOMPRESSION : TGUID = '{C6E13343-30AC-11d0-A18C-00A0C9118956}'; + {$EXTERNALSYM PROPSETID_VIDCAP_VIDEOCOMPRESSION} + +type + KSPROPERTY_VIDCAP_VIDEOCOMPRESSION = ( + KSPROPERTY_VIDEOCOMPRESSION_GETINFO, // R + KSPROPERTY_VIDEOCOMPRESSION_KEYFRAME_RATE, // RW + KSPROPERTY_VIDEOCOMPRESSION_PFRAMES_PER_KEYFRAME, // RW + KSPROPERTY_VIDEOCOMPRESSION_QUALITY, // RW + KSPROPERTY_VIDEOCOMPRESSION_OVERRIDE_KEYFRAME, // W + KSPROPERTY_VIDEOCOMPRESSION_OVERRIDE_FRAME_SIZE, // W + KSPROPERTY_VIDEOCOMPRESSION_WINDOWSIZE // RW + ); + {$EXTERNALSYM KSPROPERTY_VIDCAP_VIDEOCOMPRESSION} + TKSPRopertyVidCapVideoCompression = KSPROPERTY_VIDCAP_VIDEOCOMPRESSION; + + KS_CompressionCaps = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM KS_CompressionCaps} + const + KS_CompressionCaps_CanQuality = 1; + {$EXTERNALSYM KS_CompressionCaps_CanQuality} + KS_CompressionCaps_CanCrunch = 2; + {$EXTERNALSYM KS_CompressionCaps_CanCrunch} + KS_CompressionCaps_CanKeyFrame = 4; + {$EXTERNALSYM KS_CompressionCaps_CanKeyFrame} + KS_CompressionCaps_CanBFrame = 8; + {$EXTERNALSYM KS_CompressionCaps_CanBFrame} + KS_CompressionCaps_CanWindow = $10; + {$EXTERNALSYM KS_CompressionCaps_CanWindow} + +type + PKSPropertyVideoCompressionGetInfoS = ^TKSPropertyVideoCompressionGetInfoS; + KSPROPERTY_VIDEOCOMPRESSION_GETINFO_S = record + Property_ : KSPROPERTY; + // Note, no VersionString! + // Note, no DescriptionString! + StreamIndex : ULONG; // zero based index of stream + DefaultKeyFrameRate : longint; // Key frame rate + DefaultPFrameRate : longint; // Predeicted frames per Key frame + DefaultQuality : longint; // 0 to 10000 + NumberOfQualitySettings : longint; // How many discreet quality settings? + Capabilities : longint; // KS_CompressionCaps_* + end; + {$EXTERNALSYM KSPROPERTY_VIDEOCOMPRESSION_GETINFO_S} + PKSPROPERTY_VIDEOCOMPRESSION_GETINFO_S = ^KSPROPERTY_VIDEOCOMPRESSION_GETINFO_S; + {$EXTERNALSYM PKSPROPERTY_VIDEOCOMPRESSION_GETINFO_S} + TKSPropertyVideoCompressionGetInfoS = KSPROPERTY_VIDEOCOMPRESSION_GETINFO_S; + + PKSPropertyVideoCompressionS = ^TKSPropertyVideoCompressionS; + KSPROPERTY_VIDEOCOMPRESSION_S = record + Property_ : KSPROPERTY; + StreamIndex : ULONG; // zero based index of stream + Value : longint; // value to get or set + end; + {$EXTERNALSYM KSPROPERTY_VIDEOCOMPRESSION_S} + PKSPROPERTY_VIDEOCOMPRESSION_S = ^KSPROPERTY_VIDEOCOMPRESSION_S; + {$EXTERNALSYM PKSPROPERTY_VIDEOCOMPRESSION_S} + TKSPropertyVideoCompressionS = KSPROPERTY_VIDEOCOMPRESSION_S; + +//=========================================================================== +// MEDIASUBTYPE_Overlay +const + KSDATAFORMAT_SUBTYPE_OVERLAY : TGUID = '{e436eb7f-524f-11ce-9f53-0020af0ba770}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_OVERLAY} + KSPROPSETID_OverlayUpdate : TGUID = '{490EA5CF-7681-11D1-A21C-00A0C9223196}'; + {$EXTERNALSYM KSPROPSETID_OverlayUpdate} + +type + KSPROPERTY_OVERLAYUPDATE = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM KSPROPERTY_OVERLAYUPDATE} + const + KSPROPERTY_OVERLAYUPDATE_INTERESTS = $0; + {$EXTERNALSYM KSPROPERTY_OVERLAYUPDATE_INTERESTS} + KSPROPERTY_OVERLAYUPDATE_CLIPLIST = $1; + {$EXTERNALSYM KSPROPERTY_OVERLAYUPDATE_CLIPLIST} + KSPROPERTY_OVERLAYUPDATE_PALETTE = $2; + {$EXTERNALSYM KSPROPERTY_OVERLAYUPDATE_PALETTE} + KSPROPERTY_OVERLAYUPDATE_COLORKEY = $4; + {$EXTERNALSYM KSPROPERTY_OVERLAYUPDATE_COLORKEY} + KSPROPERTY_OVERLAYUPDATE_VIDEOPOSITION = $8; + {$EXTERNALSYM KSPROPERTY_OVERLAYUPDATE_VIDEOPOSITION} + KSPROPERTY_OVERLAYUPDATE_DISPLAYCHANGE = $10; + {$EXTERNALSYM KSPROPERTY_OVERLAYUPDATE_DISPLAYCHANGE} + KSPROPERTY_OVERLAYUPDATE_COLORREF = $10000000; + {$EXTERNALSYM KSPROPERTY_OVERLAYUPDATE_COLORREF} + +type + KSDISPLAYCHANGE = record + PelsWidth :ULONG; + PelsHeight :ULONG; + BitsPerPel :ULONG; + DeviceID :array[0..0] of WideChar; + end; + {$EXTERNALSYM KSDISPLAYCHANGE} + PKSDISPLAYCHANGE = ^KSDISPLAYCHANGE; + {$EXTERNALSYM PKSDISPLAYCHANGE} + TKSDisplayChange = KSDISPLAYCHANGE; + +{#define DEFINE_KSPROPERTY_ITEM_OVERLAYUPDATE_INTERESTS(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_OVERLAYUPDATE_INTERESTS,\ + (Handler),\ + sizeof(KSPROPERTY),\ + sizeof(ULONG),\ + NULL, NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_OVERLAYUPDATE_PALETTE(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_OVERLAYUPDATE_PALETTE,\ + NULL,\ + sizeof(KSPROPERTY),\ + 0,\ + (Handler),\ + NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_OVERLAYUPDATE_COLORKEY(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_OVERLAYUPDATE_COLORKEY,\ + NULL,\ + sizeof(KSPROPERTY),\ + sizeof(COLORKEY),\ + (Handler),\ + NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_OVERLAYUPDATE_CLIPLIST(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_OVERLAYUPDATE_CLIPLIST,\ + NULL,\ + sizeof(KSPROPERTY),\ + 2 * sizeof(RECT) + sizeof(RGNDATAHEADER),\ + (Handler),\ + NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_OVERLAYUPDATE_VIDEOPOSITION(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_OVERLAYUPDATE_VIDEOPOSITION,\ + NULL,\ + sizeof(KSPROPERTY),\ + 2 * sizeof(RECT),\ + (Handler),\ + NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_OVERLAYUPDATE_DISPLAYCHANGE(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_OVERLAYUPDATE_DISPLAYCHANGE,\ + NULL,\ + sizeof(KSPROPERTY),\ + sizeof(KSDISPLAYCHANGE),\ + (Handler),\ + NULL, 0, NULL, NULL, 0) + +#define DEFINE_KSPROPERTY_ITEM_OVERLAYUPDATE_COLORREF(Handler)\ + DEFINE_KSPROPERTY_ITEM(\ + KSPROPERTY_OVERLAYUPDATE_COLORREF,\ + (Handler),\ + sizeof(KSPROPERTY),\ + sizeof(COLORREF),\ + NULL,\ + NULL, 0, NULL, NULL, 0) } + +//=========================================================================== +const + PROPSETID_VIDCAP_VIDEOCONTROL : TGUID = '{6a2e0670-28e4-11d0-a18c-00a0c9118956}'; + {$EXTERNALSYM PROPSETID_VIDCAP_VIDEOCONTROL} + +type + KSPROPERTY_VIDCAP_VIDEOCONTROL = ( + KSPROPERTY_VIDEOCONTROL_CAPS, // R + KSPROPERTY_VIDEOCONTROL_ACTUAL_FRAME_RATE, // R O + KSPROPERTY_VIDEOCONTROL_FRAME_RATES, // R O + KSPROPERTY_VIDEOCONTROL_MODE // RWO + ); + {$EXTERNALSYM KSPROPERTY_VIDCAP_VIDEOCONTROL} + TKSPropertyVidCapVideoControl = KSPROPERTY_VIDCAP_VIDEOCONTROL; + + KS_VideoControlFlags = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM KS_VideoControlFlags} + const + KS_VideoControlFlag_FlipHorizontal = $0001; + {$EXTERNALSYM KS_VideoControlFlag_FlipHorizontal} + KS_VideoControlFlag_FlipVertical = $0002; + {$EXTERNALSYM KS_VideoControlFlag_FlipVertical} + KS_Obsolete_VideoControlFlag_ExternalTriggerEnable = $0010; // ***WARNING *** Flag msimatch with DSHOW. + {$EXTERNALSYM KS_Obsolete_VideoControlFlag_ExternalTriggerEnable} + KS_Obsolete_VideoControlFlag_Trigger = $0020; // ***WARNING *** Flag msimatch with DSHOW. + {$EXTERNALSYM KS_Obsolete_VideoControlFlag_Trigger} + KS_VideoControlFlag_ExternalTriggerEnable = $0004; + {$EXTERNALSYM KS_VideoControlFlag_ExternalTriggerEnable} + KS_VideoControlFlag_Trigger = $0008; + {$EXTERNALSYM KS_VideoControlFlag_Trigger} + +type + PKSPropertyVideoControlCapsS = ^TKSPropertyVideoControlCapsS; + KSPROPERTY_VIDEOCONTROL_CAPS_S = record + Property_ : KSPROPERTY; + StreamIndex : ULONG; + VideoControlCaps : ULONG; // KS_VideoControlFlags_* + end; + {$EXTERNALSYM KSPROPERTY_VIDEOCONTROL_CAPS_S} + PKSPROPERTY_VIDEOCONTROL_CAPS_S = ^KSPROPERTY_VIDEOCONTROL_CAPS_S; + {$EXTERNALSYM PKSPROPERTY_VIDEOCONTROL_CAPS_S} + TKSPropertyVideoControlCapsS = KSPROPERTY_VIDEOCONTROL_CAPS_S; + + PKSPropertyVideoControlModeS = ^TKSPropertyVideoControlModeS; + KSPROPERTY_VIDEOCONTROL_MODE_S = record + Property_ : KSPROPERTY; + StreamIndex : ULONG; + Mode : longint; // KS_VideoControlFlags_* + end; + {$EXTERNALSYM KSPROPERTY_VIDEOCONTROL_MODE_S} + PKSPROPERTY_VIDEOCONTROL_MODE_S = ^KSPROPERTY_VIDEOCONTROL_MODE_S; + {$EXTERNALSYM PKSPROPERTY_VIDEOCONTROL_MODE_S} + TKSPropertyVideoControlModeS = KSPROPERTY_VIDEOCONTROL_MODE_S; + + PKSPropertyVideoControlActualFrameRateS = ^TKSPropertyVideoControlActualFrameRateS; + KSPROPERTY_VIDEOCONTROL_ACTUAL_FRAME_RATE_S = record + Property_ : KSPROPERTY; + StreamIndex : ULONG; // Index of stream + RangeIndex : ULONG; // Index of range + Dimensions : TSIZE; // Size of image + CurrentActualFrameRate : int64; // Only correct if pin is open + CurrentMaxAvailableFrameRate : int64; // Max Rate temporarily limited on USB or 1394? + end; + {$EXTERNALSYM KSPROPERTY_VIDEOCONTROL_ACTUAL_FRAME_RATE_S} + PKSPROPERTY_VIDEOCONTROL_ACTUAL_FRAME_RATE_S = ^KSPROPERTY_VIDEOCONTROL_ACTUAL_FRAME_RATE_S; + {$EXTERNALSYM PKSPROPERTY_VIDEOCONTROL_ACTUAL_FRAME_RATE_S} + TKSPropertyVideoControlActualFrameRateS = KSPROPERTY_VIDEOCONTROL_ACTUAL_FRAME_RATE_S; + +// KSPROPERTY_VIDEOCONTROL_FRAME_RATES returns a list of available frame rates in 100 nS units + PKSPropertyVideoControlFrameRatesS = ^TKSPropertyVideoControlFrameRatesS; + KSPROPERTY_VIDEOCONTROL_FRAME_RATES_S = record + Property_ : KSPROPERTY; + StreamIndex : ULONG; // Index of stream + RangeIndex : ULONG; // Index of range + Dimensions : TSIZE; // Size of image + end; + {$EXTERNALSYM KSPROPERTY_VIDEOCONTROL_FRAME_RATES_S} + PKSPROPERTY_VIDEOCONTROL_FRAME_RATES_S = ^KSPROPERTY_VIDEOCONTROL_FRAME_RATES_S; + {$EXTERNALSYM PKSPROPERTY_VIDEOCONTROL_FRAME_RATES_S} + TKSPropertyVideoControlFrameRatesS = KSPROPERTY_VIDEOCONTROL_FRAME_RATES_S; + +//=========================================================================== +const + PROPSETID_VIDCAP_DROPPEDFRAMES : TGUID = '{C6E13344-30AC-11d0-A18C-00A0C9118956}'; + {$EXTERNALSYM PROPSETID_VIDCAP_DROPPEDFRAMES} + +type + KSPROPERTY_VIDCAP_DROPPEDFRAMES = ( + KSPROPERTY_DROPPEDFRAMES_CURRENT // R + ); + {$EXTERNALSYM KSPROPERTY_VIDCAP_DROPPEDFRAMES} + TKSPropertyVidCapDroppedFrames = KSPROPERTY_VIDCAP_DROPPEDFRAMES; + + PKSPropertyDroppedFramesCurrentS = ^TKSPropertyDroppedFramesCurrentS; + KSPROPERTY_DROPPEDFRAMES_CURRENT_S = record + Property_ : KSPROPERTY; + PictureNumber : int64; // Current Picture Number + DropCount : int64; // Count of frames dropped + AverageFrameSize : ULONG; // Average size of frames captured + end; + {$EXTERNALSYM KSPROPERTY_DROPPEDFRAMES_CURRENT_S} + PKSPROPERTY_DROPPEDFRAMES_CURRENT_S = ^KSPROPERTY_DROPPEDFRAMES_CURRENT_S; + {$EXTERNALSYM PKSPROPERTY_DROPPEDFRAMES_CURRENT_S} + TKSPropertyDroppedFramesCurrentS = KSPROPERTY_DROPPEDFRAMES_CURRENT_S; + +//=========================================================================== +// VPE +const + KSPROPSETID_VPConfig : TGUID = '{bc29a660-30e3-11d0-9e69-00c04fd7c15b}'; + {$EXTERNALSYM KSPROPSETID_VPConfig} + KSPROPSETID_VPVBIConfig : TGUID = '{ec529b00-1a1f-11d1-bad9-00609744111a}'; + {$EXTERNALSYM KSPROPSETID_VPVBIConfig} + +// Both of the above property sets use the same list of properties below + +type + KSPROPERTY_VPCONFIG = ( + KSPROPERTY_VPCONFIG_NUMCONNECTINFO, + KSPROPERTY_VPCONFIG_GETCONNECTINFO, + KSPROPERTY_VPCONFIG_SETCONNECTINFO, + KSPROPERTY_VPCONFIG_VPDATAINFO, + KSPROPERTY_VPCONFIG_MAXPIXELRATE, + KSPROPERTY_VPCONFIG_INFORMVPINPUT, + KSPROPERTY_VPCONFIG_NUMVIDEOFORMAT, + KSPROPERTY_VPCONFIG_GETVIDEOFORMAT, + KSPROPERTY_VPCONFIG_SETVIDEOFORMAT, + KSPROPERTY_VPCONFIG_INVERTPOLARITY, + KSPROPERTY_VPCONFIG_DECIMATIONCAPABILITY, // E_NOTIMPL for VBI + KSPROPERTY_VPCONFIG_SCALEFACTOR, // E_NOTIMPL for VBI + KSPROPERTY_VPCONFIG_DDRAWHANDLE, + KSPROPERTY_VPCONFIG_VIDEOPORTID, + KSPROPERTY_VPCONFIG_DDRAWSURFACEHANDLE, + KSPROPERTY_VPCONFIG_SURFACEPARAMS + ); + {$EXTERNALSYM KSPROPERTY_VPCONFIG} + TKSPropertyVPConfig = KSPROPERTY_VPCONFIG; + +//========================= +// IBasicAudio +// +const + CLSID_KsIBasicAudioInterfaceHandler : TGUID = '{b9f8ac3e-0f71-11d2-b72c-00c04fb6bd3d}'; + {$EXTERNALSYM CLSID_KsIBasicAudioInterfaceHandler} + +type + KSVPMAXPIXELRATE = record + Size : TAMVPSIZE; + MaxPixelsPerSecond : DWORD; + Reserved : DWORD; + end; + {$EXTERNALSYM KSVPMAXPIXELRATE} + PKSVPMAXPIXELRATE = ^KSVPMAXPIXELRATE; + {$EXTERNALSYM PKSVPMAXPIXELRATE} + TKSVPMaxPixelRate = KSVPMAXPIXELRATE; + + PKSVPSizeProp = ^TKSVPSizeProp; + KSVPSIZE_PROP = record + Property_ : KSPROPERTY; + Size : TAMVPSIZE; + end; + {$EXTERNALSYM KSVPSIZE_PROP} + PKSVPSIZE_PROP = ^KSVPSIZE_PROP; + {$EXTERNALSYM PKSVPSIZE_PROP} + TKSVPSizeProp = KSVPSIZE_PROP; + + KSVPSURFACEPARAMS = record + dwPitch : DWORD; + dwXOrigin : DWORD; + dwYOrigin : DWORD; + end; + {$EXTERNALSYM KSVPSURFACEPARAMS} + PKSVPSURFACEPARAMS = ^KSVPSURFACEPARAMS; + {$EXTERNALSYM PKSVPSURFACEPARAMS} + TKSVPSurfaceParams = KSVPSURFACEPARAMS; + +//========================================================================== +// The following definitions must be in sync with DDraw.h in DirectX SDK +//========================================================================== + +//* +//* The FourCC code is valid. +//* +// uses directdraw.pas + +//========================================================================== +// End of DDraw.h header info +//========================================================================== + +//========================================================================== +// The following definitions must be in sync with DVP.h in DirectX SDK +//========================================================================== + + + _DDVIDEOPORTCONNECT = record + dwSize : DWORD; // size of the DDVIDEOPORTCONNECT structure + dwPortWidth : DWORD; // Width of the video port + guidTypeID : TGUID; // Description of video port connection + dwFlags : DWORD; // Connection flags + dwReserved1 : DWORD; // Reserved, set to zero. + end; + {$EXTERNALSYM _DDVIDEOPORTCONNECT} + DDVIDEOPORTCONNECT = _DDVIDEOPORTCONNECT; + {$EXTERNALSYM DDVIDEOPORTCONNECT} + PDDVIDEOPORTCONNECT = ^DDVIDEOPORTCONNECT; + {$EXTERNALSYM PDDVIDEOPORTCONNECT} + TDDVideoPortConnect = _DDVIDEOPORTCONNECT; + +const + DDVPTYPE_E_HREFH_VREFH : TGUID = (D1:$54F39980;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + {$EXTERNALSYM DDVPTYPE_E_HREFH_VREFH} + DDVPTYPE_E_HREFL_VREFL : TGUID = (D1:$E09C77E0;D2:$DA60;D3:$11CF;D4:($9B,$06,$00,$A0,$C9,$03,$A3,$B8)); + {$EXTERNALSYM DDVPTYPE_E_HREFL_VREFL} + +//========================================================================== +// End of DVP.h header info +//========================================================================== + + +//========================================================================== +// The following definitions must be in sync with VPType.h in AM 2.0 SDK +//========================================================================== +type +// pixel aspect ratios corresponding to a 720x480 NTSC image or a 720x576 image + KS_AMPixAspectRatio = ( // AMPixAspectRatio + KS_PixAspectRatio_NTSC4x3, + KS_PixAspectRatio_NTSC16x9, + KS_PixAspectRatio_PAL4x3, + KS_PixAspectRatio_PAL16x9 + ); + {$NODEFINE KS_AMPixAspectRatio} + TKSAMPixAspectRatio = KS_AMPixAspectRatio; + {$NODEFINE TKSAMPixAspectRatio} + + KS_AMVP_SELECTFORMATBY = ( // AMVP_SELECTFORMATBY + KS_AMVP_DO_NOT_CARE, + KS_AMVP_BEST_BANDWIDTH, + KS_AMVP_INPUT_SAME_AS_OUTPUT + ); + {$NODEFINE KS_AMVP_SELECTFORMATBY} + TKSAMVPSelectFormatBy = KS_AMVP_SELECTFORMATBY; + {$NODEFINE TKSAMVPSelectFormatBy} + + KS_AMVP_MODE = ( // AMVP_MODE + KS_AMVP_MODE_WEAVE, + KS_AMVP_MODE_BOBINTERLEAVED, + KS_AMVP_MODE_BOBNONINTERLEAVED, + KS_AMVP_MODE_SKIPEVEN, + KS_AMVP_MODE_SKIPODD + ); + {$NODEFINE KS_AMVP_MODE} + TKSAMVPMode = KS_AMVP_MODE; + {$NODEFINE TKSAMVPMode} + + PKSAMVPDimInfo = ^TKSAMVPDimInfo; + {$NODEFINE PKSAMVPDimInfo} + tagKS_AMVPDIMINFO = record // AMVPDIMINFO + dwFieldWidth : DWORD; // [out] field width + dwFieldHeight : DWORD; // [out] field height + dwVBIWidth : DWORD; // [out] VBI data width + dwVBIHeight : DWORD; // [out] VBI data height + rcValidRegion : TRECT; // [out] valid rect for data cropping + end; + {$NODEFINE tagKS_AMVPDIMINFO} + KS_AMVPDIMINFO = tagKS_AMVPDIMINFO; + {$EXTERNALSYM KS_AMVPDIMINFO} + PKS_AMVPDIMINFO = ^KS_AMVPDIMINFO; + {$NODEFINE PKS_AMVPDIMINFO} + TKSAMVPDimInfo = tagKS_AMVPDIMINFO; + {$NODEFINE TKSAMVPDimInfo} + + PKSAMVPDataInfo = ^TKSAMVPDataInfo; + {$NODEFINE PKSAMVPDataInfo} + tagKS_AMVPDATAINFO = record // AMVPDATAINFO + dwSize : DWORD; // Size of the struct + dwMicrosecondsPerField : DWORD; // Time taken by each field + amvpDimInfo : TKSAMVPDimInfo; // Dimensional Information + dwPictAspectRatioX : DWORD; // Pict aspect ratio in X dimn + dwPictAspectRatioY : DWORD; // Pict aspect ratio in Y dimn + bEnableDoubleClock : BOOL; // Videoport should enable double clocking + bEnableVACT : BOOL; // Videoport should use an external VACT signal + bDataIsInterlaced : BOOL; // Indicates that the signal is interlaced + lHalfLinesOdd : Longint; // number of halflines in the odd field + bFieldPolarityInverted : BOOL; // Device inverts the polarity by default + dwNumLinesInVREF : DWORD; // Number of lines of data in VREF + lHalfLinesEven : Longint; // number of halflines in the even field + dwReserved1 : DWORD; // Reserved for future use + end; + {$NODEFINE tagKS_AMVPDATAINFO} + KS_AMVPDATAINFO = tagKS_AMVPDATAINFO; + {$NODEFINE KS_AMVPDATAINFO} + PKS_AMVPDATAINFO = ^KS_AMVPDATAINFO; + {$NODEFINE PKS_AMVPDATAINFO} + TKSAMVPDataInfo = tagKS_AMVPDATAINFO; + {$NODEFINE TKSAMVPDataInfo} + + PKSAMVPSize = ^TKSAMVPSize; + {$NODEFINE PKSAMVPSize} + tagKS_AMVPSIZE = record // AMVPSIZE + dwWidth : DWORD; // [in] width in pixels + dwHeight : DWORD; // [in] height in pixels + end; + {$NODEFINE tagKS_AMVPSIZE} + KS_AMVPSIZE = tagKS_AMVPSIZE; + {$NODEFINE KS_AMVPSIZE} + PKS_AMVPSIZE = ^KS_AMVPSIZE; + {$NODEFINE PKS_AMVPSIZE} + TKSAMVPSize = tagKS_AMVPSIZE; + {$NODEFINE TKSAMVPSize} + +//========================================================================== +// End of VPType.h header info +//========================================================================== + +{ // allready defined above + PKSVPMAXPIXELRATE = ^TKSVPMAXPIXELRATE; + TKSVPMAXPIXELRATE = record + Size : TKS_AMVPSIZE; + MaxPixelsPerSecond : DWORD; + Reserved : DWORD; + end; + + PKSVPSIZE_PROP = ^TKSVPSIZE_PROP; + TKSVPSIZE_PROP = record + Property_ : KSPROPERTY; + Size : TKS_AMVPSIZE; + end; + + PKSVPSURFACEPARAMS = ^TKSVPSURFACEPARAMS; + TKSVPSURFACEPARAMS = record + dwPitch : DWORD; + dwXOrigin : DWORD; + dwYOrigin : DWORD; + end; } + +// +// IVPNotify event notification +// +const + KSEVENTSETID_VPNotify : TGUID = '{20c5598e-d3c8-11d0-8dfc-00c04fd7c08b}'; + {$EXTERNALSYM KSEVENTSETID_VPNotify} + +type + KSEVENT_VPNOTIFY = ( + KSEVENT_VPNOTIFY_FORMATCHANGE + ); + {$EXTERNALSYM KSEVENT_VPNOTIFY} + TKSEventVPNotify = KSEVENT_VPNOTIFY; + +// +// VIDCAPTOSTI event notification +// +const + KSEVENTSETID_VIDCAPTOSTI : TGUID = '{DB47DE20-F628-11d1-BA41-00A0C90D2B05}'; + {$EXTERNALSYM KSEVENTSETID_VIDCAPTOSTI} + +type + KSEVENT_VIDCAPTOSTI = ( + KSEVENT_VIDCAPTOSTI_EXT_TRIGGER, + KSEVENT_VIDCAP_AUTO_UPDATE, + KSEVENT_VIDCAP_SEARCH + ); + {$EXTERNALSYM KSEVENT_VIDCAPTOSTI} + TKSEventVidCapToSTI = KSEVENT_VIDCAPTOSTI; + +// +// extension unit properties +// +const + KSPROPERTY_EXTENSION_UNIT_PASS_THROUGH = $ffff; // (RW) + {$EXTERNALSYM KSPROPERTY_EXTENSION_UNIT_PASS_THROUGH} + +type + pkspropertyextensionunit = ^tkspropertyextensionunit; + ksproperty_extension_unit = ( + KSPROPERTY_EXTENSION_UNIT_INFO, // (R) + KSPROPERTY_EXTENSION_UNIT_CONTROL // (RW) + ); + {$EXTERNALSYM KSPROPERTY_EXTENSION_UNIT} + pksproperty_extension_unit = ^ksproperty_extension_unit; + {$EXTERNALSYM PKSPROPERTY_EXTENSION_UNIT} + tkspropertyextensionunit = ksproperty_extension_unit; + + +// +// IVPVBINotify event notification +// +const + KSEVENTSETID_VPVBINotify : TGUID = '{ec529b01-1a1f-11d1-bad9-00609744111a}'; + {$EXTERNALSYM KSEVENTSETID_VPVBINotify} + +type + KSEVENT_VPVBINOTIFY = ( + KSEVENT_VPVBINOTIFY_FORMATCHANGE + ); + {$EXTERNALSYM KSEVENT_VPVBINOTIFY} + TKSEventVPVBINotify = KSEVENT_VPVBINOTIFY; + +// +// closed caption information +// +const + KSDATAFORMAT_TYPE_AUXLine21Data : TGUID = '{670aea80-3a82-11d0-b79b-00aa003767a7}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_AUXLine21Data} + KSDATAFORMAT_SUBTYPE_Line21_BytePair : TGUID = '{6e8d4a22-310c-11d0-b79a-00aa003767a7}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_Line21_BytePair} + KSDATAFORMAT_SUBTYPE_Line21_GOPPacket : TGUID = '{6e8d4a23-310c-11d0-b79a-00aa003767a7}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_Line21_GOPPacket} + +type + PKSGopUserData = ^TKSGopUserData; + _KSGOP_USERDATA = record + sc : ULONG; + reserved1 : ULONG; + cFields : BYTE; + l21Data : array[0..2] of CHAR; + end; + {$EXTERNALSYM _KSGOP_USERDATA} + KSGOP_USERDATA = _KSGOP_USERDATA; + {$EXTERNALSYM KSGOP_USERDATA} + PKSGOP_USERDATA = ^KSGOP_USERDATA; + {$EXTERNALSYM PKSGOP_USERDATA} + TKSGopUserData = _KSGOP_USERDATA; + +// +// DVD encrypted PACK format type definition +// +const + KSDATAFORMAT_TYPE_DVD_ENCRYPTED_PACK : TGUID = '{ed0b916a-044d-11d1-aa78-00c04fc31d60}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_DVD_ENCRYPTED_PACK} + + KS_AM_UseNewCSSKey = $1; + {$EXTERNALSYM KS_AM_UseNewCSSKey} + +// ----------------------------------------------------------------------- +// KS_AM_KSPROPSETID_TSRateChange property set definitions for time stamp +// rate changes. +// ----------------------------------------------------------------------- + + KSPROPSETID_TSRateChange : TGUID = '{A503C5C0-1D1D-11D1-AD80-444553540000}'; + {$EXTERNALSYM KSPROPSETID_TSRateChange} + +type + PKSAMPropertyTSRateChange = ^TKSAMPropertyTSRateChange; + KS_AM_PROPERTY_TS_RATE_CHANGE = ( + KS_AM_RATE_Invalid, + KS_AM_RATE_SimpleRateChange, // rw, use KS_AM_SimpleRateChange + KS_AM_RATE_ExactRateChange, // rw, use KS_AM_ExactRateChange + KS_AM_RATE_MaxFullDataRate, // r, use KS_AM_MaxFullDataRate + KS_AM_RATE_Step // w, use KS_AM_Step + ); + {$EXTERNALSYM KS_AM_PROPERTY_TS_RATE_CHANGE} + TKSAMPropertyTSRateChange = KS_AM_PROPERTY_TS_RATE_CHANGE; + + PKSAMSimpleRateChange = ^TKSAMSimpleRateChange; + KS_AM_SimpleRateChange = record + // this is the simplest mechanism to set a time stamp rate change on + // a filter (simplest for the person setting the rate change, harder + // for the filter doing the rate change). + StartTime : TReferenceTime; //stream time at which to start this rate + Rate : Longint; //new rate * 10000 (decimal) + end; + {$EXTERNALSYM KS_AM_SimpleRateChange} + PKS_AM_SimpleRateChange = ^KS_AM_SimpleRateChange; + {$EXTERNALSYM PKS_AM_SimpleRateChange} + TKSAMSimpleRateChange = KS_AM_SimpleRateChange; + + PKSAMExactRateChange = ^TKSAMExactRateChange; + KS_AM_ExactRateChange = record + OutputZeroTime : TReferenceTime; //input TS that maps to zero output TS + Rate : Longint; //new rate * 10000 (decimal) + end; + {$EXTERNALSYM KS_AM_ExactRateChange} + PKS_AM_ExactRateChange = ^KS_AM_ExactRateChange; + {$EXTERNALSYM PKS_AM_ExactRateChange} + TKSAMExactRateChange = KS_AM_ExactRateChange; + + KS_AM_MaxFullDataRate = {$IFDEF TYPE_IDENTITY}type {$ENDIF} Longint; //rate * 10000 (decimal) + {$EXTERNALSYM KS_AM_MaxFullDataRate} + + KS_AM_Step = {$IFDEF TYPE_IDENTITY}type {$ENDIF} DWORD; // number of frame to step + {$EXTERNALSYM KS_AM_Step} + +//=========================================================================== +//ENCODER API DEFINITIONS +//=========================================================================== +const + KSCATEGORY_ENCODER : TGUID = '{19689BF6-C384-48fd-AD51-90E58C79F70B}'; + {$EXTERNALSYM KSCATEGORY_ENCODER} + KSCATEGORY_MULTIPLEXER : TGUID = '{7A5DE1D3-01A1-452c-B481-4FA2B96271E8}'; + {$EXTERNALSYM KSCATEGORY_MULTIPLEXER} +// ENCAPIPARAM_BITRATE : TGUID = '{49CC4C43-CA83-4ad4-A9AF-F3696AF666DF}'; +// ENCAPIPARAM_PEAK_BITRATE : TGUID = '{703F16A9-3D48-44a1-B077-018DFF915D19}'; +// ENCAPIPARAM_BITRATE_MODE : TGUID = '{EE5FB25C-C713-40d1-9D58-C0D7241E250F}'; +// CODECAPI_CHANGELISTS : TGUID = '{62B12ACF-F6B0-47D9-9456-96F22C4E0B9D}'; +// CODECAPI_VIDEO_ENCODER : TGUID = '{7112E8E1-3D03-47EF-8E60-03F1CF537301}'; +// CODECAPI_AUDIO_ENCODER : TGUID = '{B9D19A3E-F897-429C-BC46-8138B7272B2D}'; +// CODECAPI_SETALLDEFAULTS : TGUID = '{6C5E6A7C-ACF8-4F55-A999-1A628109051B}'; +// CODECAPI_ALLSETTINGS : TGUID = '{6A577E92-83E1-4113-ADC2-4FCEC32F83A1}'; +// CODECAPI_SUPPORTSEVENTS : TGUID = '{0581AF97-7693-4DBD-9DCA-3F9EBD6585A1}'; +// CODECAPI_CURRENTCHANGELIST : TGUID = '{1CB14E83-7D72-4657-83FD-47A2C5B9D13D}'; + + {************************************************************************ + * * + * dmksctrl.h -- Definition of IKsControl * + * * + * Copyright (c) 1998-1999 Microsoft Corporation * + * * + * * + * This header file contains the definition of IKsControl, which * + * duplicates definitions from ks.h and ksproxy.h. Your code should * + * include ks.h and ksproxy.h directly if you have them (they are * + * provided in the Windows 98 DDK and will be in the Windows NT 5 * + * SDK). * + * * + ************************************************************************} +// IID_IKsControl : TGUID = (D1:$28F54685;D2:$06FD;D3:$11D2;D4:($B2,$7A,$00,$A0,$C9,$22,$31,$96)); + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IKsControl;'} + {$EXTERNALSYM IKsControl} + IKsControl = interface(IUnknown) + ['{28F54685-06FD-11D2-B27A-00A0C9223196}'] + (*** IKsControl methods ***) + procedure KsProperty(Property_: PKSPROPERTY; PropertyLength: ULONG; PropertyData: Pointer; + DataLength: ULONG; out BytesReturned: ULONG); stdcall; + procedure KsMethod(Method: PKSMETHOD; MethodLength: ULONG; MethodData: Pointer; + DataLength: ULONG; out BytesReturned: ULONG); stdcall; + procedure KsEvent({OPTIONAL}Event: PKSEVENT; EventLength: ULONG; EventData: Pointer; + DataLength: ULONG; out BytesReturned: ULONG); stdcall; + end; + +//------------------------------------------------------------------------------ +// File: BDAMedia.h +// +// Desc: Broadcast Driver Architecture Multimedia Definitions. +// +// Copyright (c) 1996 - 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + +//=========================================================================== +// +// KSProperty Set Structure Definitions for BDA +// +//=========================================================================== + + PKSPBDANodePin = ^TKSPBDANodePin; + KSP_BDA_NODE_PIN = record + Property_ : KSPROPERTY; + ulNodeType : ULONG; + ulInputPinId : ULONG; + ulOutputPinId : ULONG; + end; + {$EXTERNALSYM KSP_BDA_NODE_PIN} + PKSP_BDA_NODE_PIN = ^KSP_BDA_NODE_PIN; + {$EXTERNALSYM PKSP_BDA_NODE_PIN} + TKSPBDANodePin = KSP_BDA_NODE_PIN; + + PKSMBDAPin = ^TKSMBDAPin; + KSM_BDA_PIN = record + Method: KSMETHOD; + case integer of + 0 : (PinId : ULONG; + Reserved : ULONG); + 1 : (PinType : ULONG; + Reserved_ : ULONG); + end; + {$EXTERNALSYM KSM_BDA_PIN} + PKSM_BDA_PIN = ^KSM_BDA_PIN; + {$EXTERNALSYM PKSM_BDA_PIN} + TKSMBDAPin = KSM_BDA_PIN; + + PKSMBDAPinPair = ^TKSMBDAPinPair; + KSM_BDA_PIN_PAIR = record + Method: KSMETHOD; + case integer of + 0 : (InputPinId : ULONG; + OutputPinId : ULONG); + 1 : (InputPinType : ULONG; + OutputPinType : ULONG); + end; + {$EXTERNALSYM KSM_BDA_PIN_PAIR} + PKSM_BDA_PIN_PAIR = ^KSM_BDA_PIN_PAIR; + {$EXTERNALSYM PKSM_BDA_PIN_PAIR} + TKSMBDAPinPair = KSM_BDA_PIN_PAIR; + + PKSPNodeESPID = ^TKSPNodeESPID; + KSP_NODE_ESPID = record + Property_ : TKSPNode; + EsPid : ULONG; + end; + {$EXTERNALSYM KSP_NODE_ESPID} + PKSP_NODE_ESPID = ^KSP_NODE_ESPID; + {$EXTERNALSYM PKSP_NODE_ESPID} + TKSPNodeESPID = KSP_NODE_ESPID; + +//=========================================================================== +// +// BDA Data Range definitions. Includes specifier definitions. +// +//=========================================================================== + +// Antenna Signal Formats +// + + PKSDataRangeBDAAntenna = ^TKSDataRangeBDAAntenna; + KS_DATARANGE_BDA_ANTENNA = record + DataRange : TKSDataRange; + // Antenna specifier can go here if required + // + end; + {$EXTERNALSYM KS_DATARANGE_BDA_ANTENNA} + PKS_DATARANGE_BDA_ANTENNA = ^KS_DATARANGE_BDA_ANTENNA; + {$EXTERNALSYM PKS_DATARANGE_BDA_ANTENNA} + TKSDataRangeBDAAntenna = KS_DATARANGE_BDA_ANTENNA; + +// Transport Formats +// + + PBDATransportInfo = ^TBDATransportInfo; + BDA_TRANSPORT_INFO = record + ulcbPhyiscalPacket : ULONG; // Size, in bytes, of a physical packet + // (e.g. Satellite link payload size. + ulcbPhyiscalFrame : ULONG; // Size, in bytes, of each physical frame + // 0 indicates no HW requirement + ulcbPhyiscalFrameAlignment : ULONG; // Capture buffer alignment in bytes + // 0 and 1 indicate no alignment requirements + AvgTimePerFrame : TReferenceTime ; // Normal ActiveMovie units (100 nS) + end; + {$EXTERNALSYM BDA_TRANSPORT_INFO} + PBDA_TRANSPORT_INFO = ^BDA_TRANSPORT_INFO; + {$EXTERNALSYM PBDA_TRANSPORT_INFO} + TBDATransportInfo = BDA_TRANSPORT_INFO; + + PKSDataRangeBDATransport = ^TKSDataRangeBDATransport; + KS_DATARANGE_BDA_TRANSPORT = record + DataRange : TKSDataRange; + BdaTransportInfo : TBDATransportInfo; + // Transport specifier can go here if required + // + end; + {$EXTERNALSYM KS_DATARANGE_BDA_TRANSPORT} + PKS_DATARANGE_BDA_TRANSPORT = ^KS_DATARANGE_BDA_TRANSPORT; + {$EXTERNALSYM PKS_DATARANGE_BDA_TRANSPORT} + TKSDataRangeBDATransport = KS_DATARANGE_BDA_TRANSPORT; + +//=========================================================================== +// BDA Event Guids +// +// These are sent by the IBroadcastEvent service on the graph. +// To receive, +// 0) Implement IBroadcastEvent in your receiving object - this has one Method on it: Fire() +// 1) QI the graphs service provider for SID_SBroadcastEventService +// for the IID_IBroadcastEvent object +// 2) OR create the event service (CLSID_BroadcastEventService) if not already there +// and register it +// 3) QI that object for it's IConnectionPoint interface (*pCP) +// 4) Advise your object on *pCP (e.g. pCP->Advise(static_cast(this), &dwCookie) +// 5) Unadvise when done.. +// 6) Implement IBroadcastEvent::Fire(GUID gEventID) +// Check for relevant event below and deal with it appropriatly... +//=========================================================================== + +const + EVENTID_TuningChanged : TGUID = '{9D7E6235-4B7D-425d-A6D1-D717C33B9C4C}'; + {$EXTERNALSYM EVENTID_TuningChanged} + EVENTID_CADenialCountChanged : TGUID = '{2A65C528-2249-4070-AC16-00390CDFB2DD}'; + {$EXTERNALSYM EVENTID_CADenialCountChanged} + EVENTID_SignalStatusChanged : TGUID = '{6D9CFAF2-702D-4b01-8DFF-6892AD20D191}'; + {$EXTERNALSYM EVENTID_SignalStatusChanged} + +//=========================================================================== +// +// BDA Stream Format GUIDs +// +//=========================================================================== +const + KSDATAFORMAT_TYPE_BDA_ANTENNA : TGUID = '{71985F41-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_BDA_ANTENNA} + KSDATAFORMAT_SUBTYPE_BDA_MPEG2_TRANSPORT : TGUID = '{F4AEB342-0329-4fdd-A8FD-4AFF4926C978}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_BDA_MPEG2_TRANSPORT} + KSDATAFORMAT_SPECIFIER_BDA_TRANSPORT : TGUID = '{8DEDA6FD-AC5F-4334-8ECF-A4BA8FA7D0F0}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_BDA_TRANSPORT} + KSDATAFORMAT_TYPE_BDA_IF_SIGNAL : TGUID = '{61BE0B47-A5EB-499b-9A85-5B16C07F1258}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_BDA_IF_SIGNAL} + KSDATAFORMAT_TYPE_MPEG2_SECTIONS : TGUID = '{455F176C-4B06-47CE-9AEF-8CAEF73DF7B5}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_MPEG2_SECTIONS} + KSDATAFORMAT_SUBTYPE_ATSC_SI : TGUID = '{B3C7397C-D303-414D-B33C-4ED2C9D29733}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_ATSC_SI} + KSDATAFORMAT_SUBTYPE_DVB_SI : TGUID = '{e9dd31a3-221d-4adb-8532-9af309c1a408}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_DVB_SI} + KSDATAFORMAT_SUBTYPE_BDA_OPENCABLE_PSIP : TGUID = '{762E3F66-336F-48d1-BF83-2B00352C11F0}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_BDA_OPENCABLE_PSIP} + KSDATAFORMAT_SUBTYPE_BDA_OPENCABLE_OOB_PSIP : TGUID = '{951727DB-D2CE-4528-96F6-3301FABB2DE0}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_BDA_OPENCABLE_OOB_PSIP} + +//=========================================================================== +// +// KSPinName Definitions for BDA +// +//=========================================================================== + +// Pin name for a BDA transport pin + PINNAME_BDA_TRANSPORT : TGUID = '{78216A81-CFA8-493e-9711-36A61C08BD9D}'; + {$EXTERNALSYM PINNAME_BDA_TRANSPORT} + +// Pin name for a BDA analog video pin + PINNAME_BDA_ANALOG_VIDEO : TGUID = '{5C0C8281-5667-486c-8482-63E31F01A6E9}'; + {$EXTERNALSYM PINNAME_BDA_ANALOG_VIDEO} + +// Pin name for a BDA analog audio pin + PINNAME_BDA_ANALOG_AUDIO : TGUID = '{D28A580A-9B1F-4b0c-9C33-9BF0A8EA636B}'; + {$EXTERNALSYM PINNAME_BDA_ANALOG_AUDIO} + +// Pin name for a BDA FM Radio pin + PINNAME_BDA_FM_RADIO : TGUID = '{D2855FED-B2D3-4eeb-9BD0-193436A2F890}'; + {$EXTERNALSYM PINNAME_BDA_FM_RADIO} + +// Pin name for a BDA Intermediate Frequency pin + PINNAME_BDA_IF_PIN : TGUID = '{1A9D4A42-F3CD-48a1-9AEA-71DE133CBE14}'; + {$EXTERNALSYM PINNAME_BDA_IF_PIN} + +// Pin name for a BDA Open Cable PSIP pin + PINNAME_BDA_OPENCABLE_PSIP_PIN : TGUID = '{297BB104-E5C9-4ACE-B123-95C3CBB24D4F}'; + {$EXTERNALSYM PINNAME_BDA_OPENCABLE_PSIP_PIN} + +//=========================================================================== +// +// KSProperty Set Definitions for BDA +// +//=========================================================================== + + +//------------------------------------------------------------ +// +// BDA Network Ethernet Filter Property Set + KSPROPSETID_BdaEthernetFilter : TGUID = '{71985F43-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM KSPROPSETID_BdaEthernetFilter} + +type + KSPROPERTY_BDA_ETHERNET_FILTER = ( + KSPROPERTY_BDA_ETHERNET_FILTER_MULTICAST_LIST_SIZE, + KSPROPERTY_BDA_ETHERNET_FILTER_MULTICAST_LIST, + KSPROPERTY_BDA_ETHERNET_FILTER_MULTICAST_MODE + ); + {$EXTERNALSYM KSPROPERTY_BDA_ETHERNET_FILTER} + TKSPropertyBDAEthernetFilter = KSPROPERTY_BDA_ETHERNET_FILTER; + +//------------------------------------------------------------ +// +// BDA Network IPv4 Filter Property Set +// +// {71985F44-1CA1-11d3-9CC8-00C04F7971E0} +// +const + KSPROPSETID_BdaIPv4Filter : TGUID ='{71985F44-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM KSPROPSETID_BdaIPv4Filter} + +type + KSPROPERTY_BDA_IPv4_FILTER = ( + KSPROPERTY_BDA_IPv4_FILTER_MULTICAST_LIST_SIZE, + KSPROPERTY_BDA_IPv4_FILTER_MULTICAST_LIST, + KSPROPERTY_BDA_IPv4_FILTER_MULTICAST_MODE + ); + {$EXTERNALSYM KSPROPERTY_BDA_IPv4_FILTER} + TKSPropertyBDAIPv4Filter = KSPROPERTY_BDA_IPv4_FILTER; +//------------------------------------------------------------ +// +// BDA Network IPv6 Filter Property Set +// +// {E1785A74-2A23-4fb3-9245-A8F88017EF33} +// +const + KSPROPSETID_BdaIPv6Filter : TGUID = '{E1785A74-2A23-4fb3-9245-A8F88017EF33}'; + {$EXTERNALSYM KSPROPSETID_BdaIPv6Filter} + +type + KSPROPERTY_BDA_IPv6_FILTER = ( + KSPROPERTY_BDA_IPv6_FILTER_MULTICAST_LIST_SIZE, + KSPROPERTY_BDA_IPv6_FILTER_MULTICAST_LIST, + KSPROPERTY_BDA_IPv6_FILTER_MULTICAST_MODE + ); + {$EXTERNALSYM KSPROPERTY_BDA_IPv6_FILTER} + TKSPropertyBDAIPv6Filter = KSPROPERTY_BDA_IPv6_FILTER; + +//------------------------------------------------------------ +// BDA Signal Statistics Property Set +// + +const + KSPROPSETID_BdaSignalStats : TGUID = '{1347D106-CF3A-428a-A5CB-AC0D9A2A4338}'; + {$EXTERNALSYM KSPROPSETID_BdaSignalStats} + +type + KSPROPERTY_BDA_SIGNAL_STATS = ( + KSPROPERTY_BDA_SIGNAL_STRENGTH, + KSPROPERTY_BDA_SIGNAL_QUALITY, + KSPROPERTY_BDA_SIGNAL_PRESENT, + KSPROPERTY_BDA_SIGNAL_LOCKED, + KSPROPERTY_BDA_SAMPLE_TIME + ); + {$EXTERNALSYM KSPROPERTY_BDA_SIGNAL_STATS} + TKSPropertyBDASignalStats = KSPROPERTY_BDA_SIGNAL_STATS; + +//------------------------------------------------------------ +// BDA Signal Property Set +// +// {D2F1644B-B409-11d2-BC69-00A0C9EE9E16} + +const + KSPROPSETID_BdaSignal : TGUID = '{D2F1644B-B409-11d2-BC69-00A0C9EE9E16}'; + {$EXTERNALSYM KSPROPSETID_BdaSignal} + +//type +// KSPROPERTY_BDA_SIGNAL = ( +// KSPROPERTY_BDA_SIGNAL_SOURCE, +// KSPROPERTY_BDA_SIGNAL_TUNING_SPACE, +// KSPROPERTY_BDA_SIGNAL_NETWORK_TYPE, +// KSPROPERTY_BDA_SIGNAL_STATE +// ); +// {$NODEFINE KSPROPERTY_BDA_SIGNAL} +// TKSPropertyBDASignal = KSPROPERTY_BDA_SIGNAL; +// {$NODEFINE TKSPropertyBDASignal} + +//------------------------------------------------------------ +// +// +// BDA Change Sync Method Set +// +const + KSMETHODSETID_BdaChangeSync : TGUID = '{FD0A5AF3-B41D-11d2-9C95-00C04F7971E0}'; + {$EXTERNALSYM KSMETHODSETID_BdaChangeSync} + +type + KSMETHOD_BDA_CHANGE_SYNC = ( + KSMETHOD_BDA_START_CHANGES, + KSMETHOD_BDA_CHECK_CHANGES, + KSMETHOD_BDA_COMMIT_CHANGES, + KSMETHOD_BDA_GET_CHANGE_STATE + ); + {$EXTERNALSYM KSMETHOD_BDA_CHANGE_SYNC} + TKSMethodBDAChangeSync = KSMETHOD_BDA_CHANGE_SYNC; + +//------------------------------------------------------------ +// +// +// BDA Device Configuration Method Set +// +const + KSMETHODSETID_BdaDeviceConfiguration : TGUID = '{71985F45-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM KSMETHODSETID_BdaDeviceConfiguration} + +type + KSMETHOD_BDA_DEVICE_CONFIGURATION = ( + KSMETHOD_BDA_CREATE_PIN_FACTORY, + KSMETHOD_BDA_DELETE_PIN_FACTORY, + KSMETHOD_BDA_CREATE_TOPOLOGY + ); + {$EXTERNALSYM KSMETHOD_BDA_DEVICE_CONFIGURATION} + TKSMethodBDADeviceConfiguration = KSMETHOD_BDA_DEVICE_CONFIGURATION; + +//------------------------------------------------------------ +// +// +// BDA Topology Property Set +// +const + KSPROPSETID_BdaTopology : TGUID = '{A14EE835-0A23-11d3-9CC7-00C04F7971E0}'; + {$EXTERNALSYM KSPROPSETID_BdaTopology} + +type + KSPROPERTY_BDA_TOPOLOGY = ( + KSPROPERTY_BDA_NODE_TYPES, + KSPROPERTY_BDA_PIN_TYPES, + KSPROPERTY_BDA_TEMPLATE_CONNECTIONS, + KSPROPERTY_BDA_NODE_METHODS, + KSPROPERTY_BDA_NODE_PROPERTIES, + KSPROPERTY_BDA_NODE_EVENTS, + KSPROPERTY_BDA_CONTROLLING_PIN_ID, + KSPROPERTY_BDA_NODE_DESCRIPTORS + ); + {$EXTERNALSYM KSPROPERTY_BDA_TOPOLOGY} + TKSPropertyBDATopology = KSPROPERTY_BDA_TOPOLOGY; + +//------------------------------------------------------------ +// +// +// BDA Pin Control Property Set +// +// {0DED49D5-A8B7-4d5d-97A1-12B0C195874D} +// +const + KSPROPSETID_BdaPinControl : TGUID = '{0DED49D5-A8B7-4d5d-97A1-12B0C195874D}'; + {$EXTERNALSYM KSPROPSETID_BdaPinControl} + +type + KSPROPERTY_BDA_PIN_CONTROL = ( + KSPROPERTY_BDA_PIN_ID, + KSPROPERTY_BDA_PIN_TYPE + ); + {$EXTERNALSYM KSPROPERTY_BDA_PIN_CONTROL} + TKSPropertyBDAPinControl = KSPROPERTY_BDA_PIN_CONTROL; + +//------------------------------------------------------------ +// +// +// BDA Pin Event Set + +const + KSEVENTSETID_BdaPinEvent : TGUID = '{104781CD-50BD-40d5-95FB-087E0E86A591}'; + {$EXTERNALSYM KSEVENTSETID_BdaPinEvent} + +type + KSPROPERTY_BDA_PIN_EVENT = ( + {$EXTERNALSYM KSPROPERTY_BDA_PIN_EVENT} + KSEVENT_BDA_PIN_CONNECTED, + KSEVENT_BDA_PIN_DISCONNECTED + ); + TKSPropertyBDAPinEvent = KSPROPERTY_BDA_PIN_EVENT; + +//------------------------------------------------------------ +// +// +// BDA Void Transform Property Set +// +const + KSPROPSETID_BdaVoidTransform : TGUID = '{71985F46-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM KSPROPSETID_BdaVoidTransform} + +type + KSPROPERTY_BDA_VOID_TRANSFORM = ( + KSPROPERTY_BDA_VOID_TRANSFORM_START, + KSPROPERTY_BDA_VOID_TRANSFORM_STOP + ); + {$EXTERNALSYM KSPROPERTY_BDA_VOID_TRANSFORM} + TKSPropertyBDAVoidTransform = KSPROPERTY_BDA_VOID_TRANSFORM; + +//------------------------------------------------------------ +// +// +// BDA Null Transform Property Set +// +const + KSPROPSETID_BdaNullTransform : TGUID = '{DDF15B0D-BD25-11d2-9CA0-00C04F7971E0}'; + {$EXTERNALSYM KSPROPSETID_BdaNullTransform} + +type + KSPROPERTY_BDA_NULL_TRANSFORM = ( + KSPROPERTY_BDA_NULL_TRANSFORM_START, + KSPROPERTY_BDA_NULL_TRANSFORM_STOP + ); + {$EXTERNALSYM KSPROPERTY_BDA_NULL_TRANSFORM} + TKSPropertyBDANullTransform = KSPROPERTY_BDA_NULL_TRANSFORM; + +//------------------------------------------------------------ +// +// +// BDA Frequency Filter Property Set +// +const + KSPROPSETID_BdaFrequencyFilter : TGUID = '{71985F47-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM KSPROPSETID_BdaFrequencyFilter} + +type + KSPROPERTY_BDA_FREQUENCY_FILTER = ( + KSPROPERTY_BDA_RF_TUNER_FREQUENCY, + KSPROPERTY_BDA_RF_TUNER_POLARITY, + KSPROPERTY_BDA_RF_TUNER_RANGE, + KSPROPERTY_BDA_RF_TUNER_TRANSPONDER, + KSPROPERTY_BDA_RF_TUNER_BANDWIDTH, + KSPROPERTY_BDA_RF_TUNER_FREQUENCY_MULTIPLIER + ); + {$EXTERNALSYM KSPROPERTY_BDA_FREQUENCY_FILTER} + TKSPropertyBDAFrequencyFilter = KSPROPERTY_BDA_FREQUENCY_FILTER; + + +//------------------------------------------------------------ +// BDA LNB Info Property Set +// +// {992CF102-49F9-4719-A664-C4F23E2408F4} + +const + KSPROPSETID_BdaLNBInfo : TGUID = '{992CF102-49F9-4719-A664-C4F23E2408F4}'; + {$EXTERNALSYM KSPROPSETID_BdaLNBInfo} + +type + KSPROPERTY_BDA_LNB_INFO = ( + KSPROPERTY_BDA_LNB_LOF_LOW_BAND, + KSPROPERTY_BDA_LNB_LOF_HIGH_BAND, + KSPROPERTY_BDA_LNB_SWITCH_FREQUENCY + ); + {$EXTERNALSYM KSPROPERTY_BDA_LNB_INFO} + TKSPropertyBDALNBInfo = KSPROPERTY_BDA_LNB_INFO; + +//------------------------------------------------------------ +// +// +// BDA Digital Demodulator Property Set +// +const + KSPROPSETID_BdaDigitalDemodulator : TGUID = '{EF30F379-985B-4d10-B640-A79D5E04E1E0}'; + {$EXTERNALSYM KSPROPSETID_BdaDigitalDemodulator} + +type + KSPROPERTY_BDA_DIGITAL_DEMODULATOR = ( + KSPROPERTY_BDA_MODULATION_TYPE, + KSPROPERTY_BDA_INNER_FEC_TYPE, + KSPROPERTY_BDA_INNER_FEC_RATE, + KSPROPERTY_BDA_OUTER_FEC_TYPE, + KSPROPERTY_BDA_OUTER_FEC_RATE, + KSPROPERTY_BDA_SYMBOL_RATE, + KSPROPERTY_BDA_SPECTRAL_INVERSION, + KSPROPERTY_BDA_GUARD_INTERVAL, + KSPROPERTY_BDA_TRANSMISSION_MODE + ); + {$EXTERNALSYM KSPROPERTY_BDA_DIGITAL_DEMODULATOR} + TKSPropertyBDADigitalDemodulator = KSPROPERTY_BDA_DIGITAL_DEMODULATOR; + +//------------------------------------------------------------ +// +// +// BDA Table Section Property Set +// +// {516B99C5-971C-4aaf-B3F3-D9FDA8A15E16} +// + +const + KSPROPSETID_BdaTableSection : TGUID = '{516B99C5-971C-4aaf-B3F3-D9FDA8A15E16}'; + {$EXTERNALSYM KSPROPSETID_BdaTableSection} + +type + KSPROPERTY_IDS_BDA_TABLE = ( + KSPROPERTY_BDA_TABLE_SECTION + ); + {$EXTERNALSYM KSPROPERTY_IDS_BDA_TABLE} + TKSPropertyIdsBDATable = KSPROPERTY_IDS_BDA_TABLE; + +//------------------------------------------------------------ +// +// BDA PID Filter Property Set +// +const + KSPROPSETID_BdaPIDFilter : TGUID = '{D0A67D65-08DF-4fec-8533-E5B550410B85}'; + {$EXTERNALSYM KSPROPSETID_BdaPIDFilter} + +type + KSPROPERTY_BDA_PIDFILTER = ( + KSPROPERTY_BDA_PIDFILTER_MAP_PIDS, + KSPROPERTY_BDA_PIDFILTER_UNMAP_PIDS, + KSPROPERTY_BDA_PIDFILTER_LIST_PIDS + ); + {$EXTERNALSYM KSPROPERTY_BDA_PIDFILTER} + TKSPropertyBDAPIDFilter = KSPROPERTY_BDA_PIDFILTER; + +//------------------------------------------------------------ +// +// BDA CA Property Set +// +const + KSPROPSETID_BdaCA : TGUID = '{B0693766-5278-4ec6-B9E1-3CE40560EF5A}'; + {$EXTERNALSYM KSPROPSETID_BdaCA} + +type + KSPROPERTY_BDA_CA = ( + KSPROPERTY_BDA_ECM_MAP_STATUS, + KSPROPERTY_BDA_CA_MODULE_STATUS, + KSPROPERTY_BDA_CA_SMART_CARD_STATUS, + KSPROPERTY_BDA_CA_MODULE_UI, + KSPROPERTY_BDA_CA_SET_PROGRAM_PIDS, + KSPROPERTY_BDA_CA_REMOVE_PROGRAM + ); + {$EXTERNALSYM KSPROPERTY_BDA_CA} + TKSPropertyBDACA = KSPROPERTY_BDA_CA; + +//------------------------------------------------------------ +// +// BDA CA Event Set +// +const + KSEVENTSETID_BdaCAEvent : TGUID = '{488C4CCC-B768-4129-8EB1-B00A071F9068}'; + {$EXTERNALSYM KSEVENTSETID_BdaCAEvent} + +type + KSPROPERTY_BDA_CA_EVENT = ( + KSEVENT_BDA_PROGRAM_FLOW_STATUS_CHANGED, + KSEVENT_BDA_CA_MODULE_STATUS_CHANGED, + KSEVENT_BDA_CA_SMART_CARD_STATUS_CHANGED, + KSEVENT_BDA_CA_MODULE_UI_REQUESTED + ); + {$EXTERNALSYM KSPROPERTY_BDA_CA_EVENT} + TKSPropertyBDACAEvent = KSPROPERTY_BDA_CA_EVENT; + +//=========================================================================== +// +// BDA Filter Categories +// +//=========================================================================== +const + KSCATEGORY_BDA_RECEIVER_COMPONENT : TGUID = '{FD0A5AF4-B41D-11d2-9C95-00C04F7971E0}'; + {$EXTERNALSYM KSCATEGORY_BDA_RECEIVER_COMPONENT} + KSCATEGORY_BDA_NETWORK_TUNER : TGUID = '{71985F48-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM KSCATEGORY_BDA_NETWORK_TUNER} + KSCATEGORY_BDA_NETWORK_EPG : TGUID = '{71985F49-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM KSCATEGORY_BDA_NETWORK_EPG} + KSCATEGORY_BDA_IP_SINK : TGUID = '{71985F4A-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM KSCATEGORY_BDA_IP_SINK} + KSCATEGORY_BDA_NETWORK_PROVIDER : TGUID = '{71985F4B-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM KSCATEGORY_BDA_NETWORK_PROVIDER} + KSCATEGORY_BDA_TRANSPORT_INFORMATION : TGUID = '{A2E3074F-6C3D-11d3-B653-00C04F79498E}'; + {$EXTERNALSYM KSCATEGORY_BDA_TRANSPORT_INFORMATION} + +//=========================================================================== +// +// BDA Node Categories +// +//=========================================================================== + + KSNODE_BDA_RF_TUNER : TGUID = '{71985F4C-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM KSNODE_BDA_RF_TUNER} + KSNODE_BDA_QAM_DEMODULATOR : TGUID = '{71985F4D-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM KSNODE_BDA_QAM_DEMODULATOR} + KSNODE_BDA_QPSK_DEMODULATOR : TGUID = '{6390C905-27C1-4d67-BDB7-77C50D079300}'; + {$EXTERNALSYM KSNODE_BDA_QPSK_DEMODULATOR} + KSNODE_BDA_8VSB_DEMODULATOR : TGUID = '{71985F4F-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM KSNODE_BDA_8VSB_DEMODULATOR} + KSNODE_BDA_OPENCABLE_POD : TGUID = '{D83EF8FC-F3B8-45ab-8B71-ECF7C339DEB4}'; + {$EXTERNALSYM KSNODE_BDA_OPENCABLE_POD} + KSNODE_BDA_PID_FILTER : TGUID = '{F5412789-B0A0-44e1-AE4F-EE999B1B7FBE}'; + {$EXTERNALSYM KSNODE_BDA_PID_FILTER} + KSNODE_BDA_IP_SINK : TGUID = '{71985F4E-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM KSNODE_BDA_IP_SINK} + + KSNODE_BDA_COFDM_DEMODULATOR: TGUID = '{2DAC6E05-EDBE-4b9c-B387-1B6FAD7D6495}'; + {$EXTERNALSYM KSNODE_BDA_COFDM_DEMODULATOR} + KSNODE_BDA_COMMON_CA_POD : TGUID = '{D83EF8FC-F3B8-45ab-8B71-ECF7C339DEB4}'; + {$EXTERNALSYM KSNODE_BDA_COMMON_CA_POD} + +//=========================================================================== +// +// IPSink PINNAME GUID +// +//=========================================================================== + + PINNAME_IPSINK_INPUT : TGUID = '{3fdffa70-ac9a-11d2-8f17-00c04f7971e2}'; + {$EXTERNALSYM PINNAME_IPSINK_INPUT} + +//=========================================================================== +// +// BDA IPSink Categories/Types +// +//=========================================================================== + + KSDATAFORMAT_TYPE_BDA_IP : TGUID = '{e25f7b8e-cccc-11d2-8f25-00c04f7971e2}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_BDA_IP} + KSDATAFORMAT_SUBTYPE_BDA_IP : TGUID = '{5a9a213c-db08-11d2-8f32-00c04f7971e2}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_BDA_IP} + KSDATAFORMAT_SPECIFIER_BDA_IP : TGUID = '{6B891420-DB09-11d2-8F32-00C04F7971E2}'; + {$EXTERNALSYM KSDATAFORMAT_SPECIFIER_BDA_IP} + KSDATAFORMAT_TYPE_BDA_IP_CONTROL : TGUID = '{DADD5799-7D5B-4b63-80FB-D1442F26B621}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_BDA_IP_CONTROL} + KSDATAFORMAT_SUBTYPE_BDA_IP_CONTROL : TGUID = '{499856E8-E85B-48ed-9BEA-410D0DD4EF81}'; + {$EXTERNALSYM KSDATAFORMAT_SUBTYPE_BDA_IP_CONTROL} + +//=========================================================================== +// +// MPE PINNAME GUID +// +//=========================================================================== + + PINNAME_MPE : TGUID = '{C1B06D73-1DBB-11d3-8F46-00C04F7971E2}'; + {$EXTERNALSYM PINNAME_MPE} + +///////////////////////////////////////////////////////////// +// +// BDA MPE Categories/Types +// + KSDATAFORMAT_TYPE_MPE : TGUID = '{455F176C-4B06-47ce-9AEF-8CAEF73DF7B5}'; + {$EXTERNALSYM KSDATAFORMAT_TYPE_MPE} + +//------------------------------------------------------------------------------ +// File: BDAIface.idl +// +// Desc: This file defines the Ring 3 BDA interfaces that are common to +// all BDA network and device types. +// +// The interfaces specific to a particular Network Type or filter +// implementation are defined in a separate include file for that +// Network Type or filter implementation. +// +// Copyright (c) 1999 - 2001, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ + + + + +const + IID_IBDA_NetworkProvider : TGUID = '{fd501041-8ebe-11ce-8183-00aa00577da2}'; + {$EXTERNALSYM IID_IBDA_NetworkProvider} + IID_IBDA_EthernetFilter : TGUID = '{71985F43-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM IID_IBDA_EthernetFilter} + IID_IBDA_IPV4Filter : TGUID = '{71985F44-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM IID_IBDA_IPV4Filter} + IID_IBDA_IPV6Filter : TGUID = '{E1785A74-2A23-4fb3-9245-A8F88017EF33}'; + {$EXTERNALSYM IID_IBDA_IPV6Filter} + IID_IBDA_DeviceControl : TGUID = '{FD0A5AF3-B41D-11d2-9C95-00C04F7971E0}'; + {$EXTERNALSYM IID_IBDA_DeviceControl} + IID_IBDA_PinControl : TGUID = '{0DED49D5-A8B7-4d5d-97A1-12B0C195874D}'; + {$EXTERNALSYM IID_IBDA_PinControl} + IID_IBDA_SignalProperties : TGUID = '{D2F1644B-B409-11d2-BC69-00A0C9EE9E16}'; + {$EXTERNALSYM IID_IBDA_SignalProperties} + IID_IBDA_VoidTransform : TGUID = '{71985F46-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM IID_IBDA_VoidTransform} + IID_IBDA_NullTransform : TGUID = '{DDF15B0D-BD25-11d2-9CA0-00C04F7971E0}'; + {$EXTERNALSYM IID_IBDA_NullTransform} + IID_IBDA_FrequencyFilter : TGUID = '{71985F47-1CA1-11d3-9CC8-00C04F7971E0}'; + {$EXTERNALSYM IID_IBDA_FrequencyFilter} + IID_IBDA_AutoDemodulate : TGUID = '{DDF15B12-BD25-11d2-9CA0-00C04F7971E0}'; + {$EXTERNALSYM IID_IBDA_AutoDemodulate} + IID_IBDA_DigitalDemodulator : TGUID = '{EF30F379-985B-4d10-B640-A79D5E04E1E0}'; + {$EXTERNALSYM IID_IBDA_DigitalDemodulator} + IID_IBDA_IPSinkControl : TGUID = '{3F4DC8E2-4050-11d3-8F4B-00C04F7971E2}'; + {$EXTERNALSYM IID_IBDA_IPSinkControl} + IID_IEnumPIDMap : TGUID = '{afb6c2a2-2c41-11d3-8a60-0000f81e0e4a}'; + {$EXTERNALSYM IID_IEnumPIDMap} + IID_IMPEG2PIDMap : TGUID = '{afb6c2a1-2c41-11d3-8a60-0000f81e0e4a}'; + {$EXTERNALSYM IID_IMPEG2PIDMap} + IID_IBDA_SignalStatistics : TGUID = '{1347D106-CF3A-428a-A5CB-AC0D9A2A4338}'; + {$EXTERNALSYM IID_IBDA_SignalStatistics} + IID_IBDA_Topology : TGUID = '{79B56888-7FEA-4690-B45D-38FD3C7849BE}'; + {$EXTERNALSYM IID_IBDA_Topology} + IID_IBDA_LNBInfo : TGUID = '{992CF102-49F9-4719-A664-C4F23E2408F4}'; + {$EXTERNALSYM IID_IBDA_LNBInfo} + IID_IBDA_IPSinkInfo : TGUID = '{A750108F-492E-4d51-95F7-649B23FF7AD7}'; + {$EXTERNALSYM IID_IBDA_IPSinkInfo} + + IID_IFrequencyMap : TGUID = '{06FB45C1-693C-4ea7-B79F-7A6A54D8DEF2}'; //DX9 + {$EXTERNALSYM IID_IFrequencyMap} + +type + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_NetworkProvider;'} + {$EXTERNALSYM IBDA_NetworkProvider} + IBDA_NetworkProvider = interface(IUnknown) + ['{fd501041-8ebe-11ce-8183-00aa00577da2}'] + (*** IBDA_NetworkProvider methods ***) + function PutSignalSource(ulSignalSource: ULONG): HResult; stdcall; + function GetSignalSource(out pulSignalSource: ULONG): HResult; stdcall; + function GetNetworkType(var pguidNetworkType: TGUID): HResult; stdcall; + function PutTuningSpace(const guidTuningSpace: TGUID): HResult; stdcall; + function GetTuningSpace(out pguidTuingSpace: TGUID): HResult; stdcall; + function RegisterDeviceFilter(pUnkFilterControl: IUnknown; + var ppvRegisitrationContext: ULONG): HResult; stdcall; + function UnRegisterDeviceFilter(pvRegistrationContext: ULONG): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_EthernetFilter;'} + {$EXTERNALSYM IBDA_EthernetFilter} + IBDA_EthernetFilter = interface(IUnknown) + ['{71985F43-1CA1-11d3-9CC8-00C04F7971E0}'] + (*** IBDA_EthernetFilter methods ***) + function GetMulticastListSize(out pulcbAddresses: ULONG): HResult; stdcall; + function PutMulticastList(ulcbAddresses: ULONG; pAddressList: Pointer): HResult; stdcall; + function GetMulticastList(out pulcbAddresses: ULONG; + out pAddressList): HResult; stdcall; + function PutMulticastMode(ulModeMask: ULONG): HResult; stdcall; + function GetMulticastMode(out pulModeMask: ULONG): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_IPV4Filter;'} + {$EXTERNALSYM IBDA_IPV4Filter} + IBDA_IPV4Filter = interface(IUnknown) + ['{71985F44-1CA1-11d3-9CC8-00C04F7971E0}'] + (*** IBDA_IPV4Filter methods ***) + function GetMulticastListSize(out pulcbAddresses: ULONG): HResult; stdcall; + function PutMulticastList(ulcbAddresses: ULONG; pAddressList: Pointer): HResult; stdcall; + function GetMulticastList(var pulcbAddresses: ULONG; out pAddressList): HResult; stdcall; + function PutMulticastMode(ulModeMask: ULONG): HResult; stdcall; + function GetMulticastMode(out pulModeMask: ULONG): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_IPV6Filter;'} + {$EXTERNALSYM IBDA_IPV6Filter} + IBDA_IPV6Filter = interface(IUnknown) + ['{E1785A74-2A23-4fb3-9245-A8F88017EF33}'] + (*** IBDA_IPV6Filter methods ***) + function GetMulticastListSize(out pulcbAddresses: ULONG): HResult; stdcall; + function PutMulticastList(ulcbAddresses: ULONG; pAddressList: Pointer): HResult; stdcall; + function GetMulticastList(var pulcbAddresses: ULONG; out pAddressList): HResult; stdcall; + function PutMulticastMode(ulModeMask: ULONG): HResult; stdcall; + function GetMulticastMode(out pulModeMask: ULONG): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_DeviceControl;'} + {$EXTERNALSYM IBDA_DeviceControl} + IBDA_DeviceControl = interface(IUnknown) + ['{FD0A5AF3-B41D-11d2-9C95-00C04F7971E0}'] + (*** IBDA_DeviceControl methods ***) + function StartChanges : HResult; stdcall; + function CheckChanges : HResult; stdcall; + function CommitChanges : HResult; stdcall; + function GetChangeState(var pState: ULONG): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_PinControl;'} + {$EXTERNALSYM IBDA_PinControl} + IBDA_PinControl = interface(IUnknown) + ['{0DED49D5-A8B7-4d5d-97A1-12B0C195874D}'] + (*** IBDA_PinControl methods ***) + function GetPinID(var pulPinID: ULONG): HResult; stdcall; + function GetPinType(var pulPinType: ULONG): HResult; stdcall; + function RegistrationContext(var pulRegistrationCtx: ULONG): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_SignalProperties;'} + {$EXTERNALSYM IBDA_SignalProperties} + IBDA_SignalProperties = interface(IUnknown) + ['{D2F1644B-B409-11d2-BC69-00A0C9EE9E16}'] + (*** IBDA_SignalProperties methods ***) + function PutNetworkType(const guidNetworkType: TGUID): HResult; stdcall; + function GetNetworkType(out pguidNetworkType: TGUID): HResult; stdcall; + function PutSignalSource(ulSignalSource: ULONG): HResult; stdcall; + function GetSignalSource(out pulSignalSource: ULONG): HResult; stdcall; + function PutTuningSpace(const guidTuningSpace: TGUID): HResult; stdcall; + function GetTuningSpace(out pguidTuingSpace: TGUID): HResult; stdcall; + end; + + //--------------------------------------------------------------------- + // + // IBDA_SignalStatistics interface + // + // Implemented by a BDA Control Node + // + // A BDA Control Node may return these properties to describe + // the condition of a signal that is being received. + // + //--------------------------------------------------------------------- + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_SignalStatistics;'} + {$EXTERNALSYM IBDA_SignalStatistics} + IBDA_SignalStatistics = interface(IUnknown) + ['{1347D106-CF3A-428a-A5CB-AC0D9A2A4338}'] + (*** IBDA_SignalStatistics methods ***) + function put_SignalStrength(lDbStrength: LongInt): HResult; stdcall; + function get_SignalStrength(out plDbStrength: LongInt): HResult; stdcall; + function put_SignalQuality(lPercentQuality: LongInt): HResult; stdcall; + function get_SignalQuality(out lPercentQuality: LongInt): HResult; stdcall; + function put_SignalPresent(fPresent: BOOL): HResult; stdcall; + function get_SignalPresent(out fPresent: BOOL): HResult; stdcall; + function put_SignalLocked(fLocked: BOOL): HResult; stdcall; + function get_SignalLocked(out pfLocked: BOOL): HResult; stdcall; + function put_SampleTime(lmsSampleTime: LongInt): HResult; stdcall; + function get_SampleTime(out plmsSampleTime: LongInt): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_Topology;'} + {$EXTERNALSYM IBDA_Topology} + IBDA_Topology = interface(IUnknown) + ['{79B56888-7FEA-4690-B45D-38FD3C7849BE}'] + (*** IBDA_Topology methods ***) + function GetNodeTypes(var pulcNodeTypes: ULONG; ulcNodeTypesMax: ULONG; + rgulNodeTypes: PULONG): HResult; stdcall; + function GetNodeDescriptors(var ulcNodeDescriptors: ULONG; ulcNodeDescriptorsMax: ULONG; + rgNodeDescriptors: PBDANodeDescriptor): HResult; stdcall; + function GetNodeInterfaces(ulNodeType: ULONG; var pulcInterfaces: ULONG; + ulcInterfacesMax: ULONG; rgguidInterfaces: PGUID): HResult; stdcall; + function GetPinTypes(var pulcPinTypes: ULONG; ulcPinTypesMax: ULONG; + rgulPinTypes: PULONG): HResult; stdcall; + function GetTemplateConnections(var pulcConnections: ULONG; ulcConnectionsMax: ULONG; + rgConnections: PBDATemplateConnection): HResult; stdcall; + function CreatePin(ulPinType: ULONG; var pulPinId: ULONG): HResult; stdcall; + function DeletePin(ulPinId: ULONG): HResult; stdcall; + function SetMediaType(ulPinId :ULONG; pMediaType: PAMMediaType): HResult; stdcall; + function SetMedium(ulPinId: ULONG; pMedium: PREGPINMEDIUM): HResult; stdcall; + function CreateTopology(ulInputPinId, ulOutputPinId: ULONG): HResult; stdcall; + function GetControlNode(ulInputPinId, ulOutputPinId, ulNodeType: ULONG; + out ppControlNode: IUnknown): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_VoidTransform;'} + {$EXTERNALSYM IBDA_VoidTransform} + IBDA_VoidTransform = interface(IUnknown) + ['{71985F46-1CA1-11d3-9CC8-00C04F7971E0}'] + (*** IBDA_VoidTransform methods ***) + function Start: HResult; stdcall; + function Stop: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_NullTransform;'} + {$EXTERNALSYM IBDA_NullTransform} + IBDA_NullTransform = interface(IUnknown) + ['{DDF15B0D-BD25-11d2-9CA0-00C04F7971E0}'] + (*** IBDA_NullTransform methods ***) + function Start: HResult; stdcall; + function Stop: HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_FrequencyFilter;'} + {$EXTERNALSYM IBDA_FrequencyFilter} + IBDA_FrequencyFilter = interface(IUnknown) + ['{71985F47-1CA1-11d3-9CC8-00C04F7971E0}'] + (*** IBDA_FrequencyFilter methods ***) + function put_Autotune(pulTransponder: ULONG): HResult; stdcall; + function get_Autotune(out pulTransponder: ULONG): HResult; stdcall; + function put_Frequency(pulFrequency: ULONG): HResult; stdcall; + function get_Frequency(out pulFrequency: ULONG): HResult; stdcall; + function put_Polarity(pulPolarity: Polarisation): HResult; stdcall; + function get_Polarity(out pulPolarity: Polarisation): HResult; stdcall; + function put_Range(pulRange: ULONG): HResult; stdcall; + function get_Range(out pulRange: ULONG): HResult; stdcall; + function put_Bandwidth(ulBandwidth: ULONG): HResult; stdcall; + function get_Bandwidth(out pulBandwidth: ULONG): HResult; stdcall; + function put_FrequencyMultiplier(ulMultiplier: ULONG): HResult; stdcall; + function get_FrequencyMultiplier(out pulMultiplier: ULONG): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_LNBInfo;'} + {$EXTERNALSYM IBDA_LNBInfo} + IBDA_LNBInfo = interface(IUnknown) + ['{992CF102-49F9-4719-A664-C4F23E2408F4}'] + (*** IBDA_LNBInfo methods ***) + function put_LocalOscilatorFrequencyLowBand(ulLOFLow: ULONG): HResult; stdcall; + function get_LocalOscilatorFrequencyLowBand(out pulLOFLow: ULONG): HResult; stdcall; + function put_LocalOscilatorFrequencyHighBand(ulLOFHigh: ULONG): HResult; stdcall; + function get_LocalOscilatorFrequencyHighBand(out pulLOFHigh: ULONG): HResult; stdcall; + function put_HighLowSwitchFrequency(ulSwitchFrequency: ULONG): HResult; stdcall; + function get_HighLowSwitchFrequency(out pulSwitchFrequency: ULONG): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_AutoDemodulate;'} + {$EXTERNALSYM IBDA_AutoDemodulate} + IBDA_AutoDemodulate = interface(IUnknown) + ['{DDF15B12-BD25-11d2-9CA0-00C04F7971E0}'] + (*** IBDA_AutoDemodulate methods ***) + function put_AutoDemodulate : HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_DigitalDemodulator;'} + {$EXTERNALSYM IBDA_DigitalDemodulator} + IBDA_DigitalDemodulator = interface(IUnknown) + ['{EF30F379-985B-4d10-B640-A79D5E04E1E0}'] + (*** IBDA_DigitalDemodulator methods ***) + function put_ModulationType(var pModulationType: ModulationType): HResult; stdcall; + function get_ModulationType(out pModulationType: ModulationType): HResult; stdcall; + function put_InnerFECMethod(var pFECMethod: FECMethod): HResult; stdcall; + function get_InnerFECMethod(out pFECMethod: FECMethod): HResult; stdcall; + function put_InnerFECRate(var pFECRate: BinaryConvolutionCodeRate): HResult; stdcall; + function get_InnerFECRate(out pFECRate: BinaryConvolutionCodeRate): HResult; stdcall; + function put_OuterFECMethod(var pFECMethod: FECMethod): HResult; stdcall; + function get_OuterFECMethod(out pFECMethod: FECMethod): HResult; stdcall; + function put_OuterFECRate(var pFECRate: BinaryConvolutionCodeRate): HResult; stdcall; + function get_OuterFECRate(out pFECRate: BinaryConvolutionCodeRate): HResult; stdcall; + function put_SymbolRate(var pSymbolRate: ULONG): HResult; stdcall; + function get_SymbolRate(out pSymbolRate: ULONG): HResult; stdcall; + function put_SpectralInversion(var pSpectralInversion: SpectralInversion): HResult; stdcall; + function get_SpectralInversion(out pSpectralInversion: SpectralInversion): HResult; stdcall; + end; + + KSPROPERTY_IPSINK = ( + KSPROPERTY_IPSINK_MULTICASTLIST, + KSPROPERTY_IPSINK_ADAPTER_DESCRIPTION, + KSPROPERTY_IPSINK_ADAPTER_ADDRESS + ); + {$EXTERNALSYM KSPROPERTY_IPSINK} + TKSPropertyIPSink = KSPROPERTY_IPSINK; + + //--------------------------------------------------------------------- + // IBDA_IPSinkControl interface (mutlimedia\filters.ks\ipsink) + // IBDA_IPSinkInfo interface + // + // IBDA_IPSinkControl is no longer being supported for Ring3 clients. + // Use the BDA_IPSinkInfo interface instead. + //--------------------------------------------------------------------- + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_IPSinkControl;'} + {$EXTERNALSYM IBDA_IPSinkControl} + IBDA_IPSinkControl = interface(IUnknown) + ['{3F4DC8E2-4050-11d3-8F4B-00C04F7971E2}'] + (*** IBDA_IPSinkControl methods ***) + function GetMulticastList(var pulcbSize: ULONG; pbBuffer: Pointer): HResult; stdcall; + function GetAdapterIPAddress(var pulcbSize: ULONG; pbBuffer: Pointer): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_IPSinkInfo;'} + {$EXTERNALSYM IBDA_IPSinkInfo} + IBDA_IPSinkInfo = interface(IUnknown) + ['{A750108F-492E-4d51-95F7-649B23FF7AD7}'] + (*** IBDA_IPSinkInfo methods ***) + // returns N 6-byte 802.3 IP addreses. + function get_MulticastList(pulcbAddresses: PULONG; // 6*N + out ppbAddressList: PBYTE // Allocated by caller, must deallocate in callee with CoTaskMemFree() + ): HResult; stdcall; + function get_AdapterIPAddress(out pbstrBuffer: WideString): HResult; stdcall; + function get_AdapterDescription(out pbstrBuffer: WideString): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IEnumPIDMap;'} + {$EXTERNALSYM IEnumPIDMap} + IEnumPIDMap = interface(IUnknown) + ['{afb6c2a2-2c41-11d3-8a60-0000f81e0e4a}'] + (*** IEnumPIDMap methods ***) + function Next(cRequest: ULONG; PIDMap: PPIDMap; out pcReceived: ULONG): HResult; stdcall; + function Skip(cRecords: ULONG): HResult; stdcall; + function Reset: HResult; stdcall; + function Clone(out ppIEnumPIDMap: IEnumPIDMap): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMPEG2PIDMap;'} + {$EXTERNALSYM IMPEG2PIDMap} + IMPEG2PIDMap = interface(IUnknown) + ['{afb6c2a1-2c41-11d3-8a60-0000f81e0e4a}'] + (*** IMPEG2PIDMap methods ***) + function MapPID(culPID: ULONG; pulPID: PULONG; + MediaSampleContent: TMediaSampleContent): HResult; stdcall; + function UnmapPID(culPID: ULONG; pulPID: PULONG): HResult; stdcall; + function EnumPIDMap(out pIEnumPIDMap: IEnumPIDMap): HResult; stdcall; + end; + +//--------------------------------------------------------------------- +// IFrequencyMap interface +// Currently implemented on the TIF. The interface can be QIed on the NP +//--------------------------------------------------------------------- + // DirectX9 Specific + {$HPPEMIT 'typedef System::DelphiInterface _di_IFrequencyMap;'} + {$EXTERNALSYM IFrequencyMap} + IFrequencyMap = interface(IUnknown) + ['{06FB45C1-693C-4ea7-B79F-7A6A54D8DEF2}'] + (*** IFrequencyMap methods ***) + function get_FrequencyMapping(out ulCount: ULONG; out ppulList: PULONG): HResult; stdcall; + function put_FrequencyMapping(ulCount: ULONG; pList: PULONG): HResult; stdcall; + function get_CountryCode(out pulCountryCode: ULONG): HResult; stdcall; + function put_CountryCode(ulCountryCode: ULONG): HResult; stdcall; + function get_DefaultFrequencyMapping(ulCountryCode: ULONG; out pulCount: ULONG; + out ppulList: PULONG): HResult; stdcall; + function get_CountryCodeList(out pulCount: ULONG; out ppulList: PULONG): HResult; stdcall; + end; + +//--------------------------------------------------------------------- +// +// Copyright (c) 1999-2001 Microsoft Corporation +// +// BDATIF.idl +// +//--------------------------------------------------------------------- + +const + IID_IMPEG2_TIF_CONTROL : TGUID = '{F9BAC2F9-4149-4916-B2EF-FAA202326862}'; + {$EXTERNALSYM IID_IMPEG2_TIF_CONTROL} + IID_ITuneRequestInfo : TGUID = '{A3B152DF-7A90-4218-AC54-9830BEE8C0B6}'; + {$EXTERNALSYM IID_ITuneRequestInfo} + IID_IGuideDataEvent : TGUID = '{EFDA0C80-F395-42c3-9B3C-56B37DEC7BB7}'; + {$EXTERNALSYM IID_IGuideDataEvent} + IID_IGuideDataProperty : TGUID = '{88EC5E58-BB73-41d6-99CE-66C524B8B591}'; + {$EXTERNALSYM IID_IGuideDataProperty} + IID_IEnumGuideDataProperties : TGUID = '{AE44423B-4571-475c-AD2C-F40A771D80EF}'; + {$EXTERNALSYM IID_IEnumGuideDataProperties} + IID_IEnumTuneRequests : TGUID = '{1993299C-CED6-4788-87A3-420067DCE0C7}'; + {$EXTERNALSYM IID_IEnumTuneRequests} + IID_IGuideData : TGUID = '{61571138-5B01-43cd-AEAF-60B784A0BF93}'; + {$EXTERNALSYM IID_IGuideData} + IID_IGuideDataLoader : TGUID = '{4764ff7c-fa95-4525-af4d-d32236db9e38}'; + {$EXTERNALSYM IID_IGuideDataLoader} + IID_IBDA_TIF_REGISTRATION : TGUID = '{DFEF4A68-EE61-415f-9CCB-CD95F2F98A3A}'; // DX9 + {$EXTERNALSYM IID_IBDA_TIF_REGISTRATION} + + LIBID_PSISLOAD : TGUID = '{8224A083-7F8C-432D-B83E-3C5E9BDE3528}'; + {$EXTERNALSYM LIBID_PSISLOAD} + CLSID_TIFLoad : TGUID = '{14EB8748-1753-4393-95AE-4F7E7A87AAD6}';// default interface IGuideDataEvent + {$EXTERNALSYM CLSID_TIFLoad} + + +//****************************************************************************** +// +// IBDA_TIF_REGISTRATION interface +// +// Implemented by the Microsoft ATSC/DVB BDA Network Provider +// +// Used by a transport information filter (TIF) to Register with the NP +// AND obtain an Interface to the Demux to set/ Remove PIDs.The TIF here passes +// IUNKNOWN of the pin it is connecting to and obtains the IMPEG2PIDMAP interface +// implemented by the NP to Map/ UnMap pids. +// +type + // DirectX9 Specific + {$HPPEMIT 'typedef System::DelphiInterface _di_IBDA_TIF_REGISTRATION;'} + {$EXTERNALSYM IBDA_TIF_REGISTRATION} + IBDA_TIF_REGISTRATION = interface(IUnknown) + ['{DFEF4A68-EE61-415f-9CCB-CD95F2F98A3A}'] + (*** IBDA_TIF_REGISTRATION methods ***) + // Used to register a transport analyzer with the Network Provider. + function RegisterTIFEx(pTIFInputPin: IPin; out ppvRegistrationContext: ULONG; + out ppMpeg2DataControl: IUnknown): HResult; stdcall; + // Used to unregister TIF with the Network Provider. + function UnregisterTIF(pvRegistrationContext: ULONG): HResult; stdcall; + end; + + +//****************************************************************************** +// +// IMPEG2_TIF_CONTROL interface +// +// Implemented by the Microsoft ATSC/DVB BDA Network Provider +// +// Used by a transport information filter (TIF) to request table +// sections carried on specific PIDs within the transport stream. +// The Network Provider Filter will, in turn, do the necessary +// control on the Demux Filter. All sections are delivered as comlete +// mpeg2 table sections via the TIF's connection to the Demux Filter. +// + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMPEG2_TIF_CONTROL;'} + {$EXTERNALSYM IMPEG2_TIF_CONTROL} + IMPEG2_TIF_CONTROL = interface(IUnknown) + ['{F9BAC2F9-4149-4916-B2EF-FAA202326862}'] + (*** IMPEG2_TIF_CONTROL methods ***) + // Used to register a transport analyzer with the Network Provider + function RegisterTIF(pUnkTIF: IUnknown; out ppvRegistrationContext: ULONG): HResult; stdcall; + // Used to unregister TIF with the Network Provider + function UnregisterTIF(pvRegistrationContext: ULONG): HResult; stdcall; + // Used to add PSI/SI MPEG2 packet IDs to the TIF's data stream + function AddPIDs(ulcPIDs: ULONG; pulPIDs: array of ULONG): HResult; stdcall; + // Used to remove PSI/SI MPEG2 packet IDs from the TIF's data stream + function DeletePIDs(ulcPIDs: ULONG; pulPIDs: array of ULONG): HResult; stdcall; + // Returns the number of MPEG2 Packet IDs being filtered into the TIF's input data. + function GetPIDCount(out pulcPIDs: ULONG): HResult; stdcall; + // Returns the the list of MPEG2 Packet IDs being filtered into the TIF's input data. + function GetPIDs(out pulcPIDs: ULONG; pulPIDs: array of ULONG): HResult; stdcall; + end; + + +//****************************************************************************** +// +// ITuneRequestInfo interface +// +// Implemented by a BDA transport information filter (TIF) +// +// Used by the BDA Network Provider to obtain network specific +// information about locating transport streams and aquiring +// services. +// +// GetLocatorData - +// GetComponentData - +// CreateComponentList - +// GetNextService - +// GetPreviouService - +// GetNextLocator - +// GetPreviousLocator - + + {$HPPEMIT 'typedef System::DelphiInterface _di_ITuneRequestInfo;'} + {$EXTERNALSYM ITuneRequestInfo} + ITuneRequestInfo = interface(IUnknown) + ['{A3B152DF-7A90-4218-AC54-9830BEE8C0B6}'] + (*** ITuneRequestInfo methods ***) + // TIF fills in channel/program locator information for the given tune request. + function GetLocatorData(Request: ITuneRequest): HResult; stdcall; + // TIF fills in all network specific component data for the existing component + // list on the given tune request. + function GetComponentData(CurrentRequest: ITuneRequest): HResult; stdcall; + // TIF creates a complete component list and fills in all network specific + // component data on the given tune request + function CreateComponentList(CurrentRequest: ITuneRequest): HResult; stdcall; + // TIF creates a new TuneRequest with channel/program locator information + // for the next service. + function GetNextProgram(CurrentRequest: ITuneRequest; out TuneRequest: ITuneRequest): HResult; stdcall; + // TIF creates a new TuneRequest with channel/program locator information + // for the previous service. + function GetPreviousProgram(CurrentRequest: ITuneRequest; out TuneRequest: ITuneRequest): HResult; stdcall; + // TIF creates a new TuneRequest with locator information for the next transport stream. + function GetNextLocator(CurrentRequest: ITuneRequest; out TuneRequest: ITuneRequest): HResult; stdcall; + // TIF creates a new TuneRequest with locator information for the previous transport stream. + function GetPreviousLocator(CurrentRequest: ITuneRequest; out TuneRequest: ITuneRequest): HResult; stdcall; + end; + +//****************************************************************************** +// +// IGuideDataEvent +// +// This is the guide data event notification callback interface. The +// callback interface is registered on a transport analyzer's +// IConnectionPoint by the event consumer. +// +// The event consumer MUST NOT BLOCK THE CALLING THREAD. +// +// If the consumer requires additional information about the event, it +// should queue the event to a separate thread. +// +// {EFDA0C80-F395-42c3-9B3C-56B37DEC7BB7} +// + + {$HPPEMIT 'typedef System::DelphiInterface _di_IGuideDataEvent;'} + {$EXTERNALSYM IGuideDataEvent} + IGuideDataEvent = interface(IUnknown) + ['{EFDA0C80-F395-42c3-9B3C-56B37DEC7BB7}'] + (*** IGuideDataEvent methods ***) + // Indicates that a complete set of guide data has been acquire from + // the current transport stream. + // + // MANDATORY - If a transport analyzer supports IGuideDataEvent then + // it must supply this event. + // + function GuideDataAcquired: HResult; stdcall; + + // Indicates that information about one or more programs changed. + // + // If varProgramDescriptionID is NULL then the consumer + // must get properties for all programs to determine which ones + // changed. + // + // MANDATORY - If a transport analyzer supports IGuideDataEvent then + // it must supply this event. + // + function ProgramChanged(varProgramDescriptionID: OLEVARIANT): HResult; stdcall; + // Indicates that information about one or more services changed. + // + // If varServiceDescriptionID is NULL then the consumer + // must get properties for all services to determine which ones + // changed. + // + // MANDATORY - If a transport analyzer supports IGuideDataEvent then + // it must supply this event. + // + function ServiceChanged(varServiceDescriptionID: OLEVARIANT): HResult; stdcall; + // Indicates that information about one or more schedule entries + // changed. + // + // If varScheduleEntryDescriptionID is NULL then the consumer + // must get properties for all schedule entries to determine which ones + // changed. + // + // MANDATORY - If a transport analyzer supports IGuideDataEvent then + // it must supply this event. + // + function ScheduleEntryChanged(varScheduleEntryDescriptionID: OLEVARIANT): HResult; stdcall; + // Indicates that the program with the given Description.ID + // has been deleted. + // + // + // Optional - Transport analyzer may supply this event. Consumer + // may return E_NOTIMPL. + // + function ProgramDeleted(varProgramDescriptionID: OLEVARIANT): HResult; stdcall; + // Indicates that the service with the given Description.ID + // has been deleted. + // + // + // Optional - Transport analyzer may supply this event. Consumer + // may return E_NOTIMPL. + // + function ServiceDeleted(varServiceDescriptionID: OLEVARIANT): HResult; stdcall; + // Indicates that the schedule entry with the given Description.ID + // has been deleted. + // + // + // Optional - Transport analyzer may supply this event. Consumer + // may return E_NOTIMPL. + // + function ScheduleDeleted(varScheduleEntryDescriptionID: OLEVARIANT): HResult; stdcall; + end; + +//****************************************************************************** +// +// IGuideDataPropery +// +// {88EC5E58-BB73-41d6-99CE-66C524B8B591} +// +// interface provided by a transport analyzer to represent a guide data property. + + {$HPPEMIT 'typedef System::DelphiInterface _di_IGuideDataProperty;'} + {$EXTERNALSYM IGuideDataProperty} + IGuideDataProperty = interface(IUnknown) + ['{88EC5E58-BB73-41d6-99CE-66C524B8B591}'] + (*** IGuideDataProperty methods ***) + function Name(out pbstrName: TBSTR): HResult; stdcall; + function Language(out idLang: longint): HResult; stdcall; + function Value(out pvar: OLEVARIANT): HResult; stdcall; + end; + +//****************************************************************************** +// +// IEnumGuideDataProperties +// +// {AE44423B-4571-475c-AD2C-F40A771D80EF} +// +// Interface provided by a transport analyzer to enumerate guide data properties. + + {$HPPEMIT 'typedef System::DelphiInterface _di_IEnumGuideDataProperties;'} + {$EXTERNALSYM IEnumGuideDataProperties} + IEnumGuideDataProperties = interface(IUnknown) + ['{AE44423B-4571-475c-AD2C-F40A771D80EF}'] + (*** IEnumGuideDataProperties methods ***) + function Next(celt: ULONG; out ppprop: IGuideDataProperty ; out pcelt: ULONG): HResult; stdcall; + function Skip(celt: ULONG): HResult; stdcall; + function Reset: HResult; stdcall; + function Clone(out ppenum: IEnumGuideDataProperties): HResult; stdcall; + end; + +//****************************************************************************** +// +// IEnumTuneRequests +// +// {1993299C-CED6-4788-87A3-420067DCE0C7} +// +// Interface provided by a transport analyzer to enumerate service tune requests + + {$HPPEMIT 'typedef System::DelphiInterface _di_IEnumTuneRequests;'} + {$EXTERNALSYM IEnumTuneRequests} + IEnumTuneRequests = interface(IUnknown) + ['{1993299C-CED6-4788-87A3-420067DCE0C7}'] + (*** IEnumTuneRequests methods ***) + function Next(celt: ULONG; out ppprop: ITuneRequest; out pcelt: ULONG): HResult; stdcall; + function Skip(celt: ULONG): HResult; stdcall; + function Reset: HResult; stdcall; + function Clone(out ppenum: IEnumTuneRequests): HResult; stdcall; + end; + +//****************************************************************************** +// +// IGuideData +// +// {61571138-5B01-43cd-AEAF-60B784A0BF93} +// +// Interface provided by a transport analyzer to supply guide data information. + + {$HPPEMIT 'typedef System::DelphiInterface _di_IGuideData;'} + {$EXTERNALSYM IGuideData} + IGuideData = interface(IUnknown) + ['{61571138-5B01-43cd-AEAF-60B784A0BF93}'] + (*** IGuideData methods ***) + //------------------------------------------------------------------------- + // + // GetServices + // Returns an enumeration of tune requests for all services whose + // information is found in the current transport stream. + // + // Parameters + // + // IEnumTuneRequests ** + // Location in which a reference to the resulting + // IEnumTuneRequests is placed. The caller must release + // this reference when finished with it. + // + // Comments + // This call is used to enumerate all services whose information + // can be found in the service descriptor table. Each tune request + // in the IEnumTuneRequest * contains the tune request including the + // locator data for the service. + // + // Returns an enumeration of services whose information is found in the given transport stream + function GetServices(out ppEnumTuneRequests: IEnumTuneRequests): HResult; stdcall; + + //------------------------------------------------------------------------- + // + // GetServiceProperties + // Returns an enumeration of all guide data properties for + // the service with the given Description.ID. + // + // Parameters + // ITuneRequest * + // Pointer to a tune request that contains information needed + // to indentify the requested transport stream. + // A NULL ITuneRequest * indicates that information about the + // current transport stream is requested. + // + // IEnumGuideDataProperties ** + // Location in which a reference to the resulting + // IEnumGuideDataProperties is placed. The caller must release + // this reference when finished with it. + // + // Required Properties + // The following properties MUST be included in the returned + // property enumeration. + // + // Description.ID + // Uniquely identifies a service. + // + // Description.Name + // The default name to use for this service in the channel lineup. + // + // Description.Version + // Identifies the current version of the properties associated + // with this service. + // + // Provider.Name + // Name of the service provider (e.g. "KCTS") + // + // Provider.NetworkName + // Name of the network on which the service is provided. + // (e.g. "PBS") + // + // Service.TuneRequest + // Contains a tune request in the variant + // + // + // Returns an enumeration of all guide data properties for the service specified by a tune request. + function GetServiceProperties(pTuneRequest: ITuneRequest; out ppEnumProperties: IEnumGuideDataProperties): HResult; stdcall; + + //------------------------------------------------------------------------- + // + // GetProgramIDs + // Returns an enumeration of the unique identifiers (Description.ID) + // of programs with description contained in all transport + // streams + // + // Parameters + // + // IEnumVARIANT ** + // Location in which a reference to the resulting + // IEnumVARIANT is placed. The caller must release + // this reference when finished with it. + // + // Comments + // This call is used to get a list of programs that have + // guide data properties in all transport streams. + // Each variant returned in the IEnumVARIANT * contains the + // unique Description.ID property for a program. + // Note that more than on transport stream may contain properties + // for the same program. In this case the properties should be + // merged. + // + // Returns an enumeration of the Description.ID property for all programs on + // the given transport stream. + + function GetGuideProgramIDs(out pEnumPrograms: IEnumVARIANT): HResult; stdcall; + + //------------------------------------------------------------------------- + // + // GetProgramProperties + // Returns an enumeration of all guide data properties for + // the program with the given Description.ID. + // + // Parameters + // varProgramDescriptionID + // Variant containing the unique identifier for the program + // for which properties are requested. + // + // IEnumGuideDataProperties ** + // Location in which a reference to the resulting + // IEnumGuideDataProperties is placed. The caller must release + // this reference when finished with it. + // + // Required Properties + // The following properties MUST be included in the returned + // property enumeration. + // + // Description.ID + // Uniquely identifies a program. + // + // Description.Version + // Identifies the current version of the properties associated + // with this program. + // + // Description.Title + // Human readable title of the program (e.g. "") + // + // Description.Long + // A description of the program. + // + // Returns an enumeration of all guide data properties for the program with + // the given Description.ID. + + function GetProgramProperties(varProgramDescriptionID: OLEVARIANT; + out ppEnumProperties: IEnumGuideDataProperties): HResult; stdcall; + + //------------------------------------------------------------------------- + // + // GetScheduleIDs + // Returns an enumeration of the unique identifiers (Description.ID) + // transport of schedule entries with description contained in the + // given transport stream. + // + // Parameters + // + // IEnumVARIANT ** + // Location in which a reference to the resulting + // IEnumVARIANT is placed. The caller must release + // this reference when finished with it. + // + // Comments + // This call is used to get a list of schedule entries that have + // guide data properties in all transport streams. + // Each variant returned in the IEnumVARIANT * contains the + // unique Description.ID property for a schedule entry. + // Note that more than on transport stream may contain properties + // for the same schedule entry. In this case the properties + // should be merged. + // + // Returns an enumeration of the Description.ID property for all schedule + // entries in the transport stream specified by a tune request. + function GetScheduleEntryIDs(out pEnumScheduleEntries: IEnumVARIANT): HResult; stdcall; + + //------------------------------------------------------------------------- + // + // GetScheduleEntryProperties + // Returns an enumeration of all guide data properties for + // the schedule entry with the given Description.ID. + // + // Parameters + // varScheduleEntryDescriptionID + // Variant containing the unique identifier for the schedule + // entry for which properties are requested. + // + // IEnumGuideDataProperties ** + // Location in which a reference to the resulting + // IEnumGuideDataProperties is placed. The caller must release + // this reference when finished with it. + // + // Required Properties + // The following properties MUST be included in the returned + // property enumeration. + // + // Description.ID + // Uniquely identifies a schedule entry. + // + // Description.Version + // Identifies the current version of the properties associated + // with this program. + // + // Time.Start + // The starting time and date of this schedule entry. + // + // Time.End + // The ending time and date of this schedule entry. + // + // Schedule.Program + // The Description.ID of the program that will play at the + // time specified by this schedule entry. + // + // Schedule.Service + // The Description.ID of the Service that carries the + // program that will play at the time specified by this + // schedule entry. + // + // Returns an enumeration of all guide data properties for the schedule + // entry with the given Description.ID.")] + function GetScheduleEntryProperties(varScheduleEntryDescriptionID: OLEVARIANT; + out ppEnumProperties: IEnumGuideDataProperties): HResult; stdcall; + end; + +//****************************************************************************** +// +// IGuideDataLoader +// +// All Guide Data Loaders MUST implement this interface. It is how they are +// provided with the IGuideData interface that they will use. +// +// + + {$HPPEMIT 'typedef System::DelphiInterface _di_IGuideDataLoader;'} + {$EXTERNALSYM IGuideDataLoader} + IGuideDataLoader = interface(IUnknown) + ['{4764ff7c-fa95-4525-af4d-d32236db9e38}'] + (*** IGuideDataLoader methods ***) + function Init(pGuideStore: IGuideData): HResult; stdcall; + function Terminate: HResult; stdcall; + end; + +//****************************************************************************** +// Copyright (c) 1998 Microsoft Corporation. All Rights Reserved. +// FileName: Mixerocx.idl + +const + + IID_IMixerOCXNotify : TGUID = '{81A3BD31-DEE1-11d1-8508-00A0C91F9CA0}'; + {$EXTERNALSYM IID_IMixerOCXNotify} + IID_IMixerOCX : TGUID = '{81A3BD32-DEE1-11d1-8508-00A0C91F9CA0}'; + {$EXTERNALSYM IID_IMixerOCX} + + // data id flags, used to notify the client whenever pertinent data changes + MIXER_DATA_ASPECT_RATIO = $00000001; // picture aspect ratio changed + {$EXTERNALSYM MIXER_DATA_ASPECT_RATIO} + MIXER_DATA_NATIVE_SIZE = $00000002; // native size of video changed + {$EXTERNALSYM MIXER_DATA_NATIVE_SIZE} + MIXER_DATA_PALETTE = $00000004; // palette of video changed + {$EXTERNALSYM MIXER_DATA_PALETTE} + + // status flags defined here + MIXER_STATE_MASK = $00000003; // use this mask with state status bits + {$EXTERNALSYM MIXER_STATE_MASK} + MIXER_STATE_UNCONNECTED = $00000000; // mixer is unconnected and stopped + {$EXTERNALSYM MIXER_STATE_UNCONNECTED} + MIXER_STATE_CONNECTED_STOPPED = $00000001; // mixer is connected and stopped + {$EXTERNALSYM MIXER_STATE_CONNECTED_STOPPED} + MIXER_STATE_CONNECTED_PAUSED = $00000002; // mixer is connected and paused + {$EXTERNALSYM MIXER_STATE_CONNECTED_PAUSED} + MIXER_STATE_CONNECTED_PLAYING = $00000003; // mixer is connected and playing + {$EXTERNALSYM MIXER_STATE_CONNECTED_PLAYING} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IMixerOCXNotify;'} + {$EXTERNALSYM IMixerOCXNotify} + IMixerOCXNotify = interface(IUnknown) + ['{81A3BD31-DEE1-11d1-8508-00A0C91F9CA0}'] + (*** IMixerOCXNotify methods ***) + // invalidates the rect + function OnInvalidateRect(lpcRect: PRECT): HResult; stdcall; + // informs that a status change has occured, new status bits provided in ulStatusFlags + function OnStatusChange(ulStatusFlags: ULONG): HResult; stdcall; + // informs that data parameters, whose id is present in ilDataFlags has changed + function OnDataChange(ulDataFlags: ULONG): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMixerOCX;'} + {$EXTERNALSYM IMixerOCX} + IMixerOCX = interface(IUnknown) + ['{81A3BD32-DEE1-11d1-8508-00A0C91F9CA0}'] + (*** IMixerOCX methods ***) + // used to notify the mixer that the display mode has changed, the mixer handles this + // asynchronously and the calls OnStatusChange(MIXER_DISPLAYCHANGE_HANDLED) when processing + // is done + function OnDisplayChange(ulBitsPerPixel, ulScreenWidth, ulScreenHeight: ULONG): HResult; stdcall; + function GetAspectRatio(out pdwPictAspectRatioX, pdwPictAspectRatioY: DWORD): HResult; stdcall; + function GetVideoSize(out pdwVideoWidth, pdwVideoHeight: DWORD): HResult; stdcall; + function GetStatus(out pdwStatus: DWORD): HResult; stdcall; + // the dc provided here is not supposed to be cached. If apps have set a dc using + // SetDrawInfo, then it is illegal to provide a non NULL argument here + function OnDraw(hdcDraw: HDC; prcDraw: PRECT): HResult; stdcall; + // lpptTopLeftSC should be NULL unless MIXER_DRAW_DC_ONSCREEN is set to TRUE + // specifying a NULL value for lprcClip means no clipping + // lpptTopLeftSC - top left corner of surface/dc in screen coordinates + // prcDrawCC - draw rectangle in surface/dc coordinates + // lprcClip - clipping rect in surface/dc coordinates (optional) + function SetDrawRegion(lpptTopLeftSC: PPOINT; prcDrawCC, lprcClip: PRECT): HResult; stdcall; + // function to set the sink interface for client notification + function Advise(pmdns: IMixerOCXNotify): HResult; stdcall; + // function to remove the sink interface + function UnAdvise: HResult; stdcall; + end; + +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Module Name: +// +// Mpeg2Bits.h +// +// Abstract: +// +// This file defines the MPEG-2 section header bitfields. These are +// defined here instead of in mpegstructs.idl because of MIDL +// compiler conflicts with bitfield definitions. +// +///////////////////////////////////////////////////////////////////////////// + + // PID structure + + // WORD Reserved : 3; + // WORD ProgramId : 13; + PPIDBits = ^TPIDBits; + PID_BITS = packed record + Bits: WORD; + end; + {$EXTERNALSYM PID_BITS} + PPID_BITS = ^PID_BITS; + {$EXTERNALSYM PPID_BITS} + TPIDBits = PID_BITS; + + // Generic MPEG packet header structure + + // WORD SectionLength : 12; + // WORD Reserved : 2; + // WORD PrivateIndicator : 1; + // WORD SectionSyntaxIndicator : 1; + PMPEGHeaderBits = ^TMPEGHeaderBits; + MPEG_HEADER_BITS = packed record + Bits: WORD; + end; + {$EXTERNALSYM MPEG_HEADER_BITS} + PMPEG_HEADER_BITS = ^MPEG_HEADER_BITS; + {$EXTERNALSYM PMPEG_HEADER_BITS} + TMPEGHeaderBits = MPEG_HEADER_BITS; + + // Long MPEG packet header structure + + // BYTE CurrentNextIndicator : 1; + // BYTE VersionNumber : 5; + // BYTE Reserved : 2; + PMPEGHeaderVersionBits = ^TMPEGHeaderVersionBits; + MPEG_HEADER_VERSION_BITS = packed record + Bits: BYTE; + end; + {$EXTERNALSYM MPEG_HEADER_VERSION_BITS} + PMPEG_HEADER_VERSION_BITS = ^MPEG_HEADER_VERSION_BITS; + {$EXTERNALSYM PMPEG_HEADER_VERSION_BITS} + TMPEGHeaderVersionBits = MPEG_HEADER_VERSION_BITS; + +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Module Name: +// +// Mpeg2Structs.idl +// +// Abstract: +// +// Definitions for the common structures used in Mpeg2Data +// +// Notes: +// +// This IDL file is not built independently, but is included and built +// in the master IDL file Mpeg2Data.idl +// +///////////////////////////////////////////////////////////////////////////// + + +type + // Basic Type Aliases + PPID = ^PID; + {$EXTERNALSYM PPID} + PID = WORD; + {$EXTERNALSYM PID} + PTID = ^TID; + {$EXTERNALSYM PTID} + TID = BYTE; + {$EXTERNALSYM TID} + ClientKey = UINT; + {$EXTERNALSYM ClientKey} + + // MPEG-2 Current/Next bit field + MPEG_CURRENT_NEXT_BIT = ( + {$EXTERNALSYM MPEG_CURRENT_NEXT_BIT} + MPEG_SECTION_IS_NEXT, + MPEG_SECTION_IS_CURRENT + ); + TMPEGCurrentNextBit = MPEG_CURRENT_NEXT_BIT; + + // MPEG-2 TID Extension structure + PTidExtension = ^TTidExtension; + TID_EXTENSION = packed record + wTidExt: WORD; + wCount : WORD; + end; + {$EXTERNALSYM TID_EXTENSION} + PTID_EXTENSION = ^TID_EXTENSION; + {$EXTERNALSYM PTID_EXTENSION} + TTidExtension = TID_EXTENSION; + + // MPEG-2 packet "small" header structure + SECTION = packed record + TableId : TID; + Header : TMPEGHeaderBits; + SectionData : array[0..0] of BYTE; // Array size is Header.S.SectionLength + end; + {$EXTERNALSYM SECTION} + PSECTION = ^SECTION; + {$EXTERNALSYM PSECTION} + TSection = SECTION; + + // MPEG-2 packet "long" header structure + PLongSection = ^TLongSection; + LONG_SECTION = packed record + TableId : TID; + Header : TMPEGHeaderBits; + TableIdExtension : WORD; + Version : TMPEGHeaderVersionBits; + SectionNumber : BYTE; + LastSectionNumber : BYTE; + RemainingData : array[0..0] of BYTE; // Array size is Header.S.SectionLength - 5 + end; + {$EXTERNALSYM LONG_SECTION} + PLONG_SECTION = ^LONG_SECTION; + {$EXTERNALSYM PLONG_SECTION} + TLongSection = LONG_SECTION; + + // DSM-CC packet header structure + PDSMCCSection = ^TDSMCCSection; + DSMCC_SECTION = packed record + TableId : TID; + Header : TMPEGHeaderBits; + TableIdExtension : WORD; + Version : TMPEGHeaderVersionBits; + SectionNumber : BYTE; + LastSectionNumber : BYTE; + ProtocolDiscriminator : BYTE; + DsmccType : BYTE; + MessageId : WORD; + TransactionId : DWORD; + Reserved : BYTE; + AdaptationLength : BYTE; + MessageLength : WORD; + RemainingData: array[0..0] of BYTE; + end; + {$EXTERNALSYM DSMCC_SECTION} + PDSMCC_SECTION = ^DSMCC_SECTION; + {$EXTERNALSYM PDSMCC_SECTION} + TDSMCCSection = DSMCC_SECTION; + + // MPEG-2 request/response packets structures + PMPEGRQSTPacket = ^TMPEGRQSTPacket; + MPEG_RQST_PACKET = packed record + dwLength: DWORD; + pSection: PSECTION; + end; + {$EXTERNALSYM MPEG_RQST_PACKET} + PMPEG_RQST_PACKET = ^MPEG_RQST_PACKET; + {$EXTERNALSYM PMPEG_RQST_PACKET} + TMPEGRQSTPacket = MPEG_RQST_PACKET; + + PMPEGPacketList = ^TMPEGPacketList; + MPEG_PACKET_LIST = packed record + wPacketCount : WORD ; + PacketList : array[0..0] of PMPEG_RQST_PACKET; // Array size is wPacketCount; + end; + {$EXTERNALSYM MPEG_PACKET_LIST} + PMPEG_PACKET_LIST = ^MPEG_PACKET_LIST; + {$EXTERNALSYM PMPEG_PACKET_LIST} + TMPEGPacketList = MPEG_PACKET_LIST; + + // DSM-CC request filter options + + PDSMCCFilterOptions = ^TDSMCCFilterOptions; + DSMCC_FILTER_OPTIONS = packed record + fSpecifyProtocol : BOOL; // If true, Protocol should be set to desired value + Protocol : BYTE; + fSpecifyType : BOOL; // If true, Type should be set to desired value + Type_ : BYTE; + fSpecifyMessageId : BOOL; // If true, MessageId should be set to desired value + MessageId : WORD; + fSpecifyTransactionId : BOOL; // If true, TransactionId (or DownloadId for DDB msgs) should be set to desired value + fUseTrxIdMessageIdMask : BOOL; // If false, TransactionId is filtered as is. + // If true, TransactionId is masked to look + // for any version of message with associated + // message identifier. See DVB - Data + // Broadcasting Guidlines 4.6.5. (Assignment + // and use of transactionId values). + TransactionId : DWORD; + fSpecifyModuleVersion : BOOL; // If true, ModuleVersion should be set to the desired value + ModuleVersion : BYTE; + fSpecifyBlockNumber : BOOL; // If true, BlockNumber should be set to desired value + BlockNumber : WORD; + fGetModuleCall : BOOL; // If true, NumberOfBlocksInModule should be set + NumberOfBlocksInModule : WORD; + end; + // 45 BYTES + {$EXTERNALSYM DSMCC_FILTER_OPTIONS} + PDSMCC_FILTER_OPTIONS = ^DSMCC_FILTER_OPTIONS; + {$EXTERNALSYM PDSMCC_FILTER_OPTIONS} + TDSMCCFilterOptions = DSMCC_FILTER_OPTIONS; + + + // ATSC request filter options + PATSCFilterOptions = ^TATSCFilterOptions; + ATSC_FILTER_OPTIONS = packed record + fSpecifyEtmId : BOOL; // If true, EtmId should be set to desired value + EtmId : DWORD; + end; + // 8 BYTES + {$EXTERNALSYM ATSC_FILTER_OPTIONS} + TATSCFilterOptions = ATSC_FILTER_OPTIONS; + + // MPEG-2 request filter structure + PMPEG2Filter = ^TMPEG2Filter; + MPEG2_FILTER = packed record + bVersionNumber : BYTE; // Must be set to 1 or more to match filter definition + wFilterSize : WORD; // Size of total filter structure. Version 1 filter is 73 bytes. + fUseRawFilteringBits : BOOL; // If true, Filter and Mask fields should be set to desired value, all other + // fields with be ignored. + Filter : array[0..15] of BYTE; // Bits with values to compare against for a match. + Mask : array[0..15] of BYTE; // Bits set to 0 are bits that are compared to those in the filter, those + // bits set to 1 are ignored. + fSpecifyTableIdExtension : BOOL; // If true, TableIdExtension should be set to desired value (false = don't care) + TableIdExtension : WORD; + fSpecifyVersion : BOOL; // If true, Version should be set to desired value (false = don't care) + Version : BYTE; + fSpecifySectionNumber : BOOL; // If true, SectionNumber should be set to desired value (false = don't care) + SectionNumber : BYTE; + fSpecifyCurrentNext : BOOL; // If true, fNext should be set to desired value (false = don't care) + fNext : BOOL; // If true, next table is queried. Else, current + fSpecifyDsmccOptions : BOOL; // If true, Dsmcc should be set with desired filter options + Dsmcc : TDSMCCFilterOptions; + fSpecifyAtscOptions : BOOL; // If true, Atsc should be set with desired filter options + Atsc : TATSCFilterOptions; + end; + // 124 BYTES + {$EXTERNALSYM MPEG2_FILTER} + PMPEG2_FILTER = ^MPEG2_FILTER; + {$EXTERNALSYM PMPEG2_FILTER} + TMPEG2Filter = MPEG2_FILTER; + +const + MPEG2_FILTER_VERSION_1_SIZE = 124; + {$EXTERNALSYM MPEG2_FILTER_VERSION_1_SIZE} + +type + // Mpeg-2 Stream buffer structure + PMPEGStreamBuffer = ^TMPEGStreamBuffer; + MPEG_STREAM_BUFFER = packed record + hr : HResult; + dwDataBufferSize : DWORD; + dwSizeOfDataRead : DWORD; + pDataBuffer : PBYTE; + end; + {$EXTERNALSYM MPEG_STREAM_BUFFER} + PMPEG_STREAM_BUFFER = ^MPEG_STREAM_BUFFER; + {$EXTERNALSYM PMPEG_STREAM_BUFFER} + TMPEGStreamBuffer = MPEG_STREAM_BUFFER; + + // MPEG-2 Time and Date structures + PMPEGTime = ^TMPEGTime; + MPEG_TIME = packed record + Hours : BYTE; // Legal Range: 0 to 23 + Minutes : BYTE; // Legal Range: 0 to 59 + Seconds : BYTE; // Legal Range: 0 to 59 + end; + {$EXTERNALSYM MPEG_TIME} + TMPEGTime = MPEG_TIME; + + MPEG_DURATION = MPEG_TIME; + {$EXTERNALSYM MPEG_DURATION} + + PMPEGDate = ^TMPEGDate; + MPEG_DATE = packed record + Date : BYTE; // Legal Range: 1 to 31 + Month : BYTE; // Legal Range: 1 to 12 + Year : WORD; // Legal Range: 1900 to 2100 + end; + {$EXTERNALSYM MPEG_DATE} + TMPEGDate = MPEG_DATE; + + PMPEGDateAndTime = ^TMPEGDateAndTime; + MPEG_DATE_AND_TIME = packed record + D: TMPEGDate; + T: TMPEGTime; + end; + {$EXTERNALSYM MPEG_DATE_AND_TIME} + TMPEGDateAndTime = MPEG_DATE_AND_TIME; + + // MPEG-2 API Context structures + MPEG_CONTEXT_TYPE = ( + MPEG_CONTEXT_BCS_DEMUX, + MPEG_CONTEXT_WINSOCK + ); + {$EXTERNALSYM MPEG_CONTEXT_TYPE} + TMPEGContextType = MPEG_CONTEXT_TYPE; + + MPEG_BCS_DEMUX = packed record + AVMGraphId: DWORD; + end; + {$EXTERNALSYM MPEG_BCS_DEMUX} + TMPEGBCSDemux = MPEG_BCS_DEMUX; + + MPEG_WINSOCK = record + AVMGraphId: DWORD; + end; + {$EXTERNALSYM MPEG_WINSOCK} + TMPEGWinsock = MPEG_WINSOCK; + + PMPEGContext = ^TMPEGContext; + MPEG_CONTEXT = packed record + Type_ : TMPEGContextType; + case byte of + 0: (Demux: TMPEGBCSDemux); + 1: (Winsock: TMPEGWinsock); + end; + {$EXTERNALSYM MPEG_CONTEXT} + PMPEG_CONTEXT = ^MPEG_CONTEXT; + {$EXTERNALSYM PMPEG_CONTEXT} + TMPEGContext = MPEG_CONTEXT; + + // MPEG-2 Service Request and Responses + MPEG_REQUEST_TYPE = ( + MPEG_RQST_UNKNOWN, + MPEG_RQST_GET_SECTION, + MPEG_RQST_GET_SECTION_ASYNC, + MPEG_RQST_GET_TABLE, + MPEG_RQST_GET_TABLE_ASYNC, + MPEG_RQST_GET_SECTIONS_STREAM, + MPEG_RQST_GET_PES_STREAM, + MPEG_RQST_GET_TS_STREAM, + MPEG_RQST_START_MPE_STREAM + ); + {$EXTERNALSYM MPEG_REQUEST_TYPE} + TMPEGRequestType = MPEG_REQUEST_TYPE; + + PMPEGServiceRequest = ^TMPEGServiceRequest; + MPEG_SERVICE_REQUEST = packed record + Type_ : TMPEGRequestType; + Context : TMPEGContext; + Pid : PID; + TableId : TID; + Filter : TMPEG2Filter; + Flags : DWORD; + end; + {$EXTERNALSYM MPEG_SERVICE_REQUEST} + PMPEG_SERVICE_REQUEST = ^MPEG_SERVICE_REQUEST; + {$EXTERNALSYM PMPEG_SERVICE_REQUEST} + TMPEGServiceRequest = MPEG_SERVICE_REQUEST; + + PMPEGServiceResponse = ^TMPEGServiceResponse; + MPEG_SERVICE_RESPONSE = packed record + IPAddress : DWORD; + Port : WORD; + end; + {$EXTERNALSYM MPEG_SERVICE_RESPONSE} + PMPEG_SERVICE_RESPONSE = ^MPEG_SERVICE_RESPONSE; + {$EXTERNALSYM PMPEG_SERVICE_RESPONSE} + TMPEGServiceResponse = MPEG_SERVICE_RESPONSE; + + // DSM-CC & MPE Query Results + PDSMCCElement = ^TDSMCCElement; + DSMCC_ELEMENT = packed record + pid : PID; + bComponentTag : BYTE; + dwCarouselId : DWORD; + dwTransactionId : DWORD; + pNext : PDSMCCElement; + end; + {$EXTERNALSYM DSMCC_ELEMENT} + PDSMCC_ELEMENT = ^DSMCC_ELEMENT; + {$EXTERNALSYM PDSMCC_ELEMENT} + TDSMCCElement = DSMCC_ELEMENT; + + PMPEElement = ^TMPEElement; + MPE_ELEMENT = packed record + pid : PID; + bComponentTag : BYTE; + pNext : PMPEElement; + end; + {$EXTERNALSYM MPE_ELEMENT} + PMPE_ELEMENT = ^MPE_ELEMENT; + {$EXTERNALSYM PMPE_ELEMENT} + TMPEElement = MPE_ELEMENT; + + // MPEG-2 Stream Filtering Structure + PMPEGStreamFilter = ^TMPEGStreamFilter; + MPEG_STREAM_FILTER = packed record + wPidValue : WORD; // PID value + dwFilterSize : DWORD; // size of filter in bits + fCrcEnabled : BOOL; // enable/disable CRC check + rgchFilter : array[0..15] of BYTE; // filter data + rgchMask : array[0..15] of BYTE; // filter mask + end; + {$EXTERNALSYM MPEG_STREAM_FILTER} + TMPEGStreamFilter = MPEG_STREAM_FILTER; + +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Module Name: +// +// Mpeg2Data.idl +// +// Abstract: +// +// Main Mpeg2Data Library Definition, and interface definitions for +// the MPEG-2 Section and Table acquisition functionality +// +///////////////////////////////////////////////////////////////////////////// + + +const + // Declare well known PID/TID values for MPEG-2 tables + MPEG_PAT_PID = $0000; + {$EXTERNALSYM MPEG_PAT_PID} + MPEG_PAT_TID = $00; + {$EXTERNALSYM MPEG_PAT_TID} + + MPEG_CAT_PID = $0001; + {$EXTERNALSYM MPEG_CAT_PID} + MPEG_CAT_TID = $01; + {$EXTERNALSYM MPEG_CAT_TID} + + MPEG_PMT_TID = $02; + {$EXTERNALSYM MPEG_PMT_TID} + + MPEG_TSDT_PID = $0002; + {$EXTERNALSYM MPEG_TSDT_PID} + MPEG_TSDT_TID = $03; + {$EXTERNALSYM MPEG_TSDT_TID} + + // Declare well known PID/TID values for ATSC tables + ATSC_MGT_PID = $1FFB; + {$EXTERNALSYM ATSC_MGT_PID} + ATSC_MGT_TID = $C7; + {$EXTERNALSYM ATSC_MGT_TID} + + ATSC_VCT_PID = $1FFB; + {$EXTERNALSYM ATSC_VCT_PID} + ATSC_VCT_TERR_TID = $C8; + {$EXTERNALSYM ATSC_VCT_TERR_TID} + ATSC_VCT_CABL_TID = $C9; + {$EXTERNALSYM ATSC_VCT_CABL_TID} + + ATSC_RRT_PID = $1FFB; + {$EXTERNALSYM ATSC_RRT_PID} + ATSC_RRT_TID = $CA; + {$EXTERNALSYM ATSC_RRT_TID} + + ATSC_EIT_TID = $CB; + {$EXTERNALSYM ATSC_EIT_TID} + + ATSC_ETT_TID = $CC; + {$EXTERNALSYM ATSC_ETT_TID} + + ATSC_STT_PID = $1FFB; + {$EXTERNALSYM ATSC_STT_PID} + ATSC_STT_TID = $CD; + {$EXTERNALSYM ATSC_STT_TID} + + ATSC_PIT_TID = $D0; + {$EXTERNALSYM ATSC_PIT_TID} + + // Declare well known PID/TID values for DVB tables + DVB_NIT_PID = $0010; + {$EXTERNALSYM DVB_NIT_PID} + DVB_NIT_ACTUAL_TID = $40; + {$EXTERNALSYM DVB_NIT_ACTUAL_TID} + DVB_NIT_OTHER_TID = $41; + {$EXTERNALSYM DVB_NIT_OTHER_TID} + + DVB_SDT_PID = $0011; + {$EXTERNALSYM DVB_SDT_PID} + DVB_SDT_ACTUAL_TID = $42; + {$EXTERNALSYM DVB_SDT_ACTUAL_TID} + DVB_SDT_OTHER_TID = $46; + {$EXTERNALSYM DVB_SDT_OTHER_TID} + + DVB_BAT_PID = $0011; + {$EXTERNALSYM DVB_BAT_PID} + DVB_BAT_TID = $4A; + {$EXTERNALSYM DVB_BAT_TID} + + DVB_EIT_PID = $0012; + {$EXTERNALSYM DVB_EIT_PID} + DVB_EIT_ACTUAL_TID = $4E; + {$EXTERNALSYM DVB_EIT_ACTUAL_TID} + DVB_EIT_OTHER_TID = $4F; + {$EXTERNALSYM DVB_EIT_OTHER_TID} + + DVB_RST_PID = $0013; + {$EXTERNALSYM DVB_RST_PID} + DVB_RST_TID = $71; + {$EXTERNALSYM DVB_RST_TID} + + DVB_TDT_PID = $0014; + {$EXTERNALSYM DVB_TDT_PID} + DVB_TDT_TID = $70; + {$EXTERNALSYM DVB_TDT_TID} + + DVB_ST_PID_16 = $0010; + {$EXTERNALSYM DVB_ST_PID_16} + DVB_ST_PID_17 = $0011; + {$EXTERNALSYM DVB_ST_PID_17} + DVB_ST_PID_18 = $0012; + {$EXTERNALSYM DVB_ST_PID_18} + DVB_ST_PID_19 = $0013; + {$EXTERNALSYM DVB_ST_PID_19} + DVB_ST_PID_20 = $0014; + {$EXTERNALSYM DVB_ST_PID_20} + DVB_ST_TID = $72; + {$EXTERNALSYM DVB_ST_TID} + + DVB_TOT_PID = $0014; + {$EXTERNALSYM DVB_TOT_PID} + DVB_TOT_TID = $73; + {$EXTERNALSYM DVB_TOT_TID} + + DVB_DIT_PID = $001E; + {$EXTERNALSYM DVB_DIT_PID} + DVB_DIT_TID = $7E; + {$EXTERNALSYM DVB_DIT_TID} + + DVB_SIT_PID = $001F; + {$EXTERNALSYM DVB_SIT_PID} + DVB_SIT_TID = $7F; + {$EXTERNALSYM DVB_SIT_TID} + + // Declare well known PID/TID values for ISDB tables + ISDB_DCT_PID = $0017; + {$EXTERNALSYM ISDB_DCT_PID} + ISDB_DCT_TID = $C0; + {$EXTERNALSYM ISDB_DCT_TID} + + ISDB_LIT_PID = $0020; + {$EXTERNALSYM ISDB_LIT_PID} + ISDB_LIT_TID = $D0; + {$EXTERNALSYM ISDB_LIT_TID} + + ISDB_ERT_PID = $0021; + {$EXTERNALSYM ISDB_ERT_PID} + ISDB_ERT_TID = $D1; + {$EXTERNALSYM ISDB_ERT_TID} + + ISDB_ITT_TID = $D2; + {$EXTERNALSYM ISDB_ITT_TID} + + ISDB_DLT_TID = $C1; + {$EXTERNALSYM ISDB_DLT_TID} + + ISDB_PCAT_PID = $0022; + {$EXTERNALSYM ISDB_PCAT_PID} + ISDB_PCAT_TID = $C2; + {$EXTERNALSYM ISDB_PCAT_TID} + + ISDB_SDTT_PID = $0023; + {$EXTERNALSYM ISDB_SDTT_PID} + ISDB_SDTT_TID = $C3; + {$EXTERNALSYM ISDB_SDTT_TID} + + +//////////////////////////////////// +// +// Mpeg2DataLib Library +// +//////////////////////////////////// + +const + LIBID_Mpeg2DataLib : TGUID = '{DBAF6C1B-B6A4-4898-AE65-204F0D9509A1}'; + {$EXTERNALSYM LIBID_Mpeg2DataLib} + + IID_IMpeg2Data : TGUID = '{9B396D40-F380-4e3c-A514-1A82BF6EBFE6}'; + {$EXTERNALSYM IID_IMpeg2Data} + IID_ISectionList : TGUID = '{AFEC1EB5-2A64-46c6-BF4B-AE3CCB6AFDB0}'; + {$EXTERNALSYM IID_ISectionList} + IID_IMpeg2FilterControl : TGUID = '{7066CCDA-5C09-4e4f-85BC-2A2D6E0E310D}'; + {$EXTERNALSYM IID_IMpeg2FilterControl} + IID_IMpeg2Stream : TGUID = '{400CC286-32A0-4ce4-9041-39571125A635}'; + {$EXTERNALSYM IID_IMpeg2Stream} + + CLSID_SectionList : TGUID = '{73DA5D04-4347-45d3-A9DC-FAE9DDBE558D}'; // ISectionList + {$EXTERNALSYM CLSID_SectionList} + CLSID_Mpeg2Stream : TGUID = '{F91D96C7-8509-4d0b-AB26-A0DD10904BB7}'; // IMpeg2Stream + {$EXTERNALSYM CLSID_Mpeg2Stream} + CLSID_Mpeg2Data : TGUID = '{C666E115-BB62-4027-A113-82D643FE2D99}'; // IMpeg2FilterControl (IAtscPsipParser IDvbSiParser Not available in DX9) + {$NODEFINE CLSID_Mpeg2Data} + +type + //////////////////////////////////// + // + // IMpeg2Data Interface + // + //////////////////////////////////// + ISectionList = interface; + IMpeg2Stream = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMpeg2Data;'} + {$EXTERNALSYM IMpeg2Data} + IMpeg2Data = interface(IUnknown) + ['{9B396D40-F380-4e3c-A514-1A82BF6EBFE6}'] + (*** IMpeg2Data methods ***) + function GetSection(pid: PID; tid: TID; pFilter: PMPEG2_FILTER {OPTIONAL}; + dwTimeout: DWORD; out ppSectionList: ISectionList): HResult; stdcall; + function GetTable(pid: PID; tid: TID; pFilter: PMPEG2_FILTER {OPTIONAL}; + dwTimeout: DWORD; out ppSectionList: ISectionList): HResult; stdcall; + function GetStreamOfSections(pid: PID; tid: TID; pFilter: PMPEG2_FILTER {OPTIONAL}; + hDataReadyEvent: THandle; out ppMpegStream: IMpeg2Stream): HResult; stdcall; + end; + + //////////////////////////////////// + // + // ISectionList Interface + // + //////////////////////////////////// + + {$HPPEMIT 'typedef System::DelphiInterface _di_ISectionList;'} + {$EXTERNALSYM ISectionList} + ISectionList = interface(IUnknown) + ['{AFEC1EB5-2A64-46c6-BF4B-AE3CCB6AFDB0}'] + (*** ISectionList methods ***) + function Initialize(requestType: TMPEGRequestType; pMpeg2Data: IMpeg2Data; + pContext: PMPEG_CONTEXT; pid: PID; tid: TID; pFilter: PMPEG2_FILTER {OPTIONAL}; + timeout: DWORD; hDoneEvent: THandle {OPTIONAL}): HResult; stdcall; + function InitializeWithRawSections(pmplSections: PMPEG_PACKET_LIST): HResult; stdcall; + function CancelPendingRequest: HResult; stdcall; + function GetNumberOfSections(out pCount: WORD): HResult; stdcall; + function GetSectionData(sectionNumber: WORD; out pdwRawPacketLength: DWORD; + out ppSection: PSECTION): HResult; stdcall; + function GetProgramIdentifier(pPid: PPID): HResult; stdcall; + function GetTableIdentifier(pTableId: PTID): HResult; stdcall; + end; + + //////////////////////////////////// + // + // IMpeg2FilterControl Interface + // + //////////////////////////////////// + + // Defined in DX9 RC0 but removed in RC1 ??? + {$NODEFINE IMpeg2FilterControl} + IMpeg2FilterControl = interface(IUnknown) + ['{7066CCDA-5C09-4e4f-85BC-2A2D6E0E310D}'] + (*** IMpeg2FilterControl methods ***) + function SetFilter(culFilterItems: ULONG; prgFilterCriteria: PMPEGStreamFilter; + MediaSampleContent: TMediaSampleContent; hEvent: THandle; + out pClientKey: ClientKey): HResult; stdcall; + function ClearFilter(clientKey: ClientKey): HResult; stdcall; + + function GetData(pbDataBuffer: PBYTE; dwBufferSize: DWORD; + out pdwBytesWritten: DWORD; clientKey: ClientKey): HResult; + end; + + //////////////////////////////////// + // + // IMpeg2Stream Interface + // + //////////////////////////////////// + + {$HPPEMIT 'typedef System::DelphiInterface _di_IMpeg2Stream;'} + {$EXTERNALSYM IMpeg2Stream} + IMpeg2Stream = interface(IUnknown) + ['{400CC286-32A0-4ce4-9041-39571125A635}'] + (*** IMpeg2Stream methods ***) + function Initialize(requestType: TMPEGRequestType; pMpeg2Data: IMpeg2Data; + pContext: PMPEG_CONTEXT; pid: PID; tid: TID; pFilter: PMPEG2_FILTER {OPTIONAL}; + hDataReadyEvent: THandle): HResult; stdcall; + function SupplyDataBuffer(pStreamBuffer: PMPEG_STREAM_BUFFER): HResult; stdcall; + end; + +///////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Module Name: +// +// MPEG2Error.h +// +// Abstract: +// +// Interface specific HResult error codes for MPEG-2 tables. +// +///////////////////////////////////////////////////////////////////////////// + + + // Interface specific SUCCESS and ERROR macros + +const + // MPEG-2 base HResult code (must be at least 0x200) + MPEG2_BASE = Cardinal($200); + {$EXTERNALSYM MPEG2_BASE} + + // MPEG-2 Success HRESULTs + MPEG2_S_MORE_DATA_AVAILABLE = HResult((SEVERITY_SUCCESS shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 0)); + {$EXTERNALSYM MPEG2_S_MORE_DATA_AVAILABLE} + MPEG2_S_NO_MORE_DATA_AVAILABLE = HResult((SEVERITY_SUCCESS shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 1)); + {$EXTERNALSYM MPEG2_S_NO_MORE_DATA_AVAILABLE} + MPEG2_S_SG_INFO_FOUND = HResult((SEVERITY_SUCCESS shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 2)); + {$EXTERNALSYM MPEG2_S_SG_INFO_FOUND} + MPEG2_S_SG_INFO_NOT_FOUND = HResult((SEVERITY_SUCCESS shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 3)); + {$EXTERNALSYM MPEG2_S_SG_INFO_NOT_FOUND} + MPEG2_S_MPE_INFO_FOUND = HResult((SEVERITY_SUCCESS shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 4)); + {$EXTERNALSYM MPEG2_S_MPE_INFO_FOUND} + MPEG2_S_MPE_INFO_NOT_FOUND = HResult((SEVERITY_SUCCESS shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 5)); + {$EXTERNALSYM MPEG2_S_MPE_INFO_NOT_FOUND} + MPEG2_S_NEW_MODULE_VERSION = HResult((SEVERITY_SUCCESS shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 6)); + {$EXTERNALSYM MPEG2_S_NEW_MODULE_VERSION} + + // MPEG-2 Error HRESULTs + MPEG2_E_UNINITIALIZED = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 0)); + {$EXTERNALSYM MPEG2_E_UNINITIALIZED} + MPEG2_E_ALREADY_INITIALIZED = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 1)); + {$EXTERNALSYM MPEG2_E_ALREADY_INITIALIZED} + MPEG2_E_OUT_OF_BOUNDS = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 2)); + {$EXTERNALSYM MPEG2_E_OUT_OF_BOUNDS} + MPEG2_E_MALFORMED_TABLE = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 3)); + {$EXTERNALSYM MPEG2_E_MALFORMED_TABLE} + MPEG2_E_UNDEFINED = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 4)); + {$EXTERNALSYM MPEG2_E_UNDEFINED} + MPEG2_E_NOT_PRESENT = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 5)); + {$EXTERNALSYM MPEG2_E_NOT_PRESENT} + MPEG2_E_SECTION_NOT_FOUND = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 6)); + {$EXTERNALSYM MPEG2_E_SECTION_NOT_FOUND} + MPEG2_E_TX_STREAM_UNAVAILABLE = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 7)); + {$EXTERNALSYM MPEG2_E_TX_STREAM_UNAVAILABLE} + MPEG2_E_SERVICE_ID_NOT_FOUND = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 8)); + {$EXTERNALSYM MPEG2_E_SERVICE_ID_NOT_FOUND} + MPEG2_E_SERVICE_PMT_NOT_FOUND = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 9)); + {$EXTERNALSYM MPEG2_E_SERVICE_PMT_NOT_FOUND} + MPEG2_E_DSI_NOT_FOUND = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 10)); + {$EXTERNALSYM MPEG2_E_DSI_NOT_FOUND} + MPEG2_E_SERVER_UNAVAILABLE = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 11)); + {$EXTERNALSYM MPEG2_E_SERVER_UNAVAILABLE} + MPEG2_E_INVALID_CAROUSEL_ID = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 12)); + {$EXTERNALSYM MPEG2_E_INVALID_CAROUSEL_ID} + MPEG2_E_MALFORMED_DSMCC_MESSAGE = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 13)); + {$EXTERNALSYM MPEG2_E_MALFORMED_DSMCC_MESSAGE} + MPEG2_E_INVALID_SG_OBJECT_KIND = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 14)); + {$EXTERNALSYM MPEG2_E_INVALID_SG_OBJECT_KIND} + MPEG2_E_OBJECT_NOT_FOUND = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 15)); + {$EXTERNALSYM MPEG2_E_OBJECT_NOT_FOUND} + MPEG2_E_OBJECT_KIND_NOT_A_DIRECTORY = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 16)); + {$EXTERNALSYM MPEG2_E_OBJECT_KIND_NOT_A_DIRECTORY} + MPEG2_E_OBJECT_KIND_NOT_A_FILE = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 17)); + {$EXTERNALSYM MPEG2_E_OBJECT_KIND_NOT_A_FILE} + MPEG2_E_FILE_OFFSET_TOO_BIG = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 18)); + {$EXTERNALSYM MPEG2_E_FILE_OFFSET_TOO_BIG} + MPEG2_E_STREAM_STOPPED = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 19)); + {$EXTERNALSYM MPEG2_E_STREAM_STOPPED} + MPEG2_E_REGISTRY_ACCESS_FAILED = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 20)); + {$EXTERNALSYM MPEG2_E_REGISTRY_ACCESS_FAILED} + MPEG2_E_INVALID_UDP_PORT = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 21)); + {$EXTERNALSYM MPEG2_E_INVALID_UDP_PORT} + MPEG2_E_DATA_SOURCE_FAILED = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 22)); + {$EXTERNALSYM MPEG2_E_DATA_SOURCE_FAILED} + MPEG2_E_DII_NOT_FOUND = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 23)); + {$EXTERNALSYM MPEG2_E_DII_NOT_FOUND} + MPEG2_E_DSHOW_PIN_NOT_FOUND = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 24)); + {$EXTERNALSYM MPEG2_E_DSHOW_PIN_NOT_FOUND} + MPEG2_E_BUFFER_TOO_SMALL = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 25)); + {$EXTERNALSYM MPEG2_E_BUFFER_TOO_SMALL} + MPEG2_E_MISSING_SECTIONS = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 26)); + {$EXTERNALSYM MPEG2_E_MISSING_SECTIONS} + MPEG2_E_TOO_MANY_SECTIONS = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 27)); + {$EXTERNALSYM MPEG2_E_TOO_MANY_SECTIONS} + MPEG2_E_NEXT_TABLE_OPS_NOT_AVAILABLE = HResult((SEVERITY_ERROR shl 31) or (FACILITY_ITF shl 16) or (MPEG2_BASE + 28)); + {$EXTERNALSYM MPEG2_E_NEXT_TABLE_OPS_NOT_AVAILABLE} + +//////////////////////////////////////////////////////////////////////////////// +// Copyright (C) Microsoft Corporation, 1998 - 1999 +// +// Module Name: +// EDevCtrl.h +// +// Abstract: +// This header contain structures and peroperty sets for +// interfacing to an external device, like a DV. +// The code is modeled after DirectShow's Vcrctrl Sample +// (VCR Control Filter). It contain IAMExtDevice, +// IAMExtTransport, and IAMTimecodeReader interfaces, and +// a new interface IAMAdvancedAVControl() is added +// for additional advanced device controls. +// +// Note: (From DShow DDK) +// The VCR control sample filter, Vcrctrl, is a simple +// implementation of the external device control interfaces +// that DirectShow provides. Vcrctrl provides basic transport +// control and SMPTE timecode-reading capabilities for certain +// Betacam and SVHS videocassette recorders with RS-422 or RS-232 +// serial interfaces (see source code for specific machine types +// supported). +// +// Note: some methods in IAM* interfaces may not be +// used and will return not implemented. +// +// Created: +// September 23, 1998 +// Yee J. Wu +// +// Revision: 0.6 +// +//////////////////////////////////////////////////////////////////////////////// + +type + + // Device Capabilities + tagDEVCAPS = record + CanRecord : LongInt; + CanRecordStrobe : LongInt; + HasAudio : LongInt; + HasVideo : LongInt; + UsesFiles : LongInt; + CanSave : LongInt; + DeviceType : LongInt; + TCRead : LongInt; + TCWrite : LongInt; + CTLRead : LongInt; + IndexRead : LongInt; + Preroll : LongInt; + Postroll : LongInt; + SyncAcc : LongInt; + NormRate : LongInt; + CanPreview : LongInt; + CanMonitorSrc : LongInt; + CanTest : LongInt; + VideoIn : LongInt; + AudioIn : LongInt; + Calibrate : LongInt; + SeekType : LongInt; + SimulatedHardware : LongInt; // private + end; + {$EXTERNALSYM tagDEVCAPS} + DEVCAPS = tagDEVCAPS; + {$EXTERNALSYM DEVCAPS} + PDEVCAPS = ^DEVCAPS; + {$EXTERNALSYM PDEVCAPS} + TDevCaps = tagDEVCAPS; + + // transport status + tagTRANSPORTSTATUS = record + Mode : LongInt; + LastError : LongInt; + RecordInhibit : LongInt; + ServoLock : LongInt; + MediaPresent : LongInt; + MediaLength : LongInt; + MediaSize : LongInt; + MediaTrackCount : LongInt; + MediaTrackLength : LongInt; + MediaTrackSide : LongInt; + MediaType : LongInt; + LinkMode : LongInt; + NotifyOn : LongInt; + end; + {$EXTERNALSYM tagTRANSPORTSTATUS} + TRANSPORTSTATUS = tagTRANSPORTSTATUS; + {$EXTERNALSYM TRANSPORTSTATUS} + PTRANSPORTSTATUS = ^TRANSPORTSTATUS; + {$EXTERNALSYM PTRANSPORTSTATUS} + TTransportStatus = tagTRANSPORTSTATUS; + + // transport basic parameters + tagTRANSPORTBASICPARMS = record + TimeFormat : LongInt; + TimeReference : LongInt; + Superimpose : LongInt; + EndStopAction : LongInt; + RecordFormat : LongInt; + StepFrames : LongInt; + SetpField : LongInt; + Preroll : LongInt; + RecPreroll : LongInt; + Postroll : LongInt; + EditDelay : LongInt; + PlayTCDelay : LongInt; + RecTCDelay : LongInt; + EditField : LongInt; + FrameServo : LongInt; + ColorFrameServo : LongInt; + ServoRef : LongInt; + WarnGenlock : LongInt; + SetTracking : LongInt; + VolumeName: array[0..39] of Char; + Ballistic: array[0..19] of LongInt; + Speed : LongInt; + CounterFormat : LongInt; + TunerChannel : LongInt; + TunerNumber : LongInt; + TimerEvent : LongInt; + TimerStartDay : LongInt; + TimerStartTime : LongInt; + TimerStopDay : LongInt; + TimerStopTime : LongInt; + end; + {$EXTERNALSYM tagTRANSPORTBASICPARMS} + TRANSPORTBASICPARMS = tagTRANSPORTBASICPARMS; + {$EXTERNALSYM TRANSPORTBASICPARMS} + PTRANSPORTBASICPARMS = ^TRANSPORTBASICPARMS; + {$EXTERNALSYM PTRANSPORTBASICPARMS} + TTransportBasicParms = tagTRANSPORTBASICPARMS; + + + // transport video parameters + tagTRANSPORTVIDEOPARMS = record + OutputMode : LongInt; + Input : LongInt; + end; + {$EXTERNALSYM tagTRANSPORTVIDEOPARMS} + TRANSPORTVIDEOPARMS = tagTRANSPORTVIDEOPARMS; + {$EXTERNALSYM TRANSPORTVIDEOPARMS} + PTRANSPORTVIDEOPARMS = ^TRANSPORTVIDEOPARMS; + {$EXTERNALSYM PTRANSPORTVIDEOPARMS} + TTransportVideoParms = tagTRANSPORTVIDEOPARMS; + + // transport audio parameters + tagTRANSPORTAUDIOPARMS = record + EnableOutput : LongInt; + EnableRecord : LongInt; + EnableSelsync : LongInt; + Input : LongInt; + MonitorSource : LongInt; + end; + {$EXTERNALSYM tagTRANSPORTAUDIOPARMS} + TRANSPORTAUDIOPARMS = tagTRANSPORTAUDIOPARMS; + {$EXTERNALSYM TRANSPORTAUDIOPARMS} + PTRANSPORTAUDIOPARMS = ^TRANSPORTAUDIOPARMS; + {$EXTERNALSYM PTRANSPORTAUDIOPARMS} + TTransportAudioParms = tagTRANSPORTAUDIOPARMS; + + // low level machine status structure filled in after + // REQUEST_STATUS command from above. This structure would + // grow in a full implementation + tagVCRSTATUS = record + bCassetteOut : BOOL; // OATRUE means no cassette + bLocal : BOOL; // OATRUE means front panel switch in local + end; + {$NODEFINE tagVCRSTATUS} + VCRSTATUS = tagVCRSTATUS; + {$NODEFINE VCRSTATUS} + PVCRSTATUS = ^VCRSTATUS; + {$NODEFINE PVCRSTATUS} + TVCRStatus = tagVCRSTATUS; + {$NODEFINE TVCRStatus} +//--------------------------------------------------------- +// STATIC_PROPSETID_VIDCAP_EXT_DEVICE +//--------------------------------------------------------- +// This guid and interface is defined in strmif.h +const + PROPSETID_EXT_DEVICE : TGUID = '{B5730A90-1A2C-11cf-8C23-00AA006B6814}'; + {$EXTERNALSYM PROPSETID_EXT_DEVICE} + +type + // KS properties and structure for this interface + KSPROPERTY_EXTDEVICE = ( + KSPROPERTY_EXTDEVICE_ID, // ID (such as Symbolic Lin) that can uniquely idenfy this device + ksproperty_extdevice_version, // device model number and version (such av/c vcr subunit spec. 2.01) + KSPROPERTY_EXTDEVICE_POWER_STATE, // Return current device power state. + KSPROPERTY_EXTDEVICE_PORT, // Can use this to return DEV_PORT_1394 + KSPROPERTY_EXTDEVICE_CAPABILITIES // Device specific capabilities + ); + {$EXTERNALSYM KSPROPERTY_EXTDEVICE} + TKSPropertyExtDevice = KSPROPERTY_EXTDEVICE; + + PKSPropertyExtDeviceS = ^TKSPropertyExtDeviceS; + KSPROPERTY_EXTDEVICE_S = record + Property_ : KSPROPERTY; + // Client is responsible for allocating this. + case byte of + 0: (Capabilities: TDEVCAPS); + 1: (DevPort: ULONG); + 2: (PowerState: ULONG); + 3: (pawchString: array[0..MAX_PATH-1] of WideChar); + 4: (NodeUniqueID: array[0..1] of DWORD); + end; + {$EXTERNALSYM KSPROPERTY_EXTDEVICE_S} + PKSPROPERTY_EXTDEVICE_S = ^KSPROPERTY_EXTDEVICE_S; + {$EXTERNALSYM PKSPROPERTY_EXTDEVICE_S} + TKSPropertyExtDeviceS = KSPROPERTY_EXTDEVICE_S; + +//--------------------------------------------------------- +// STATIC_PROPSETID_VIDCAP_EXT_TRANSPORT +//--------------------------------------------------------- +const + // This guid and interface is defined in strmif.h + PROPSETID_EXT_TRANSPORT : TGUID = '{A03CD5F0-3045-11cf-8C44-00AA006B6814}'; + {$EXTERNALSYM PROPSETID_EXT_TRANSPORT} + +type + // KS properties and structure for this interface + KSPROPERTY_EXTXPORT = ( + KSPROPERTY_EXTXPORT_CAPABILITIES, // Transport specific capability + KSPROPERTY_EXTXPORT_INPUT_SIGNAL_MODE, // MPEG, D-VHS, Analog VHS etc. + KSPROPERTY_EXTXPORT_OUTPUT_SIGNAL_MODE, // MPEG, D-VHS, Analog VHS etc. + KSPROPERTY_EXTXPORT_LOAD_MEDIUM, // Eject, open tray, close tray + KSPROPERTY_EXTXPORT_MEDIUM_INFO, // cassettte_type and tape_grade_and_write_protect + KSPROPERTY_EXTXPORT_STATE, // Get/Set transport mode and state + KSPROPERTY_EXTXPORT_STATE_NOTIFY, // NOTIFY: Mode + State (Table 4-8) + ksproperty_extxport_timecode_search, // request vcr subunit to search for a specific timecode on the medium + ksproperty_extxport_atn_search, // request vcr subunit to search for a specific atn on the medium + ksproperty_extxport_rtc_search, // request vcr subunit to search for a specific relativetimecounter on the medium + // Implemented for testing purpose + // Will remove this later... + KSPROPERTY_RAW_AVC_CMD // Send/Rcv raw AVC commnad with a FCP packet. + ); + {$EXTERNALSYM KSPROPERTY_EXTXPORT} + TKSPropertyExtXPort = KSPROPERTY_EXTXPORT; + + PMediumInfo = ^TMediumInfo; + MEDIUM_INFO = record + MediaPresent : BOOL; // TRUE/FALSE + MediaType : ULONG; // DVCR standard, small, medium; VHS; VHS-C; unknown + RecordInhibit : BOOL; // TRUE/FALSE + end; + {$EXTERNALSYM MEDIUM_INFO} + PMEDIUM_INFO = ^MEDIUM_INFO; + {$EXTERNALSYM PMEDIUM_INFO} + TMediumInfo = MEDIUM_INFO; + + PTransportState = ^TTransportState; + TRANSPORT_STATE = record + Mode : ULONG; // LOAD MEDIUM, RECORD, PLAY or WIND + State : ULONG; // Vary depend on mode (Table 4-8) + end; + {$EXTERNALSYM TRANSPORT_STATE} + PTRANSPORT_STATE = ^TRANSPORT_STATE; + {$EXTERNALSYM PTRANSPORT_STATE} + TTransportState = TRANSPORT_STATE; + + PKSPropertyExtXPortS = ^TKSPropertyExtXPortS; + KSPROPERTY_EXTXPORT_S = record + Property_: KSPROPERTY; + case byte of + 0: (Capabilities: ULONG); // May need to expand on the existing structure + 1: (SignalMode: ULONG); // May need to expand on the existing structure + 2: (LoadMedium: ULONG); // MPEG, D-VHS, Analog VHS etc. + 3: (MediumInfo: TMediumInfo); // Eject, open tray, close tray + 4: (XPrtState: TTransportState); + 5: (Timecode: record + frame : BYTE; + second : BYTE; + minute : BYTE; + hour : BYTE; + end; + ); + 6: (dwTimecode: DWORD); // hour:minute:second:frame + 7: (dwAbsTrackNumber: DWORD); // absolute track number + // Implemented for testing purpose + // Will remove this later or will keep this for + // packet specific command. + 8: (RawAVC: record + PayloadSize : ULONG; + Payload : array[0..511] of BYTE; // This is only for testing sending AVC command from User mode. + end;); + end; + {$EXTERNALSYM KSPROPERTY_EXTXPORT_S} + PKSPROPERTY_EXTXPORT_S = ^KSPROPERTY_EXTXPORT_S; + {$EXTERNALSYM PKSPROPERTY_EXTXPORT_S} + TKSPropertyExtXPortS = KSPROPERTY_EXTXPORT_S; + + PKSPropertyExtxportNodeS = ^TKSPropertyExtxportNodeS; + KSPROPERTY_EXTXPORT_NODE_S = packed record + NodeProperty: KSP_NODE; + case byte of + 0: (Capabilities: ULONG); + 1: (SignalMode: ULONG); + 2: (LoadMedium: ULONG); + 3: (MediumInfo: MEDIUM_INFO); + 4: (XPrtState: TRANSPORT_STATE); + 5: (Timecode: record + frame: byte; + second: byte; + minute: byte; + hour: byte; + end); + 6: (dwTimecode: DWORD); + 7: (dwAbsTrackNumber: DWORD); + 8: (RawAVC: record + PayloadSize: ULONG; + Payload: array[0..511] of byte; + end); + end; + {$EXTERNALSYM KSPROPERTY_EXTXPORT_NODE_S} + PKSPROPERTY_EXTXPORT_NODE_S = KSPROPERTY_EXTXPORT_NODE_S; + {$EXTERNALSYM PKSPROPERTY_EXTXPORT_NODE_S} + TKSPropertyExtxportNodeS = KSPROPERTY_EXTXPORT_NODE_S; + +//--------------------------------------------------------- +// PROPSETID_TIMECODE +//--------------------------------------------------------- +// This guid and interface is defined in strmif.h +const + PROPSETID_TIMECODE_READER : TGUID = '{9B496CE1-811B-11cf-8C77-00AA006B6814}'; + {$EXTERNALSYM PROPSETID_TIMECODE_READER} + +type + // KS properties and structure for this interface + KSPROPERTY_TIMECODE = ( + KSPROPERTY_TIMECODE_READER, // Timecode for the current medium position + KSPROPERTY_ATN_READER, // Absolute track number the current medium position + KSPROPERTY_RTC_READER // Relative time counter for the current medium position + ); + {$EXTERNALSYM KSPROPERTY_TIMECODE} + TKSPropertyTimeCode = KSPROPERTY_TIMECODE; + + KSPROPERTY_TIMECODE_S = record + Property_: KSPROPERTY; + TimecodeSamp: TTimeCodeSample; + end; + {$EXTERNALSYM KSPROPERTY_TIMECODE_S} + PKSPROPERTY_TIMECODE_S = ^KSPROPERTY_TIMECODE_S; + {$EXTERNALSYM PKSPROPERTY_TIMECODE_S} + TKSPropertyTimeCodeS = KSPROPERTY_TIMECODE_S; + + PKSPropertyTimecodeNodeS = ^TKSPropertyTimecodeNodeS; + KSPROPERTY_TIMECODE_NODE_S = packed record + NodeProperty: KSP_NODE; + TimecodeSamp: TIMECODE_SAMPLE; + end; + {$EXTERNALSYM KSPROPERTY_TIMECODE_NODE_S} + PKSPROPERTY_TIMECODE_NODE_S = ^KSPROPERTY_TIMECODE_NODE_S; + {$EXTERNALSYM PKSPROPERTY_TIMECODE_NODE_S} + TKSPropertyTimecodeNodeS = PKSPROPERTY_TIMECODE_NODE_S; + +//--------------------------------------------------------- +// External Device Command event notification +//--------------------------------------------------------- +const + KSEVENTSETID_EXTDEV_Command : TGUID = '{109c7988-b3cb-11d2-b48e-006097b3391b}'; + {$EXTERNALSYM KSEVENTSETID_EXTDEV_Command} + +type + KSEVENT_DEVCMD = ( + KSEVENT_EXTDEV_COMMAND_NOTIFY_INTERIM_READY, + KSEVENT_EXTDEV_COMMAND_CONTROL_INTERIM_READY, + KSEVENT_EXTDEV_COMMAND_BUSRESET, + KSEVENT_EXTDEV_TIMECODE_UPDATE, + KSEVENT_EXTDEV_OPERATION_MODE_UPDATE, // Notify mode of operation change (VCR,OFF,Camera) + KSEVENT_EXTDEV_TRANSPORT_STATE_UPDATE, // XPrt state change + KSEVENT_EXTDEV_NOTIFY_REMOVAL, // Notify device removal + KSEVENT_EXTDEV_NOTIFY_MEDIUM_CHANGE // Notify medium (tape) is removed or added + ); + {$EXTERNALSYM KSEVENT_DEVCMD} + TKSEventDevCmd = KSEVENT_DEVCMD; + + +//////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2002 Microsoft Corporation +// +// Module Name: +// +// sbe.idl +// +// Abstract: +// +// This module the StreamBuffer interface definitions & CLSIDs, public +// +//////////////////////////////////////////////////////////////////////////////// + +const + IID_IStreamBufferSink : TGUID = '{afd1f242-7efd-45ee-ba4e-407a25c9a77a}'; // get recording objects + {$EXTERNALSYM IID_IStreamBufferSink} + IID_IStreamBufferSource : TGUID = '{1c5bd776-6ced-4f44-8164-5eab0e98db12}'; // associates with IStreamBufferSink + {$EXTERNALSYM IID_IStreamBufferSource} + IID_IStreamBufferRecordControl : TGUID = '{ba9b6c99-f3c7-4ff2-92db-cfdd4851bf31}'; // recording control + {$EXTERNALSYM IID_IStreamBufferRecordControl} + IID_IStreamBufferRecComp : TGUID = '{9E259A9B-8815-42ae-B09F-221970B154FD}'; + {$EXTERNALSYM IID_IStreamBufferRecComp} + IID_IStreamBufferRecordingAttribute : TGUID = '{16CA4E03-FE69-4705-BD41-5B7DFC0C95F3}'; // StreamBuffer attribute creation + {$EXTERNALSYM IID_IStreamBufferRecordingAttribute} + IID_IEnumStreamBufferRecordingAttrib : TGUID = '{C18A9162-1E82-4142-8C73-5690FA62FE33}'; // StreamBuffer attribute enumeration + {$EXTERNALSYM IID_IEnumStreamBufferRecordingAttrib} + IID_IStreamBufferConfigure : TGUID = '{ce14dfae-4098-4af7-bbf7-d6511f835414}'; // configuration interface + {$EXTERNALSYM IID_IStreamBufferConfigure} + IID_IStreamBufferMediaSeeking : TGUID = '{f61f5c26-863d-4afa-b0ba-2f81dc978596}'; // IMediaSeeking but with different GUID + {$EXTERNALSYM IID_IStreamBufferMediaSeeking} + IID_IStreamBufferInitialize : TGUID = '{9ce50f2d-6ba7-40fb-a034-50b1a674ec78}'; // allows 3rd party app to set HKEY + {$EXTERNALSYM IID_IStreamBufferInitialize} +// ??? IID_IStreamBufferPolicy : TGUID = '{}'; // StreamBuffer policies + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IStreamBufferInitialize;'} + {$EXTERNALSYM IStreamBufferInitialize} + IStreamBufferInitialize = interface(IUnknown) + ['{9ce50f2d-6ba7-40fb-a034-50b1a674ec78}'] + (*** IStreamBufferInitialize methods ***) + // Implemented on StreamBufferStreamSink and StreamBufferSource filters. + // Gives a hosting application the ability to specify HKEY root in + // registry. This method must called **early**: after the filter is + // instantiated, but before StreamBufferSource is locked (explicitly or + // implicitely) if calling the method on StreamBufferSource, or before + // a source is set (via IStreamBufferSource or IFileSourceFilter) if + // calling the method on StreamBufferStreamSource. If a call is made + // after either filter has been initialized internally, the call will + // fail with E_UNEXPECTED. The hosting application is responsible for + // ensuring that the HKEY passed in is writable & readable per the + // logged-on user privileges. The HKEY is duplicated internally, + // so the caller can close it after making this call. + function SetHKEY(hkeyRoot: HKEY): HResult; stdcall; + + // Implemented on StreamBufferStreamSink and StreamBufferSource filters. + // Provides a way for the hosting application to specify security-level + // sharing between capture and render processes and contexts. By + // default security attributes are inherited from the hosting process, + // unless the application overrides the defaults and provides them via + // this method. + function SetSIDs(cSIDs: DWORD; var ppSID: PSID): HResult; stdcall; + end; + +// ============================================================================ +// ============================================================================ +// IStreamBufferSink +// +// Stream Source interface; +// implemented on the StreamBufferSink filter; +// Only way to get a recorder object's IUnknown (object will subsequently +// be associated with this Sink) +const + RECORDING_TYPE_CONTENT = 0; // no post-recording or overlapped + {$EXTERNALSYM RECORDING_TYPE_CONTENT} + RECORDING_TYPE_REFERENCE = 1; // allows post-recording & overlapped + {$EXTERNALSYM RECORDING_TYPE_REFERENCE} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IStreamBufferSink;'} + {$EXTERNALSYM IStreamBufferSink} + IStreamBufferSink = interface(IUnknown) + ['{afd1f242-7efd-45ee-ba4e-407a25c9a77a}'] + (*** IStreamBufferSink methods ***) + // 1. Locks the profile; + // 2. No *new* input pin connections will be accepted; + // 3. Existing pins that are, or have ever been, connected can be + // reconnected if the media type is exactly the same as the first + // successful connection; + // 4. Can be called multiple times safely with NULL parameter, but only + // once with non-NULL parameter; returns E_UNEXPECTED if called more + // than once with non-NULL param, or after the hosting filter has run; + // 5. Must be called before the filter that implements this interface is + // ever run; when it is run, it locks implicitely and this method has + // no effect if called with NULL parameters, or fails if called with + // non-NULL parameter for the reasons listed above; + // 6. Errors with VFW_E_UNSUPPORTED_STREAM if there are no streams in the + // profile; + // Parameter Detail + // ---------------- + // + // pszStreamBufferFilename + // + // Is a NULL-terminated filename string. If the content written by + // this sink is to be shared cross-process, this parameter specifies a + // filename that will be opened by any reader(s) to read & render the + // content sent into the sink. + // + // Can be NULL (not specified) + // + // Must be a full-path filename; if no path is specified, the file is + // created in a "current" directory + // + // If the file already exists, the call fails + // + // Is opened with DELETE_ON_CLOSE flag, so is automatically deleted + // when the sink is unlocked, or when the hosting process terminates + function LockProfile(pszStreamBufferFilename: PWideChar): HResult; stdcall; + + // 1. Returns a *new* recorder object's IUnknown; + // 2. Caller can call QueryInterface() on the returned pointer to get + // interface pointers to configure & control the recording; + // 3. Returned IUnknown pointer is ref'd & must be Release()'d by the + // caller + // 4. IStreamBufferSink interface must have been locked (explicitely or + // implicitely) prior to call + // + // To create an ordinary recording, specify RECORDING_TYPE_CONTENT for the + // dwRecordType parammeter. This will record the content directly into + // the specified file. These recording types only accept start and stop + // times that occur in the future. + // + // A recording of type RECORDING_TYPE_REFERENCE generates a small file + // that references content saved in temporary storage. Recordings of this + // type can have start and stop times that occurs in the past, and can + // overlap other same-type recordings. + // + // Reference recording *content* will be saved in the same subdirectory as + // the specified reference file, but with hidden and system attributes. + // The naming convention of the files will append a _1.sbe, _2.sbe, etc... + // to the filename (minus extension) specified in the call e.g. a + // "seinfeld01.sbe" reference file will have saved content in hidden + // and system files "seinfeld01_1.sbe", "seinfeld01_2.sbe", etc... + function CreateRecorder(pszFilename: PWideChar; dwRecordType: DWORD; // RECORDING_TYPE_CONTENT or RECORDING_TYPE_REFERENCE + out pRecordingIUnknown: IUnknown): HResult; stdcall; + + // 1. Returns S_OK if the profile is locked and S_FALSE if it is not. + // 2. Returns E_FAIL on error. + function IsProfileLocked: HResult; stdcall; + end; + +// ============================================================================ +// ============================================================================ +// IStreamBufferSource () +// +// Stream Source reader interface; +// Implemented on the StreamBufferSource filter; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IStreamBufferSource;'} + {$EXTERNALSYM IStreamBufferSource} + IStreamBufferSource = interface(IUnknown) + ['{1c5bd776-6ced-4f44-8164-5eab0e98db12}'] + (*** IStreamBufferSource methods ***) + //------------------------------------------------------------------------ + // SetStreamSink () + // + // 1. Sets the StreamBuffer Sink that streams from this Source; + // 2. IStreamBufferSink object must be in the same process as this object; + // 3. Interface is AddRef()'d if the call succeeds; + // + // Parameter Detail + // ---------------- + // + // pIStreamBufferSink + // Sink that will stream to this Source + function SetStreamSink(pIStreamBufferSink: IStreamBufferSink): HResult; stdcall; + end; + +// ============================================================================ +// ============================================================================ +// IStreamBufferRecordControl +// +// obtained by QIing IStreamBufferSink::CreateRecorder()-returned IUnknown * + + {$HPPEMIT 'typedef System::DelphiInterface _di_IStreamBufferRecordControl;'} + {$EXTERNALSYM IStreamBufferRecordControl} + IStreamBufferRecordControl = interface(IUnknown) + ['{ba9b6c99-f3c7-4ff2-92db-cfdd4851bf31}'] + (*** IStreamBufferRecordControl methods ***) + // 1. Starts a recording; + // 2. Will save to the filename that is specified when this interface's + // IUnknown is requested (IStreamBufferSink::CreateRecorder()); + // + // Parameter Detail + // ---------------- + // + // rtStart + // + // Start time relative to "now; + // + // If the recording type is a content recording, can only refer to + // seconds in the future; allowed seconds are [0,5] + // + // If the recording type is a reference recording, can refer to any + // time that still has valid content i.e. content that has not yet + // become stale + // + // If the recording is a reference recording and (* prtStart) is + // earlier than the earliest still-valid content, the call will reset + // it to the earliest content; the value when the recording was + // actually started will be [out] + function Start(prtStart: PReferenceTime): HResult; stdcall; + + // 1. Stops a recording; + // 2. Closes out the file; + // + // Parameter Detail + // ---------------- + // + // rtStart + // + // Stop time relative to "now; + // + // If the recording type is a content recording, can only refer to + // seconds in the future; allowed seconds are [0,5] + // + // If the recording type is a reference recording, can refer to any + // time that still has valid content i.e. content that has not yet + // become stale; stop time cannot be <= start time + function Stop(rtStop: TReferenceTime): HResult; stdcall; + + // 1. Retrieves the status of the recording + // + // Parameter Detail + // ---------------- + // + // phResult + // + // The (current) status of writing or closing the recording file; + // + // Can be NULL; + // + // pbStarted + // + // If supplied, set to a non-zero value if the recording has been + // started + // + // Can be NULL; + // + // pbStopped + // + // If supplied, set to a non-zero value if the recording has been + // stopped; + // + // Can be NULL; + // + // NOTE: If the recording has never been started, it will not be flagged + // as stopped. + function GetRecordingStatus(phResult: PHRESULT; pbStarted, pbStopped: PBOOL): HResult; stdcall; + end; + +// ============================================================================ +// ============================================================================ +// IStreamBufferRecComp +// +// CoCreateInstance CLSID_StreamBufferComposeRecording and QueryInterface for +// this interface; this interface allows the creation of a single target +// content recording which consists of a number of concatenated recordings +// (reference or content; can mix & match if desired) + + {$HPPEMIT 'typedef System::DelphiInterface _di_IStreamBufferRecComp;'} + {$EXTERNALSYM IStreamBufferRecComp} + IStreamBufferRecComp = interface(IUnknown) + ['{9E259A9B-8815-42ae-B09F-221970B154FD}'] + (*** IStreamBufferRecComp methods ***) + // 1. Initializes for a target recording + // + // Parameter Detail + // ---------------- + // + // pszTargetFilename + // + // Sets the target filename + // + // Fails if the file already exists + // + // pszSBRecProfileRef + // + // Must be a completed, SBE-generated recording + // + // This recording's profile will be used to define the target profile + // + // Appended files must have exactly the same profile + function Initialize(pszTargetFilename, pszSBRecProfileRef: PWideChar): HResult; stdcall; + + // 1. appends an entire recording + // 2. fails if the recording is live + function Append (pszSBRecording: PwideChar): HResult; stdcall; + + // 1. appends the specified portion of the recording; the parameters must + // be accurate; the call will not readjust them within the boundaries + // 2. the time spread must be at least 2 seconds + // 3. fails if the recording is live + function AppendEx(pszSBRecording: PWideChar; rtStart, rtStop: TReferenceTime): HResult; stdcall; + + // 1. returns the current length of the recording; updates as recordings + // are appended; + // 2. can be called repeatedly during a Append() call on another + // thread; + function GetCurrentLength(out pcSeconds: DWORD): HResult; stdcall; + + // 1. explicitely closes the recording + // 2. final release of interface closes the recording as well + function Close: HResult; stdcall; + + // 1. cancels an in-progress appending operation; has no effect otherwise + function Cancel: HResult; stdcall; + end; + +// ============================================================================ +// ============================================================================ +// IStreamBufferRecordingAttribute +// +// obtained by calling QueryInterface on a recorder +// +// well-known attributes: +// +// NAME DESCRIPTION +// ------------------- ---------------------------------------------------- +// +// Title String containing the content title. +// +// Author String containing the name of the content author. +// +// Description String containing a description of the content. +// +// Rating String containing a content rating. +// +// Copyright String containing a content copyright message. +// +// Duration Quadruple word value containing the playing duration +// of the file, in 100-nanosecond units. +// +// Bitrate Double word value containing the bit rate. +// +// Seekable Boolean value; true denoting that the content is +// seekable. +// +// Stridable Boolean value, true denoting that the content is +// stridable (fast forward and rewind are enabled). +// +// Broadcast Boolean value; true denoting that the content is not +// copyright-protected, and can be broadcast. +// +// Use_DRM reserved +// +// DRM_Flags reserved +// +// DRM_Level reserved +// +// Is_Protected reserved +// +// Is_Trusted reserved +// +// Signature_Name reserved +// +// HasAudio Boolean, true denoting the content includes an +// audio stream. +// +// HasImage Boolean, true denoting the content includes a still +// image stream (such as JPEG images). +// +// HasScript Boolean, true denoting the content includes a script +// stream. +// +// HasVideo Boolean, true denoting the content includes a video +// stream. +// +// CurrentBitrate Double word containing the current total bitrate, +// usually used for MEB (multi-bit rate) streams. +// +// OptimalBitrate Double word containing the minimum total bitrate +// recommended to stream the content and get +// maximum quality. +// +// WM/AlbumTitle String containing the album title. +// +// WM/Track Double word containing the track number. +// +// WM/PromotionURL String with a URL to an HTML page that contains +// information about products and events (such as +// concerts) that are related to this music. +// +// WM/AlbumCoverURL String with a URL to an HTML page that contains an +// image of the album cover and information about +// the album. +// +// WM/Genre String with the genre of the music. +// +// WM/Year String with the year of publication of the music. +// +// WM/GenreID +// +// WM/MCDI +// +// BannerImageType One member of the WMT_ATTR_IMAGETYPE enumeration +// type. +// +// BannerImageData The actual image data: a bitmap, JPEG, or GIF image. +// +// +// BannerImageURL If the banner image is clicked on then this URL is +// activated. +// +// CopyrightURL An URL to a copyright page. +// +// NSC_Name String containing the multicast station contact +// name (read-only). +// +// NSC_Address String containing the multicast station contact +// address (read-only). +// +// NSC_Phone String containing the multicast station contact +// phone number (read-only). +// +// NSC_Email String containing the multicast station contact +// email address (read-only). +// +// NSC_Description String containing the multicast station contact +// description (read-only). + +//////////////////////////////////////////////////////////////// +// +// List of pre-defined attributes +const + g_wszStreamBufferRecordingDuration = WideString('Duration'); + {$EXTERNALSYM g_wszStreamBufferRecordingDuration} + g_wszStreamBufferRecordingBitrate = WideString('Bitrate'); + {$EXTERNALSYM g_wszStreamBufferRecordingBitrate} + g_wszStreamBufferRecordingSeekable = WideString('Seekable'); + {$EXTERNALSYM g_wszStreamBufferRecordingSeekable} + g_wszStreamBufferRecordingStridable = WideString('Stridable'); + {$EXTERNALSYM g_wszStreamBufferRecordingStridable} + g_wszStreamBufferRecordingBroadcast = WideString('Broadcast'); + {$EXTERNALSYM g_wszStreamBufferRecordingBroadcast} + g_wszStreamBufferRecordingProtected = WideString('Is_Protected'); + {$EXTERNALSYM g_wszStreamBufferRecordingProtected} + g_wszStreamBufferRecordingTrusted = WideString('Is_Trusted'); + {$EXTERNALSYM g_wszStreamBufferRecordingTrusted} + g_wszStreamBufferRecordingSignature_Name = WideString('Signature_Name'); + {$EXTERNALSYM g_wszStreamBufferRecordingSignature_Name} + g_wszStreamBufferRecordingHasAudio = WideString('HasAudio'); + {$EXTERNALSYM g_wszStreamBufferRecordingHasAudio} + g_wszStreamBufferRecordingHasImage = WideString('HasImage'); + {$EXTERNALSYM g_wszStreamBufferRecordingHasImage} + g_wszStreamBufferRecordingHasScript = WideString('HasScript'); + {$EXTERNALSYM g_wszStreamBufferRecordingHasScript} + g_wszStreamBufferRecordingHasVideo = WideString('HasVideo'); + {$EXTERNALSYM g_wszStreamBufferRecordingHasVideo} + g_wszStreamBufferRecordingCurrentBitrate = WideString('CurrentBitrate'); + {$EXTERNALSYM g_wszStreamBufferRecordingCurrentBitrate} + g_wszStreamBufferRecordingOptimalBitrate = WideString('OptimalBitrate'); + {$EXTERNALSYM g_wszStreamBufferRecordingOptimalBitrate} + g_wszStreamBufferRecordingHasAttachedImages = WideString('HasAttachedImages'); + {$EXTERNALSYM g_wszStreamBufferRecordingHasAttachedImages} + g_wszStreamBufferRecordingSkipBackward = WideString('Can_Skip_Backward'); + {$EXTERNALSYM g_wszStreamBufferRecordingSkipBackward} + g_wszStreamBufferRecordingSkipForward = WideString('Can_Skip_Forward'); + {$EXTERNALSYM g_wszStreamBufferRecordingSkipForward} + g_wszStreamBufferRecordingNumberOfFrames = WideString('NumberOfFrames'); + {$EXTERNALSYM g_wszStreamBufferRecordingNumberOfFrames} + g_wszStreamBufferRecordingFileSize = WideString('FileSize'); + {$EXTERNALSYM g_wszStreamBufferRecordingFileSize} + g_wszStreamBufferRecordingHasArbitraryDataStream = WideString('HasArbitraryDataStream'); + {$EXTERNALSYM g_wszStreamBufferRecordingHasArbitraryDataStream} + g_wszStreamBufferRecordingHasFileTransferStream = WideString('HasFileTransferStream'); + {$EXTERNALSYM g_wszStreamBufferRecordingHasFileTransferStream} + +//////////////////////////////////////////////////////////////// +// +// The content description object supports 5 basic attributes. + + g_wszStreamBufferRecordingTitle = WideString('Title'); + {$EXTERNALSYM g_wszStreamBufferRecordingTitle} + g_wszStreamBufferRecordingAuthor = WideString('Author'); + {$EXTERNALSYM g_wszStreamBufferRecordingAuthor} + g_wszStreamBufferRecordingDescription = WideString('Description'); + {$EXTERNALSYM g_wszStreamBufferRecordingDescription} + g_wszStreamBufferRecordingRating = WideString('Rating'); + {$EXTERNALSYM g_wszStreamBufferRecordingRating} + g_wszStreamBufferRecordingCopyright = WideString('Copyright'); + {$EXTERNALSYM g_wszStreamBufferRecordingCopyright} + +//////////////////////////////////////////////////////////////// +// +// These attributes are used to configure DRM using IWMDRMWriter::SetDRMAttribute. + + g_wszStreamBufferRecordingUse_DRM = WideString('Use_DRM'); + {$EXTERNALSYM g_wszStreamBufferRecordingUse_DRM} + g_wszStreamBufferRecordingDRM_Flags = WideString('DRM_Flags'); + {$EXTERNALSYM g_wszStreamBufferRecordingDRM_Flags} + g_wszStreamBufferRecordingDRM_Level = WideString('DRM_Level'); + {$EXTERNALSYM g_wszStreamBufferRecordingDRM_Level} + +//////////////////////////////////////////////////////////////// +// +// These are the additional attributes defined in the WM attribute +// namespace that give information about the content. + + g_wszStreamBufferRecordingAlbumTitle = WideString('WM/AlbumTitle'); + {$EXTERNALSYM g_wszStreamBufferRecordingAlbumTitle} + g_wszStreamBufferRecordingTrack = WideString('WM/Track'); + {$EXTERNALSYM g_wszStreamBufferRecordingTrack} + g_wszStreamBufferRecordingPromotionURL = WideString('WM/PromotionURL'); + {$EXTERNALSYM g_wszStreamBufferRecordingPromotionURL} + g_wszStreamBufferRecordingAlbumCoverURL = WideString('WM/AlbumCoverURL'); + {$EXTERNALSYM g_wszStreamBufferRecordingAlbumCoverURL} + g_wszStreamBufferRecordingGenre = WideString('WM/Genre'); + {$EXTERNALSYM g_wszStreamBufferRecordingGenre} + g_wszStreamBufferRecordingYear = WideString('WM/Year'); + {$EXTERNALSYM g_wszStreamBufferRecordingYear} + g_wszStreamBufferRecordingGenreID = WideString('WM/GenreID'); + {$EXTERNALSYM g_wszStreamBufferRecordingGenreID} + g_wszStreamBufferRecordingMCDI = WideString('WM/MCDI'); + {$EXTERNALSYM g_wszStreamBufferRecordingMCDI} + g_wszStreamBufferRecordingComposer = WideString('WM/Composer'); + {$EXTERNALSYM g_wszStreamBufferRecordingComposer} + g_wszStreamBufferRecordingLyrics = WideString('WM/Lyrics'); + {$EXTERNALSYM g_wszStreamBufferRecordingLyrics} + g_wszStreamBufferRecordingTrackNumber = WideString('WM/TrackNumber'); + {$EXTERNALSYM g_wszStreamBufferRecordingTrackNumber} + g_wszStreamBufferRecordingToolName = WideString('WM/ToolName'); + {$EXTERNALSYM g_wszStreamBufferRecordingToolName} + g_wszStreamBufferRecordingToolVersion = WideString('WM/ToolVersion'); + {$EXTERNALSYM g_wszStreamBufferRecordingToolVersion} + g_wszStreamBufferRecordingIsVBR = WideString('IsVBR'); + {$EXTERNALSYM g_wszStreamBufferRecordingIsVBR} + +// WM/AlbumArtist is a potentially different value than Author + + g_wszStreamBufferRecordingAlbumArtist = WideString('WM/AlbumArtist'); + {$EXTERNALSYM g_wszStreamBufferRecordingAlbumArtist} + +//////////////////////////////////////////////////////////////// +// +// These optional attributes may be used to give information +// about the branding of the content. + + g_wszStreamBufferRecordingBannerImageType = WideString('BannerImageType'); + {$EXTERNALSYM g_wszStreamBufferRecordingBannerImageType} + g_wszStreamBufferRecordingBannerImageData = WideString('BannerImageData'); + {$EXTERNALSYM g_wszStreamBufferRecordingBannerImageData} + g_wszStreamBufferRecordingBannerImageURL = WideString('BannerImageURL'); + {$EXTERNALSYM g_wszStreamBufferRecordingBannerImageURL} + g_wszStreamBufferRecordingCopyrightURL = WideString('CopyrightURL'); + {$EXTERNALSYM g_wszStreamBufferRecordingCopyrightURL} + +//////////////////////////////////////////////////////////////// +// +// Optional attributes, used to give information +// about video stream properties. + + g_wszStreamBufferRecordingAspectRatioX = WideString('AspectRatioX'); + {$EXTERNALSYM g_wszStreamBufferRecordingAspectRatioX} + g_wszStreamBufferRecordingAspectRatioY = WideString('AspectRatioY'); + {$EXTERNALSYM g_wszStreamBufferRecordingAspectRatioY} + +//////////////////////////////////////////////////////////////// +// +// The NSC file supports the following attributes. + + g_wszStreamBufferRecordingNSCName = WideString('NSC_Name'); + {$EXTERNALSYM g_wszStreamBufferRecordingNSCName} + g_wszStreamBufferRecordingNSCAddress = WideString('NSC_Address'); + {$EXTERNALSYM g_wszStreamBufferRecordingNSCAddress} + g_wszStreamBufferRecordingNSCPhone = WideString('NSC_Phone'); + {$EXTERNALSYM g_wszStreamBufferRecordingNSCPhone} + g_wszStreamBufferRecordingNSCEmail = WideString('NSC_Email'); + {$EXTERNALSYM g_wszStreamBufferRecordingNSCEmail} + g_wszStreamBufferRecordingNSCDescription = WideString('NSC_Description'); + {$EXTERNALSYM g_wszStreamBufferRecordingNSCDescription} + +type + // StreamBuffer Attribute datatypes; + STREAMBUFFER_ATTR_DATATYPE = ( + STREAMBUFFER_TYPE_DWORD, + STREAMBUFFER_TYPE_STRING, + STREAMBUFFER_TYPE_BINARY, + STREAMBUFFER_TYPE_BOOL, + STREAMBUFFER_TYPE_QWORD, + STREAMBUFFER_TYPE_WORD, + STREAMBUFFER_TYPE_GUID + ); + {$EXTERNALSYM STREAMBUFFER_ATTR_DATATYPE} + TStreamBufferAttrDataType = STREAMBUFFER_ATTR_DATATYPE; + + IEnumStreamBufferRecordingAttrib = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IStreamBufferRecordingAttribute;'} + {$EXTERNALSYM IStreamBufferRecordingAttribute} + IStreamBufferRecordingAttribute = interface(IUnknown) + ['{16CA4E03-FE69-4705-BD41-5B7DFC0C95F3}'] + (*** IStreamBufferRecordingAttribute methods ***) + // 1. Sets an attribute on a recording object; + // 2. Fails if the IStreamBufferRecordControl::Start has already been successfully + // called; + // 3. If an attribute of the same name already exists, overwrites the old; + function SetAttribute(ulReserved: ULONG; pszAttributeName: PWideChar; + StreamBufferAttributeType: TStreamBufferAttrDataType; pbAttribute: PBYTE; + cbAttributeLength: WORD): HResult; stdcall; + + // 1. Returns the count of attributes currently set; + function GetAttributeCount(ulReserved: ULONG; out pcAttributes: WORD): HResult; stdcall; + + // 1. Given a name, returns the attribute data; + // 2. If the provided buffer is too small, returns VFW_E_BUFFER_OVERFLOW, + // and (* pcbLength) contains the minimum required length of the buffer + // 3. To learn the length of the attribute, pass in non-NULL pcbLength, + // and NULL pbAttribute parameter; [out] value will be the length of + // the attribute + function GetAttributeByName(pszAttributeName: PWideChar; pulReserved: PULONG; + out pStreamBufferAttributeType: TStreamBufferAttrDataType; + {out} pbAttribute: PBYTE; var pcbLength: WORD): HResult; stdcall; + + // 1. Given an 0-based index, returns the attribute name and data + // 2. If either buffer is too small, returns VFW_E_BUFFER_OVERFLOW, and + // (* pcbLength) and (* pcchNameLength) contain the minimum required + // length of each buffer + // 3. The length returned by pcchNameLength includes the null-terminator + // 4. To learn the length of the name & attribute, pass in non-NULL + // pcchNameLength & pcbLength, and NULL pszAttributeName & pbAttribute + // parameters; [out] value of the non-NULL parameters will be the + // lengths of the name and attribute + function GetAttributeByIndex(wIndex: WORD; pulReserved: PULONG; + pszAttributeName: PWideChar; var pcchNameLength: WORD; // includes NULL-terminator; in BYTES + out pStreamBufferAttributeType: TStreamBufferAttrDataType; + pbAttribute: PBYTE; pcbLength: PWORD): HResult; stdcall; + + // 1. Returns a StreamBuffer attribute enumeration object that snapshots + // the attributes at time-of-call + function EnumAttributes(out ppIEnumStreamBufferAttrib: IEnumStreamBufferRecordingAttrib): HResult; stdcall; + end; + +// ============================================================================ +// ============================================================================ +// IEnumStreamBufferRecordingAttrib +// +// obtained by calling IStreamBufferRecordingAttribute::EnumAttributes, or +// calling clone on this interface + + PStreamBufferAttribute = ^TStreamBufferAttribute; + STREAMBUFFER_ATTRIBUTE = record + pszName : PWideChar; // allocated by callee; freed by caller + StreamBufferAttributeType : TStreamBufferAttrDataType; + pbAttribute : PBYTE; // allocated by caller; freed by caller + cbLength : WORD; + end; + {$EXTERNALSYM STREAMBUFFER_ATTRIBUTE} + TStreamBufferAttribute = STREAMBUFFER_ATTRIBUTE; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IEnumStreamBufferRecordingAttrib;'} + {$EXTERNALSYM IEnumStreamBufferRecordingAttrib} + IEnumStreamBufferRecordingAttrib = interface(IUnknown) + ['{C18A9162-1E82-4142-8C73-5690FA62FE33}'] + (*** IEnumStreamBufferRecordingAttrib methods ***) + function Next(cRequest: ULONG; pStreamBufferAttribute: PStreamBufferAttribute; + out pcReceived: ULONG): HResult; stdcall; + function Skip(cRecords: ULONG): HResult; stdcall; + function Reset: HResult; stdcall; + function Clone(out ppIEnumStreamBufferAttrib: IEnumStreamBufferRecordingAttrib): HResult; stdcall; + end; + +// ============================================================================ +// ============================================================================ +// IStreamBufferConfigure + + {$HPPEMIT 'typedef System::DelphiInterface _di_IStreamBufferConfigure;'} + {$EXTERNALSYM IStreamBufferConfigure} + IStreamBufferConfigure = interface(IUnknown) + ['{ce14dfae-4098-4af7-bbf7-d6511f835414}'] + (*** IStreamBufferConfigure methods ***) + // 1. Sets the directory where all content is saved, ringbuffer & + // StreamBuffer; + // 2. Creates directory if necessary; + // 3. All TEMP files have hidden+system attributes + function SetDirectory(pszDirectoryName: PWideChar): HResult; stdcall; + + // 1. Retrieves previously set backing store directory, or default + // location if none was specified + function GetDirectory(out ppszDirectoryName: PWideChar): HResult; stdcall; + + // 1. Sets the number of backing files + // 2. valid values + // + // 4 <= min <= 100 + // 6 <= max <= 102 + // min max delta >= 2 + function SetBackingFileCount(dwMin, dwMax: DWORD): HResult; stdcall; + + // 1. Retrieves previously set backing file counts, or defaults if none + // have have been set + function GetBackingFileCount(out pdwMin, pdwMax: DWORD): HResult; stdcall; + + // 1. Sets the seconds of content each backing file will hold + // 2. valid values: + // dwSeconds >= 15 + function SetBackingFileDuration(dwSeconds: DWORD): HResult; stdcall; + + // 1. Retrieves previously set backing file duration, or default of none + // is set + function GetBackingFileDuration(out pdwSeconds: DWORD): HResult; stdcall; + end; + +// ============================================================================ +// ============================================================================ +// IStreamBufferMediaSeeking +// +// Implemented on the StreamBufferSource filter. Used to seek and set the +// playback rate. + + {$HPPEMIT 'typedef System::DelphiInterface _di_IStreamBufferMediaSeeking;'} + {$EXTERNALSYM IStreamBufferMediaSeeking} + IStreamBufferMediaSeeking = interface(IMediaSeeking) + ['{f61f5c26-863d-4afa-b0ba-2f81dc978596}'] + (*** IStreamBufferMediaSeeking methods ***) + // no additional methods have been added + end; + +// ============================================================================ +// ============================================================================ +// events + +// see evcode.h comment for range +// stream buffer engine (PVR) 0x0326 - 0x0350 (sbe.idl) +const + STREAMBUFFER_EC_BASE = $0326; + {$EXTERNALSYM STREAMBUFFER_EC_BASE} + + // timehole event + // param1 = timehole stream offset ms + // param1 = timehole size ms + STREAMBUFFER_EC_TIMEHOLE = STREAMBUFFER_EC_BASE; + {$EXTERNALSYM STREAMBUFFER_EC_TIMEHOLE} + STREAMBUFFER_EC_STALE_DATA_READ = STREAMBUFFER_EC_TIMEHOLE + 1; + {$EXTERNALSYM STREAMBUFFER_EC_STALE_DATA_READ} + STREAMBUFFER_EC_STALE_FILE_DELETED = STREAMBUFFER_EC_STALE_DATA_READ + 1; + {$EXTERNALSYM STREAMBUFFER_EC_STALE_FILE_DELETED} + STREAMBUFFER_EC_CONTENT_BECOMING_STALE = STREAMBUFFER_EC_STALE_FILE_DELETED + 1; + {$EXTERNALSYM STREAMBUFFER_EC_CONTENT_BECOMING_STALE} + STREAMBUFFER_EC_WRITE_FAILURE = STREAMBUFFER_EC_CONTENT_BECOMING_STALE + 1; + {$EXTERNALSYM STREAMBUFFER_EC_WRITE_FAILURE} + + // unexpected read failure + // param1 = HResult failure + // param2 = undefined + STREAMBUFFER_EC_READ_FAILURE = STREAMBUFFER_EC_WRITE_FAILURE + 1; + {$EXTERNALSYM STREAMBUFFER_EC_READ_FAILURE} + + // playback rate change + // param1 = old_playback_rate * 10000 e.g. 2x is 20000 + // param2 = new_playback_rate * 10000 + STREAMBUFFER_EC_RATE_CHANGED = STREAMBUFFER_EC_READ_FAILURE + 1; + {$EXTERNALSYM STREAMBUFFER_EC_RATE_CHANGED} + +/////////////////////////////////////////////////////////////////////////////// +// +// Public Interfaces for the DX9 Video Mixing Renderer DShow filter +// +// Copyright (c) 1999 - 2002, Microsoft Corporation. All rights reserved. +/////////////////////////////////////////////////////////////////////////////// + +// public interfaces supported by the VMR9 +const + IID_IVMRSurface9 : TGUID = '{dfc581a1-6e1f-4c3a-8d0a-5e9792ea2afc}'; + {$EXTERNALSYM IID_IVMRSurface9} + + IID_IVMRSurfaceAllocator9 : TGUID = '{8d5148ea-3f5d-46cf-9df1-d1b896eedb1f}'; + {$EXTERNALSYM IID_IVMRSurfaceAllocator9} + IID_IVMRSurfaceAllocatorEx9 : TGUID = '{6de9a68a-a928-4522-bf57-655ae3866456}'; + {$EXTERNALSYM IID_IVMRSurfaceAllocatorEx9} + IID_IVMRSurfaceAllocatorNotify9 : TGUID = '{dca3f5df-bb3a-4d03-bd81-84614bfbfa0c}'; + {$EXTERNALSYM IID_IVMRSurfaceAllocatorNotify9} + IID_IVMRImagePresenter9 : TGUID = '{69188c61-12a3-40f0-8ffc-342e7b433fd7}'; + {$EXTERNALSYM IID_IVMRImagePresenter9} + IID_IVMRImagePresenterConfig9 : TGUID = '{45c15cab-6e22-420a-8043-ae1f0ac02c7d}'; + {$EXTERNALSYM IID_IVMRImagePresenterConfig9} + IID_IVMRMonitorConfig9 : TGUID = '{46c2e457-8ba0-4eef-b80b-0680f0978749}'; + {$EXTERNALSYM IID_IVMRMonitorConfig9} + IID_IVMRWindowlessControl9 : TGUID = '{8f537d09-f85e-4414-b23b-502e54c79927}'; + {$EXTERNALSYM IID_IVMRWindowlessControl9} + + IID_IVMRMixerControl9 : TGUID = '{1a777eaa-47c8-4930-b2c9-8fee1c1b0f3b}'; + {$EXTERNALSYM IID_IVMRMixerControl9} + IID_IVMRImageCompositor9 : TGUID = '{4a5c89eb-df51-4654-ac2a-e48e02bbabf6}'; + {$EXTERNALSYM IID_IVMRImageCompositor9} + IID_IVMRMixerBitmap9 : TGUID = '{ced175e5-1935-4820-81bd-ff6ad00c9108}'; + {$EXTERNALSYM IID_IVMRMixerBitmap9} + + IID_IVMRFilterConfig9 : TGUID = '{5a804648-4f66-4867-9c43-4f5c822cf1b8}'; + {$EXTERNALSYM IID_IVMRFilterConfig9} + IID_IVMRAspectRatioControl9 : TGUID = '{00d96c29-bbde-4efc-9901-bb5036392146}'; + {$EXTERNALSYM IID_IVMRAspectRatioControl9} + IID_IVMRVideoStreamControl9 : TGUID = '{d0cfe38b-93e7-4772-8957-0400c49a4485}'; + {$EXTERNALSYM IID_IVMRVideoStreamControl9} + + IID_IVMRDeinterlaceControl9 : TGUID = '{a215fb8d-13c2-4f7f-993c-003d6271a459}'; + {$EXTERNALSYM IID_IVMRDeinterlaceControl9} + +/////////////////////////////////////////////////////////////////////////////// +// +// Allocator Presenter interfaces +// +/////////////////////////////////////////////////////////////////////////////// + + +//===================================================================== +// +// IVMRImagePresenter9 +// +//===================================================================== +type + VMR9PresentationFlags = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM VMR9PresentationFlags} + const + VMR9Sample_SyncPoint = $00000001; + {$EXTERNALSYM VMR9Sample_SyncPoint} + VMR9Sample_Preroll = $00000002; + {$EXTERNALSYM VMR9Sample_Preroll} + VMR9Sample_Discontinuity = $00000004; + {$EXTERNALSYM VMR9Sample_Discontinuity} + VMR9Sample_TimeValid = $00000008; + {$EXTERNALSYM VMR9Sample_TimeValid} + VMR9Sample_SrcDstRectsValid = $00000010; + {$EXTERNALSYM VMR9Sample_SrcDstRectsValid} + + +type + PVMR9PresentationInfo = ^TVMR9PresentationInfo; + VMR9PresentationInfo = record + dwFlags : DWORD; + lpSurf : IDirect3DSurface9; + rtStart : TReferenceTime; + rtEnd : TReferenceTime; + szAspectRatio : TSIZE; + rcSrc : TRECT; + rcDst : TRECT; + dwReserved1 : DWORD; + dwReserved2 : DWORD; + end; + {$EXTERNALSYM VMR9PresentationInfo} + TVMR9PresentationInfo = VMR9PresentationInfo; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRImagePresenter9;'} + {$EXTERNALSYM IVMRImagePresenter9} + IVMRImagePresenter9 = interface(IUnknown) + ['{69188c61-12a3-40f0-8ffc-342e7b433fd7}'] + (*** IVMRImagePresenter9 methods ***) + function StartPresenting(dwUserID: DWORD): HResult; stdcall; + function StopPresenting(dwUserID: DWORD): HResult; stdcall; + function PresentImage(dwUserID: DWORD; lpPresInfo: PVMR9PresentationInfo): HResult; stdcall; + end; + +//===================================================================== +// +// IVMRSurfaceAllocator +// +//===================================================================== + + VMR9SurfaceAllocationFlags = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM VMR9SurfaceAllocationFlags} + const + // surface types/usage + VMR9AllocFlag_3DRenderTarget = $0001; + {$EXTERNALSYM VMR9AllocFlag_3DRenderTarget} + VMR9AllocFlag_DXVATarget = $0002; + {$EXTERNALSYM VMR9AllocFlag_DXVATarget} + // VMR9AllocFlag_TextureSurface can be combined with + // DXVATarget and 3DRenderTarget + VMR9AllocFlag_TextureSurface = $0004; + {$EXTERNALSYM VMR9AllocFlag_TextureSurface} + VMR9AllocFlag_OffscreenSurface = $0008; + {$EXTERNALSYM VMR9AllocFlag_OffscreenSurface} + + // + // The following flag applies to YUV mixing mode only + // and indicates that VMR9's mixer can accept RGB formats + // as well as the specified YUV format. + // The allocator-present can switch between the two + // surface formats dynamically. + // + VMR9AllocFlag_RGBDynamicSwitch = $0010; + {$EXTERNALSYM VMR9AllocFlag_RGBDynamicSwitch} + VMR9AllocFlag_UsageReserved = $00E0; + {$EXTERNALSYM VMR9AllocFlag_UsageReserved} + + VMR9AllocFlag_UsageMask = $00FF; + {$EXTERNALSYM VMR9AllocFlag_UsageMask} + +type + PVMR9AllocationInfo = ^TVMR9AllocationInfo; + _VMR9AllocationInfo = record + dwFlags : DWORD; // see VMR9SurfaceAllocationFlags + dwWidth : DWORD; + dwHeight : DWORD; + Format : TD3DFORMAT; // 0 means use a format compatible with the display + Pool : TD3DPOOL; + MinBuffers : DWORD; + szAspectRatio : TSIZE; + szNativeSize : TSIZE; + end; + {$EXTERNALSYM _VMR9AllocationInfo} + VMR9AllocationInfo = _VMR9AllocationInfo; + {$EXTERNALSYM VMR9AllocationInfo} + TVMR9AllocationInfo = _VMR9AllocationInfo; + + IVMRSurfaceAllocatorNotify9 = interface; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRSurfaceAllocator9;'} + {$EXTERNALSYM IVMRSurfaceAllocator9} + IVMRSurfaceAllocator9 = interface(IUnknown) + ['{8d5148ea-3f5d-46cf-9df1-d1b896eedb1f}'] + (*** IVMRSurfaceAllocator9 methods ***) + function InitializeDevice(dwUserID: DWORD; lpAllocInfo: PVMR9AllocationInfo; + var lpNumBuffers: DWORD): HResult; stdcall; + function TerminateDevice(dwID: DWORD): HResult; stdcall; + function GetSurface(dwUserID: DWORD; SurfaceIndex: DWORD; SurfaceFlags: DWORD; + out lplpSurface: IDirect3DSurface9): HResult; stdcall; + function AdviseNotify(lpIVMRSurfAllocNotify: IVMRSurfaceAllocatorNotify9): HResult; stdcall; + end; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRSurfaceAllocatorEx9;'} + {$EXTERNALSYM IVMRSurfaceAllocatorEx9} + IVMRSurfaceAllocatorEx9 = interface(IVMRSurfaceAllocator9) + ['{6DE9A68A-A928-4522-BF57-655AE3866456}'] + function GetSurfaceEx(dwUserID: LongWord; SurfaceIndex, SurfaceFlags: DWORD; + out lplpSurface: IDirect3DSurface9; lprcDst: PRect): HRESULT; stdcall; + end; + +//===================================================================== +// +// IVMRSurfaceAllocatorNotify9 +// +//===================================================================== + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRSurfaceAllocatorNotify9;'} + {$EXTERNALSYM IVMRSurfaceAllocatorNotify9} + IVMRSurfaceAllocatorNotify9 = interface(IUnknown) + ['{dca3f5df-bb3a-4d03-bd81-84614bfbfa0c}'] + (*** IVMRSurfaceAllocatorNotify9 methods ***) + function AdviseSurfaceAllocator(dwUserID: DWORD; + lpIVRMSurfaceAllocator: IVMRSurfaceAllocator9): HResult; stdcall; + function SetD3DDevice(lpD3DDevice: IDirect3DDevice9; + hMonitor: HMONITOR): HResult; stdcall; + function ChangeD3DDevice(lpD3DDevice: IDirect3DDevice9; + hMonitor: HMONITOR): HResult; stdcall; + function AllocateSurfaceHelper(lpAllocInfo: PVMR9AllocationInfo; + var lpNumBuffers: DWORD; out lplpSurface: IDirect3DSurface9): HResult; stdcall; + function NotifyEvent(EventCode: LongInt; Param1, Param2: LongInt): HResult; stdcall; + end; + +/////////////////////////////////////////////////////////////////////////////// +// +// Application control and configuration interfaces +// +/////////////////////////////////////////////////////////////////////////////// + + +//===================================================================== +// +// IVMRWindowlessControl9 +// +//===================================================================== + VMR9AspectRatioMode= ( + VMR9ARMode_None, + VMR9ARMode_LetterBox + ); + {$EXTERNALSYM VMR9AspectRatioMode} + TVMR9AspectRatioMode = VMR9AspectRatioMode; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRWindowlessControl9;'} + {$EXTERNALSYM IVMRWindowlessControl9} + IVMRWindowlessControl9 = interface(IUnknown) + ['{8f537d09-f85e-4414-b23b-502e54c79927}'] + (*** IVMRWindowlessControl9 methods ***) + ////////////////////////////////////////////////////////// + // Video size and position information + ////////////////////////////////////////////////////////// + function GetNativeVideoSize(out lpWidth, lpHeight, lpARWidth, lpARHeigh: LongInt): HResult; stdcall; + function GetMinIdealVideoSize(out lpWidth, lpHeight: LongInt): HResult; stdcall; + function GetMaxIdealVideoSize(out lpWidth, lpHeight: LongInt): HResult; stdcall; + function SetVideoPosition(lpSRCRect, lpDSTRect: PRECT): HResult; stdcall; + function GetVideoPosition(out lpSRCRect, lpDSTRect: TRECT): HResult; stdcall; + function GetAspectRatioMode(out lpAspectRatioMode: TVMR9AspectRatioMode): HResult; stdcall; + function SetAspectRatioMode(AspectRatioMode: TVMR9AspectRatioMode): HResult; stdcall; + + ////////////////////////////////////////////////////////// + // Display and clipping management + ////////////////////////////////////////////////////////// + function SetVideoClippingWindow(hwnd: HWND): HResult; stdcall; + function RepaintVideo(hwnd: HWND; hdc: HDC): HResult; stdcall; + function DisplayModeChanged: HResult; stdcall; + + ////////////////////////////////////////////////////////// + // GetCurrentImage + // + // Returns the current image being displayed. This images + // is returned in the form of packed Windows DIB. + // + // GetCurrentImage can be called at any time, also + // the caller is responsible for free the returned memory + // by calling CoTaskMemFree. + // + // Excessive use of this function will degrade video + // playback performed. + ////////////////////////////////////////////////////////// + function GetCurrentImage(out lpDib: PBYTE): HResult; stdcall; + + ////////////////////////////////////////////////////////// + // Border Color control + // + // The border color is color used to fill any area of the + // the destination rectangle that does not contain video. + // It is typically used in two instances. When the video + // straddles two monitors and when the VMR is trying + // to maintain the aspect ratio of the movies by letter + // boxing the video to fit within the specified destination + // rectangle. See SetAspectRatioMode above. + ////////////////////////////////////////////////////////// + function SetBorderColor(Clr: COLORREF): HResult; stdcall; + function GetBorderColor(out lpClr: COLORREF): HResult; stdcall; + end; + +//===================================================================== +// +// IVMRMixerControl9 +// +//===================================================================== + + VMR9MixerPrefs = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM VMR9MixerPrefs} + const + MixerPref9_NoDecimation = $00000001; // No decimation - full size + {$EXTERNALSYM MixerPref9_NoDecimation} + MixerPref9_DecimateOutput = $00000002; // decimate output by 2 in x & y + {$EXTERNALSYM MixerPref9_DecimateOutput} + MixerPref9_ARAdjustXorY = $00000004; // adjust the aspect ratio in x or y + {$EXTERNALSYM MixerPref9_ARAdjustXorY} + MixerPref9_NonSquareMixing = $00000008; // assume AP can handle non-square mixing, avoids intermediate scales + {$EXTERNALSYM MixerPref9_NonSquareMixing} + MixerPref9_DecimateMask = $0000000F; + {$EXTERNALSYM MixerPref9_DecimateMask} + + MixerPref9_BiLinearFiltering = $00000010; // use bi-linear filtering + {$EXTERNALSYM MixerPref9_BiLinearFiltering} + MixerPref9_PointFiltering = $00000020; // use point filtering + {$EXTERNALSYM MixerPref9_PointFiltering} + MixerPref9_AnisotropicFiltering = $00000040; // + {$EXTERNALSYM MixerPref9_AnisotropicFiltering} + MixerPref9_PyramidalQuadFiltering = $00000080; // 4-sample tent + {$EXTERNALSYM MixerPref9_PyramidalQuadFiltering} + MixerPref9_GaussianQuadFiltering = $00000100; // 4-sample gaussian + {$EXTERNALSYM MixerPref9_GaussianQuadFiltering} + MixerPref9_FilteringReserved = $00000E00; // bits reserved for future use. + {$EXTERNALSYM MixerPref9_FilteringReserved} + MixerPref9_FilteringMask = $00000FF0; // OR of all above flags + {$EXTERNALSYM MixerPref9_FilteringMask} + + MixerPref9_RenderTargetRGB = $00001000; + {$EXTERNALSYM MixerPref9_RenderTargetRGB} + mixerpref9_rendertargetyuv = $00002000; // uses dxva to perform mixing + {$externalsym mixerpref9_rendertargetyuv} + mixerpref9_rendertargetreserved = $000fc000; // bits reserved for future use. + {$externalsym mixerpref9_rendertargetreserved} + mixerpref9_rendertargetmask = $000ff000; // or of all above flags + {$externalsym mixerpref9_rendertargetmask} + + // + // Dynamic changes that can be performed when the VMR's mixer is + // configured to use the YUV Render target (see MixerPref_RenderTargetYUV) + // These preferences can be applied while the graph is running and take effect + // when the next frame is composed by the mixer. + // + MixerPref9_DynamicSwitchToBOB = $00100000; + {$EXTERNALSYM MixerPref9_DynamicSwitchToBOB} + MixerPref9_DynamicDecimateBy2 = $00200000; + {$EXTERNALSYM MixerPref9_DynamicDecimateBy2} + + MixerPref9_DynamicReserved = $00C00000; + {$EXTERNALSYM MixerPref9_DynamicReserved} + MixerPref9_DynamicMask = $00F00000; + {$EXTERNALSYM MixerPref9_DynamicMask} + + +type +// Normalized relative rectangle +// Coordinate ranges: x=[0...1) y=[0...1) +// Where the output window goes from 0,0 (closed inclusive lower bound) +// to 1,1 (open exclusive upper bound) + + PVMR9NormalizedRect = ^TVMR9NormalizedRect; + _VMR9NormalizedRect = record + left : Single; + top : Single; + right : Single; + bottom : Single; + end; + {$EXTERNALSYM _VMR9NormalizedRect} + VMR9NormalizedRect = _VMR9NormalizedRect; + {$EXTERNALSYM VMR9NormalizedRect} + TVMR9NormalizedRect = _VMR9NormalizedRect; + + VMR9ProcAmpControlFlags = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM VMR9ProcAmpControlFlags} + const + ProcAmpControl9_Brightness = $00000001; + {$EXTERNALSYM ProcAmpControl9_Brightness} + ProcAmpControl9_Contrast = $00000002; + {$EXTERNALSYM ProcAmpControl9_Contrast} + ProcAmpControl9_Hue = $00000004; + {$EXTERNALSYM ProcAmpControl9_Hue} + ProcAmpControl9_Saturation = $00000008; + {$EXTERNALSYM ProcAmpControl9_Saturation} + ProcAmpControl9_Mask = $0000000F; + {$EXTERNALSYM ProcAmpControl9_Mask} + +type + PVMR9ProcAmpControl = ^TVMR9ProcAmpControl; + _VMR9ProcAmpControl = record + dwSize : DWORD; + dwFlags : DWORD; + Brightness : Single; + Contrast : Single; + Hue : Single; + Saturation : Single; + end; + {$EXTERNALSYM _VMR9ProcAmpControl} + VMR9ProcAmpControl = _VMR9ProcAmpControl; + {$EXTERNALSYM VMR9ProcAmpControl} + TVMR9ProcAmpControl = _VMR9ProcAmpControl; + + PVMR9ProcAmpControlRange = ^TVMR9ProcAmpControlRange; + _VMR9ProcAmpControlRange = record + dwSize : DWORD; + dwProperty : VMR9ProcAmpControlFlags; // see VMR9ProcAmpControlFlags above; + MinValue : Single; + MaxValue : Single; + DefaultValue : Single; + StepSize : Single; + end; + {$EXTERNALSYM _VMR9ProcAmpControlRange} + VMR9ProcAmpControlRange = _VMR9ProcAmpControlRange; + {$EXTERNALSYM VMR9ProcAmpControlRange} + TVMR9ProcAmpControlRange = _VMR9ProcAmpControlRange; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRMixerControl9;'} + {$EXTERNALSYM IVMRMixerControl9} + IVMRMixerControl9 = interface(IUnknown) + ['{1a777eaa-47c8-4930-b2c9-8fee1c1b0f3b}'] + (*** IVMRMixerControl9 methods ***) + // Source alpha premultication factor (global alpha for source) + function SetAlpha(dwStreamID: DWORD; Alpha: Single): HResult; stdcall; + function GetAlpha(dwStreamID: DWORD; out pAlpha: Single): HResult; stdcall; + function SetZOrder(dwStreamID: DWORD; dwZ: DWORD): HResult; stdcall; + function GetZOrder(dwStreamID: DWORD; out pZ: DWORD): HResult; stdcall; + function SetOutputRect(dwStreamID: DWORD; pRect: PVMR9NormalizedRect): HResult; stdcall; + function GetOutputRect(dwStreamID: DWORD; {out} pRect: PVMR9NormalizedRect): HResult; stdcall; + function SetBackgroundClr(ClrBkg: COLORREF): HResult; stdcall; + function GetBackgroundClr(out lpClrBkg: COLORREF): HResult; stdcall; + // a combination of VMRMixingPrefFlags + function SetMixingPrefs(dwMixerPrefs: DWORD): HResult; stdcall; + function GetMixingPrefs(out pdwMixerPrefs: DWORD): HResult; stdcall; + function SetProcAmpControl(dwStreamID: DWORD; lpClrControl: PVMR9ProcAmpControl): HResult; stdcall; + function GetProcAmpControl(dwStreamID: DWORD; {in/out} lpClrControl: PVMR9ProcAmpControl): HResult; stdcall; + function GetProcAmpControlRange(dwStreamID: DWORD; {in/out} lpClrControl: PVMR9ProcAmpControlRange): HResult; stdcall; + end; + + +//===================================================================== +// +// IVMRMixerBitmap9 +// +//===================================================================== + + PVMR9AlphaBitmap = ^TVMR9AlphaBitmap; + _VMR9AlphaBitmap = record + dwFlags : DWORD; // flags word + hdc : HDC; // DC for the bitmap to copy + pDDS : IDirect3DSurface9; // D3D surface to copy + rSrc : TRECT; // rectangle to copy from the DC/DDS + rDest : TVMR9NormalizedRect; // output rectangle in composition space + fAlpha : Single; // opacity of the bitmap + clrSrcKey : COLORREF; // src color key + dwFilterMode : DWORD; // See "SetMixerPrefs" + end; + {$EXTERNALSYM _VMR9AlphaBitmap} + VMR9AlphaBitmap = _VMR9AlphaBitmap; + {$EXTERNALSYM VMR9AlphaBitmap} + TVMR9AlphaBitmap = _VMR9AlphaBitmap; + + VMR9AlphaBitmapFlags = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM VMR9AlphaBitmapFlags} + const + // Disable the alpha bitmap for now + VMR9AlphaBitmap_Disable = $00000001; + {$EXTERNALSYM VMR9AlphaBitmap_Disable} + + // Take the bitmap from the HDC rather than the DirectDraw surface + VMR9AlphaBitmap_hDC = $00000002; + {$EXTERNALSYM VMR9AlphaBitmap_hDC} + + // Take the entire DDraw surface - rSrc is ignored + VMR9AlphaBitmap_EntireDDS = $00000004; + {$EXTERNALSYM VMR9AlphaBitmap_EntireDDS} + + // Indicates that the clrTrans value is valid and should be + // used when blending + VMR9AlphaBitmap_SrcColorKey = $00000008; + {$EXTERNALSYM VMR9AlphaBitmap_SrcColorKey} + + // Indicates that the rSrc rectangle is valid and specifies a + // sub-rectangle of the of original app image to be blended. + // Use of this parameter enables "Image Strips" + VMR9AlphaBitmap_SrcRect = $00000010; + {$EXTERNALSYM VMR9AlphaBitmap_SrcRect} + + // Indicates that dwFilterMode parameter is valid and should be + // used to overide the default filtering method used by the VMR. + // MixerPref_PointFiltering is particulaly useful for images that + // contain text and do not need to be stretch prior to blending with + // the video content. + VMR9AlphaBitmap_FilterMode = $00000020; + {$EXTERNALSYM VMR9AlphaBitmap_FilterMode} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRMixerBitmap9;'} + {$EXTERNALSYM IVMRMixerBitmap9} + IVMRMixerBitmap9 = interface(IUnknown) + ['{ced175e5-1935-4820-81bd-ff6ad00c9108}'] + (*** IVMRMixerBitmap9 methods ***) + // Set bitmap, location to blend it, and blending value + function SetAlphaBitmap(pBmpParms: PVMR9AlphaBitmap): HResult; stdcall; + + // Change bitmap location, size and blending value, + // graph must be running for change to take effect. + function UpdateAlphaBitmapParameters(pBmpParms: PVMR9AlphaBitmap): HResult; stdcall; + + // Get bitmap, location to blend it, and blending value + function GetAlphaBitmapParameters(out pBmpParms: TVMR9AlphaBitmap): HResult; stdcall; + end; + +//===================================================================== +// +// IVMRSurface9 +// +//===================================================================== + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRSurface9;'} + {$EXTERNALSYM IVMRSurface9} + IVMRSurface9 = interface(IUnknown) + ['{dfc581a1-6e1f-4c3a-8d0a-5e9792ea2afc}'] + (*** IVMRSurface9 methods ***) + function IsSurfaceLocked: HResult; stdcall; + function LockSurface(out lpSurface: PBYTE): HResult; stdcall; + function UnlockSurface: HResult; stdcall; + function GetSurface(out lplpSurface: IDirect3DSurface9): HResult; stdcall; + end; + +//===================================================================== +// +// IID_IVMRImagePresenterConfig9 - this interface allows applications +// to configure the default Microsoft provided allocator-presenter +// inorder to simplify the implementation of their own +// allocator-presenter plug-in. +// +//===================================================================== + VMR9RenderPrefs = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM VMR9RenderPrefs} + const + RenderPrefs9_DoNotRenderBorder = $00000001; // app paints color keys + {$EXTERNALSYM RenderPrefs9_DoNotRenderBorder} + RenderPrefs9_Mask = $00000001; // OR of all above flags + {$EXTERNALSYM RenderPrefs9_Mask} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRImagePresenterConfig9;'} + {$EXTERNALSYM IVMRImagePresenterConfig9} + IVMRImagePresenterConfig9 = interface(IUnknown) + ['{45c15cab-6e22-420a-8043-ae1f0ac02c7d}'] + (*** IVMRImagePresenterConfig9 methods ***) + function SetRenderingPrefs(dwRenderFlags: DWORD): HResult; stdcall; + function GetRenderingPrefs(out dwRenderFlags: DWORD): HResult; stdcall; + end; + +//===================================================================== +// +// IVMRDeinterlaceControl +// +// New interfaced introduced into the WindowsXP SP1 release of the VMR. +// This interface allows applications to control the DX-VA deinterlacing +// support provided by the VMR. +// +// The VMR needs to be set into "mixing" mode for this interface to work. +// +// SetDeinterlaceMode is only effective for new connections made to the +// VMR. It should be noted that the graphics device driver may refuse +// to use the specified deinterlace mode, in which case 3 fallback +// policies are offered by the VMR, these being: +// +// 1. Fallback to the next best mode offered by the driver. +// 2. Fallback to the BOB deinterlace mode. +// 3. Fallback to the WEAVE deinterlace mode (ie. turn deinterlacing off). +// +//===================================================================== + + VMR9DeinterlacePrefs = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM VMR9DeinterlacePrefs} + const + DeinterlacePref9_NextBest = $01; + {$EXTERNALSYM DeinterlacePref9_NextBest} + DeinterlacePref9_BOB = $02; + {$EXTERNALSYM DeinterlacePref9_BOB} + DeinterlacePref9_Weave = $04; + {$EXTERNALSYM DeinterlacePref9_Weave} + DeinterlacePref9_Mask = $07; + {$EXTERNALSYM DeinterlacePref9_Mask} + +type + VMR9DeinterlaceTech = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM VMR9DeinterlaceTech} + const + // the algorithm is unknown or proprietary + DeinterlaceTech9_Unknown = $0000; + {$EXTERNALSYM DeinterlaceTech9_Unknown} + + // the algorithm creates the missing lines by repeating + // the line either above or below it - this method will look very jaggy and + // isn't recommended + DeinterlaceTech9_BOBLineReplicate = $0001; + {$EXTERNALSYM DeinterlaceTech9_BOBLineReplicate} + + + // the algorithm creates the missing lines by vertically stretching each + // video field by a factor of two, for example by averaging two lines or + // using a [-1, 9, 9, -1]/16 filter across four lines. + // Slight vertical adjustments are made to ensure that the resulting image + // does not "bob" up and down. + DeinterlaceTech9_BOBVerticalStretch = $0002; + {$EXTERNALSYM DeinterlaceTech9_BOBVerticalStretch} + + // the pixels in the missing line are recreated by a median filtering operation + DeinterlaceTech9_MedianFiltering = $0004; + {$EXTERNALSYM DeinterlaceTech9_MedianFiltering} + + // the pixels in the missing line are recreated by an edge filter. + // In this process, spatial directional filters are applied to determine + // the orientation of edges in the picture content, and missing + // pixels are created by filtering along (rather than across) the + // detected edges. + DeinterlaceTech9_EdgeFiltering = $0010; + {$EXTERNALSYM DeinterlaceTech9_EdgeFiltering} + + // the pixels in the missing line are recreated by switching on a field by + // field basis between using either spatial or temporal interpolation + // depending on the amount of motion. + DeinterlaceTech9_FieldAdaptive = $0020; + {$EXTERNALSYM DeinterlaceTech9_FieldAdaptive} + + // the pixels in the missing line are recreated by switching on a pixel by pixel + // basis between using either spatial or temporal interpolation depending on + // the amount of motion.. + DeinterlaceTech9_PixelAdaptive = $0040; + {$EXTERNALSYM DeinterlaceTech9_PixelAdaptive} + + // Motion Vector Steering identifies objects within a sequence of video + // fields. The missing pixels are recreated after first aligning the + // movement axes of the individual objects in the scene to make them + // parallel with the time axis. + DeinterlaceTech9_MotionVectorSteered = $0080; + {$EXTERNALSYM DeinterlaceTech9_MotionVectorSteered} + +type + PVMR9Frequency = ^TVMR9Frequency; + _VMR9Frequency = record + dwNumerator : DWORD; + dwDenominator : DWORD; + end; + {$EXTERNALSYM _VMR9Frequency} + VMR9Frequency = _VMR9Frequency; + {$EXTERNALSYM VMR9Frequency} + TVMR9Frequency = _VMR9Frequency; + + _VMR9_SampleFormat = ( + {$IFNDEF COMPILER6_UP} + VMR9_Sample_INVALID_0, + VMR9_SampleReserved, + {$ELSE} + VMR9_SampleReserved = 1, + {$ENDIF} + VMR9_SampleProgressiveFrame, + VMR9_SampleFieldInterleavedEvenFirst, + VMR9_SampleFieldInterleavedOddFirst, + VMR9_SampleFieldSingleEven, + VMR9_SampleFieldSingleOdd + ); + {$EXTERNALSYM _VMR9_SampleFormat} + VMR9_SampleFormat = _VMR9_SampleFormat; + {$EXTERNALSYM VMR9_SampleFormat} + TVMR9SampleFormat = _VMR9_SampleFormat; + + PVMR9VideoDesc = ^TVMR9VideoDesc; + _VMR9VideoDesc = record + dwSize : DWORD; + dwSampleWidth : DWORD; + dwSampleHeight : DWORD; + SampleFormat : TVMR9SampleFormat; + dwFourCC : DWORD; + InputSampleFreq : TVMR9Frequency; + OutputFrameFreq : TVMR9Frequency; + end; + {$EXTERNALSYM _VMR9VideoDesc} + VMR9VideoDesc = _VMR9VideoDesc; + {$EXTERNALSYM VMR9VideoDesc} + TVMR9VideoDesc = _VMR9VideoDesc; + + PVMR9DeinterlaceCaps = ^TVMR9DeinterlaceCaps; + _VMR9DeinterlaceCaps = record + dwSize : DWORD; + dwNumPreviousOutputFrames : DWORD; + dwNumForwardRefSamples : DWORD; + dwNumBackwardRefSamples : DWORD; + DeinterlaceTechnology : VMR9DeinterlaceTech; + end; + {$EXTERNALSYM _VMR9DeinterlaceCaps} + VMR9DeinterlaceCaps = _VMR9DeinterlaceCaps; + {$EXTERNALSYM VMR9DeinterlaceCaps} + TVMR9DeinterlaceCaps = _VMR9DeinterlaceCaps; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRDeinterlaceControl9;'} + {$EXTERNALSYM IVMRDeinterlaceControl9} + IVMRDeinterlaceControl9 = interface(IUnknown) + ['{a215fb8d-13c2-4f7f-993c-003d6271a459}'] + (*** IVMRDeinterlaceControl9 methods ***) + // For the specified video description returns the + // number of deinterlacing modes available to the VMR. + // The deinterlacing modes are returned in descending + // quality order ie. the best quality mode is at + // lpdwNumDeinterlaceModes[0], the next best at + // lpdwNumDeinterlaceModes[1] and so on. + // + // To determine how big an array of guids to pass to the + // GetNumberOfDeinterlaceModes method call + // GetNumberOfDeinterlaceModes(lpVideoDescription, &dwNumModes, NULL); + // + function GetNumberOfDeinterlaceModes(out lpVideoDescription: TVMR9VideoDesc; + var lpdwNumDeinterlaceModes: DWORD; lpDeinterlaceModes: PGUID): HResult; stdcall; + + // For the given video description get the capabilities of the + // specified de-interlace mode. + function GetDeinterlaceModeCaps(const lpDeinterlaceMode: TGUID; + lpVideoDescription: PVMR9VideoDesc; + out lpDeinterlaceCaps: TVMR9DeinterlaceCaps): HResult; stdcall; + + // Get/Set the deinterlace mode that you would like the + // VMR to use when de-interlacing the specified stream. + // It should be noted that the VMR may not actually be able + // to use the requested deinterlace mode, in which case the + // the VMR will fall back to other de-interlace modes as specified + // by the de-interlace preferences (see SetDeinterlacePrefs below). + + function GetDeinterlaceMode(dwStreamID: DWORD; + out lpDeinterlaceMode: TGUID // returns GUID_NULL if SetDeinterlaceMode + ): HResult; stdcall; // has not been called yet. + + function SetDeinterlaceMode( + dwStreamID: DWORD; // use 0xFFFFFFFF to set mode for all streams + const lpDeinterlaceMode: TGUID // GUID_NULL == turn deinterlacing off + ): HResult; stdcall; + + function GetDeinterlacePrefs(out lpdwDeinterlacePrefs: DWORD): HResult; stdcall; + + function SetDeinterlacePrefs(dwDeinterlacePrefs: DWORD): HResult; stdcall; + + // Get the DeinterlaceMode currently in use for the specified + // video stream (ie. pin). The returned GUID will be NULL if + // the de-interlacing h/w has not been created by the VMR at the + // time the function is called, or if the VMR determines that + // this stream should not or can be de-interlaced. + function GetActualDeinterlaceMode(dwStreamID: DWORD; + out lpDeinterlaceMode: TGUID): HResult; stdcall; + end; + +//===================================================================== +// +// IVMRImageCompositor9 +// +//===================================================================== + PVMR9VideoStreamInfo = ^TVMR9VideoStreamInfo; + _VMR9VideoStreamInfo = record + pddsVideoSurface : IDirect3DSurface9; + dwWidth, dwHeight : DWORD; + dwStrmID : DWORD; + fAlpha : Single; + rNormal : TVMR9NormalizedRect; + rtStart : TReferenceTime; + rtEnd : TReferenceTime; + SampleFormat : TVMR9SampleFormat; + end; + {$EXTERNALSYM _VMR9VideoStreamInfo} + VMR9VideoStreamInfo = _VMR9VideoStreamInfo; + {$EXTERNALSYM VMR9VideoStreamInfo} + TVMR9VideoStreamInfo = _VMR9VideoStreamInfo; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRImageCompositor9;'} + {$EXTERNALSYM IVMRImageCompositor9} + IVMRImageCompositor9 = interface(IUnknown) + ['{4a5c89eb-df51-4654-ac2a-e48e02bbabf6}'] + (*** IVMRImageCompositor9 methods ***) + function InitCompositionDevice(pD3DDevice: IUnknown): HResult; stdcall; + function TermCompositionDevice(pD3DDevice: IUnknown): HResult; stdcall; + function SetStreamMediaType(dwStrmID: DWORD; pmt: PAMMediaType; + fTexture: BOOL): HResult; stdcall; + function CompositeImage(pD3DDevice: IUnknown; pddsRenderTarget: IDirect3DSurface9; + pmtRenderTarget: PAMMediaType; rtStart, rtEnd: TReferenceTime; + dwClrBkGnd: TD3DCOLOR; pVideoStreamInfo: PVMR9VideoStreamInfo; + cStreams: UINT): HResult; stdcall; + end; + +//===================================================================== +// +// IVMRVideoStreamControl9 +// +//===================================================================== + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRVideoStreamControl9;'} + {$EXTERNALSYM IVMRVideoStreamControl9} + IVMRVideoStreamControl9 = interface(IUnknown) + ['{d0cfe38b-93e7-4772-8957-0400c49a4485}'] + (*** IVMRVideoStreamControl9 methods ***) + function SetStreamActiveState(fActive: BOOL): HResult; stdcall; + function GetStreamActiveState(out lpfActive: BOOL): HResult; stdcall; + end; + + VMR9Mode = {$IFDEF TYPE_IDENTITY}type {$ENDIF} LongWord; + {$EXTERNALSYM VMR9Mode} + const + VMR9Mode_Windowed = $00000001; + {$EXTERNALSYM VMR9Mode_Windowed} + VMR9Mode_Windowless = $00000002; + {$EXTERNALSYM VMR9Mode_Windowless} + VMR9Mode_Renderless = $00000004; + {$EXTERNALSYM VMR9Mode_Renderless} + // not a valid value to pass to SetRenderMode + VMR9Mode_Mask = $00000007; // OR of all above flags + {$EXTERNALSYM VMR9Mode_Mask} + +type + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRFilterConfig9;'} + {$EXTERNALSYM IVMRFilterConfig9} + IVMRFilterConfig9 = interface(IUnknown) + ['{5a804648-4f66-4867-9c43-4f5c822cf1b8}'] + (*** IVMRFilterConfig9 methods ***) + function SetImageCompositor(lpVMRImgCompositor: IVMRImageCompositor9): HResult; stdcall; + function SetNumberOfStreams(dwMaxStreams: DWORD): HResult; stdcall; + function GetNumberOfStreams(out pdwMaxStreams: DWORD): HResult; stdcall; + function SetRenderingPrefs(dwRenderFlags: DWORD): HResult; stdcall; + function GetRenderingPrefs(out pdwRenderFlags: DWORD): HResult; stdcall; + function SetRenderingMode(Mode: DWORD): HResult; stdcall; + function GetRenderingMode(out pMode: DWORD): HResult; stdcall; + end; + +//===================================================================== +// +// IVMRAspectRatioControl9 +// +//===================================================================== + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRAspectRatioControl9;'} + {$EXTERNALSYM IVMRAspectRatioControl9} + IVMRAspectRatioControl9 = interface(IUnknown) + ['{00d96c29-bbde-4efc-9901-bb5036392146}'] + (*** IVMRAspectRatioControl9 methods ***) + function GetAspectRatioMode(out lpdwARMode: TVMRAspectRatioMode): HResult; stdcall; + function SetAspectRatioMode(dwARMode: TVMRAspectRatioMode): HResult; stdcall; + end; + +/////////////////////////////////////////////////////////////////////////////// +// +// VMR Multimon configuration interface +// +/////////////////////////////////////////////////////////////////////////////// +const + VMR9DEVICENAMELEN = 32; + {$EXTERNALSYM VMR9DEVICENAMELEN} + VMR9DEVICEDESCRIPTIONLEN = 512; + {$EXTERNALSYM VMR9DEVICEDESCRIPTIONLEN} + +type + PVMR9MonitorInfo = ^TVMR9MonitorInfo; + _VMR9MonitorInfo = record + uDevID : UINT; + rcMonitor : TRECT; + hMon : HMONITOR; + dwFlags : DWORD; // described in MONITORINFOEX, currently only MONITORINFOF_PRIMARY + szDevice: array[0..VMR9DEVICENAMELEN-1]of WideChar; + szDescription: array[0..VMR9DEVICEDESCRIPTIONLEN-1] of WideChar; + liDriverVersion : LARGE_INTEGER; + dwVendorId : DWORD; + dwDeviceId : DWORD; + dwSubSysId : DWORD; + dwRevision : DWORD; + end; + {$EXTERNALSYM _VMR9MonitorInfo} + VMR9MonitorInfo = _VMR9MonitorInfo; + {$EXTERNALSYM VMR9MonitorInfo} + TVMR9MonitorInfo = _VMR9MonitorInfo; + + {$HPPEMIT 'typedef System::DelphiInterface _di_IVMRMonitorConfig9;'} + {$EXTERNALSYM IVMRMonitorConfig9} + IVMRMonitorConfig9 = interface(IUnknown) + ['{46c2e457-8ba0-4eef-b80b-0680f0978749}'] + (*** IVMRMonitorConfig9 methods ***) + // Use this method on a Multi-Monitor system to specify to the + // mixer filter which Direct Draw driver should be used when connecting + // to an upstream decoder filter. + function SetMonitor(uDev: UINT): HResult; stdcall; + + // Use this method to determine the direct draw object that will be used when + // connecting the mixer filter to an upstream decoder filter. + function GetMonitor(out puDev: UINT): HResult; stdcall; + + // Use this method on a multi-monitor system to specify to the + // mixer filter the default Direct Draw device to use when + // connecting to an upstream filter. The default direct draw device + // can be overriden for a particular connection by SetMonitor method + // described above. + function SetDefaultMonitor(uDev: UINT): HResult; stdcall; + + // Use this method on a multi-monitor system to determine which + // is the default direct draw device the overlay mixer filter + // will use when connecting to an upstream filter. + function GetDefaultMonitor(out puDev: UINT): HResult; stdcall; + + // Use this method to get a list of Direct Draw device GUIDs and thier + // associated monitor information that the mixer can use when + // connecting to an upstream decoder filter. Passing down a NULL pInfo + // parameter allows the app to determine the required array size (returned + // in pdwNumDevices). Otherwise, dwNumDevices returns the actual + // number of devices retrieved. + function GetAvailableMonitors( + {out} pInfo: PVMR9MonitorInfo; + dwMaxInfoArraySize: DWORD; // in array members + out pdwNumDevices: DWORD // actual number of devices retrieved + ): HResult; stdcall; + end; + + +//------------------------------------------------------------------------------ +// File: DMOImpl.h +// +// Desc: Classes to implement a DMO. +// +// Copyright (c) 2000, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ +{$IFDEF DELPHI4_UP} +type + TMOinplIOInfo = record + fTypeSet : DWORD; //:1; + fIncomplete : DWORD; //:1; + CurrentMediaType: TDMOMediaType; + end; + +// Class to implement a DMO +// +// +// Assumes the number of input and output streams is fixed +// (these are template parameters) +// +// Provides following services: +// +// Basic parameter checking and locking +// Fully implements : +// GetStreamCount +// SetInputType +// SetOutputType +// GetCurrentInputType +// GetCurrentOutputType +// +// Checks if all types are set before streaming +// Automatically calls AllocateStreamingResources before streaming +// if it's not been called already +// Prevents streaming until the types on all non-optional streams +// have been set +// +// +// Derived class implements the following methods : +// +{ + HResult InternalGetInputStreamInfo(DWORD dwInputStreamIndex, DWORD *pdwFlags); + HResult InternalGetOutputStreamInfo(DWORD dwOutputStreamIndex, DWORD *pdwFlags); + HResult InternalCheckInputType(DWORD dwInputStreamIndex, const DMO_MEDIA_TYPE *pmt); + HResult InternalCheckOutputType(DWORD dwOutputStreamIndex, const DMO_MEDIA_TYPE *pmt); + HResult InternalGetInputType(DWORD dwInputStreamIndex, DWORD dwTypeIndex, + DMO_MEDIA_TYPE *pmt); + HResult InternalGetOutputType(DWORD dwOutputStreamIndex, DWORD dwTypeIndex, + DMO_MEDIA_TYPE *pmt); + HResult InternalGetInputSizeInfo(DWORD dwInputStreamIndex, DWORD *pcbSize, + DWORD *pcbMaxLookahead, DWORD *pcbAlignment); + HResult InternalGetOutputSizeInfo(DWORD dwOutputStreamIndex, DWORD *pcbSize, + DWORD *pcbAlignment); + HResult InternalGetInputMaxLatency(DWORD dwInputStreamIndex, REFERENCE_TIME *prtMaxLatency); + HResult InternalSetInputMaxLatency(DWORD dwInputStreamIndex, REFERENCE_TIME rtMaxLatency); + HResult InternalFlush(); + HResult InternalDiscontinuity(DWORD dwInputStreamIndex); + HResult InternalAllocateStreamingResources(); + HResult InternalFreeStreamingResources(); + HResult InternalProcessInput(DWORD dwInputStreamIndex, IMediaBuffer *pBuffer, + DWORD dwFlags, REFERENCE_TIME rtTimestamp, + REFERENCE_TIME rtTimelength); + HResult InternalProcessOutput(DWORD dwFlags, DWORD cOutputBufferCount, + DMO_OUTPUT_DATA_BUFFER *pOutputBuffers, + DWORD *pdwStatus); + HResult InternalAcceptingInput(DWORD dwInputStreamIndex); + void Lock(); + void Unlock(); + + Notes: + The derived class is meant to do most work to initialize streaming + in AllocateStreamingResources rather than when types are set. + + This centralizes the work to one + clear place based on the types set for all streams. + + The derived class implements locking. + + The derived class implements the IUnknown methods + + Usage example (1 input and 1 output) : + class CMyDMO : public IMediaObjectImpl, + ... +} + +////////////////////////////////////////////////////////////////////// +///// Translator comments ///// +////////////////////////////////////////////////////////////////////// +{ + Delphi class tries to follow C++ template class as much as possible. + But in addition to original C++ template it's already implements + multi-threading support due to: + 1) AddRef, Release - realized as thread safe in TComObject + 2) lock(), unlock() - uses critical section. + + If you do not need support for thread-safe processing you can save some + system resources by not calling Windows functions (InterlockedInclerent, + InterlockedDecrement, EnterCriticalSection, LeaveCriticalSection). This + can be don by overriding these funtions in derived class: + ObjAddRef, ObjRelease, Lock(), Unlock() +} + + TMediaObjectImpl = class(TComObject, IMediaObject) + private + m_fTypesSet : Boolean; + m_fFlushed : Boolean; + m_fResourcesAllocated: Boolean; + // Syncronizing + fCritSection: TCriticalSection; + protected + // init this variables !! + NUMBEROFINPUTS : DWORD; + NUMBEROFOUTPUTS : DWORD; + // Member variables + m_InputInfo : array of TMOinplIOInfo;// [0..NUMBEROFINPUTS-1] + m_OutputInfo : array of TMOinplIOInfo;// [0..NUMBEROFOUTPUTS-1] + // Implement these functions !!! + function InternalGetInputStreamInfo(dwInputStreamIndex: DWORD; out pdwFlags: DWORD): HResult; virtual; abstract; + function InternalGetOutputStreamInfo(dwOutputStreamIndex: DWORD; out pdwFlags: DWORD): HResult; virtual; abstract; + function InternalCheckInputType(dwInputStreamIndex: DWORD; const pmt: PDMOMediaType): HResult; virtual; abstract; + function InternalCheckOutputType(dwOutputStreamIndex: DWORD; const pmt: PDMOMediaType): HResult; virtual; abstract; + function InternalGetInputType(dwInputStreamIndex, dwTypeIndex: DWORD; out pmt: TDMOMediaType): HResult; virtual; abstract; + function InternalGetOutputType(dwOutputStreamIndex, dwTypeIndex:DWORD; out pmt: TDMOMediaType): HResult; virtual; abstract; + function InternalGetInputSizeInfo(dwInputStreamIndex: DWORD; out pcbSize, pcbMaxLookahead, pcbAlignment: DWORD): HResult; virtual; abstract; + function InternalGetOutputSizeInfo(dwOutputStreamIndex: DWORD; out pcbSize, pcbAlignment: DWORD): HResult; virtual; abstract; + function InternalGetInputMaxLatency(dwInputStreamIndex: DWORD; out prtMaxLatency: TReferenceTime): HResult; virtual; abstract; + function InternalSetInputMaxLatency(dwInputStreamIndex: DWORD; rtMaxLatency: TReferenceTime): HResult; virtual; abstract; + function InternalFlush: HResult; virtual; abstract; + function InternalDiscontinuity(dwInputStreamIndex: DWORD): HResult; virtual; abstract; + function InternalAllocateStreamingResources: HResult; virtual; abstract; + function InternalFreeStreamingResources: HResult; virtual; abstract; + function InternalProcessInput(dwInputStreamIndex: DWORD; pBuffer: IMediaBuffer; dwFlags: DWORD; rtTimestamp, rtTimelength: TReferenceTime): HResult; virtual; abstract; + function InternalProcessOutput(dwFlags, cOutputBufferCount: DWORD; var pOutputBuffers: TDMOOutputDataBufferArray; out pdwStatus: DWORD): HResult; virtual; abstract; + function InternalAcceptingInput(dwInputStreamIndex: DWORD): HResult; virtual; abstract; + procedure Lock; overload; virtual; + procedure Unlock; virtual; + // Helpers + function InputTypeSet(ulInputStreamIndex: DWORD): BOOL; // const + function OutputTypeSet(ulOutputStreamIndex: DWORD): BOOL; // const + function InputType(ulInputStreamIndex: DWORD): PDMOMediaType;// const + function OutputType(ulOutputStreamIndex: DWORD): PDMOMediaType; // const + function CheckTypesSet: bool; + public + destructor Destroy; override; + procedure Initialize; override; + function GetStreamCount(out pulNumberOfInputStreams, pulNumberOfOutputStreams: DWORD): HResult; stdcall; + function GetInputStreamInfo(ulStreamIndex: DWORD; out pdwFlags: DWORD): HResult; stdcall; + function GetOutputStreamInfo(ulStreamIndex: DWORD; out pdwFlags: DWORD): HResult; stdcall; + function GetInputType(ulStreamIndex, ulTypeIndex: DWORD; out pmt: TDMOMediaType): HResult; stdcall; + function GetOutputType(ulStreamIndex, ulTypeIndex: DWORD; out pmt: TDMOMediaType): HResult; stdcall; + function GetInputCurrentType(ulStreamIndex: DWORD; out pmt: TDMOMediaType): HResult; stdcall; + function GetOutputCurrentType(ulStreamIndex: DWORD; out pmt: TDMOMediaType): HResult; stdcall; + function GetInputSizeInfo(ulStreamIndex: DWORD; out pcbSize, pcbMaxLookahead, pcbAlignment: DWORD): HResult; stdcall; + function GetOutputSizeInfo(ulStreamIndex: DWORD; out pcbSize, pcbAlignment: DWORD): HResult; stdcall; + function SetInputType(ulStreamIndex: DWORD; const pmt: PDMOMediaType; dwFlags: DWORD): HResult; stdcall; + function SetOutputType(ulStreamIndex: DWORD; const pmt: PDMOMediaType; dwFlags: DWORD): HResult; stdcall; + function GetInputStatus(ulStreamIndex: DWORD; out pdwStatus: DWORD): HResult; stdcall; + function GetInputMaxLatency(ulStreamIndex: DWORD; out prtLatency: TReferenceTime): HResult; stdcall; + function SetInputMaxLatency(ulStreamIndex: DWORD; rtLatency: TReferenceTime): HResult; stdcall; + function Flush: HResult; stdcall; + function Discontinuity(ulStreamIndex: DWORD): HResult; stdcall; + function AllocateStreamingResources: HResult; stdcall; + function FreeStreamingResources: HResult; stdcall; + function ProcessInput(ulStreamIndex: DWORD; pBuffer: IMediaBuffer; dwFlags: DWORD; rtTimestamp, rtTimelength: TReferenceTime): HResult; stdcall; + function ProcessOutput(dwFlags, cOutputBufferCount: DWORD; var pOutputBuffers: TDMOOutputDataBufferArray; out pdwStatus: DWORD): HResult; stdcall; + function Lock(bLock: Longint): HResult; overload; stdcall; + end; +{$ENDIF} + +//------------------------------------------------------------------------------ +// File: iwstdec.h +// +// Desc: WST Decoder related definitions and interfaces for ActiveMovie +// +// Copyright (c) 1999 - 2001, Microsoft Corporation. All rights reserved. +//------------------------------------------------------------------------------ +// +type + PAM_WST_PAGE = ^TAM_WST_PAGE; + _AM_WST_PAGE = record + dwPageNr : DWORD; + dwSubPageNr : DWORD; + pucPageData : PByte; + end; + {$EXTERNALSYM _AM_WST_PAGE} + AM_WST_PAGE = _AM_WST_PAGE; + {$EXTERNALSYM AM_WST_PAGE} + TAM_WST_PAGE = _AM_WST_PAGE; + + PAM_WST_LEVEL = ^TAM_WST_LEVEL; + _AM_WST_LEVEL = ( + AM_WST_LEVEL_1_5 + ); + {$EXTERNALSYM _AM_WST_PAGE} + AM_WST_LEVEL = _AM_WST_LEVEL; + {$EXTERNALSYM AM_WST_LEVEL} + TAM_WST_LEVEL = _AM_WST_LEVEL; + + PAM_WST_SERVICE = ^TAM_WST_SERVICE; + _AM_WST_SERVICE = ( + AM_WST_SERVICE_None, + AM_WST_SERVICE_Text, + AM_WST_SERVICE_IDS, + AM_WST_SERVICE_Invalid + ); + {$EXTERNALSYM _AM_WST_SERVICE} + AM_WST_SERVICE = _AM_WST_SERVICE; + {$EXTERNALSYM AM_WST_SERVICE} + TAM_WST_SERVICE = _AM_WST_SERVICE; + + PAM_WST_STATE = ^TAM_WST_STATE; + _AM_WST_STATE = ( + AM_WST_STATE_Off, + AM_WST_STATE_On + ); + {$EXTERNALSYM _AM_WST_STATE} + AM_WST_STATE = _AM_WST_STATE; + {$EXTERNALSYM AM_WST_STATE} + TAM_WST_STATE = _AM_WST_STATE; + + PAM_WST_STYLE = ^TAM_WST_STYLE; + _AM_WST_STYLE = ( + AM_WST_STYLE_None, + AM_WST_STYLE_Invers + ); + {$EXTERNALSYM _AM_WST_STYLE} + AM_WST_STYLE = _AM_WST_STYLE; + {$EXTERNALSYM AM_WST_STYLE} + TAM_WST_STYLE = _AM_WST_STYLE; + + PAM_WST_DRAWBGMODE = ^TAM_WST_DRAWBGMODE; + _AM_WST_DRAWBGMODE = ( + AM_WST_DRAWBGMODE_Opaque, + AM_WST_DRAWBGMODE_Transparent + ); + {$EXTERNALSYM _AM_WST_DRAWBGMODE} + AM_WST_DRAWBGMODE = _AM_WST_DRAWBGMODE; + {$EXTERNALSYM AM_WST_DRAWBGMODE} + TAM_WST_DRAWBGMODE = _AM_WST_DRAWBGMODE; + +// +// WST Decoder standard COM interface +// + + {$HPPEMIT 'typedef System::DelphiInterface _di_IAMWstDecoder;'} + {$EXTERNALSYM IAMWstDecoder} + IAMWstDecoder = interface(IUnknown) + ['{C056DE21-75C2-11d3-A184-00105AEF9F33}'] + // Decoder options to be used by apps + // What is the decoder's level + function GetDecoderLevel(out lpLevel : TAM_WST_LEVEL) : HRESULT; stdcall; + // function SetDecoderLevel(Level : TAM_WST_LEVEL) : HRESULT; stdcall; + // Which of the services is being currently used + function GetCurrentService(out lpService : TAM_WST_SERVICE) : HRESULT; stdcall; + // function SetCurrentService(Service : AM_WST_SERVICE) : HRESULT; stdcall; + // Query/Set the service state (On/Off) + // supported state values are AM_WSTState_On and AM_WSTState_Off + function GetServiceState(out lpState : TAM_WST_STATE) : HRESULT; stdcall; + function SetServiceState(State : TAM_WST_STATE) : HRESULT; stdcall; + // + // Output options to be used by downstream filters + // + // What size, bitdepth etc should the output video be + function GetOutputFormat(out lpbmih : TBITMAPINFOHEADER) : HRESULT; stdcall; + // GetOutputFormat() method, if successful, returns + // 1. S_FALSE if no output format has so far been defined by downstream filters + // 2. S_OK if an output format has already been defined by downstream filters + function SetOutputFormat(lpbmi : PBITMAPINFO) : HRESULT; stdcall; + // Specify physical color to be used in colorkeying the background + // for overlay mixing + function GetBackgroundColor(out pdwPhysColor : DWORD) : HRESULT; stdcall; + function SetBackgroundColor(dwPhysColor : DWORD) : HRESULT; stdcall; + // Specify if whole output bitmap should be redrawn for each sample + function GetRedrawAlways(out lpbOption : BOOL) : HRESULT; stdcall; + function SetRedrawAlways(bOption : BOOL) : HRESULT; stdcall; + // Specify if the caption text background should be opaque/transparent + function GetDrawBackgroundMode(out lpMode : TAM_WST_DRAWBGMODE) : HRESULT; stdcall; + function SetDrawBackgroundMode(Mode : TAM_WST_DRAWBGMODE) : HRESULT; stdcall; + // supported mode values are AM_WST_DrawBGMode_Opaque and + // AM_WST_DrawBGMode_Transparent + function SetAnswerMode(bAnswer : BOOL) : HRESULT; stdcall; + function GetAnswerMode(out pbAnswer : BOOL) : HRESULT; stdcall; + function SetHoldPage(bHoldPage : BOOL) : HRESULT; stdcall; + function GetHoldPage(out pbHoldPage : BOOL) : HRESULT; stdcall; + function GetCurrentPage(out pWstPage : TAM_WST_PAGE) : HRESULT; stdcall; + function SetCurrentPage(WstPage : AM_WST_PAGE) : HRESULT; stdcall; + end; + +implementation + +const + Ole32 = 'ole32.dll'; + Quartz = 'quartz.dll'; + MSDmo = 'msdmo.dll'; + ksUser = 'Ksuser.dll'; + ksProxy = 'Ksproxy.ax'; + +{$IFDEF DIRECTSHOW9_DYNAMIC_LINK} +var + Ole32Lib : THandle = 0; + QuartzLib : THandle = 0; + MSDmoLib : THandle = 0; + ksUserLib : THandle = 0; + ksProxyLib : THandle = 0; + + { Ole32 } + _QzInitialize : function(pvReserved: Pointer): HResult; stdcall; + _QzUninitialize : procedure; stdcall; + _QzFreeUnusedLibraries : procedure; stdcall; + _QzGetMalloc : function(dwMemContext: Longint; out malloc: IMalloc): HResult; stdcall; + _QzTaskMemAlloc : function(cb: Longint): Pointer; stdcall; + _QzTaskMemRealloc : function(pv: Pointer; cb: Longint): Pointer; stdcall; + _QzTaskMemFree : procedure(pv: Pointer); stdcall; + _QzCreateFilterObject : function(const clsid: TCLSID; unkOuter: IUnknown; dwClsContext: Longint; const iid: TIID; out pv): HResult; stdcall; + _QzCLSIDFromString : function(psz: POleStr; out clsid: TCLSID): HResult; stdcall; + _QzStringFromGUID2 : function(const guid: TGUID; psz: POleStr; cbMax: Integer): Integer; stdcall; + + { Quartz } + _AMGetErrorTextA: function(hr: HResult; pbuffer: PChar; MaxLen: DWORD): DWORD; stdcall; + _AMGetErrorTextW: function(hr: HResult; pbuffer: PWideChar; MaxLen: DWORD): DWORD; stdcall; + // [pjh, 2003-07-14] ANSI and UNICODE declaration exchange + {$IFDEF UNICODE} + _AMGetErrorText: function(hr: HResult; pbuffer: PWideChar; MaxLen: DWORD): DWORD; stdcall; + {$ELSE} + _AMGetErrorText: function(hr: HResult; pbuffer: PChar; MaxLen: DWORD): DWORD; stdcall; + {$ENDIF} + + { MSDmo } + + _DMORegister : function(szName: PWideChar; const clsidDMO, guidCategory: TGUID; dwFlags: DWORD; cInTypes: DWORD; const pInTypes: PDMO_PARTIAL_MEDIATYPE; cOutTypes: DWORD; const pOutTypes: PDMO_PARTIAL_MEDIATYPE): HResult; stdcall; + _DMOUnregister : function(const clsidDMO, guidCategory: TGUID): HResult; stdcall; + _DMOEnum : function(const guidCategory: TGUID; dwFlags: DWORD; cInTypes: DWORD; pInTypes: PDMO_PARTIAL_MEDIATYPE; cOutTypes: DWORD; pOutTypes: PDMO_PARTIAL_MEDIATYPE; out ppEnum: IEnumDMO): HResult; stdcall; + _DMOGetTypes : function(const clsidDMO: TGUID; ulInputTypesRequested: ULONG; pulInputTypesSupplied: PULONG; pInputTypes: PDMO_PARTIAL_MEDIATYPE; ulOutputTypesRequested: ULONG; pulOutputTypesSupplied: PULONG; pOutputTypes: PDMO_PARTIAL_MEDIATYPE): HResult; stdcall; + _DMOGetName : function(const clsidDMO: TGUID; szName: TDMOName): HResult; stdcall; + _MoInitMediaType : function(pmt: PDMOMediaType; cbFormat: DWORD): HResult; stdcall; + _MoFreeMediaType : function(pmt: PDMOMediaType): HResult; stdcall; + _MoCopyMediaType : function(out pmtDest: TDMOMediaType; const pmtSrc: PDMOMediaType): HResult; stdcall; + _MoCreateMediaType : function(out ppmt: PDMOMediaType; cbFormat: DWORD): HResult; stdcall; + _MoDeleteMediaType : function(pmt: PDMOMediaType): HResult; stdcall; + _MoDuplicateMediaType : function(out ppmtDest: PDMOMediaType; const pmtSrc: PDMOMediaType): HResult; stdcall; + + { KsUser } + + _KsCreateAllocator : function(ConnectionHandle: THandle; AllocatorFraming: PKSAllocatorFraming; out AllocatorHandle: PHandle): DWORD; stdcall; + _KsCreateClock : function(ConnectionHandle: THandle; ClockCreate: PKSClockCreate; out ClockHandle: PHandle): DWORD; stdcall; + _KsCreatePin : function(FilterHandle: THandle; Connect: PKSPinConnect; DesiredAccess: ACCESS_MASK; out ConnectionHandle: PHandle): DWORD; stdcall; + _KsCreateTopologyNode : function(ParentHandle: THandle; NodeCreate: PKSNodeCreate; DesiredAccess: ACCESS_MASK; out NodeHandle: PHandle): DWORD; stdcall; + + { KsProxy } + + _KsResolveRequiredAttributes : function(DataRange: PKSDATARANGE; Attributes: PKSMULTIPLE_ITEM): HResult; stdcall; + _KsOpenDefaultDevice : function(Category: TGUID; Access: ACCESS_MASK; DeviceHandle: PHANDLE): HResult; stdcall; + _KsSynchronousDeviceControl : function(Handle: THandle; IoControl: ULONG; InBuffer: Pointer; InLength: ULONG; OutBuffer: Pointer; OutLength: ULONG; BytesReturned: PULONG): HResult; stdcall; + _KsGetMultiplePinFactoryItems : function(FilterHandle: THandle; PinFactoryId: ULONG; PropertyId: ULONG; Items: Pointer): HResult; stdcall; + _KsGetMediaTypeCount : function(FilterHandle: THandle; PinFactoryId: ULONG; out MediaTypeCount: ULONG): HResult; stdcall; + _KsGetMediaType : function(Position: integer; out AmMediaType: TAMMediaType; FilterHandle: THandle; PinFactoryId: ULONG): HResult; stdcall; + + { Ole32 } + + function Ole32Loaded: Boolean; + begin + Result := ole32Lib <> 0; + end; + + function UnLoadOle32: Boolean; + begin + Result:= True; + if Ole32Loaded then + begin + Result := FreeLibrary(Ole32Lib); + _QzInitialize := nil; + _QzUninitialize := nil; + _QzFreeUnusedLibraries := nil; + _QzGetMalloc := nil; + _QzTaskMemAlloc := nil; + _QzTaskMemRealloc := nil; + _QzTaskMemFree := nil; + _QzCreateFilterObject := nil; + _QzCLSIDFromString := nil; + _QzStringFromGUID2 := nil; + Ole32Lib := 0; + end; + end; + + function LoadOle32: Boolean; + begin + Result := Ole32Loaded; + if (not Result) then + begin + Ole32Lib := LoadLibrary(Ole32); + if Ole32Loaded then + begin + _QzInitialize := GetProcAddress(Ole32Lib, 'CoInitialize'); + _QzUninitialize := GetProcAddress(Ole32Lib, 'CoUninitialize'); + _QzFreeUnusedLibraries := GetProcAddress(Ole32Lib, 'CoFreeUnusedLibraries'); + _QzGetMalloc := GetProcAddress(Ole32Lib, 'CoGetMalloc'); + _QzTaskMemAlloc := GetProcAddress(Ole32Lib, 'CoTaskMemAlloc'); + _QzTaskMemRealloc := GetProcAddress(Ole32Lib, 'CoTaskMemRealloc'); + _QzTaskMemFree := GetProcAddress(Ole32Lib, 'CoTaskMemFree'); + _QzCreateFilterObject := GetProcAddress(Ole32Lib, 'CoCreateInstance'); + _QzCLSIDFromString := GetProcAddress(Ole32Lib, 'CLSIDFromString'); + _QzStringFromGUID2 := GetProcAddress(Ole32Lib, 'StringFromGUID2'); + Result:= Assigned(_QzInitialize) and Assigned(_QzUninitialize) and + Assigned(_QzFreeUnusedLibraries) and Assigned(_QzGetMalloc) and + Assigned(_QzTaskMemAlloc) and Assigned(_QzTaskMemRealloc) and + Assigned(_QzTaskMemFree) and Assigned(_QzCreateFilterObject) and + Assigned(_QzCLSIDFromString) and Assigned(_QzStringFromGUID2); + if not Result then UnLoadOle32; + end; + end; + end; + + function QzInitialize(pvReserved: Pointer): HResult; stdcall; + begin + LoadOle32; + Result := _QzInitialize(pvReserved); + end; + + procedure QzUninitialize; stdcall; + begin + LoadOle32; + _QzUninitialize; + end; + + procedure QzFreeUnusedLibraries; stdcall; + begin + LoadOle32; + _QzFreeUnusedLibraries; + end; + + function QzGetMalloc(dwMemContext: Longint; out malloc: IMalloc): HResult; stdcall; + begin + LoadOle32; + Result := _QzGetMalloc(dwMemContext, malloc); + end; + + function QzTaskMemAlloc(cb: Longint): Pointer; stdcall; + begin + LoadOle32; + Result := _QzTaskMemAlloc(cb); + end; + + function QzTaskMemRealloc(pv: Pointer; cb: Longint): Pointer; stdcall; + begin + LoadOle32; + Result := _QzTaskMemRealloc(pv, cb); + end; + + procedure QzTaskMemFree(pv: Pointer); stdcall; + begin + LoadOle32; + _QzTaskMemFree(pv); + end; + + function QzCreateFilterObject(const clsid: TCLSID; unkOuter: IUnknown; + dwClsContext: Longint; const iid: TIID; out pv): HResult; stdcall; + begin + LoadOle32; + Result := _QzCreateFilterObject(clsid, unkOuter, dwClsContext, iid, pv); + end; + + function QzCLSIDFromString(psz: POleStr; out clsid: TCLSID): HResult; stdcall; + begin + LoadOle32; + Result := _QzCLSIDFromString(psz, clsid); + end; + + function QzStringFromGUID2(const guid: TGUID; psz: POleStr; cbMax: Integer): Integer; stdcall; + begin + LoadOle32; + Result := _QzStringFromGUID2(guid, psz, cbMax); + end; + + { Quartz } + + function QuartzLoaded: Boolean; + begin + Result := QuartzLib <> 0; + end; + + function UnLoadQuartz: Boolean; + begin + Result:= True; + if QuartzLoaded then + begin + Result := FreeLibrary(QuartzLib); + _AMGetErrorTextA := nil; + _AMGetErrorTextW := nil; + _AMGetErrorText := nil; + QuartzLib := 0; + end; + end; + + function LoadQuartz: Boolean; + begin + Result := QuartzLoaded; + if (not Result) then + begin + QuartzLib := LoadLibrary(Quartz); + if QuartzLoaded then + begin + _AMGetErrorTextA := GetProcAddress(QuartzLib, 'AMGetErrorTextA'); + _AMGetErrorTextW := GetProcAddress(QuartzLib, 'AMGetErrorTextW'); + // [pjh, 2003-07-14] ANSI and UNICODE declaration exchange + {$IFDEF UNICODE} + _AMGetErrorText := _AMGetErrorTextW; + {$ELSE} + _AMGetErrorText := _AMGetErrorTextA; + {$ENDIF} + Result:= Assigned(_AMGetErrorTextA) and Assigned(_AMGetErrorTextW); + if not Result then UnLoadQuartz; + end; + end; + end; + + function AMGetErrorTextA(hr: HResult; pbuffer: PChar; MaxLen: DWORD): DWORD; stdcall; + begin + LoadQuartz; + Result := _AMGetErrorTextA(hr, pbuffer, MaxLen); + end; + + function AMGetErrorTextW(hr: HResult; pbuffer: PWideChar; MaxLen: DWORD): DWORD; stdcall; + begin + LoadQuartz; + Result := _AMGetErrorTextW(hr, pbuffer, MaxLen); + end; + + // [pjh, 2003-07-14] ANSI and UNICODE declaration exchange + {$IFDEF UNICODE} + function AMGetErrorText(hr: HResult; pbuffer: PWideChar; MaxLen: DWORD): DWORD; stdcall; + {$ELSE} + function AMGetErrorText(hr: HResult; pbuffer: PChar; MaxLen: DWORD): DWORD; stdcall; + {$ENDIF} + begin + LoadQuartz; + Result := _AMGetErrorText(hr, pbuffer, MaxLen); + end; + + { MSDmo } + + function MSDmoLoaded: Boolean; + begin + Result := MSDmoLib <> 0; + end; + + function UnLoadMSDmo: Boolean; + begin + Result:= True; + if MSDmoLoaded then + begin + Result := FreeLibrary(MSDmoLib); + _DMORegister := nil; + _DMOEnum := nil; + _DMOUnregister := nil; + _DMOGetTypes := nil; + _DMOGetName := nil; + _MoInitMediaType := nil; + _MoFreeMediaType := nil; + _MoCopyMediaType := nil; + _MoCreateMediaType := nil; + _MoDeleteMediaType := nil; + _MoDuplicateMediaType := nil; + MSDmoLib := 0; + end; + end; + + function LoadMSDmo: Boolean; + begin + Result := MSDmoLoaded; + if (not Result) then + begin + MSDmoLib := LoadLibrary(MSDmo); + if MSDmoLoaded then + begin + _DMORegister := GetProcAddress(MSDmoLib, 'DMORegister'); + _DMOEnum := GetProcAddress(MSDmoLib, 'DMOEnum'); + _DMOUnregister := GetProcAddress(MSDmoLib, 'DMOUnregister'); + _DMOGetTypes := GetProcAddress(MSDmoLib, 'DMOGetTypes'); + _DMOGetName := GetProcAddress(MSDmoLib, 'DMOGetName'); + _MoInitMediaType := GetProcAddress(MSDmoLib, 'MoInitMediaType'); + _MoFreeMediaType := GetProcAddress(MSDmoLib, 'MoFreeMediaType'); + _MoCopyMediaType := GetProcAddress(MSDmoLib, 'MoCopyMediaType'); + _MoCreateMediaType := GetProcAddress(MSDmoLib, 'MoCreateMediaType'); + _MoDeleteMediaType := GetProcAddress(MSDmoLib, 'MoDeleteMediaType'); + _MoDuplicateMediaType := GetProcAddress(MSDmoLib, 'MoDuplicateMediaType'); + Result:= Assigned(_DMORegister) and Assigned(_DMOEnum) and + Assigned(_DMOUnregister) and Assigned(_DMOGetTypes) and + Assigned(_DMOGetName) and Assigned(_MoInitMediaType) and + Assigned(_MoFreeMediaType) and Assigned(_MoCopyMediaType) and + Assigned(_MoCreateMediaType) and Assigned(_MoDeleteMediaType) and + Assigned(_MoDuplicateMediaType); + if not Result then UnLoadMSDmo; + end; + end; + end; + + function DMORegister(szName: PWideChar; const clsidDMO, guidCategory: TGUID; dwFlags: DWORD; + cInTypes: DWORD; const pInTypes: PDMO_PARTIAL_MEDIATYPE; cOutTypes: DWORD; + const pOutTypes: PDMO_PARTIAL_MEDIATYPE): HResult; stdcall; + begin + LoadMSDmo; + Result := _DMORegister(szName, clsidDMO, guidCategory, dwFlags, cInTypes, + pInTypes, cOutTypes, pOutTypes); + end; + + function DMOUnregister(const clsidDMO, guidCategory: TGUID): HResult; stdcall; + begin + LoadMSDmo; + Result := _DMOUnregister(clsidDMO, guidCategory); + end; + + function DMOEnum(const guidCategory: TGUID; dwFlags: DWORD; cInTypes: DWORD; + pInTypes: PDMO_PARTIAL_MEDIATYPE; cOutTypes: DWORD; + pOutTypes: PDMO_PARTIAL_MEDIATYPE; out ppEnum: IEnumDMO): HResult; stdcall; + begin + LoadMSDmo; + Result := _DMOEnum(guidCategory, dwFlags, cInTypes, pInTypes, cOutTypes, pOutTypes, ppEnum); + end; + + function DMOGetTypes(const clsidDMO: TGUID; ulInputTypesRequested: ULONG; + pulInputTypesSupplied: PULONG; pInputTypes: PDMO_PARTIAL_MEDIATYPE; + ulOutputTypesRequested: ULONG; pulOutputTypesSupplied: PULONG; + pOutputTypes: PDMO_PARTIAL_MEDIATYPE): HResult; stdcall; + begin + LoadMSDmo; + Result := _DMOGetTypes(clsidDMO, ulInputTypesRequested, pulInputTypesSupplied, + pInputTypes, ulOutputTypesRequested, pulOutputTypesSupplied, pOutputTypes); + end; + + function DMOGetName(const clsidDMO: TGUID; szName: TDMOName): HResult; stdcall; + begin + LoadMSDmo; + Result := _DMOGetName(clsidDMO, szName); + end; + + function MoInitMediaType(pmt: PDMOMediaType; cbFormat: DWORD): HResult; stdcall; + begin + LoadMSDmo; + Result := _MoInitMediaType(pmt, cbFormat); + end; + + function MoFreeMediaType(pmt: PDMOMediaType): HResult; stdcall; + begin + LoadMSDmo; + Result := _MoFreeMediaType(pmt); + end; + + function MoCopyMediaType(out pmtDest: TDMOMediaType; const pmtSrc: PDMOMediaType): HResult; stdcall; + begin + LoadMSDmo; + Result := _MoCopyMediaType(pmtDest, pmtSrc); + end; + + function MoCreateMediaType(out ppmt: PDMOMediaType; cbFormat: DWORD): HResult; stdcall; + begin + LoadMSDmo; + Result := _MoCreateMediaType(ppmt, cbFormat); + end; + + function MoDeleteMediaType(pmt: PDMOMediaType): HResult; stdcall; + begin + LoadMSDmo; + Result := _MoDeleteMediaType(pmt); + end; + + function MoDuplicateMediaType(out ppmtDest: PDMOMediaType; const pmtSrc: PDMOMediaType): HResult; stdcall; + begin + LoadMSDmo; + Result := _MoDuplicateMediaType(ppmtDest, pmtSrc); + end; + + { ksUser } + + function ksUserLoaded: Boolean; + begin + Result := ksUserLib <> 0; + end; + + function UnLoadksUser: Boolean; + begin + Result:= True; + if ksUserLoaded then + begin + Result := FreeLibrary(ksUserLib); + _KsCreateAllocator := nil; + _KsCreateClock := nil; + _KsCreatePin := nil; + _KsCreateTopologyNode := nil; + ksUserLib := 0; + end; + end; + + function LoadksUser: Boolean; + begin + Result := ksUserLoaded; + if (not Result) then + begin + ksUserLib := LoadLibrary(ksUser); + if ksUserLoaded then + begin + _KsCreateAllocator := GetProcAddress(ksUserLib, 'KsCreateAllocator'); + _KsCreateClock := GetProcAddress(ksUserLib, 'KsCreateClock'); + _KsCreatePin := GetProcAddress(ksUserLib, 'KsCreatePin'); + _KsCreateTopologyNode := GetProcAddress(ksUserLib, 'KsCreateTopologyNode'); + Result:= + Assigned(_KsCreateAllocator) and Assigned(_KsCreateClock) and + Assigned(_KsCreatePin) and Assigned(_KsCreateTopologyNode); + if not Result then UnLoadksUser; + end; + end; + end; + + function KsCreateAllocator(ConnectionHandle: THandle; AllocatorFraming: PKSAllocatorFraming; out AllocatorHandle: PHandle): DWORD; stdcall; + begin + LoadksUser; + Result := _KsCreateAllocator(ConnectionHandle, AllocatorFraming, AllocatorHandle); + end; + + function KsCreateClock(ConnectionHandle: THandle; ClockCreate: PKSClockCreate; out ClockHandle: PHandle): DWORD; stdcall; + begin + LoadksUser; + Result := _KsCreateClock(ConnectionHandle, ClockCreate, ClockHandle); + end; + + function KsCreatePin(FilterHandle: THandle; Connect: PKSPinConnect; DesiredAccess: ACCESS_MASK; out ConnectionHandle: PHandle): DWORD; stdcall; + begin + LoadksUser; + Result := _KsCreatePin(FilterHandle, Connect, DesiredAccess, ConnectionHandle); + end; + + function KsCreateTopologyNode(ParentHandle: THandle; NodeCreate: PKSNodeCreate; DesiredAccess: ACCESS_MASK; out NodeHandle: PHandle): DWORD; stdcall; + begin + LoadksUser; + Result := _KsCreateTopologyNode(ParentHandle, NodeCreate, DesiredAccess, NodeHandle); + end; + + { KsProxy } + + function KsProxyLoaded: Boolean; + begin + Result := ksProxyLib <> 0; + end; + + function UnLoadKsProxy: Boolean; + begin + Result:= True; + if KsProxyLoaded then + begin + Result := FreeLibrary(KsProxyLib); + _KsResolveRequiredAttributes := nil; + _KsOpenDefaultDevice := nil; + _KsSynchronousDeviceControl := nil; + _KsGetMultiplePinFactoryItems := nil; + _KsGetMediaTypeCount := nil; + _KsGetMediaType := nil; + KsProxyLib := 0; + end; + end; + + function LoadKsProxy: Boolean; + begin + Result := KsProxyLoaded; + if (not Result) then + begin + KsProxyLib := LoadLibrary(KsProxy); + if KsProxyLoaded then + begin + _KsResolveRequiredAttributes := GetProcAddress(KsProxyLib, 'KsResolveRequiredAttributes'); + _KsOpenDefaultDevice := GetProcAddress(KsProxyLib, 'KsOpenDefaultDevice'); + _KsSynchronousDeviceControl := GetProcAddress(KsProxyLib, 'KsSynchronousDeviceControl'); + _KsGetMultiplePinFactoryItems := GetProcAddress(KsProxyLib, 'KsGetMultiplePinFactoryItems'); + _KsGetMediaTypeCount := GetProcAddress(KsProxyLib, 'KsGetMediaTypeCount'); + _KsGetMediaType := GetProcAddress(KsProxyLib, 'KsGetMediaType'); + Result:= Assigned(_KsResolveRequiredAttributes) and Assigned(_KsOpenDefaultDevice) and + Assigned(_KsSynchronousDeviceControl) and Assigned(_KsGetMultiplePinFactoryItems) and + Assigned(_KsGetMediaTypeCount) and Assigned(_KsGetMediaType); + if not Result then UnLoadKsProxy; + end; + end; + end; + + function KsResolveRequiredAttributes(DataRange: PKSDATARANGE; Attributes: PKSMULTIPLE_ITEM): HResult; stdcall; + begin + LoadKsProxy; + Result := _KsResolveRequiredAttributes(DataRange, Attributes); + end; + + function KsOpenDefaultDevice(Category: TGUID; Access: ACCESS_MASK; DeviceHandle: PHANDLE): HResult; stdcall; + begin + LoadKsProxy; + Result := _KsOpenDefaultDevice(Category, Access, DeviceHandle); + end; + + function KsSynchronousDeviceControl(Handle: THandle; IoControl: ULONG; InBuffer: Pointer; InLength: ULONG; OutBuffer: Pointer; OutLength: ULONG; BytesReturned: PULONG): HResult; stdcall; + begin + LoadKsProxy; + Result := _KsSynchronousDeviceControl(Handle, IoControl, InBuffer, InLength, OutBuffer, OutLength, BytesReturned); + end; + + function KsGetMultiplePinFactoryItems(FilterHandle: THandle; PinFactoryId: ULONG; PropertyId: ULONG; Items: Pointer): HResult; stdcall; + begin + LoadKsProxy; + Result := _KsGetMultiplePinFactoryItems(FilterHandle, PinFactoryId, PropertyId, Items); + end; + + function KsGetMediaTypeCount(FilterHandle: THandle; PinFactoryId: ULONG; out MediaTypeCount: ULONG): HResult; stdcall; + begin + LoadKsProxy; + Result := _KsGetMediaTypeCount(FilterHandle, PinFactoryId, MediaTypeCount); + end; + + function KsGetMediaType(Position: integer; out AmMediaType: TAMMediaType; FilterHandle: THandle; PinFactoryId: ULONG): HResult; stdcall; + begin + LoadKsProxy; + Result := _KsGetMediaType(Position, AmMediaType, FilterHandle, PinFactoryId); + end; + +{$ELSE} + function QzInitialize; external ole32 name 'CoInitialize'; + procedure QzUninitialize; external ole32 name 'CoUninitialize'; + procedure QzFreeUnusedLibraries; external ole32 name 'CoFreeUnusedLibraries'; + + function QzGetMalloc; external ole32 name 'CoGetMalloc'; + function QzTaskMemAlloc; external ole32 name 'CoTaskMemAlloc'; + function QzTaskMemRealloc; external ole32 name 'CoTaskMemRealloc'; + procedure QzTaskMemFree; external ole32 name 'CoTaskMemFree'; + + function QzCreateFilterObject; external ole32 name 'CoCreateInstance'; + function QzCLSIDFromString; external ole32 name 'CLSIDFromString'; + function QzStringFromGUID2; external ole32 name 'StringFromGUID2'; + + function AMGetErrorTextA; external quartz name 'AMGetErrorTextA'; + function AMGetErrorTextW; external quartz name 'AMGetErrorTextW'; + function AMGetErrorText; external quartz name {$IFDEF UNICODE}'AMGetErrorTextW'{$ELSE}'AMGetErrorTextA'{$ENDIF}; + + function DMORegister ; external msdmo name 'DMORegister'; + function DMOUnregister ; external msdmo name 'DMOUnregister'; + function DMOEnum ; external msdmo name 'DMOEnum'; + function DMOGetTypes ; external msdmo name 'DMOGetTypes'; + function DMOGetName ; external msdmo name 'DMOGetName'; + + function MoInitMediaType ; external msdmo name 'MoInitMediaType'; + function MoFreeMediaType ; external msdmo name 'MoFreeMediaType'; + function MoCopyMediaType ; external msdmo name 'MoCopyMediaType'; + function MoCreateMediaType ; external msdmo name 'MoCreateMediaType'; + function MoDeleteMediaType ; external msdmo name 'MoDeleteMediaType'; + function MoDuplicateMediaType; external msdmo name 'MoDuplicateMediaType'; + + function KsCreateAllocator ; external ksuser name 'KsCreateAllocator'; + function KsCreateClock ; external ksuser name 'KsCreateClock'; + function KsCreatePin ; external ksuser name 'KsCreatePin'; + function KsCreateTopologyNode; external ksuser name 'KsCreateTopologyNode'; + + function KsGetMediaType ; external ksproxy name 'KsGetMediaType'; + function KsGetMediaTypeCount ; external ksproxy name 'KsGetMediaTypeCount'; + function KsGetMultiplePinFactoryItems; external ksproxy name 'KsGetMultiplePinFactoryItems'; + function KsOpenDefaultDevice ; external ksproxy name 'KsOpenDefaultDevice'; + function KsResolveRequiredAttributes ; external ksproxy name 'KsResolveRequiredAttributes'; + function KsSynchronousDeviceControl ; external ksproxy name 'KsSynchronousDeviceControl'; +{$ENDIF} + +{$IFDEF DELPHI4_UP} +//////////////////////////////////////////////////////////////////////////////// +// +// TMediaObjectImpl +// +/////////////////////////////////////////////////////////////////////////////// + +type + ILockIt = interface + end; + + TLockIt = class(TInterfacedObject, ILockIt) + private + FMOI: TMediaObjectImpl; + public + constructor Create(MOI: TMediaObjectImpl); + destructor Destroy; override; + end; + +constructor TLockIt.Create(MOI: TMediaObjectImpl); +begin + FMOI := MOI; + FMOI.Lock; +end; + +destructor TLockIt.Destroy; +begin + FMOI.Unlock; + FMOI := nil; +end; + +//=================================================================== + +// Helpers +function TMediaObjectImpl.InputTypeSet(ulInputStreamIndex: DWORD): BOOL; +begin + ASSERT(ulInputStreamIndex < NUMBEROFINPUTS); + Result := (0 <> m_InputInfo[ulInputStreamIndex].fTypeSet); +end; + +function TMediaObjectImpl.OutputTypeSet(ulOutputStreamIndex: DWORD): BOOL; +begin + ASSERT(ulOutputStreamIndex < NUMBEROFOUTPUTS); + Result := (0 <> m_OutputInfo[ulOutputStreamIndex].fTypeSet); +end; + +function TMediaObjectImpl.InputType(ulInputStreamIndex: DWORD): PDMOMediaType; +begin + if (not InputTypeSet(ulInputStreamIndex)) then Result := nil + else Result := @m_InputInfo[ulInputStreamIndex].CurrentMediaType; +end; + +function TMediaObjectImpl.OutputType(ulOutputStreamIndex: DWORD): PDMOMediaType; +begin + if (not OutputTypeSet(ulOutputStreamIndex)) then Result := nil + else Result := @m_OutputInfo[ulOutputStreamIndex].CurrentMediaType; +end; + +function TMediaObjectImpl.CheckTypesSet: bool; +var + dw: Integer; + dwFlags: DWORD; +begin + m_fTypesSet := False; + for dw := 0 to (NUMBEROFINPUTS - 1) do + begin + if (not InputTypeSet(dw)) then + begin + Result := False; + Exit; + end; + end; + for dw := 0 to (NUMBEROFOUTPUTS - 1) do + begin + if (not OutputTypeSet(dw)) then + begin + // Check if it's optional + {$IFDEF DEBUG} + dwFlags := $FFFFFFFF; + {$ENDIF} + InternalGetOutputStreamInfo(dw, dwFlags); + ASSERT(0 = (dwFlags and not (DMO_OUTPUT_STREAMF_WHOLE_SAMPLES or + DMO_OUTPUT_STREAMF_SINGLE_SAMPLE_PER_BUFFER or + DMO_OUTPUT_STREAMF_FIXED_SAMPLE_SIZE or + DMO_OUTPUT_STREAMF_DISCARDABLE or + DMO_OUTPUT_STREAMF_OPTIONAL))); + if not ((dwFlags and DMO_OUTPUT_STREAMF_OPTIONAL) <> 0) then + begin + Result := False; + Exit; + end; + end; + end; + m_fTypesSet := True; + Result := True; +end; + +procedure TMediaObjectImpl.Initialize; +begin + inherited; + Assert((NUMBEROFINPUTS <> 0) or (NUMBEROFOUTPUTS <> 0),'NUMBEROFINPUTS or NUMBEROFOUTPUTS = 0'); + m_fTypesSet := False; + m_fFlushed := True; + m_fResourcesAllocated := False; + SetLength(m_InputInfo, NUMBEROFINPUTS); + SetLength(m_OutputInfo, NUMBEROFOUTPUTS); + ZeroMemory(m_InputInfo, SizeOf(TMOinplIOInfo)*NUMBEROFINPUTS); + ZeroMemory(m_OutputInfo, SizeOf(TMOinplIOInfo)*NUMBEROFOUTPUTS); + fCritSection:= TCriticalSection.Create; +end; + +destructor TMediaObjectImpl.Destroy; +var + dwCurrentType: Integer; +begin + for dwCurrentType := 0 to (NUMBEROFINPUTS - 1) do + begin + if (InputTypeSet(dwCurrentType)) then + MoFreeMediaType(@m_InputInfo[dwCurrentType].CurrentMediaType); + end; + + for dwCurrentType := 0 to (NUMBEROFOUTPUTS - 1) do + begin + if (OutputTypeSet(dwCurrentType)) then + MoFreeMediaType(@m_OutputInfo[dwCurrentType].CurrentMediaType); + end; + + fCritSection.Free; + inherited Destroy; +end; + +// +// IMediaObject methods +// +function TMediaObjectImpl.GetStreamCount(out pulNumberOfInputStreams, pulNumberOfOutputStreams: DWORD): HResult; +var + lck: ILockIt; +begin + lck := TLockIt.Create(Self); + pulNumberOfInputStreams := NUMBEROFINPUTS; + pulNumberOfOutputStreams := NUMBEROFOUTPUTS; + Result := S_OK; +end; + +function TMediaObjectImpl.GetInputStreamInfo(ulStreamIndex: DWORD; out pdwFlags: DWORD): HResult; +var + lck: ILockIt; +begin + lck := TLockIt.Create(Self); + if (ulStreamIndex >= NUMBEROFINPUTS) then + begin +{$IFDEF VER120} + Result := DMO_E_INVALIDSTREAMINDEX; +{$ELSE} + Result := Longint(DMO_E_INVALIDSTREAMINDEX); +{$ENDIF} + Exit; + end; + if (@pdwFlags = nil) then + begin + Result := E_POINTER; + Exit; + end; + Result := InternalGetInputStreamInfo(ulStreamIndex, pdwFlags); + ASSERT(0 = (pdwFlags and not (DMO_INPUT_STREAMF_WHOLE_SAMPLES or + DMO_INPUT_STREAMF_SINGLE_SAMPLE_PER_BUFFER or + DMO_INPUT_STREAMF_FIXED_SAMPLE_SIZE or + DMO_INPUT_STREAMF_HOLDS_BUFFERS))); +end; + +function TMediaObjectImpl.GetOutputStreamInfo(ulStreamIndex: DWORD; out pdwFlags: DWORD): HResult; +var + lck: ILockIt; +begin + lck:= TLockIt.Create(Self); + if (ulStreamIndex >= NUMBEROFOUTPUTS) then + begin +{$IFDEF VER120} + Result := DMO_E_INVALIDSTREAMINDEX; +{$ELSE} + Result := Longint(DMO_E_INVALIDSTREAMINDEX); +{$ENDIF} + Exit; + end; + if (@pdwFlags = nil) then + begin + Result := E_POINTER; + Exit; + end; + + Result := InternalGetOutputStreamInfo(ulStreamIndex, pdwFlags); + ASSERT(0 = (pdwFlags and not(DMO_OUTPUT_STREAMF_WHOLE_SAMPLES or + DMO_OUTPUT_STREAMF_SINGLE_SAMPLE_PER_BUFFER or + DMO_OUTPUT_STREAMF_FIXED_SAMPLE_SIZE or + DMO_OUTPUT_STREAMF_DISCARDABLE or + DMO_OUTPUT_STREAMF_OPTIONAL))); +end; + +function TMediaObjectImpl.GetInputType(ulStreamIndex, ulTypeIndex: DWORD; + out pmt: TDMOMediaType): HResult; +var + lck: ILockIt; +begin + if (ulStreamIndex >= NUMBEROFINPUTS) then + begin +{$IFDEF VER120} + Result := DMO_E_INVALIDSTREAMINDEX; +{$ELSE} + Result := Longint(DMO_E_INVALIDSTREAMINDEX); +{$ENDIF} + Exit; + end; + lck:= TLockIt.Create(Self); + Result := InternalGetInputType(ulStreamIndex, ulTypeIndex, pmt); +end; + +function TMediaObjectImpl.GetOutputType(ulStreamIndex, ulTypeIndex: DWORD; + out pmt: TDMOMediaType): HResult; stdcall; +var + lck: ILockIt; +begin + if (ulStreamIndex >= NUMBEROFOUTPUTS) then + begin +{$IFDEF VER120} + Result := DMO_E_INVALIDSTREAMINDEX; +{$ELSE} + Result := Longint(DMO_E_INVALIDSTREAMINDEX); +{$ENDIF} + Exit; + end; + lck := TLockIt.Create(Self); + Result := InternalGetOutputType(ulStreamIndex, ulTypeIndex, pmt); +end; + +function TMediaObjectImpl.GetInputCurrentType(ulStreamIndex: DWORD; + out pmt: TDMOMediaType): HResult; stdcall; +var + lck: ILockIt; +begin + if (ulStreamIndex >= NUMBEROFINPUTS) then + begin +{$IFDEF VER120} + Result := DMO_E_INVALIDSTREAMINDEX; +{$ELSE} + Result := Longint(DMO_E_INVALIDSTREAMINDEX); +{$ENDIF} + Exit; + end; + if (nil = @pmt) then + begin + Result:= E_POINTER; + Exit; + end; + lck := TLockIt.Create(Self); + if (InputTypeSet(ulStreamIndex)) + then Result := MoCopyMediaType(pmt, @m_InputInfo[ulStreamIndex].CurrentMediaType) + else +{$IFDEF VER120} + Result := DMO_E_TYPE_NOT_SET; +{$ELSE} + Result := Longint(DMO_E_TYPE_NOT_SET); +{$ENDIF} + +end; + +function TMediaObjectImpl.GetOutputCurrentType(ulStreamIndex: DWORD; + out pmt: TDMOMediaType): HResult; +var + lck: ILockIt; +begin + if (ulStreamIndex >= NUMBEROFOUTPUTS) then + begin +{$IFDEF VER120} + Result := DMO_E_INVALIDSTREAMINDEX; +{$ELSE} + Result := Longint(DMO_E_INVALIDSTREAMINDEX); +{$ENDIF} + Exit; + end; + if (nil = @pmt) then + begin + Result:= E_POINTER; + Exit; + end; + + lck := TLockIt.Create(Self); + if (OutputTypeSet(ulStreamIndex)) + then Result := MoCopyMediaType(pmt, @m_OutputInfo[ulStreamIndex].CurrentMediaType) +{$IFDEF VER120} + else Result := DMO_E_TYPE_NOT_SET; +{$ELSE} + else Result := Longint(DMO_E_TYPE_NOT_SET); +{$ENDIF} +end; + +function TMediaObjectImpl.GetInputSizeInfo(ulStreamIndex: DWORD; out pcbSize, pcbMaxLookahead, pcbAlignment: DWORD): HResult; +var + lck: ILockIt; +begin + if (ulStreamIndex >= NUMBEROFINPUTS) then + begin +{$IFDEF VER120} + Result := DMO_E_INVALIDSTREAMINDEX; +{$ELSE} + Result := Longint(DMO_E_INVALIDSTREAMINDEX); +{$ENDIF} + Exit; + end; + if (nil = @pcbSize) or (nil = @pcbMaxLookahead) or (nil = @pcbAlignment) then + begin + Result:= E_POINTER; + Exit; + end; + + lck := TLockIt.Create(Self); + if (not InputTypeSet(ulStreamIndex)) then + begin +{$IFDEF VER120} + Result := DMO_E_TYPE_NOT_SET; +{$ELSE} + Result := Longint(DMO_E_TYPE_NOT_SET); +{$ENDIF} + Exit; + end; + Result := InternalGetInputSizeInfo(ulStreamIndex, pcbSize, pcbMaxLookahead, pcbAlignment); +end; + +function TMediaObjectImpl.GetOutputSizeInfo(ulStreamIndex: DWORD; out pcbSize, pcbAlignment: DWORD): HResult; +var + lck: ILockIt; +begin + if (ulStreamIndex >= NUMBEROFOUTPUTS) then + begin +{$IFDEF VER120} + Result := DMO_E_INVALIDSTREAMINDEX; +{$ELSE} + Result := Longint(DMO_E_INVALIDSTREAMINDEX); +{$ENDIF} + Exit; + end; + if (nil = @pcbSize) or (nil = @pcbAlignment) then + begin + Result:= E_POINTER; + Exit; + end; + + lck := TLockIt.Create(Self); + if ((not m_fTypesSet) or (not OutputTypeSet(ulStreamIndex))) then + begin +{$IFDEF VER120} + Result := DMO_E_TYPE_NOT_SET; +{$ELSE} + Result := Longint(DMO_E_TYPE_NOT_SET); +{$ENDIF} + Exit; + end; + Result := InternalGetOutputSizeInfo(ulStreamIndex, pcbSize, pcbAlignment); +end; + +function TMediaObjectImpl.SetInputType(ulStreamIndex: DWORD; const pmt: PDMOMediaType; dwFlags: DWORD): HResult; +var + lck: ILockIt; + mtTemp: TDMOMediaType; +begin + if (ulStreamIndex >= NUMBEROFINPUTS) then + begin +{$IFDEF VER120} + Result := DMO_E_INVALIDSTREAMINDEX; +{$ELSE} + Result := Longint(DMO_E_INVALIDSTREAMINDEX); +{$ENDIF} + Exit; + end; + if ((dwFlags and not(DMO_SET_TYPEF_CLEAR or DMO_SET_TYPEF_TEST_ONLY)) <> 0) then + begin + Result := E_INVALIDARG; + Exit; + end; + lck := TLockIt.Create(Self); + if ((dwFlags and DMO_SET_TYPEF_CLEAR) <> 0) then + begin + MoFreeMediaType(@m_InputInfo[ulStreamIndex].CurrentMediaType); + m_InputInfo[ulStreamIndex].fTypeSet := Integer(False); + if (not CheckTypesSet) then + begin + Flush; + FreeStreamingResources; + end; + Result := NOERROR; + Exit; + end; + if (nil = pmt) then + begin + Result := E_POINTER; + Exit; + end; + Result := InternalCheckInputType(ulStreamIndex, pmt); // DMO_E_TYPE_NOT_ACCEPTED, S_FALSE + if FAILED(Result) or (Result = S_FALSE) then Exit; + + if ((dwFlags and DMO_SET_TYPEF_TEST_ONLY) <> 0) then + begin + Result := NOERROR; + Exit; + end; + // actually set the type + if (S_OK = MoCopyMediaType(mtTemp, pmt)) then + begin + // Free any previous mediatype + if (InputTypeSet(ulStreamIndex)) then + MoFreeMediaType(@m_InputInfo[ulStreamIndex].CurrentMediaType); + m_InputInfo[ulStreamIndex].CurrentMediaType := mtTemp; + m_InputInfo[ulStreamIndex].fTypeSet := Integer(True); + CheckTypesSet; + end else + begin + Result := E_OUTOFMEMORY; + Exit; + end; + Result := NOERROR; +end; + +function TMediaObjectImpl.SetOutputType(ulStreamIndex: DWORD; const pmt: PDMOMediaType; dwFlags: DWORD): HResult; +var + lck: ILockIt; + mtTemp: TDMOMediaType; +begin + if (ulStreamIndex >= NUMBEROFOUTPUTS) then + begin +{$IFDEF VER120} + Result := DMO_E_INVALIDSTREAMINDEX; +{$ELSE} + Result := Longint(DMO_E_INVALIDSTREAMINDEX); +{$ENDIF} + Exit; + end; + if (dwFlags and not(DMO_SET_TYPEF_CLEAR or DMO_SET_TYPEF_TEST_ONLY) <> 0) then + begin + Result := E_INVALIDARG; + Exit; + end; + lck := TLockIt.Create(Self); + if ((dwFlags and DMO_SET_TYPEF_CLEAR) <> 0) then + begin + MoFreeMediaType(@m_OutputInfo[ulStreamIndex].CurrentMediaType); + m_OutputInfo[ulStreamIndex].fTypeSet := 0; + if (not CheckTypesSet) then + begin + Flush; + FreeStreamingResources; + end; + Result := NOERROR; + Exit; + end; + if (nil = pmt) then + begin + Result := E_POINTER; + Exit; + end; + + Result := InternalCheckOutputType(ulStreamIndex, pmt); + if FAILED(Result) or (Result = S_FALSE) then Exit; + + if ((dwFlags and DMO_SET_TYPEF_TEST_ONLY) <> 0) then + begin + Result := NOERROR; + Exit; + end; + // actually set the type + if (S_OK = MoCopyMediaType(mtTemp, pmt)) then + begin + // Free any previous mediatype + if (OutputTypeSet(ulStreamIndex)) then + MoFreeMediaType(@m_OutputInfo[ulStreamIndex].CurrentMediaType); + m_OutputInfo[ulStreamIndex].CurrentMediaType := mtTemp; + m_OutputInfo[ulStreamIndex].fTypeSet := Integer(True); + CheckTypesSet; + end + else + begin + Result := E_OUTOFMEMORY; + Exit; + end; + Result := NOERROR; +end; + +function TMediaObjectImpl.GetInputStatus(ulStreamIndex: DWORD; out pdwStatus: DWORD): HResult; +var + lck: ILockIt; +begin + if (ulStreamIndex >= NUMBEROFINPUTS) then + begin +{$IFDEF VER120} + Result := DMO_E_INVALIDSTREAMINDEX; +{$ELSE} + Result := Longint(DMO_E_INVALIDSTREAMINDEX); +{$ENDIF} + Exit; + end; + if (nil = @pdwStatus) then + begin + Result := E_POINTER; + Exit; + end; + + pdwStatus := 0; + + lck := TLockIt.Create(Self); + if (not m_fTypesSet) then + begin +{$IFDEF VER120} + Result := DMO_E_TYPE_NOT_SET; +{$ELSE} + Result := Longint(DMO_E_TYPE_NOT_SET); +{$ENDIF} + Exit; + end; + if (InternalAcceptingInput(ulStreamIndex) = S_OK) then + pdwStatus := pdwStatus or DMO_INPUT_STATUSF_ACCEPT_DATA; + Result := NOERROR; +end; + +function TMediaObjectImpl.GetInputMaxLatency(ulStreamIndex: DWORD; out prtLatency: TReferenceTime): HResult; +var + lck: ILockIt; +begin + if (@prtLatency = nil) then + begin + Result := E_POINTER; + Exit; + end; + if (ulStreamIndex >= NUMBEROFINPUTS) then + begin +{$IFDEF VER120} + Result := DMO_E_INVALIDSTREAMINDEX; +{$ELSE} + Result := Longint(DMO_E_INVALIDSTREAMINDEX); +{$ENDIF} + Exit; + end; + lck := TLockIt.Create(Self); + Result := InternalGetInputMaxLatency(ulStreamIndex, prtLatency); +end; + +function TMediaObjectImpl.SetInputMaxLatency(ulStreamIndex: DWORD; rtLatency: TReferenceTime): HResult; +var + lck: ILockIt; +begin + if (ulStreamIndex >= NUMBEROFINPUTS) then + begin +{$IFDEF VER120} + Result := DMO_E_INVALIDSTREAMINDEX; +{$ELSE} + Result := Longint(DMO_E_INVALIDSTREAMINDEX); +{$ENDIF} + Exit; + end; + lck := TLockIt.Create(Self); + Result := InternalSetInputMaxLatency(ulStreamIndex, rtLatency); +end; + +function TMediaObjectImpl.Discontinuity(ulStreamIndex: DWORD): HResult; +var + lck: ILockIt; +begin + if (ulStreamIndex >= NUMBEROFINPUTS) then + begin +{$IFDEF VER120} + Result := DMO_E_INVALIDSTREAMINDEX; +{$ELSE} + Result := Longint(DMO_E_INVALIDSTREAMINDEX); +{$ENDIF} + Exit; + end; + lck := TLockIt.Create(Self); + if (not m_fTypesSet) then + begin +{$IFDEF VER120} + Result := DMO_E_TYPE_NOT_SET; +{$ELSE} + Result := Longint(DMO_E_TYPE_NOT_SET); +{$ENDIF} + Exit; + end; + if (S_OK <> InternalAcceptingInput(ulStreamIndex)) then + begin +{$IFDEF VER120} + Result := DMO_E_NOTACCEPTING; +{$ELSE} + Result := Longint(DMO_E_NOTACCEPTING); +{$ENDIF} + Exit; + end; + Result := InternalDiscontinuity(ulStreamIndex); +end; + +function TMediaObjectImpl.Flush: HResult; +var + lck: ILockIt; +begin + lck := TLockIt.Create(Self); + if (not m_fTypesSet) then + begin + Result := S_OK; + Exit; + end; + if (m_fFlushed) then + begin + Result := S_OK; + Exit; + end; + Result := InternalFlush; + m_fFlushed := True; +end; + +function TMediaObjectImpl.AllocateStreamingResources: HResult; +var + lck: ILockIt; +begin + lck := TLockIt.Create(Self); + if (not m_fTypesSet) then + begin +{$IFDEF VER120} + Result := DMO_E_TYPE_NOT_SET; +{$ELSE} + Result := Longint(DMO_E_TYPE_NOT_SET); +{$ENDIF} + Exit; + end; + if (m_fResourcesAllocated) then + begin + Result := S_OK; + Exit; + end; + Result := InternalAllocateStreamingResources; + if SUCCEEDED(Result) then m_fResourcesAllocated := True; +end; + +function TMediaObjectImpl.FreeStreamingResources: HResult; +var + lck: ILockIt; +begin + lck := TLockIt.Create(Self); + if (m_fResourcesAllocated) then + begin + m_fResourcesAllocated := False; + InternalFlush; + Result := InternalFreeStreamingResources; + Exit; + end; + Result := S_OK; +end; + +// +// Processing methods - public entry points +// +function TMediaObjectImpl.ProcessInput(ulStreamIndex: DWORD; pBuffer: IMediaBuffer; dwFlags: DWORD; + rtTimestamp, rtTimelength: TReferenceTime): HResult; stdcall; +var + lck: ILockIt; +begin + if (nil = pBuffer) then + begin + Result := E_POINTER; + Exit; + end; + if (ulStreamIndex >= NUMBEROFINPUTS) then + begin +{$IFDEF VER120} + Result := DMO_E_INVALIDSTREAMINDEX; +{$ELSE} + Result := Longint(DMO_E_INVALIDSTREAMINDEX); +{$ENDIF} + Exit; + end; + if ((dwFlags and not (DMO_INPUT_DATA_BUFFERF_SYNCPOINT or + DMO_INPUT_DATA_BUFFERF_TIME or + DMO_INPUT_DATA_BUFFERF_TIMELENGTH)) <> 0) then + begin + Result := E_INVALIDARG; + Exit; + end; + + lck := TLockIt.Create(Self); + + // Make sure all streams have media types set and resources are allocated + Result := AllocateStreamingResources; + if FAILED(Result) then Exit; + + if (InternalAcceptingInput(ulStreamIndex) <> S_OK) then + begin +{$IFDEF VER120} + Result := DMO_E_NOTACCEPTING; +{$ELSE} + Result := Longint(DMO_E_NOTACCEPTING); +{$ENDIF} + Exit; + end; + m_fFlushed := False; + Result := InternalProcessInput(ulStreamIndex, pBuffer, dwFlags, rtTimestamp, rtTimelength); +end; + +function TMediaObjectImpl.ProcessOutput(dwFlags, cOutputBufferCount: DWORD; var pOutputBuffers: TDMOOutputDataBufferArray; + out pdwStatus: DWORD): HResult; stdcall; +var + dw: Integer; + lck: ILockIt; +begin + if (@pdwStatus = nil) then + begin + Result:= E_POINTER; + Exit; + end; + if (cOutputBufferCount <> NUMBEROFOUTPUTS) or + ((dwFlags and not DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER) <> 0) then + begin + Result := E_INVALIDARG; + Exit; + end; + if ((NUMBEROFOUTPUTS <> 0) and (@pOutputBuffers = nil)) then + begin + Result := E_POINTER; + Exit; + end; + + pdwStatus := 0; + + lck := TLockIt.Create(Self); + + Result := AllocateStreamingResources; + if (FAILED(Result)) then Exit; + + for dw := 0 to NUMBEROFOUTPUTS - 1 do pOutputBuffers[dw].dwStatus := 0; + + Result := InternalProcessOutput(dwFlags, cOutputBufferCount, pOutputBuffers, pdwStatus); + + // remember the DMO's incomplete status + for dw := 0 to NUMBEROFOUTPUTS - 1 do + begin + if ((pOutputBuffers[dw].dwStatus and DMO_OUTPUT_DATA_BUFFERF_INCOMPLETE) <> 0) + then m_OutputInfo[dw].fIncomplete := Integer(True) + else m_OutputInfo[dw].fIncomplete := Integer(False); + end; +end; + +function TMediaObjectImpl.Lock(bLock: Longint): HResult; stdcall; +begin + if (bLock <> 0) then Lock else Unlock; + Result := S_Ok; +end; + +procedure TMediaObjectImpl.Lock; +begin + fCritSection.Enter; +end; + +procedure TMediaObjectImpl.Unlock; +begin + fCritSection.Leave; +end; +{$ENDIF} + +initialization +{$IFDEF DIRECTSHOW9_DYNAMIC_LINK} + _QzInitialize := nil; + _QzUninitialize := nil; + _QzFreeUnusedLibraries := nil; + _QzGetMalloc := nil; + _QzTaskMemAlloc := nil; + _QzTaskMemRealloc := nil; + _QzTaskMemFree := nil; + _QzCreateFilterObject := nil; + _QzCLSIDFromString := nil; + _QzStringFromGUID2 := nil; +{$ENDIF} + +finalization +{$IFDEF DIRECTSHOW9_DYNAMIC_LINK} + UnLoadOle32; + UnLoadQuartz; + UnLoadMSDmo; + UnLoadksUser; + UnLoadKsProxy; +{$ENDIF} + +end. diff --git a/components/acs/Src/fileformats/windows/directsound.pas b/components/acs/Src/fileformats/windows/directsound.pas new file mode 100644 index 000000000..3cd9e01d3 --- /dev/null +++ b/components/acs/Src/fileformats/windows/directsound.pas @@ -0,0 +1,1821 @@ +{******************************************************************************} +{* *} +{* copyright (c) microsoft corporation. all rights reserved. *} +{* *} +{* files: dsound.h *} +{* content: directsound include file *} +{* *} +{* directx 9.0 delphi / freepascal adaptation by alexey barkovoy *} +{* e-mail: directx@clootie.ru *} +{* *} +{* modified: 30-nov-2004 *} +{* *} +{* compatible with : *} +{* directx 7.0 object pascal adaptation by *} +{* erik unger, e-mail: delphidirectx@next-reality.com *} +{* *} +{* latest version can be downloaded from: *} +{* http://clootie.ru *} +{* http://sourceforge.net/projects/delphi-dx9sdk *} +{* *} +{******************************************************************************} +{ } +{ obtained through: joint endeavour of delphi innovators (project jedi) } +{ } +{ the contents of this file are used with permission, subject to the mozilla } +{ public license version 1.1 (the "license"); you may not use this file except } +{ in compliance with the license. you may obtain a copy of the license at } +{ http://www.mozilla.org/mpl/mpl-1.1.html } +{ } +{ software distributed under the license is distributed on an "as is" basis, } +{ without warranty of any kind, either express or implied. see the license for } +{ the specific language governing rights and limitations under the license. } +{ } +{ alternatively, the contents of this file may be used under the terms of the } +{ gnu lesser general public license (the "lgpl license"), in which case the } +{ provisions of the lgpl license are applicable instead of those above. } +{ if you wish to allow use of your version of this file only under the terms } +{ of the lgpl license and not to allow others to use your version of this file } +{ under the mpl, indicate your decision by deleting the provisions above and } +{ replace them with the notice and other provisions required by the lgpl } +{ license. if you do not delete the provisions above, a recipient may use } +{ your version of this file under either the mpl or the lgpl license. } +{ } +{ for more information about the lgpl: http://www.gnu.org/copyleft/lesser.html } +{ } +{******************************************************************************} + +{.$I DirectX.inc} + +unit directsound; + +interface + +uses + Windows, MMSystem, DXTypes; + +(*==========================================================================; + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: dsound.h + * Content: DirectSound include file + * + **************************************************************************) + +//////////////////////////////////////////////////////////////////////// +// Global level dynamic loading support +{$IFDEF DYNAMIC_LINK_ALL} + {$DEFINE DIRECTSOUND_DYNAMIC_LINK} +{$ENDIF} +{$IFDEF DYNAMIC_LINK_EXPLICIT_ALL} + {$DEFINE DIRECTSOUND_DYNAMIC_LINK_EXPLICIT} +{$ENDIF} + +// Remove "dots" below to force some kind of dynamic linking +{.$DEFINE DIRECTSOUND_DYNAMIC_LINK} +{.$DEFINE DIRECTSOUND_DYNAMIC_LINK_EXPLICIT} + +//////////////////////////////////////////////////////////////////////// +// Assume for what DirectSound version we will compile headers +{$IFDEF DIRECTX7} + {$DEFINE DIRECTSOUND_VERSION_7} +{$ENDIF} +{$IFDEF DIRECTX8} + {$DEFINE DIRECTSOUND_VERSION_8} +{$ENDIF} +{$IFDEF DIRECTX9} + {$DEFINE DIRECTSOUND_VERSION_9} +{$ENDIF} + +{$IFNDEF DIRECTSOUND_VERSION_9} + {$IFNDEF DIRECTSOUND_VERSION_8} + {$IFNDEF DIRECTSOUND_VERSION_7} +// Compiling for DirectSound9 by default + {$DEFINE DIRECTSOUND_VERSION_9} + {$ENDIF} + {$ENDIF} +{$ENDIF} + +//////////////////////////////////////////////////////////////////////// +// Emit conditionals to C++Builder compiler +{$IFDEF DIRECTSOUND_VERSION_7} +{$ENDIF} +{$IFDEF DIRECTSOUND_VERSION_8} +{$ENDIF} +{$IFDEF DIRECTSOUND_VERSION_9} +{$ENDIF} + + + +//////////////////////////////////////////////////////////////////////// +// Define symbols for '<=' comparision +{$IFDEF DIRECTSOUND_VERSION_9} + {$DEFINE DIRECTSOUND_VERSION_8} +{$ENDIF} +{$IFDEF DIRECTSOUND_VERSION_8} + {$DEFINE DIRECTSOUND_VERSION_7} +{$ENDIF} + + +{ Type definitions shared with Direct3D } + +type + D3DVALUE = DXTypes.D3DVALUE; + TD3DValue = DXTypes.TD3DValue; + PD3DValue = DXTypes.PD3DValue; + + D3DCOLOR = DXTypes.D3DCOLOR; + TD3DColor = DXTypes.TD3DColor; + + _D3DVECTOR = DXTypes._D3DVECTOR; + D3DVECTOR = DXTypes.D3DVECTOR; + TD3DVector = DXTypes.TD3DVector; + PD3DVector = DXTypes.PD3DVector; + +const + _FACDS = $878; { DirectSound's facility code } + +// #define MAKE_DSHRESULT(code) MAKE_HRESULT(1, _FACDS, code) +function MAKE_DSHRESULT(Code: DWord): DWord; + +const + MAKE_DSHRESULT_R = (1 shl 31) or (_FACDS shl 16); + +const + // DirectSound Component GUID {47D4D946-62E8-11CF-93BC-444553540000} + CLSID_DirectSound: TGUID = '{47d4d946-62e8-11cf-93bc-444553540000}'; + + // DirectSound 8.0 Component GUID {3901CC3F-84B5-4FA4-BA35-AA8172B8A09B} + CLSID_DirectSound8: TGUID = '{3901cc3f-84b5-4fa4-ba35-aa8172b8a09b}'; + + // DirectSound Capture Component GUID {B0210780-89CD-11D0-AF08-00A0C925CD16} + CLSID_DirectSoundCapture: TGUID = '{b0210780-89cd-11d0-af08-00a0c925cd16}'; + + // DirectSound 8.0 Capture Component GUID {E4BCAC13-7F99-4908-9A8E-74E3BF24B6E1} + CLSID_DirectSoundCapture8: TGUID = '{e4bcac13-7f99-4908-9a8e-74e3bf24b6e1}'; + + // DirectSound Full Duplex Component GUID {FEA4300C-7959-4147-B26A-2377B9E7A91D} + CLSID_DirectSoundFullDuplex: TGUID = '{fea4300c-7959-4147-b26a-2377b9e7a91d}'; + + + // DirectSound default playback device GUID {DEF00000-9C6D-47ED-AAF1-4DDA8F2B5C03} + DSDEVID_DefaultPlayback: TGUID = '{def00000-9c6d-47ed-aaf1-4dda8f2b5c03}'; + + // DirectSound default capture device GUID {DEF00001-9C6D-47ED-AAF1-4DDA8F2B5C03} + DSDEVID_DefaultCapture: TGUID = '{def00001-9c6d-47ed-aaf1-4dda8f2b5c03}'; + + // DirectSound default device for voice playback {DEF00002-9C6D-47ED-AAF1-4DDA8F2B5C03} + DSDEVID_DefaultVoicePlayback: TGUID = '{def00002-9c6d-47ed-aaf1-4dda8f2b5c03}'; + + // DirectSound default device for voice capture {DEF00003-9C6D-47ED-AAF1-4DDA8F2B5C03} + DSDEVID_DefaultVoiceCapture: TGUID = '{def00003-9c6d-47ed-aaf1-4dda8f2b5c03}'; + + +// +// Structures +// + +type + PDSCaps = ^TDSCaps; + _DSCAPS = packed record + dwSize : DWORD; + dwFlags : DWORD; + dwMinSecondarySampleRate : DWORD; + dwMaxSecondarySampleRate : DWORD; + dwPrimaryBuffers : DWORD; + dwMaxHwMixingAllBuffers : DWORD; + dwMaxHwMixingStaticBuffers : DWORD; + dwMaxHwMixingStreamingBuffers : DWORD; + dwFreeHwMixingAllBuffers : DWORD; + dwFreeHwMixingStaticBuffers : DWORD; + dwFreeHwMixingStreamingBuffers : DWORD; + dwMaxHw3DAllBuffers : DWORD; + dwMaxHw3DStaticBuffers : DWORD; + dwMaxHw3DStreamingBuffers : DWORD; + dwFreeHw3DAllBuffers : DWORD; + dwFreeHw3DStaticBuffers : DWORD; + dwFreeHw3DStreamingBuffers : DWORD; + dwTotalHwMemBytes : DWORD; + dwFreeHwMemBytes : DWORD; + dwMaxContigFreeHwMemBytes : DWORD; + dwUnlockTransferRateHwBuffers : DWORD; + dwPlayCpuOverheadSwBuffers : DWORD; + dwReserved1 : DWORD; + dwReserved2 : DWORD; + end; + DSCAPS = _DSCAPS; + TDSCaps = _DSCAPS; + + PDSBcaps = ^TDSBcaps; + _DSBCAPS = packed record + dwSize : DWORD; + dwFlags : DWORD; + dwBufferBytes : DWORD; + dwUnlockTransferRate : DWORD; + dwPlayCpuOverhead : DWORD; + end; + DSBCAPS = _DSBCAPS; + TDSBcaps = _DSBCAPS; + +{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800 + PDSEffectDesc = ^TDSEffectDesc; + _DSEFFECTDESC = packed record + dwSize : DWORD; + dwFlags : DWORD; + guidDSFXClass : TGUID; + dwReserved1 : DWORD_PTR; + dwReserved2 : DWORD_PTR; + end; + DSEFFECTDESC = _DSEFFECTDESC; + TDSEffectDesc = _DSEFFECTDESC; + +const + DSFX_LOCHARDWARE = $00000001; + DSFX_LOCSOFTWARE = $00000002; + + DSFXR_PRESENT = 0; + DSFXR_LOCHARDWARE = 1; + DSFXR_LOCSOFTWARE = 2; + DSFXR_UNALLOCATED = 3; + DSFXR_FAILED = 4; + DSFXR_UNKNOWN = 5; + DSFXR_SENDLOOP = 6; + +type + PDSCEffectDesc = ^TDSCEffectDesc; + _DSCEFFECTDESC = packed record + dwSize: DWORD; + dwFlags: DWORD; + guidDSCFXClass: TGUID; + guidDSCFXInstance: TGUID; + dwReserved1: DWORD; + dwReserved2: DWORD; + end; + DSCEFFECTDESC = _DSCEFFECTDESC; + TDSCEffectDesc = _DSCEFFECTDESC; + +const + DSCFX_LOCHARDWARE = $00000001; + DSCFX_LOCSOFTWARE = $00000002; + + DSCFXR_LOCHARDWARE = $00000010; + DSCFXR_LOCSOFTWARE = $00000020; + +{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800 + +type + PDSBufferDesc = ^TDSBufferDesc; + _DSBUFFERDESC = packed record + dwSize: DWORD; + dwFlags: DWORD; + dwBufferBytes: DWORD; + dwReserved: DWORD; + lpwfxFormat: PWaveFormatEx; +{$IFDEF DIRECTSOUND_VERSION_7} // #if DIRECTSOUND_VERSION >= 0x0700 + guid3DAlgorithm: TGUID; +{$ENDIF} // DIRECTSOUND_VERSION >= 0x0700 + end; + DSBUFFERDESC = _DSBUFFERDESC; + TDSBufferDesc = _DSBUFFERDESC; + +// Older version of this structure: + + PDSBufferDesc1 = ^TDSBufferDesc1; + _DSBUFFERDESC1 = packed record + dwSize: DWORD; + dwFlags: DWORD; + dwBufferBytes: DWORD; + dwReserved: DWORD; + lpwfxFormat: PWaveFormatEx; + end; + DSBUFFERDESC1 = _DSBUFFERDESC1; + TDSBufferDesc1 = _DSBUFFERDESC1; + + PDS3DBuffer = ^TDS3DBuffer; + _DS3DBUFFER = packed record + dwSize: DWORD; + vPosition: TD3DVector; + vVelocity: TD3DVector; + dwInsideConeAngle: DWORD; + dwOutsideConeAngle: DWORD; + vConeOrientation: TD3DVector; + lConeOutsideVolume: Longint; + flMinDistance: TD3DValue; + flMaxDistance: TD3DValue; + dwMode: DWORD; + end; + DS3DBUFFER = _DS3DBUFFER; + TDS3DBuffer = _DS3DBUFFER; + + PDS3DListener = ^TDS3DListener; + _DS3DLISTENER = packed record + dwSize: DWORD; + vPosition: TD3DVector; + vVelocity: TD3DVector; + vOrientFront: TD3DVector; + vOrientTop: TD3DVector; + flDistanceFactor: TD3DValue; + flRolloffFactor: TD3DValue; + flDopplerFactor: TD3DValue; + end; + DS3DLISTENER = _DS3DLISTENER; + TDS3DListener = _DS3DLISTENER; + + PDSCcaps = ^TDSCcaps; + _DSCCAPS = packed record + dwSize: DWORD; + dwFlags: DWORD; + dwFormats: DWORD; + dwChannels: DWORD; + end; + DSCCAPS = _DSCCAPS; + TDSCcaps = _DSCCAPS; + + PDSCBufferDesc1 = ^TDSCBufferDesc1; + _DSCBUFFERDESC1 = packed record + dwSize: DWORD; + dwFlags: DWORD; + dwBufferBytes: DWORD; + dwReserved: DWORD; + lpwfxFormat: PWaveFormatEx; + end; + DSCBUFFERDESC1 = _DSCBUFFERDESC1; + TDSCBufferDesc1 = _DSCBUFFERDESC1; + + PDSCBufferDesc = ^TDSCBufferDesc; + _DSCBUFFERDESC = packed record + dwSize: DWORD; + dwFlags: DWORD; + dwBufferBytes: DWORD; + dwReserved: DWORD; + lpwfxFormat: PWaveFormatEx; +{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800 + dwFXCount: DWORD; + lpDSCFXDesc: PDSCEffectDesc; +{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800 + end; + DSCBUFFERDESC = _DSCBUFFERDESC; + TDSCBufferDesc = _DSCBUFFERDESC; + + PDSCBCaps = ^TDSCBCaps; + _DSCBCAPS = packed record + dwSize: DWORD; + dwFlags: DWORD; + dwBufferBytes: DWORD; + dwReserved: DWORD; + end; + DSCBCAPS = _DSCBCAPS; + TDSCBCaps = _DSCBCAPS; + + PDSBPositionNotify = ^TDSBPositionNotify; + _DSBPOSITIONNOTIFY = packed record + dwOffset: DWORD; + hEventNotify: THandle; + end; + DSBPOSITIONNOTIFY = _DSBPOSITIONNOTIFY; + TDSBPositionNotify = _DSBPOSITIONNOTIFY; + + +type + REFERENCE_TIME = DXTypes.REFERENCE_TIME; + TReferenceTime = DXTypes.TReferenceTime; + PReferenceTime = DXTypes.PReferenceTime; + +type + IReferenceClock = interface(IUnknown) + ['{56a86897-0ad4-11ce-b03a-0020af0ba770}'] + // IReferenceClock methods + function GetTime(out pTime: TReferenceTime): HResult; stdcall; + function AdviseTime(rtBaseTime, rtStreamTime: TReferenceTime; hEvent: THandle; out pdwAdviseCookie: DWORD): HResult; stdcall; + function AdvisePeriodic(const rtStartTime, rtPeriodTime: TReferenceTime; hSemaphore: THandle; out pdwAdviseCookie: DWORD): HResult; stdcall; + function Unadvise(dwAdviseCookie: DWORD): HResult; stdcall; + end; + + IID_IReferenceClock = IReferenceClock; + + + IDirectSoundBuffer = interface; + + // + // IDirectSound + // + + IDirectSound = interface(IUnknown) + ['{279AFA83-4981-11CE-A521-0020AF0BE560}'] + // IDirectSound methods + function CreateSoundBuffer(const pcDSBufferDesc: TDSBufferDesc; out ppDSBuffer: IDirectSoundBuffer; pUnkOuter: IUnknown): HResult; stdcall; + function GetCaps(out pDSCaps: TDSCaps): HResult; stdcall; + function DuplicateSoundBuffer(pDSBufferOriginal: IDirectSoundBuffer; out ppDSBufferDuplicate: IDirectSoundBuffer): HResult; stdcall; + function SetCooperativeLevel(hwnd: HWND; dwLevel: DWORD): HResult; stdcall; + function Compact: HResult; stdcall; + function GetSpeakerConfig(out pdwSpeakerConfig: DWORD): HResult; stdcall; + function SetSpeakerConfig(dwSpeakerConfig: DWORD): HResult; stdcall; + function Initialize(pcGuidDevice: PGUID): HResult; stdcall; + end; + + IID_IDirectSound = IDirectSound; + + +{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800 + + // + // IDirectSound8 + // + + IDirectSound8 = interface(IDirectSound) + ['{C50A7E93-F395-4834-9EF6-7FA99DE50966}'] + // IDirectSound8 methods + function VerifyCertification(pdwCertified: PDWORD): HResult; stdcall; + end; + + IID_IDirectSound8 = IDirectSound8; + + +{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800 + + // + // IDirectSoundBuffer + // + + IDirectSoundBuffer = interface(IUnknown) + ['{279AFA85-4981-11CE-A521-0020AF0BE560}'] + // IDirectSoundBuffer methods + function GetCaps(var pDSBufferCaps: TDSBcaps): HResult; stdcall; + function GetCurrentPosition(pdwCurrentPlayCursor, pdwCurrentWriteCursor: PDWORD): HResult; stdcall; + function GetFormat(pwfxFormat: PWaveFormatEx; dwSizeAllocated: DWORD; pdwSizeWritten: PDWORD): HResult; stdcall; + function GetVolume(out plVolume: Longint): HResult; stdcall; + function GetPan(out plPan: Longint): HResult; stdcall; + function GetFrequency(out pdwFrequency: DWORD): HResult; stdcall; + function GetStatus(out pdwStatus: DWORD): HResult; stdcall; + function Initialize(pDirectSound: IDirectSound; const pcDSBufferDesc: TDSBufferDesc): HResult; stdcall; + function Lock(dwOffset, dwBytes: DWORD; ppvAudioPtr1: PPointer; pdwAudioBytes1: PDWORD; + ppvAudioPtr2: PPointer; pdwAudioBytes2: PDWORD; dwFlags: DWORD): HResult; stdcall; + function Play(dwReserved1, dwPriority, dwFlags: DWORD): HResult; stdcall; + function SetCurrentPosition(dwNewPosition: DWORD): HResult; stdcall; + function SetFormat(pcfxFormat: PWaveFormatEx): HResult; stdcall; + function SetVolume(lVolume: Longint): HResult; stdcall; + function SetPan(lPan: Longint): HResult; stdcall; + function SetFrequency(dwFrequency: DWORD): HResult; stdcall; + function Stop: HResult; stdcall; + function Unlock(pvAudioPtr1: Pointer; dwAudioBytes1: DWORD; pvAudioPtr2: Pointer; dwAudioBytes2: DWORD): HResult; stdcall; + function Restore: HResult; stdcall; + end; + + IID_IDirectSoundBuffer = IDirectSoundBuffer; + + +{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800 + + // + // IDirectSoundBuffer8 + // + + IDirectSoundBuffer8 = interface(IDirectSoundBuffer) + ['{6825a449-7524-4d82-920f-50e36ab3ab1e}'] + // IDirectSoundBuffer8 methods + function SetFX(dwEffectsCount: DWORD; pDSFXDesc: PDSEffectDesc; pdwResultCodes: PDWORD): HResult; stdcall; + function AcquireResources(dwFlags, dwEffectsCount: DWORD; pdwResultCodes: PDWORD): HResult; stdcall; + function GetObjectInPath(const rguidObject: TGUID; dwIndex: DWORD; const rguidInterface: TGUID; out ppObject{IUnknown}): HResult; stdcall; + end; + + IID_IDirectSoundBuffer8 = IDirectSoundBuffer8; + +const + // Special GUID meaning "select all objects" for use in GetObjectInPath() + GUID_All_Objects: TGUID = '{aa114de5-c262-4169-a1c8-23d698cc73b5}'; + + +type +{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800 + + // + // IDirectSound3DListener + // + + IDirectSound3DListener = interface(IUnknown) + ['{279AFA84-4981-11CE-A521-0020AF0BE560}'] + // IDirectSound3DListener methods + function GetAllParameters(var pListener: TDS3DListener): HResult; stdcall; + function GetDistanceFactor(out pflDistanceFactor: TD3DValue): HResult; stdcall; + function GetDopplerFactor(out pflDopplerFactor: TD3DValue): HResult; stdcall; + function GetOrientation(out pvOrientFront, pvOrientTop: TD3DVector): HResult; stdcall; + function GetPosition(out pvPosition: TD3DVector): HResult; stdcall; + function GetRolloffFactor(out pflRolloffFactor: TD3DValue): HResult; stdcall; + function GetVelocity(out pvVelocity: TD3DVector): HResult; stdcall; + function SetAllParameters(const pcListener: TDS3DListener; dwApply: DWORD): HResult; stdcall; + function SetDistanceFactor(flDistanceFactor: TD3DValue; dwApply: DWORD): HResult; stdcall; + function SetDopplerFactor(flDopplerFactor: TD3DValue; dwApply: DWORD): HResult; stdcall; + function SetOrientation(xFront, yFront, zFront: TD3DValue; xTop, yTop, zTop: TD3DValue; dwApply: DWORD): HResult; stdcall; + function SetPosition(x, y, z: TD3DValue; dwApply: DWORD): HResult; stdcall; + function SetRolloffFactor(flRolloffFactor: TD3DValue; dwApply: DWORD): HResult; stdcall; + function SetVelocity(x, y, z: TD3DValue; dwApply: DWORD): HResult; stdcall; + function CommitDeferredSettings: HResult; stdcall; + end; + + IID_IDirectSound3DListener = IDirectSound3DListener; + + + // + // IDirectSound3DBuffer + // + + IDirectSound3DBuffer = interface(IUnknown) + ['{279AFA86-4981-11CE-A521-0020AF0BE560}'] + // IDirectSound3DBuffer methods + function GetAllParameters(var pDs3dBuffer: TDS3DBuffer): HResult; stdcall; + function GetConeAngles(var pdwInsideConeAngle, pdwOutsideConeAngle: DWORD): HResult; stdcall; + function GetConeOrientation(out pvOrientation: TD3DVector): HResult; stdcall; + function GetConeOutsideVolume(out plConeOutsideVolume: Longint): HResult; stdcall; + function GetMaxDistance(out pflMaxDistance: TD3DValue): HResult; stdcall; + function GetMinDistance(out pflMinDistance: TD3DValue): HResult; stdcall; + function GetMode(out pdwMode: DWORD): HResult; stdcall; + function GetPosition(out pvPosition: TD3DVector): HResult; stdcall; + function GetVelocity(out pvVelocity: TD3DVector): HResult; stdcall; + function SetAllParameters(const pcDs3dBuffer: TDS3DBuffer; dwApply: DWORD): HResult; stdcall; + function SetConeAngles(dwInsideConeAngle, dwOutsideConeAngle: DWORD; dwApply: DWORD): HResult; stdcall; + function SetConeOrientation(x, y, z: TD3DValue; dwApply: DWORD): HResult; stdcall; + function SetConeOutsideVolume(lConeOutsideVolume: Longint; dwApply: DWORD): HResult; stdcall; + function SetMaxDistance(flMaxDistance: TD3DValue; dwApply: DWORD): HResult; stdcall; + function SetMinDistance(flMinDistance: TD3DValue; dwApply: DWORD): HResult; stdcall; + function SetMode(dwMode: DWORD; dwApply: DWORD): HResult; stdcall; + function SetPosition(x, y, z: TD3DValue; dwApply: DWORD): HResult; stdcall; + function SetVelocity(x, y, z: TD3DValue; dwApply: DWORD): HResult; stdcall; + end; + + IID_IDirectSound3DBuffer = IDirectSound3DBuffer; + + + IDirectSoundCaptureBuffer = interface; + + // + // IDirectSoundCapture + // + + IDirectSoundCapture = interface(IUnknown) + ['{b0210781-89cd-11d0-af08-00a0c925cd16}'] + // IDirectSoundCapture methods + function CreateCaptureBuffer(const pcDSCBufferDesc: TDSCBufferDesc; out ppDSCBuffer: IDirectSoundCaptureBuffer; pUnkOuter: IUnknown): HResult; stdcall; + function GetCaps(var pDSCCaps: TDSCcaps): HResult; stdcall; + function Initialize(pcGuidDevice: PGUID): HResult; stdcall; + end; + + IID_IDirectSoundCapture = IDirectSoundCapture; + + + // + // IDirectSoundCaptureBuffer + // + + IDirectSoundCaptureBuffer = interface(IUnknown) + ['{b0210782-89cd-11d0-af08-00a0c925cd16}'] + // IDirectSoundCaptureBuffer methods + function GetCaps(var pDSCBCaps: TDSCBCaps): HResult; stdcall; + function GetCurrentPosition(pdwCapturePosition, pdwReadPosition: PDWORD): HResult; stdcall; + function GetFormat(pwfxFormat: PWaveFormatEx; dwSizeAllocated: DWORD; pdwSizeWritten: PDWORD): HResult; stdcall; + function GetStatus(pdwStatus: PDWORD): HResult; stdcall; + function Initialize(pDirectSoundCapture: IDirectSoundCapture; const pcDSCBufferDesc: TDSCBufferDesc): HResult; stdcall; + function Lock(dwOffset, dwBytes: DWORD; ppvAudioPtr1: PPointer; pdwAudioBytes1: PDWORD; ppvAudioPtr2: PPointer; pdwAudioBytes2: PDWORD; dwFlags: DWORD): HResult; stdcall; + function Start(dwFlags: DWORD): HResult; stdcall; + function Stop: HResult; stdcall; + function Unlock(pvAudioPtr1: Pointer; dwAudioBytes1: DWORD; pvAudioPtr2: Pointer; dwAudioBytes2: DWORD): HResult; stdcall; + end; + + IID_IDirectSoundCaptureBuffer = IDirectSoundCaptureBuffer; + + +{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800 + + // + // IDirectSoundCaptureBuffer8 + // + + IDirectSoundCaptureBuffer8 = interface(IDirectSoundCaptureBuffer) + ['{00990df4-0dbb-4872-833e-6d303e80aeb6}'] + // IDirectSoundCaptureBuffer8 methods + function GetObjectInPath(const rguidObject: TGUID; dwIndex: DWORD; const rguidInterface: TGUID; out ppObject{IUnknown}): HResult; stdcall; + function GetFXStatus(dwFXCount: DWORD; pdwFXStatus: PDWORD): HResult; stdcall; + end; + + IID_IDirectSoundCaptureBuffer8 = IDirectSoundCaptureBuffer8; + +{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800 + + // + // IDirectSoundNotify + // + + IDirectSoundNotify = interface(IUnknown) + ['{b0210783-89cd-11d0-af08-00a0c925cd16}'] + // IDirectSoundNotify methods + function SetNotificationPositions(dwPositionNotifies: DWORD; pcPositionNotifies: PDSBPositionNotify): HResult; stdcall; + end; + + IID_IDirectSoundNotify = IDirectSoundNotify; + + + // + // IKsPropertySet + // + +const + KSPROPERTY_SUPPORT_GET = $00000001; + KSPROPERTY_SUPPORT_SET = $00000002; + +type + IKsPropertySet = interface(IUnknown) + ['{31efac30-515c-11d0-a9aa-00aa0061be93}'] + // IKsPropertySet methods + function Get(const rguidPropSet: TGUID; ulId: ULONG; pInstanceData: Pointer; ulInstanceLength: ULONG; pPropertyData: Pointer; ulDataLength: ULONG; out pulBytesReturned: ULONG): HResult; stdcall; + function _Set(const rguidPropSet: TGUID; ulId: ULONG; pInstanceData: Pointer; ulInstanceLength: ULONG; pPropertyData: Pointer; ulDataLength: ULONG): HResult; stdcall; + function QuerySupport(const rguidPropSet: TGUID; ulId: ULONG; out pulTypeSupport: ULONG): HResult; stdcall; + end; + + IID_IKsPropertySet = IKsPropertySet; + +{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800 + + // + // IDirectSoundFXGargle + // + + PDSFXGargle = ^TDSFXGargle; + _DSFXGargle = packed record + dwRateHz: DWORD; // Rate of modulation in hz + dwWaveShape: DWORD; // DSFXGARGLE_WAVE_xxx + end; + DSFXGargle = _DSFXGargle; + TDSFXGargle = _DSFXGargle; + +const + DSFXGARGLE_WAVE_TRIANGLE = 0; + DSFXGARGLE_WAVE_SQUARE = 1; + + DSFXGARGLE_RATEHZ_MIN = 1; + DSFXGARGLE_RATEHZ_MAX = 1000; + +type + IDirectSoundFXGargle = interface(IUnknown) + ['{d616f352-d622-11ce-aac5-0020af0b99a3}'] + // IDirectSoundFXGargle methods + function SetAllParameters(const pcDsFxGargle: TDSFXGargle): HResult; stdcall; + function GetAllParameters(out pDsFxGargle: TDSFXGargle): HResult; stdcall; + end; + + IID_IDirectSoundFXGargle = IDirectSoundFXGargle; + + + // + // IDirectSoundFXChorus + // + + PDSFXChorus = ^TDSFXChorus; + _DSFXChorus = packed record + fWetDryMix: Single; + fDepth: Single; + fFeedback: Single; + fFrequency: Single; + lWaveform: Longint; // LFO shape; DSFXCHORUS_WAVE_xxx + fDelay: Single; + lPhase: Longint; + end; + DSFXChorus = _DSFXChorus; + TDSFXChorus = _DSFXChorus; + +const + DSFXCHORUS_WAVE_TRIANGLE = 0; + DSFXCHORUS_WAVE_SIN = 1; + + DSFXCHORUS_WETDRYMIX_MIN = 0.0; + DSFXCHORUS_WETDRYMIX_MAX = 100.0; + DSFXCHORUS_DEPTH_MIN = 0.0; + DSFXCHORUS_DEPTH_MAX = 100.0; + DSFXCHORUS_FEEDBACK_MIN = -99.0; + DSFXCHORUS_FEEDBACK_MAX = 99.0; + DSFXCHORUS_FREQUENCY_MIN = 0.0; + DSFXCHORUS_FREQUENCY_MAX = 10.0; + DSFXCHORUS_DELAY_MIN = 0.0; + DSFXCHORUS_DELAY_MAX = 20.0; + DSFXCHORUS_PHASE_MIN = 0; + DSFXCHORUS_PHASE_MAX = 4; + + DSFXCHORUS_PHASE_NEG_180 = 0; + DSFXCHORUS_PHASE_NEG_90 = 1; + DSFXCHORUS_PHASE_ZERO = 2; + DSFXCHORUS_PHASE_90 = 3; + DSFXCHORUS_PHASE_180 = 4; + +type + IDirectSoundFXChorus = interface(IUnknown) + ['{880842e3-145f-43e6-a934-a71806e50547}'] + // IDirectSoundFXChorus methods + function SetAllParameters(const pcDsFxChorus: TDSFXChorus): HResult; stdcall; + function GetAllParameters(out pDsFxChorus: TDSFXChorus): HResult; stdcall; + end; + + IID_IDirectSoundFXChorus = IDirectSoundFXChorus; + + + // + // IDirectSoundFXFlanger + // + + PDSFXFlanger = ^TDSFXFlanger; + _DSFXFlanger = packed record + fWetDryMix: Single; + fDepth: Single; + fFeedback: Single; + fFrequency: Single; + lWaveform: Longint; + fDelay: Single; + lPhase: Longint; + end; + DSFXFlanger = _DSFXFlanger; + TDSFXFlanger = _DSFXFlanger; + +const + DSFXFLANGER_WAVE_TRIANGLE = 0; + DSFXFLANGER_WAVE_SIN = 1; + + DSFXFLANGER_WETDRYMIX_MIN = 0.0; + DSFXFLANGER_WETDRYMIX_MAX = 100.0; + DSFXFLANGER_FREQUENCY_MIN = 0.0; + DSFXFLANGER_FREQUENCY_MAX = 10.0; + DSFXFLANGER_DEPTH_MIN = 0.0; + DSFXFLANGER_DEPTH_MAX = 100.0; + DSFXFLANGER_PHASE_MIN = 0; + DSFXFLANGER_PHASE_MAX = 4; + DSFXFLANGER_FEEDBACK_MIN = -99.0; + DSFXFLANGER_FEEDBACK_MAX = 99.0; + DSFXFLANGER_DELAY_MIN = 0.0; + DSFXFLANGER_DELAY_MAX = 4.0; + + DSFXFLANGER_PHASE_NEG_180 = 0; + DSFXFLANGER_PHASE_NEG_90 = 1; + DSFXFLANGER_PHASE_ZERO = 2; + DSFXFLANGER_PHASE_90 = 3; + DSFXFLANGER_PHASE_180 = 4; + +type + IDirectSoundFXFlanger = interface(IUnknown) + ['{903e9878-2c92-4072-9b2c-ea68f5396783}'] + // IDirectSoundFXFlanger methods + function SetAllParameters(const pcDsFxFlanger: TDSFXFlanger): HResult; stdcall; + function GetAllParameters(out pDsFxFlanger: TDSFXFlanger): HResult; stdcall; + end; + + IID_IDirectSoundFXFlanger = IDirectSoundFXFlanger; + + + // + // IDirectSoundFXEcho + // + + PDSFXEcho = ^TDSFXEcho; + _DSFXEcho = packed record + fWetDryMix: Single; + fFeedback: Single; + fLeftDelay: Single; + fRightDelay: Single; + lPanDelay: Longint; + end; + DSFXEcho = _DSFXEcho; + TDSFXEcho = _DSFXEcho; + +const + DSFXECHO_WETDRYMIX_MIN = 0.0; + DSFXECHO_WETDRYMIX_MAX = 100.0; + DSFXECHO_FEEDBACK_MIN = 0.0; + DSFXECHO_FEEDBACK_MAX = 100.0; + DSFXECHO_LEFTDELAY_MIN = 1.0; + DSFXECHO_LEFTDELAY_MAX = 2000.0; + DSFXECHO_RIGHTDELAY_MIN = 1.0; + DSFXECHO_RIGHTDELAY_MAX = 2000.0; + DSFXECHO_PANDELAY_MIN = 0; + DSFXECHO_PANDELAY_MAX = 1; + +type + IDirectSoundFXEcho = interface(IUnknown) + ['{8bd28edf-50db-4e92-a2bd-445488d1ed42}'] + // IDirectSoundFXEcho methods + function SetAllParameters(const pcDsFxEcho: TDSFXEcho): HResult; stdcall; + function GetAllParameters(out pDsFxEcho: TDSFXEcho): HResult; stdcall; + end; + + IID_IDirectSoundFXEcho = IDirectSoundFXEcho; + + + // + // IDirectSoundFXDistortion + // + + PDSFXDistortion = ^TDSFXDistortion; + _DSFXDistortion = packed record + fGain: Single; + fEdge: Single; + fPostEQCenterFrequency: Single; + fPostEQBandwidth: Single; + fPreLowpassCutoff: Single; + end; + DSFXDistortion = _DSFXDistortion; + TDSFXDistortion = _DSFXDistortion; + +const + DSFXDISTORTION_GAIN_MIN = -60.0; + DSFXDISTORTION_GAIN_MAX = 0.0; + DSFXDISTORTION_EDGE_MIN = 0.0; + DSFXDISTORTION_EDGE_MAX = 100.0; + DSFXDISTORTION_POSTEQCENTERFREQUENCY_MIN = 100.0; + DSFXDISTORTION_POSTEQCENTERFREQUENCY_MAX = 8000.0; + DSFXDISTORTION_POSTEQBANDWIDTH_MIN = 100.0; + DSFXDISTORTION_POSTEQBANDWIDTH_MAX = 8000.0; + DSFXDISTORTION_PRELOWPASSCUTOFF_MIN = 100.0; + DSFXDISTORTION_PRELOWPASSCUTOFF_MAX = 8000.0; + +type + IDirectSoundFXDistortion = interface(IUnknown) + ['{8ecf4326-455f-4d8b-bda9-8d5d3e9e3e0b}'] + // IDirectSoundFXDistortion methods + function SetAllParameters(const pcDsFxDistortion: TDSFXDistortion): HResult; stdcall; + function GetAllParameters(out pDsFxDistortion: TDSFXDistortion): HResult; stdcall; + end; + + IID_IDirectSoundFXDistortion = IDirectSoundFXDistortion; + + + // + // IDirectSoundFXCompressor + // + + PDSFXCompressor = ^TDSFXCompressor; + _DSFXCompressor = packed record + fGain: Single; + fAttack: Single; + fRelease: Single; + fThreshold: Single; + fRatio: Single; + fPredelay: Single; + end; + DSFXCompressor = _DSFXCompressor; + TDSFXCompressor = _DSFXCompressor; + +const + DSFXCOMPRESSOR_GAIN_MIN = -60.0; + DSFXCOMPRESSOR_GAIN_MAX = 60.0; + DSFXCOMPRESSOR_ATTACK_MIN = 0.01; + DSFXCOMPRESSOR_ATTACK_MAX = 500.0; + DSFXCOMPRESSOR_RELEASE_MIN = 50.0; + DSFXCOMPRESSOR_RELEASE_MAX = 3000.0; + DSFXCOMPRESSOR_THRESHOLD_MIN = -60.0; + DSFXCOMPRESSOR_THRESHOLD_MAX = 0.0; + DSFXCOMPRESSOR_RATIO_MIN = 1.0; + DSFXCOMPRESSOR_RATIO_MAX = 100.0; + DSFXCOMPRESSOR_PREDELAY_MIN = 0.0; + DSFXCOMPRESSOR_PREDELAY_MAX = 4.0; + +type + IDirectSoundFXCompressor = interface(IUnknown) + ['{4bbd1154-62f6-4e2c-a15c-d3b6c417f7a0}'] + // IDirectSoundFXCompressor methods + function SetAllParameters(const pcDsFxCompressor: TDSFXCompressor): HResult; stdcall; + function GetAllParameters(out pDsFxCompressor: TDSFXCompressor): HResult; stdcall; + end; + + IID_IDirectSoundFXCompressor = IDirectSoundFXCompressor; + + + // + // IDirectSoundFXParamEq + // + + PDSFXParamEq = ^TDSFXParamEq; + _DSFXParamEq = packed record + fCenter: Single; + fBandwidth: Single; + fGain: Single; + end; + DSFXParamEq = _DSFXParamEq; + TDSFXParamEq = _DSFXParamEq; + +const + DSFXPARAMEQ_CENTER_MIN = 80.0; + DSFXPARAMEQ_CENTER_MAX = 16000.0; + DSFXPARAMEQ_BANDWIDTH_MIN = 1.0; + DSFXPARAMEQ_BANDWIDTH_MAX = 36.0; + DSFXPARAMEQ_GAIN_MIN = -15.0; + DSFXPARAMEQ_GAIN_MAX = 15.0; + +type + IDirectSoundFXParamEq = interface(IUnknown) + ['{c03ca9fe-fe90-4204-8078-82334cd177da}'] + // IDirectSoundFXParamEq methods + function SetAllParameters(const pcDsFxParamEq: TDSFXParamEq): HResult; stdcall; + function GetAllParameters(out pDsFxParamEq: TDSFXParamEq): HResult; stdcall; + end; + + IID_IDirectSoundFXParamEq = IDirectSoundFXParamEq; + + + // + // IDirectSoundFXI3DL2Reverb + // + + PDSFXI3DL2Reverb = ^TDSFXI3DL2Reverb; + _DSFXI3DL2Reverb = packed record + lRoom: Longint; // [-10000, 0] default: -1000 mB + lRoomHF: Longint; // [-10000, 0] default: 0 mB + flRoomRolloffFactor: Single; // [0.0, 10.0] default: 0.0 + flDecayTime: Single; // [0.1, 20.0] default: 1.49s + flDecayHFRatio: Single; // [0.1, 2.0] default: 0.83 + lReflections: Longint; // [-10000, 1000] default: -2602 mB + flReflectionsDelay: Single; // [0.0, 0.3] default: 0.007 s + lReverb: Longint; // [-10000, 2000] default: 200 mB + flReverbDelay: Single; // [0.0, 0.1] default: 0.011 s + flDiffusion: Single; // [0.0, 100.0] default: 100.0 % + flDensity: Single; // [0.0, 100.0] default: 100.0 % + flHFReference: Single; // [20.0, 20000.0] default: 5000.0 Hz + end; + DSFXI3DL2Reverb = _DSFXI3DL2Reverb; + TDSFXI3DL2Reverb = _DSFXI3DL2Reverb; + +const + DSFX_I3DL2REVERB_ROOM_MIN = (-10000); + DSFX_I3DL2REVERB_ROOM_MAX = 0; + DSFX_I3DL2REVERB_ROOM_DEFAULT = (-1000); + + DSFX_I3DL2REVERB_ROOMHF_MIN = (-10000); + DSFX_I3DL2REVERB_ROOMHF_MAX = 0; + DSFX_I3DL2REVERB_ROOMHF_DEFAULT = (-100); + + DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MIN = 0.0; + DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MAX = 10.0; + DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_DEFAULT = 0.0; + + DSFX_I3DL2REVERB_DECAYTIME_MIN = 0.1; + DSFX_I3DL2REVERB_DECAYTIME_MAX = 20.0; + DSFX_I3DL2REVERB_DECAYTIME_DEFAULT = 1.49; + + DSFX_I3DL2REVERB_DECAYHFRATIO_MIN = 0.1; + DSFX_I3DL2REVERB_DECAYHFRATIO_MAX = 2.0; + DSFX_I3DL2REVERB_DECAYHFRATIO_DEFAULT = 0.83; + + DSFX_I3DL2REVERB_REFLECTIONS_MIN = (-10000); + DSFX_I3DL2REVERB_REFLECTIONS_MAX = 1000; + DSFX_I3DL2REVERB_REFLECTIONS_DEFAULT = (-2602); + + DSFX_I3DL2REVERB_REFLECTIONSDELAY_MIN = 0.0; + DSFX_I3DL2REVERB_REFLECTIONSDELAY_MAX = 0.3; + DSFX_I3DL2REVERB_REFLECTIONSDELAY_DEFAULT = 0.007; + + DSFX_I3DL2REVERB_REVERB_MIN = (-10000); + DSFX_I3DL2REVERB_REVERB_MAX = 2000; + DSFX_I3DL2REVERB_REVERB_DEFAULT = (200); + + DSFX_I3DL2REVERB_REVERBDELAY_MIN = 0.0; + DSFX_I3DL2REVERB_REVERBDELAY_MAX = 0.1; + DSFX_I3DL2REVERB_REVERBDELAY_DEFAULT = 0.011; + + DSFX_I3DL2REVERB_DIFFUSION_MIN = 0.0; + DSFX_I3DL2REVERB_DIFFUSION_MAX = 100.0; + DSFX_I3DL2REVERB_DIFFUSION_DEFAULT = 100.0; + + DSFX_I3DL2REVERB_DENSITY_MIN = 0.0; + DSFX_I3DL2REVERB_DENSITY_MAX = 100.0; + DSFX_I3DL2REVERB_DENSITY_DEFAULT = 100.0; + + DSFX_I3DL2REVERB_HFREFERENCE_MIN = 20.0; + DSFX_I3DL2REVERB_HFREFERENCE_MAX = 20000.0; + DSFX_I3DL2REVERB_HFREFERENCE_DEFAULT = 5000.0; + + DSFX_I3DL2REVERB_QUALITY_MIN = 0; + DSFX_I3DL2REVERB_QUALITY_MAX = 3; + DSFX_I3DL2REVERB_QUALITY_DEFAULT = 2; + +type + IDirectSoundFXI3DL2Reverb = interface(IUnknown) + ['{4b166a6a-0d66-43f3-80e3-ee6280dee1a4}'] + // IDirectSoundFXI3DL2Reverb methods + function SetAllParameters(const pcDsFxI3DL2Reverb: TDSFXI3DL2Reverb): HResult; stdcall; + function GetAllParameters(out pDsFxI3DL2Reverb: TDSFXI3DL2Reverb): HResult; stdcall; + function SetPreset(dwPreset: DWORD): HResult; stdcall; + function GetPreset(out pdwPreset: DWORD): HResult; stdcall; + function SetQuality(lQuality: Longint): HResult; stdcall; + function GetQuality(out plQuality: Longint): HResult; stdcall; + end; + + IID_IDirectSoundFXI3DL2Reverb = IDirectSoundFXI3DL2Reverb; + + + // + // IDirectSoundFXWavesReverb + // + + PDSFXWavesReverb = ^TDSFXWavesReverb; + _DSFXWavesReverb = packed record + fInGain: Single; // [-96.0,0.0] default: 0.0 dB + fReverbMix: Single; // [-96.0,0.0] default: 0.0 db + fReverbTime: Single; // [0.001,3000.0] default: 1000.0 ms + fHighFreqRTRatio: Single; // [0.001,0.999] default: 0.001 + end; + DSFXWavesReverb = _DSFXWavesReverb; + TDSFXWavesReverb = _DSFXWavesReverb; + +const + DSFX_WAVESREVERB_INGAIN_MIN = -96.0; + DSFX_WAVESREVERB_INGAIN_MAX = 0.0; + DSFX_WAVESREVERB_INGAIN_DEFAULT = 0.0; + DSFX_WAVESREVERB_REVERBMIX_MIN = -96.0; + DSFX_WAVESREVERB_REVERBMIX_MAX = 0.0; + DSFX_WAVESREVERB_REVERBMIX_DEFAULT = 0.0; + DSFX_WAVESREVERB_REVERBTIME_MIN = 0.001; + DSFX_WAVESREVERB_REVERBTIME_MAX = 3000.0; + DSFX_WAVESREVERB_REVERBTIME_DEFAULT = 1000.0; + DSFX_WAVESREVERB_HIGHFREQRTRATIO_MIN = 0.001; + DSFX_WAVESREVERB_HIGHFREQRTRATIO_MAX = 0.999; + DSFX_WAVESREVERB_HIGHFREQRTRATIO_DEFAULT = 0.001; + +type + IDirectSoundFXWavesReverb = interface(IUnknown) + ['{46858c3a-0dc6-45e3-b760-d4eef16cb325}'] + // IDirectSoundFXWavesReverb methods + function SetAllParameters(const pcDsFxWavesReverb: TDSFXWavesReverb): HResult; stdcall; + function GetAllParameters(out pDsFxWavesReverb: TDSFXWavesReverb): HResult; stdcall; + end; + + IID_IDirectSoundFXWavesReverb = IDirectSoundFXWavesReverb; + + + // + // IDirectSoundCaptureFXAec + // + + PDSCFXAec = ^TDSCFXAec; + _DSCFXAec = packed record + fEnable: BOOL; + fNoiseFill: BOOL; + dwMode: DWORD; + end; + DSCFXAec = _DSCFXAec; + TDSCFXAec = _DSCFXAec; + +const + // These match the AEC_MODE_* constants in the DDK's ksmedia.h file + DSCFX_AEC_MODE_PASS_THROUGH = $0; + DSCFX_AEC_MODE_HALF_DUPLEX = $1; + DSCFX_AEC_MODE_FULL_DUPLEX = $2; + + // These match the AEC_STATUS_* constants in ksmedia.h + DSCFX_AEC_STATUS_HISTORY_UNINITIALIZED = $0; + DSCFX_AEC_STATUS_HISTORY_CONTINUOUSLY_CONVERGED = $1; + DSCFX_AEC_STATUS_HISTORY_PREVIOUSLY_DIVERGED = $2; + DSCFX_AEC_STATUS_CURRENTLY_CONVERGED = $8; + +type + IDirectSoundCaptureFXAec = interface(IUnknown) + ['{ad74143d-903d-4ab7-8066-28d363036d65}'] + // IDirectSoundCaptureFXAec methods + function SetAllParameters(const pDscFxAec: TDSCFXAec): HResult; stdcall; + function GetAllParameters(out pDscFxAec: TDSCFXAec): HResult; stdcall; + function GetStatus(out pdwStatus: DWORD): HResult; stdcall; + function Reset: HResult; stdcall; + end; + + IID_IDirectSoundCaptureFXAec = IDirectSoundCaptureFXAec; + + + // + // IDirectSoundCaptureFXNoiseSuppress + // + + PDSCFXNoiseSuppress = ^TDSCFXNoiseSuppress; + _DSCFXNoiseSuppress = packed record + fEnable: BOOL; + end; + DSCFXNoiseSuppress = _DSCFXNoiseSuppress; + TDSCFXNoiseSuppress = _DSCFXNoiseSuppress; + + IDirectSoundCaptureFXNoiseSuppress = interface(IUnknown) + ['{ed311e41-fbae-4175-9625-cd0854f693ca}'] + // IDirectSoundCaptureFXNoiseSuppress methods + function SetAllParameters(const pcDscFxNoiseSuppress: TDSCFXNoiseSuppress): HResult; stdcall; + function GetAllParameters(out pDscFxNoiseSuppress: TDSCFXNoiseSuppress): HResult; stdcall; + function Reset: HResult; stdcall; + end; + + IID_IDirectSoundCaptureFXNoiseSuppress = IDirectSoundCaptureFXNoiseSuppress; + + + // + // IDirectSoundFullDuplex + // + + IDirectSoundFullDuplex = interface(IUnknown) + ['{edcb4c7a-daab-4216-a42e-6c50596ddc1d}'] + // IDirectSoundFullDuplex methods + function Initialize(pCaptureGuid, pRenderGuid: PGUID; + const lpDscBufferDesc: TDSCBufferDesc; const lpDsBufferDesc: TDSBufferDesc; + hWnd: HWND; dwLevel: DWORD; + out lplpDirectSoundCaptureBuffer8: IDirectSoundCaptureBuffer8; + out lplpDirectSoundBuffer8: IDirectSoundBuffer8): HResult; stdcall; + end; + + IID_IDirectSoundFullDuplex = IDirectSoundFullDuplex; + + +{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800 + +// +// DirectSound 8.0 interfaces. +// + +{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800 +// IDirectSound8, IDirectSoundBuffer8 and IDirectSoundCaptureBuffer8 are the +// only DirectSound 7.0 interfaces with changed functionality in version 8.0. +// The other level 8 interfaces as equivalent to their level 7 counterparts: +type + IDirectSoundCapture8 = IDirectSoundCapture; + IDirectSound3DListener8 = IDirectSound3DListener; + IDirectSound3DBuffer8 = IDirectSound3DBuffer; + IDirectSoundNotify8 = IDirectSoundNotify; + IDirectSoundFXGargle8 = IDirectSoundFXGargle; + IDirectSoundFXChorus8 = IDirectSoundFXChorus; + IDirectSoundFXFlanger8 = IDirectSoundFXFlanger; + IDirectSoundFXEcho8 = IDirectSoundFXEcho; + IDirectSoundFXDistortion8 = IDirectSoundFXDistortion; + IDirectSoundFXCompressor8 = IDirectSoundFXCompressor; + IDirectSoundFXParamEq8 = IDirectSoundFXParamEq; + IDirectSoundFXWavesReverb8 = IDirectSoundFXWavesReverb; + IDirectSoundFXI3DL2Reverb8 = IDirectSoundFXI3DL2Reverb; + IDirectSoundCaptureFXAec8 = IDirectSoundCaptureFXAec; + IDirectSoundCaptureFXNoiseSuppress8 = IDirectSoundCaptureFXNoiseSuppress; + IDirectSoundFullDuplex8 = IDirectSoundFullDuplex; + + // + // IID definitions for the unchanged DirectSound 8.0 interfaces + // + + IID_IDirectSoundCapture8 = IID_IDirectSoundCapture; + IID_IDirectSound3DListener8 = IID_IDirectSound3DListener; + IID_IDirectSound3DBuffer8 = IID_IDirectSound3DBuffer; + IID_IDirectSoundNotify8 = IID_IDirectSoundNotify; + IID_IDirectSoundFXGargle8 = IID_IDirectSoundFXGargle; + IID_IDirectSoundFXChorus8 = IID_IDirectSoundFXChorus; + IID_IDirectSoundFXFlanger8 = IID_IDirectSoundFXFlanger; + IID_IDirectSoundFXEcho8 = IID_IDirectSoundFXEcho; + IID_IDirectSoundFXDistortion8 = IID_IDirectSoundFXDistortion; + IID_IDirectSoundFXCompressor8 = IID_IDirectSoundFXCompressor; + IID_IDirectSoundFXParamEq8 = IID_IDirectSoundFXParamEq; + IID_IDirectSoundFXWavesReverb8 = IID_IDirectSoundFXWavesReverb; + IID_IDirectSoundFXI3DL2Reverb8 = IID_IDirectSoundFXI3DL2Reverb; + IID_IDirectSoundCaptureFXAec8 = IID_IDirectSoundCaptureFXAec; + IID_IDirectSoundCaptureFXNoiseSuppress8 = IID_IDirectSoundCaptureFXNoiseSuppress; + IID_IDirectSoundFullDuplex8 = IID_IDirectSoundFullDuplex; +{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800 + +const + // + // Return Codes + // + + // The function completed successfully + DS_OK = S_OK; + + // The call succeeded, but we had to substitute the 3D algorithm + DS_NO_VIRTUALIZATION = (0 shl 31) or (_FACDS shl 16) or 10; // MAKE_HRESULT(0, _FACDS, 10) + + // The call failed because resources (such as a priority level) + // were already being used by another caller + DSERR_ALLOCATED = MAKE_DSHRESULT_R or 10; // MAKE_DSHRESULT(10) + + // The control (vol, pan, etc.) requested by the caller is not available + DSERR_CONTROLUNAVAIL = MAKE_DSHRESULT_R or 30; // MAKE_DSHRESULT(30) + + // An invalid parameter was passed to the returning function + DSERR_INVALIDPARAM = E_INVALIDARG; + + // This call is not valid for the current state of this object + DSERR_INVALIDCALL = MAKE_DSHRESULT_R or 50; // MAKE_DSHRESULT(50) + + // An undetermined error occurred inside the DirectSound subsystem + DSERR_GENERIC = E_FAIL; + + // The caller does not have the priority level required for the function to + // succeed + DSERR_PRIOLEVELNEEDED = MAKE_DSHRESULT_R or 70; // MAKE_DSHRESULT(70) + + // Not enough free memory is available to complete the operation + DSERR_OUTOFMEMORY = E_OUTOFMEMORY; + + // The specified WAVE format is not supported + DSERR_BADFORMAT = MAKE_DSHRESULT_R or 100; // MAKE_DSHRESULT(100) + + // The function called is not supported at this time + DSERR_UNSUPPORTED = E_NOTIMPL; + + // No sound driver is available for use + DSERR_NODRIVER = MAKE_DSHRESULT_R or 120; // MAKE_DSHRESULT(120) + + // This object is already initialized + DSERR_ALREADYINITIALIZED = MAKE_DSHRESULT_R or 130; // MAKE_DSHRESULT(130) + + // This object does not support aggregation + DSERR_NOAGGREGATION = CLASS_E_NOAGGREGATION; + + // The buffer memory has been lost, and must be restored + DSERR_BUFFERLOST = MAKE_DSHRESULT_R or 150; // MAKE_DSHRESULT(150) + + // Another app has a higher priority level, preventing this call from + // succeeding + DSERR_OTHERAPPHASPRIO = MAKE_DSHRESULT_R or 160; // MAKE_DSHRESULT(160) + + // This object has not been initialized + DSERR_UNINITIALIZED = MAKE_DSHRESULT_R or 170; // MAKE_DSHRESULT(170) + + // The requested COM interface is not available + DSERR_NOINTERFACE = E_NOINTERFACE; + + // Access is denied + DSERR_ACCESSDENIED = E_ACCESSDENIED; + + // Tried to create a DSBCAPS_CTRLFX buffer shorter than DSBSIZE_FX_MIN milliseconds + DSERR_BUFFERTOOSMALL = MAKE_DSHRESULT_R or 180; // MAKE_DSHRESULT(180) + + // Attempt to use DirectSound 8 functionality on an older DirectSound object + DSERR_DS8_REQUIRED = MAKE_DSHRESULT_R or 190; // MAKE_DSHRESULT(190) + + // A circular loop of send effects was detected + DSERR_SENDLOOP = MAKE_DSHRESULT_R or 200; // MAKE_DSHRESULT(200) + + // The GUID specified in an audiopath file does not match a valid MIXIN buffer + DSERR_BADSENDBUFFERGUID = MAKE_DSHRESULT_R or 210; // MAKE_DSHRESULT(210) + + // The object requested was not found (numerically equal to DMUS_E_NOT_FOUND) + DSERR_OBJECTNOTFOUND = MAKE_DSHRESULT_R or 4449; // MAKE_DSHRESULT(4449) + + // The effects requested could not be found on the system, or they were found + // but in the wrong order, or in the wrong hardware/software locations. + DSERR_FXUNAVAILABLE = MAKE_DSHRESULT_R or 220; // MAKE_DSHRESULT(220) + + // + // Flags + // + + DSCAPS_PRIMARYMONO = $00000001; + DSCAPS_PRIMARYSTEREO = $00000002; + DSCAPS_PRIMARY8BIT = $00000004; + DSCAPS_PRIMARY16BIT = $00000008; + DSCAPS_CONTINUOUSRATE = $00000010; + DSCAPS_EMULDRIVER = $00000020; + DSCAPS_CERTIFIED = $00000040; + DSCAPS_SECONDARYMONO = $00000100; + DSCAPS_SECONDARYSTEREO = $00000200; + DSCAPS_SECONDARY8BIT = $00000400; + DSCAPS_SECONDARY16BIT = $00000800; + + DSSCL_NORMAL = $00000001; + DSSCL_PRIORITY = $00000002; + DSSCL_EXCLUSIVE = $00000003; + DSSCL_WRITEPRIMARY = $00000004; + + DSSPEAKER_DIRECTOUT = $00000000; + DSSPEAKER_HEADPHONE = $00000001; + DSSPEAKER_MONO = $00000002; + DSSPEAKER_QUAD = $00000003; + DSSPEAKER_STEREO = $00000004; + DSSPEAKER_SURROUND = $00000005; + DSSPEAKER_5POINT1 = $00000006; + DSSPEAKER_7POINT1 = $00000007; + + DSSPEAKER_GEOMETRY_MIN = $00000005; // 5 degrees + DSSPEAKER_GEOMETRY_NARROW = $0000000A; // 10 degrees + DSSPEAKER_GEOMETRY_WIDE = $00000014; // 20 degrees + DSSPEAKER_GEOMETRY_MAX = $000000B4; // 180 degrees + +// #define DSSPEAKER_COMBINED(c, g) ((DWORD)(((BYTE)(c)) | ((DWORD)((BYTE)(g))) << 16)) +function DSSPEAKER_COMBINED(c, g: DWORD): DWORD; +// #define DSSPEAKER_CONFIG(a) ((BYTE)(a)) +function DSSPEAKER_CONFIG(a: Cardinal): Byte; +// #define DSSPEAKER_GEOMETRY(a) ((BYTE)(((DWORD)(a) >> 16) & 0x00FF)) +function DSSPEAKER_GEOMETRY(a: Cardinal): Byte; + +const + DSBCAPS_PRIMARYBUFFER = $00000001; + DSBCAPS_STATIC = $00000002; + DSBCAPS_LOCHARDWARE = $00000004; + DSBCAPS_LOCSOFTWARE = $00000008; + DSBCAPS_CTRL3D = $00000010; + DSBCAPS_CTRLFREQUENCY = $00000020; + DSBCAPS_CTRLPAN = $00000040; + DSBCAPS_CTRLVOLUME = $00000080; + DSBCAPS_CTRLPOSITIONNOTIFY = $00000100; + DSBCAPS_CTRLFX = $00000200; + DSBCAPS_STICKYFOCUS = $00004000; + DSBCAPS_GLOBALFOCUS = $00008000; + DSBCAPS_GETCURRENTPOSITION2 = $00010000; + DSBCAPS_MUTE3DATMAXDISTANCE = $00020000; + DSBCAPS_LOCDEFER = $00040000; + + DSBPLAY_LOOPING = $00000001; + DSBPLAY_LOCHARDWARE = $00000002; + DSBPLAY_LOCSOFTWARE = $00000004; + DSBPLAY_TERMINATEBY_TIME = $00000008; + DSBPLAY_TERMINATEBY_DISTANCE = $000000010; + DSBPLAY_TERMINATEBY_PRIORITY = $000000020; + + DSBSTATUS_PLAYING = $00000001; + DSBSTATUS_BUFFERLOST = $00000002; + DSBSTATUS_LOOPING = $00000004; + DSBSTATUS_LOCHARDWARE = $00000008; + DSBSTATUS_LOCSOFTWARE = $00000010; + DSBSTATUS_TERMINATED = $00000020; + + DSBLOCK_FROMWRITECURSOR = $00000001; + DSBLOCK_ENTIREBUFFER = $00000002; + + DSBFREQUENCY_ORIGINAL = 0; + DSBFREQUENCY_MIN = 100; +{$IFDEF DIRECTSOUND_VERSION_9} // #if DIRECTSOUND_VERSION >= 0x0900 + DSBFREQUENCY_MAX = 200000; +{$ELSE} + DSBFREQUENCY_MAX = 100000; +{$ENDIF} + + DSBPAN_LEFT = -10000; + DSBPAN_CENTER = 0; + DSBPAN_RIGHT = 10000; + + DSBVOLUME_MIN = -10000; + DSBVOLUME_MAX = 0; + + DSBSIZE_MIN = 4; + DSBSIZE_MAX = $0FFFFFFF; + DSBSIZE_FX_MIN = 150; // NOTE: Milliseconds, not bytes + + DS3DMODE_NORMAL = $00000000; + DS3DMODE_HEADRELATIVE = $00000001; + DS3DMODE_DISABLE = $00000002; + + DS3D_IMMEDIATE = $00000000; + DS3D_DEFERRED = $00000001; +var + // Forced to define as 'var' cos pascal compiler treats all consts as Double + DS3D_MINDISTANCEFACTOR: Single = 1.175494351e-38; // FLT_MIN; + DS3D_MAXDISTANCEFACTOR: Single = 3.402823466e+38; // FLT_MAX; +const + DS3D_DEFAULTDISTANCEFACTOR = 1.0; + + DS3D_MINROLLOFFFACTOR = 0.0; + DS3D_MAXROLLOFFFACTOR = 10.0; + DS3D_DEFAULTROLLOFFFACTOR = 1.0; + + DS3D_MINDOPPLERFACTOR = 0.0; + DS3D_MAXDOPPLERFACTOR = 10.0; + DS3D_DEFAULTDOPPLERFACTOR = 1.0; + + DS3D_DEFAULTMINDISTANCE = 1.0; + DS3D_DEFAULTMAXDISTANCE = 1000000000.0; + + DS3D_MINCONEANGLE = 0; + DS3D_MAXCONEANGLE = 360; + DS3D_DEFAULTCONEANGLE = 360; + + DS3D_DEFAULTCONEOUTSIDEVOLUME = DSBVOLUME_MAX; + + // IDirectSoundCapture attributes + + DSCCAPS_EMULDRIVER = DSCAPS_EMULDRIVER; + DSCCAPS_CERTIFIED = DSCAPS_CERTIFIED; + DSCCAPS_MULTIPLECAPTURE = $00000001; + + // IDirectSoundCaptureBuffer attributes + + DSCBCAPS_WAVEMAPPED = $80000000; + +{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800 + DSCBCAPS_CTRLFX = $00000200; +{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800 + + + DSCBLOCK_ENTIREBUFFER = $00000001; + + DSCBSTATUS_CAPTURING = $00000001; + DSCBSTATUS_LOOPING = $00000002; + + DSCBSTART_LOOPING = $00000001; + + DSBPN_OFFSETSTOP = $FFFFFFFF; + + DS_CERTIFIED = $00000000; + DS_UNCERTIFIED = $00000001; + + + // + // Flags for the I3DL2 effects + // + + // + // I3DL2 Material Presets + // + + DSFX_I3DL2_MATERIAL_PRESET_SINGLEWINDOW = 0; + DSFX_I3DL2_MATERIAL_PRESET_DOUBLEWINDOW = 1; + DSFX_I3DL2_MATERIAL_PRESET_THINDOOR = 2; + DSFX_I3DL2_MATERIAL_PRESET_THICKDOOR = 3; + DSFX_I3DL2_MATERIAL_PRESET_WOODWALL = 4; + DSFX_I3DL2_MATERIAL_PRESET_BRICKWALL = 5; + DSFX_I3DL2_MATERIAL_PRESET_STONEWALL = 6; + DSFX_I3DL2_MATERIAL_PRESET_CURTAIN = 7; + +//Translator: have not found where these defines are used +{ +#define I3DL2_MATERIAL_PRESET_SINGLEWINDOW -2800,0.71f +#define I3DL2_MATERIAL_PRESET_DOUBLEWINDOW -5000,0.40f +#define I3DL2_MATERIAL_PRESET_THINDOOR -1800,0.66f +#define I3DL2_MATERIAL_PRESET_THICKDOOR -4400,0.64f +#define I3DL2_MATERIAL_PRESET_WOODWALL -4000,0.50f +#define I3DL2_MATERIAL_PRESET_BRICKWALL -5000,0.60f +#define I3DL2_MATERIAL_PRESET_STONEWALL -6000,0.68f +#define I3DL2_MATERIAL_PRESET_CURTAIN -1200,0.15f +} + + DSFX_I3DL2_ENVIRONMENT_PRESET_DEFAULT = 0; + DSFX_I3DL2_ENVIRONMENT_PRESET_GENERIC = 1; + DSFX_I3DL2_ENVIRONMENT_PRESET_PADDEDCELL = 2; + DSFX_I3DL2_ENVIRONMENT_PRESET_ROOM = 3; + DSFX_I3DL2_ENVIRONMENT_PRESET_BATHROOM = 4; + DSFX_I3DL2_ENVIRONMENT_PRESET_LIVINGROOM = 5; + DSFX_I3DL2_ENVIRONMENT_PRESET_STONEROOM = 6; + DSFX_I3DL2_ENVIRONMENT_PRESET_AUDITORIUM = 7; + DSFX_I3DL2_ENVIRONMENT_PRESET_CONCERTHALL = 8; + DSFX_I3DL2_ENVIRONMENT_PRESET_CAVE = 9; + DSFX_I3DL2_ENVIRONMENT_PRESET_ARENA = 10; + DSFX_I3DL2_ENVIRONMENT_PRESET_HANGAR = 11; + DSFX_I3DL2_ENVIRONMENT_PRESET_CARPETEDHALLWAY = 12; + DSFX_I3DL2_ENVIRONMENT_PRESET_HALLWAY = 13; + DSFX_I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR = 14; + DSFX_I3DL2_ENVIRONMENT_PRESET_ALLEY = 15; + DSFX_I3DL2_ENVIRONMENT_PRESET_FOREST = 16; + DSFX_I3DL2_ENVIRONMENT_PRESET_CITY = 17; + DSFX_I3DL2_ENVIRONMENT_PRESET_MOUNTAINS = 18; + DSFX_I3DL2_ENVIRONMENT_PRESET_QUARRY = 19; + DSFX_I3DL2_ENVIRONMENT_PRESET_PLAIN = 20; + DSFX_I3DL2_ENVIRONMENT_PRESET_PARKINGLOT = 21; + DSFX_I3DL2_ENVIRONMENT_PRESET_SEWERPIPE = 22; + DSFX_I3DL2_ENVIRONMENT_PRESET_UNDERWATER = 23; + DSFX_I3DL2_ENVIRONMENT_PRESET_SMALLROOM = 24; + DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM = 25; + DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEROOM = 26; + DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL = 27; + DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEHALL = 28; + DSFX_I3DL2_ENVIRONMENT_PRESET_PLATE = 29; + + // + // I3DL2 Reverberation Presets Values + // + + I3DL2_ENVIRONMENT_PRESET_DEFAULT : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -100; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.83; lReflections: -2602; flReflectionsDelay: 0.007; lReverb: 200; flReverbDelay: 0.011; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_GENERIC : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -100; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.83; lReflections: -2602; flReflectionsDelay: 0.007; lReverb: 200; flReverbDelay: 0.011; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_PADDEDCELL : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -6000; flRoomRolloffFactor: 0.0; flDecayTime: 0.17; flDecayHFRatio: 0.10; lReflections: -1204; flReflectionsDelay: 0.001; lReverb: 207; flReverbDelay: 0.002; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_ROOM : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -454; flRoomRolloffFactor: 0.0; flDecayTime: 0.40; flDecayHFRatio: 0.83; lReflections: -1646; flReflectionsDelay: 0.002; lReverb: 53; flReverbDelay: 0.003; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_BATHROOM : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -1200; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.54; lReflections: -370; flReflectionsDelay: 0.007; lReverb: 1030; flReverbDelay: 0.011; flDiffusion: 100.0; flDensity: 60.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_LIVINGROOM : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -6000; flRoomRolloffFactor: 0.0; flDecayTime: 0.50; flDecayHFRatio: 0.10; lReflections: -1376; flReflectionsDelay: 0.003; lReverb: -1104; flReverbDelay: 0.004; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_STONEROOM : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -300; flRoomRolloffFactor: 0.0; flDecayTime: 2.31; flDecayHFRatio: 0.64; lReflections: -711; flReflectionsDelay: 0.012; lReverb: 83; flReverbDelay: 0.017; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_AUDITORIUM : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -476; flRoomRolloffFactor: 0.0; flDecayTime: 4.32; flDecayHFRatio: 0.59; lReflections: -789; flReflectionsDelay: 0.020; lReverb: -289; flReverbDelay: 0.030; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_CONCERTHALL : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -500; flRoomRolloffFactor: 0.0; flDecayTime: 3.92; flDecayHFRatio: 0.70; lReflections: -1230; flReflectionsDelay: 0.020; lReverb: -2; flReverbDelay: 0.029; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_CAVE : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: 0; flRoomRolloffFactor: 0.0; flDecayTime: 2.91; flDecayHFRatio: 1.30; lReflections: -602; flReflectionsDelay: 0.015; lReverb: -302; flReverbDelay: 0.022; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_ARENA : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -698; flRoomRolloffFactor: 0.0; flDecayTime: 7.24; flDecayHFRatio: 0.33; lReflections: -1166; flReflectionsDelay: 0.020; lReverb: 16; flReverbDelay: 0.030; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_HANGAR : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -1000; flRoomRolloffFactor: 0.0; flDecayTime:10.05; flDecayHFRatio: 0.23; lReflections: -602; flReflectionsDelay: 0.020; lReverb: 198; flReverbDelay: 0.030; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_CARPETEDHALLWAY : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -4000; flRoomRolloffFactor: 0.0; flDecayTime: 0.30; flDecayHFRatio: 0.10; lReflections: -1831; flReflectionsDelay: 0.002; lReverb: -1630; flReverbDelay: 0.030; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_HALLWAY : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -300; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.59; lReflections: -1219; flReflectionsDelay: 0.007; lReverb: 441; flReverbDelay: 0.011; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -237; flRoomRolloffFactor: 0.0; flDecayTime: 2.70; flDecayHFRatio: 0.79; lReflections: -1214; flReflectionsDelay: 0.013; lReverb: 395; flReverbDelay: 0.020; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_ALLEY : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -270; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.86; lReflections: -1204; flReflectionsDelay: 0.007; lReverb: -4; flReverbDelay: 0.011; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_FOREST : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -3300; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.54; lReflections: -2560; flReflectionsDelay: 0.162; lReverb: -613; flReverbDelay: 0.088; flDiffusion: 79.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_CITY : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -800; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.67; lReflections: -2273; flReflectionsDelay: 0.007; lReverb: -2217; flReverbDelay: 0.011; flDiffusion: 50.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_MOUNTAINS : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -2500; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.21; lReflections: -2780; flReflectionsDelay: 0.300; lReverb: -2014; flReverbDelay: 0.100; flDiffusion: 27.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_QUARRY : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -1000; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.83; lReflections:-10000; flReflectionsDelay: 0.061; lReverb: 500; flReverbDelay: 0.025; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_PLAIN : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -2000; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.50; lReflections: -2466; flReflectionsDelay: 0.179; lReverb: -2514; flReverbDelay: 0.100; flDiffusion: 21.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_PARKINGLOT : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: 0; flRoomRolloffFactor: 0.0; flDecayTime: 1.65; flDecayHFRatio: 1.50; lReflections: -1363; flReflectionsDelay: 0.008; lReverb: -1153; flReverbDelay: 0.012; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_SEWERPIPE : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -1000; flRoomRolloffFactor: 0.0; flDecayTime: 2.81; flDecayHFRatio: 0.14; lReflections: 429; flReflectionsDelay: 0.014; lReverb: 648; flReverbDelay: 0.021; flDiffusion: 80.0; flDensity: 60.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_UNDERWATER : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -4000; flRoomRolloffFactor: 0.0; flDecayTime: 1.49; flDecayHFRatio: 0.10; lReflections: -449; flReflectionsDelay: 0.007; lReverb: 1700; flReverbDelay: 0.011; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + + // + // Examples simulating 'musical' reverb presets + // + // Name Decay time Description + // Small Room 1.1s A small size room with a length of 5m or so. + // Medium Room 1.3s A medium size room with a length of 10m or so. + // Large Room 1.5s A large size room suitable for live performances. + // Medium Hall 1.8s A medium size concert hall. + // Large Hall 1.8s A large size concert hall suitable for a full orchestra. + // Plate 1.3s A plate reverb simulation. + // + + I3DL2_ENVIRONMENT_PRESET_SMALLROOM : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -600; flRoomRolloffFactor: 0.0; flDecayTime: 1.10; flDecayHFRatio: 0.83; lReflections: -400; flReflectionsDelay: 0.005; lReverb: 500; flReverbDelay: 0.010; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -600; flRoomRolloffFactor: 0.0; flDecayTime: 1.30; flDecayHFRatio: 0.83; lReflections: -1000; flReflectionsDelay: 0.010; lReverb: -200; flReverbDelay: 0.020; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_LARGEROOM : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -600; flRoomRolloffFactor: 0.0; flDecayTime: 1.50; flDecayHFRatio: 0.83; lReflections: -1600; flReflectionsDelay: 0.020; lReverb: -1000; flReverbDelay: 0.040; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -600; flRoomRolloffFactor: 0.0; flDecayTime: 1.80; flDecayHFRatio: 0.70; lReflections: -1300; flReflectionsDelay: 0.015; lReverb: -800; flReverbDelay: 0.030; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_LARGEHALL : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -600; flRoomRolloffFactor: 0.0; flDecayTime: 1.80; flDecayHFRatio: 0.70; lReflections: -2000; flReflectionsDelay: 0.030; lReverb: -1400; flReverbDelay: 0.060; flDiffusion: 100.0; flDensity: 100.0; flHFReference: 5000.0); + I3DL2_ENVIRONMENT_PRESET_PLATE : TDSFXI3DL2Reverb = (lRoom: -1000; lRoomHF: -200; flRoomRolloffFactor: 0.0; flDecayTime: 1.30; flDecayHFRatio: 0.90; lReflections: 0; flReflectionsDelay: 0.002; lReverb: 0; flReverbDelay: 0.010; flDiffusion: 100.0; flDensity: 75.0; flHFReference: 5000.0); + + // + // DirectSound3D Algorithms + // + + // Default DirectSound3D algorithm {00000000-0000-0000-0000-000000000000} + DS3DALG_DEFAULT : TGUID = '{00000000-0000-0000-0000-000000000000}'; // GUID_NULL; + + // No virtualization (Pan3D) {C241333F-1C1B-11d2-94F5-00C04FC28ACA} + DS3DALG_NO_VIRTUALIZATION: TGUID = '{c241333f-1c1b-11d2-94f5-00c04fc28aca}'; + + // High-quality HRTF algorithm {C2413340-1C1B-11d2-94F5-00C04FC28ACA} + DS3DALG_HRTF_FULL: TGUID = '{c2413340-1c1b-11d2-94f5-00c04fc28aca}'; + + // Lower-quality HRTF algorithm {C2413342-1C1B-11d2-94F5-00C04FC28ACA} + DS3DALG_HRTF_LIGHT: TGUID = '{c2413342-1c1b-11d2-94f5-00c04fc28aca}'; + + +{$IFDEF DIRECTSOUND_VERSION_8} // #if DIRECTSOUND_VERSION >= 0x0800 + + // + // DirectSound Internal Effect Algorithms + // + + + // Gargle {DAFD8210-5711-4B91-9FE3-F75B7AE279BF} + GUID_DSFX_STANDARD_GARGLE: TGUID = '{dafd8210-5711-4b91-9fe3-f75b7ae279bf}'; + + // Chorus {EFE6629C-81F7-4281-BD91-C9D604A95AF6} + GUID_DSFX_STANDARD_CHORUS: TGUID = '{efe6629c-81f7-4281-bd91-c9d604a95af6}'; + + // Flanger {EFCA3D92-DFD8-4672-A603-7420894BAD98} + GUID_DSFX_STANDARD_FLANGER: TGUID = '{efca3d92-dfd8-4672-a603-7420894bad98}'; + + // Echo/Delay {EF3E932C-D40B-4F51-8CCF-3F98F1B29D5D} + GUID_DSFX_STANDARD_ECHO: TGUID = '{ef3e932c-d40b-4f51-8ccf-3f98f1b29d5d}'; + + // Distortion {EF114C90-CD1D-484E-96E5-09CFAF912A21} + GUID_DSFX_STANDARD_DISTORTION: TGUID = '{ef114c90-cd1d-484e-96e5-09cfaf912a21}'; + + // Compressor/Limiter {EF011F79-4000-406D-87AF-BFFB3FC39D57} + GUID_DSFX_STANDARD_COMPRESSOR: TGUID = '{ef011f79-4000-406d-87af-bffb3fc39d57}'; + + // Parametric Equalization {120CED89-3BF4-4173-A132-3CB406CF3231} + GUID_DSFX_STANDARD_PARAMEQ: TGUID = '{120ced89-3bf4-4173-a132-3cb406cf3231}'; + + // I3DL2 Environmental Reverberation: Reverb (Listener) Effect {EF985E71-D5C7-42D4-BA4D-2D073E2E96F4} + GUID_DSFX_STANDARD_I3DL2REVERB: TGUID = '{ef985e71-d5c7-42d4-ba4d-2d073e2e96f4}'; + + // Waves Reverberation {87FC0268-9A55-4360-95AA-004A1D9DE26C} + GUID_DSFX_WAVES_REVERB: TGUID = '{87fc0268-9a55-4360-95aa-004a1d9de26c}'; + + // + // DirectSound Capture Effect Algorithms + // + + + // Acoustic Echo Canceller {BF963D80-C559-11D0-8A2B-00A0C9255AC1} + // Matches KSNODETYPE_ACOUSTIC_ECHO_CANCEL in ksmedia.h + GUID_DSCFX_CLASS_AEC: TGUID = '{BF963D80-C559-11D0-8A2B-00A0C9255AC1}'; + + // Microsoft AEC {CDEBB919-379A-488a-8765-F53CFD36DE40} + GUID_DSCFX_MS_AEC: TGUID = '{cdebb919-379a-488a-8765-f53cfd36de40}'; + + // System AEC {1C22C56D-9879-4f5b-A389-27996DDC2810} + GUID_DSCFX_SYSTEM_AEC: TGUID = '{1c22c56d-9879-4f5b-a389-27996ddc2810}'; + + // Noise Supression {E07F903F-62FD-4e60-8CDD-DEA7236665B5} + // Matches KSNODETYPE_NOISE_SUPPRESS in post Windows ME DDK's ksmedia.h + GUID_DSCFX_CLASS_NS: TGUID = '{e07f903f-62fd-4e60-8cdd-dea7236665b5}'; + + // Microsoft Noise Suppresion {11C5C73B-66E9-4ba1-A0BA-E814C6EED92D} + GUID_DSCFX_MS_NS: TGUID = '{11c5c73b-66e9-4ba1-a0ba-e814c6eed92d}'; + + // System Noise Suppresion {5AB0882E-7274-4516-877D-4EEE99BA4FD0} + GUID_DSCFX_SYSTEM_NS: TGUID = '{5ab0882e-7274-4516-877d-4eee99ba4fd0}'; + +{$ENDIF} // DIRECTSOUND_VERSION >= 0x0800 + + + +// +// DirectSound API +// + +type + TDSEnumCallbackA = function(lpGuid: PGUID; lpcstrDescription, lpcstrModule: PAnsiChar; + lpContext: Pointer): BOOL; stdcall; + TDSEnumCallbackW = function(lpGuid: PGUID; lpcstrDescription, lpcstrModule: PWideChar; + lpContext: Pointer): BOOL; stdcall; +{$IFDEF UNICODE} + TDSEnumCallback = TDSEnumCallbackW; +{$ELSE} + TDSEnumCallback = TDSEnumCallbackA; +{$ENDIF} + +const + DirectSoundDll = 'dsound.dll'; + +function DirectSoundLoaded: Boolean; +function UnLoadDirectSound: Boolean; +function LoadDirectSound: Boolean; + +{$IFDEF DIRECTSOUND_DYNAMIC_LINK} +var + DirectSoundCreate: function(lpGuid: PGUID; out ppDS: IDirectSound; pUnkOuter: IUnknown): HResult; stdcall; + DirectSoundEnumerateW: function(lpDSEnumCallback: TDSEnumCallbackW; lpContext: Pointer): HResult; stdcall; + DirectSoundEnumerateA: function(lpDSEnumCallback: TDSEnumCallbackA; lpContext: Pointer): HResult; stdcall; + DirectSoundEnumerate: function(lpDSEnumCallback: TDSEnumCallback; lpContext: Pointer): HResult; stdcall; + + DirectSoundCaptureCreate: function(lpGUID: PGUID; out lplpDSC: IDirectSoundCapture; pUnkOuter: IUnknown): HResult; stdcall; + DirectSoundCaptureEnumerateW: function(lpDSEnumCallback: TDSEnumCallbackW; lpContext: Pointer): HResult; stdcall; + DirectSoundCaptureEnumerateA: function(lpDSEnumCallback: TDSEnumCallbackA; lpContext: Pointer): HResult; stdcall; + DirectSoundCaptureEnumerate: function(lpDSEnumCallback: TDSEnumCallback; lpContext: Pointer): HResult; stdcall; + +//#if DIRECTSOUND_VERSION >= 0x0800 +type + TDirectSoundFullDuplexCreateFunc = function(pcGuidCaptureDevice, pcGuidRenderDevice: PGUID; + const pcDSCBufferDesc: TDSCBufferDesc; const pcDSBufferDesc: TDSBufferDesc; + hWnd: hWnd; dwLevel: DWORD; out ppDSFD: IDirectSoundFullDuplex8; + out ppDSCBuffer8: IDirectSoundCaptureBuffer8; out ppDSBuffer8: IDirectSoundBuffer8; + pUnkOuter: IUnknown): HResult; stdcall; + +var + DirectSoundCreate8: function(pcGuidDevice: PGUID; out ppDS8: IDirectSound8; pUnkOuter: IUnknown): HResult; stdcall; + DirectSoundCaptureCreate8: function(pcGuidDevice: PGUID; out ppDSC8: IDirectSoundCapture8; pUnkOuter: IUnknown): HResult; stdcall; + DirectSoundFullDuplexCreate: TDirectSoundFullDuplexCreateFunc; + DirectSoundFullDuplexCreate8: TDirectSoundFullDuplexCreateFunc; + + GetDeviceID: function(pGuidSrc, pGuidDest: PGUID): HResult; stdcall; +//#endif // DIRECTSOUND_VERSION >= 0x0800 + +{$ELSE} +function DirectSoundCreate(lpGuid: PGUID; out ppDS: IDirectSound; pUnkOuter: IUnknown): HResult; stdcall; external DirectSoundDLL; +function DirectSoundEnumerateW(lpDSEnumCallback: TDSEnumCallbackW; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundEnumerateW'; +function DirectSoundEnumerateA(lpDSEnumCallback: TDSEnumCallbackA; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundEnumerateA'; +{$IFDEF UNICODE} +function DirectSoundEnumerate(lpDSEnumCallback: TDSEnumCallback; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundEnumerateW'; +{$ELSE} +function DirectSoundEnumerate(lpDSEnumCallback: TDSEnumCallback; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundEnumerateA'; +{$ENDIF} + +function DirectSoundCaptureCreate(lpGUID: PGUID; out lplpDSC: IDirectSoundCapture; pUnkOuter: IUnknown): HResult; stdcall; external DirectSoundDLL; +function DirectSoundCaptureEnumerateW(lpDSEnumCallback: TDSEnumCallbackW; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundCaptureEnumerateW'; +function DirectSoundCaptureEnumerateA(lpDSEnumCallback: TDSEnumCallbackA; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundCaptureEnumerateA'; +{$IFDEF UNICODE} +function DirectSoundCaptureEnumerate(lpDSEnumCallback: TDSEnumCallback; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundCaptureEnumerateW'; +{$ELSE} +function DirectSoundCaptureEnumerate(lpDSEnumCallback: TDSEnumCallback; lpContext: Pointer): HResult; stdcall; external DirectSoundDLL name 'DirectSoundCaptureEnumerateA'; +{$ENDIF} + +//#if DIRECTSOUND_VERSION >= 0x0800 +function DirectSoundCreate8(pcGuidDevice: PGUID; out ppDS8: IDirectSound8; pUnkOuter: IUnknown): HResult; stdcall; external DirectSoundDLL; +function DirectSoundCaptureCreate8(pcGuidDevice: PGUID; out ppDSC8: IDirectSoundCapture8; pUnkOuter: IUnknown): HResult; stdcall; external DirectSoundDLL; +function DirectSoundFullDuplexCreate(pcGuidCaptureDevice, pcGuidRenderDevice: PGUID; + const pcDSCBufferDesc: TDSCBufferDesc; const pcDSBufferDesc: TDSBufferDesc; + hWnd: hWnd; dwLevel: DWORD; out ppDSFD: IDirectSoundFullDuplex8; + out ppDSCBuffer8: IDirectSoundCaptureBuffer8; out ppDSBuffer8: IDirectSoundBuffer8; + pUnkOuter: IUnknown): HResult; stdcall; external DirectSoundDLL; +function DirectSoundFullDuplexCreate8(pcGuidCaptureDevice, pcGuidRenderDevice: PGUID; + const pcDSCBufferDesc: TDSCBufferDesc; const pcDSBufferDesc: TDSBufferDesc; + hWnd: hWnd; dwLevel: DWORD; out ppDSFD: IDirectSoundFullDuplex8; + out ppDSCBuffer8: IDirectSoundCaptureBuffer8; out ppDSBuffer8: IDirectSoundBuffer8; + pUnkOuter: IUnknown): HResult; stdcall; external DirectSoundDLL name 'DirectSoundFullDuplexCreate'; + +function GetDeviceID(pGuidSrc, pGuidDest: PGUID): HResult; stdcall; external DirectSoundDLL; +//#endif // DIRECTSOUND_VERSION >= 0x0800 + +{$ENDIF} + + +implementation + +// #define MAKE_DSHRESULT(code) MAKE_HRESULT(1, _FACDS, code) +function MAKE_DSHRESULT(Code: DWord): DWord; +begin + Result:= DWord((1 shl 31) or (_FACDS shl 16)) or Code; +end; + +// #define DSSPEAKER_COMBINED(c, g) ((DWORD)(((BYTE)(c)) | ((DWORD)((BYTE)(g))) << 16)) +function DSSPEAKER_COMBINED(c, g: DWORD): DWORD; +begin + Result:= Byte(c) or (DWORD(Byte(g)) shl 16); +end; + +// #define DSSPEAKER_CONFIG(a) ((BYTE)(a)) +function DSSPEAKER_CONFIG(a: Cardinal): Byte; +begin + Result:= Byte(a); +end; + +// #define DSSPEAKER_GEOMETRY(a) ((BYTE)(((DWORD)(a) >> 16) & 0x00FF)) +function DSSPEAKER_GEOMETRY(a: Cardinal): Byte; +begin + Result:= Byte((DWORD(a) shr 16) and $00FF); +end; + + +{$IFDEF DIRECTSOUND_DYNAMIC_LINK} +var + DirectSoundLib: THandle = 0; + +function DirectSoundLoaded: Boolean; +begin + Result:= (DirectSoundLib <> 0); +end; + +function UnLoadDirectSound: Boolean; +begin + Result:= True; + if (DirectSoundLib <> 0) then + begin + Result:= Result and FreeLibrary(DirectSoundLib); + + DirectSoundCreate:= nil; + DirectSoundEnumerateW:= nil; + DirectSoundEnumerateA:= nil; + DirectSoundEnumerate:= nil; + + DirectSoundCaptureCreate:= nil; + DirectSoundCaptureEnumerateW:= nil; + DirectSoundCaptureEnumerateA:= nil; + DirectSoundCaptureEnumerate:= nil; + + //#if DIRECTSOUND_VERSION >= 0x0800 + DirectSoundCreate8:= nil; + DirectSoundCaptureCreate8:= nil; + DirectSoundFullDuplexCreate:= nil; + DirectSoundFullDuplexCreate8:= nil; + + GetDeviceID:= nil; + + DirectSoundLib:= 0; + end; +end; + +function LoadDirectSound: Boolean; +begin + Result:= DirectSoundLoaded; + if (not Result) then + begin + DirectSoundLib:= LoadLibrary(DirectSoundDll); + if (DirectSoundLib<>0) then + begin + DirectSoundCreate:= GetProcAddress(DirectSoundLib, 'DirectSoundCreate'); + DirectSoundEnumerateW:= GetProcAddress(DirectSoundLib, 'DirectSoundEnumerateW'); + DirectSoundEnumerateA:= GetProcAddress(DirectSoundLib, 'DirectSoundEnumerateA'); + {$IFDEF UNICODE} + DirectSoundEnumerate:= GetProcAddress(DirectSoundLib, 'DirectSoundEnumerateW'); + {$ELSE} + DirectSoundEnumerate:= GetProcAddress(DirectSoundLib, 'DirectSoundEnumerateA'); + {$ENDIF} + + DirectSoundCaptureCreate:= GetProcAddress(DirectSoundLib, 'DirectSoundCaptureCreate'); + DirectSoundCaptureEnumerateW:= GetProcAddress(DirectSoundLib, 'DirectSoundCaptureEnumerateW'); + DirectSoundCaptureEnumerateA:= GetProcAddress(DirectSoundLib, 'DirectSoundCaptureEnumerateA'); + {$IFDEF UNICODE} + DirectSoundCaptureEnumerate:= GetProcAddress(DirectSoundLib, 'DirectSoundCaptureEnumerateW'); + {$ELSE} + DirectSoundCaptureEnumerate:= GetProcAddress(DirectSoundLib, 'DirectSoundCaptureEnumerateA'); + {$ENDIF} + + //#if DIRECTSOUND_VERSION >= 0x0800 + DirectSoundCreate8:= GetProcAddress(DirectSoundLib, 'DirectSoundCreate8'); + DirectSoundCaptureCreate8:= GetProcAddress(DirectSoundLib, 'DirectSoundCaptureCreate8'); + DirectSoundFullDuplexCreate:= GetProcAddress(DirectSoundLib, 'DirectSoundFullDuplexCreate'); + DirectSoundFullDuplexCreate8:= GetProcAddress(DirectSoundLib, 'DirectSoundFullDuplexCreate'); + + GetDeviceID:= GetProcAddress(DirectSoundLib, 'GetDeviceID'); + //#endif // DIRECTSOUND_VERSION >= 0x0800 + end; + + Result:= Assigned(DirectSoundCreate); + if not Result then UnLoadDirectSound; + end; +end; +{$ELSE} +function DirectSoundLoaded: Boolean; +begin // Stub function for static linking + Result:= True; +end; + +function UnLoadDirectSound: Boolean; +begin // Stub function for static linking + Result:= True; // should emulate "normal" behaviour +end; + +function LoadDirectSound: Boolean; +begin // Stub function for static linking + Result:= True; +end; + +{$ENDIF} + +{$IFDEF DIRECTSOUND_DYNAMIC_LINK} +initialization +{$IFNDEF DIRECTSOUND_DYNAMIC_LINK_EXPLICIT} + LoadDirectSound; +{$ENDIF} +finalization + UnLoadDirectSound; +{$ENDIF} +end. diff --git a/components/acs/Src/fileformats/windows/directx.inc b/components/acs/Src/fileformats/windows/directx.inc new file mode 100644 index 000000000..1c7b3c0bc --- /dev/null +++ b/components/acs/Src/fileformats/windows/directx.inc @@ -0,0 +1,29 @@ +{******************************************************************************} +{ } +{ The contents of this file are subject to the Mozilla Public License Version } +{ 1.1 (the "License"); you may not use this file except in compliance with the } +{ License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ } +{ } +{ Software distributed under the License is distributed on an "AS IS" basis, } +{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for } +{ the specific language governing rights and limitations under the License. } +{ } +{ The Original Code is DirectX.inc. } +{ } +{******************************************************************************} + +// Borland compilers support +{$INCLUDE Jedi.inc} + +{$DEFINE TYPE_IDENTITY} +{$DEFINE SUPPORTS_EXCEPTIONS} + +// Additional settings +{$MINENUMSIZE 4} +{$ALIGN ON} + +{$IFDEF COMPILER7_UP} + {$WARN UNSAFE_CODE OFF} + {$WARN UNSAFE_TYPE OFF} + {$WARN UNSAFE_CAST OFF} +{$ENDIF} diff --git a/components/acs/Src/fileformats/windows/dxtypes.pas b/components/acs/Src/fileformats/windows/dxtypes.pas new file mode 100644 index 000000000..559061321 --- /dev/null +++ b/components/acs/Src/fileformats/windows/dxtypes.pas @@ -0,0 +1,133 @@ +{******************************************************************************} +{* *} +{* copyright (c) microsoft corporation. all rights reserved. *} +{* *} +{* files: dxsdkver.h, extracts from various directx sdk include files *} +{* content: directx 9.0 headers common types *} +{* *} +{* directx 9.0 delphi / freepascal adaptation by alexey barkovoy *} +{* e-mail: directx@clootie.ru *} +{* *} +{* latest version can be downloaded from: *} +{* http://www.clootie.ru *} +{* http://sourceforge.net/projects/delphi-dx9sdk *} +{* *} +{*----------------------------------------------------------------------------*} +{* $id: dxtypes.pas,v 1.1 2005/09/12 22:04:53 z0m3ie exp $ } +{******************************************************************************} +{ } +{ the contents of this file are used with permission, subject to the mozilla } +{ public license version 1.1 (the "license"); you may not use this file except } +{ in compliance with the license. you may obtain a copy of the license at } +{ http://www.mozilla.org/mpl/mpl-1.1.html } +{ } +{ software distributed under the license is distributed on an "as is" basis, } +{ without warranty of any kind, either express or implied. see the license for } +{ the specific language governing rights and limitations under the license. } +{ } +{ alternatively, the contents of this file may be used under the terms of the } +{ gnu lesser general public license (the "lgpl license"), in which case the } +{ provisions of the lgpl license are applicable instead of those above. } +{ if you wish to allow use of your version of this file only under the terms } +{ of the lgpl license and not to allow others to use your version of this file } +{ under the mpl, indicate your decision by deleting the provisions above and } +{ replace them with the notice and other provisions required by the lgpl } +{ license. if you do not delete the provisions above, a recipient may use } +{ your version of this file under either the mpl or the lgpl license. } +{ } +{ for more information about the lgpl: http://www.gnu.org/copyleft/lesser.html } +{ } +{******************************************************************************} + +{.$I DirectX.inc} + +unit dxtypes; + +interface + + +uses windows; + +(*==========================================================================; + * + * File: dxsdkver.h + * Content: DirectX SDK Version Include File + * + ****************************************************************************) +const + _DXSDK_PRODUCT_MAJOR = 9; + _DXSDK_PRODUCT_MINOR = 08; + _DXSDK_BUILD_MAJOR = 299; + _DXSDK_BUILD_MINOR = 0000; + + + +(**************************************************************************** + * Other files + ****************************************************************************) +type + // TD3DValue is the fundamental Direct3D fractional data type + D3DVALUE = Single; + TD3DValue = D3DVALUE; + PD3DValue = ^TD3DValue; + + D3DCOLOR = DWord; + TD3DColor = D3DCOLOR; + PD3DColor = ^TD3DColor; + + _D3DVECTOR = packed record + x: Single; + y: Single; + z: Single; + end {_D3DVECTOR}; + D3DVECTOR = _D3DVECTOR; + TD3DVector = _D3DVECTOR; + PD3DVector = ^TD3DVector; + + REFERENCE_TIME = LONGLONG; + TReferenceTime = REFERENCE_TIME; + PReferenceTime = ^TReferenceTime; + + +// ================================================================== +// Here comes generic Windows types for Win32 / Win64 compatibility +// + + // + // The INT_PTR is guaranteed to be the same size as a pointer. Its + // size with change with pointer size (32/64). It should be used + // anywhere that a pointer is cast to an integer type. UINT_PTR is + // the unsigned variation. + // + {$IFDEF WIN64} + INT_PTR = Int64; + UINT_PTR = Int64; // not yet: UInt64; + LONG_PTR = Int64; + ULONG_PTR = Int64; // not yet: UInt64; + DWORD_PTR = Int64; // not yet: UInt64; + {$ELSE} + INT_PTR = Longint; + UINT_PTR = Longword; + LONG_PTR = Longint; + ULONG_PTR = Longword; + DWORD_PTR = Longword; + {$ENDIF} + PINT_PTR = ^INT_PTR; + PUINT_PTR = ^UINT_PTR; + PLONG_PTR = ^LONG_PTR; + PULONG_PTR = ^ULONG_PTR; + + + // + // SIZE_T used for counts or ranges which need to span the range of + // of a pointer. SSIZE_T is the signed variation. + // + SIZE_T = ULONG_PTR; + SSIZE_T = LONG_PTR; + PSIZE_T = ^SIZE_T; + PSSIZE_T = ^SSIZE_T; + +implementation + +end. + diff --git a/components/acs/Src/fileformats/windows/jedi.inc b/components/acs/Src/fileformats/windows/jedi.inc new file mode 100644 index 000000000..043556fc3 --- /dev/null +++ b/components/acs/Src/fileformats/windows/jedi.inc @@ -0,0 +1,578 @@ +{******************************************************************************} +{ } +{ The contents of this file are subject to the Mozilla Public License Version } +{ 1.1 (the "License"); you may not use this file except in compliance with the } +{ License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ } +{ } +{ Software distributed under the License is distributed on an "AS IS" basis, } +{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for } +{ the specific language governing rights and limitations under the License. } +{ } +{ The Original Code is JEDI.INC. } +{ } +{ The Initial Developer of the Original Code is Project JEDI } +{ http://www.delphi-jedi.org } +{ } +{******************************************************************************} +{ } +{ This file defines various generic compiler directives used in the JEDI Code } +{ Library (JCL) and JEDI Visual Component Library Library (J-VCL). The } +{ directives in this file are of generic nature and consist mostly of mappings } +{ from the VERXXX directives defined by Delphi and C++ Builder to friendly } +{ names such as DELPHI5 and SUPPORTS_WIDESTRING. These friendly names are } +{ subsequently used in both libraries to test for compiler versions and/or } +{ whether the compiler supports certain features (such as widestring's or 64 } +{ bit integers. Both libraries provide an additional, library specific, } +{ include file. For the JCL this is JCL.INC. These files should be included in } +{ source files instead of this file (which is pulled in automatically). } +{ } +{ Maintainer: Marcel van Brakel } +{ Last modified: May 25, 2002 } +{ } +{******************************************************************************} + +(* + +- Development environment directives + + This file defines two driectives to indicate which development environment the + library is being compiled with. Currently this can either be Delphi or + C++ Builder (in the near future "Kylix" will be added). + + Directive Description + ------------------------------------------------------------------------------ + DELPHI Defined if compiled with Delphi + CBUILDER Defined if compiled with C++ Builder + +- Platform Directives + + Platform directives are not explicitly defined in this file but are defined + by the compiler itself. They are listed here only for completeness. + + Directive Description + ------------------------------------------------------------------------------ + WIN32 Defined when target platform is 32 bit Windows + LINUX Defined when target platform is Linux + +- Delphi Versions + + The following directives are direct mappings from the VERXXX directives to a + friendly name of the associated compiler. These directives are only defined if + the compiler is Delphi (ie DELPHI is defined). + + Directive Description + ------------------------------------------------------------------------------ + DELPHI1 Defined when compiling with Delphi 1 + DELPHI2 Defined when compiling with Delphi 2 + DELPHI3 Defined when compiling with Delphi 3 + DELPHI4 Defined when compiling with Delphi 4 + DELPHI5 Defined when compiling with Delphi 5 + DELPHI6 Defined when compiling with Delphi 6 + DELPHI7 Defined when compiling with Delphi 7 + DELPHI8 Defined when compiling with Delphi 8 + DELPHI9 Defined when compiling with Delphi 9 + DELPHI1_UP Defined when compiling with Delphi 1 or higher + DELPHI2_UP Defined when compiling with Delphi 2 or higher + DELPHI3_UP Defined when compiling with Delphi 3 or higher + DELPHI4_UP Defined when compiling with Delphi 4 or higher + DELPHI5_UP Defined when compiling with Delphi 5 or higher + DELPHI6_UP Defined when compiling with Delphi 6 or higher + DELPHI7_UP Defined when compiling with Delphi 7 or higher + DELPHI8_UP Defined when compiling with Delphi 8 or higher + DELPHI9_UP Defined when compiling with Delphi 9 or higher + +- C++ Builder Versions + + The following directives are direct mappings from the VERXXX directives to a + friendly name of the associated compiler. These directives are only defined if + the compiler is C++ Builder (ie BCB is defined). + + Directive Description + ------------------------------------------------------------------------------ + BCB1 Defined when compiling with C++ Builder 1 + BCB3 Defined when compiling with C++ Builder 3 + BCB4 Defined when compiling with C++ Builder 4 + BCB5 Defined when compiling with C++ Builder 5 + BCB6 Defined when compiling with C++ Builder 6 + BCB7 Defined when compiling with C++ Builder 7 + BCB1_UP Defined when compiling with C++ Builder 1 or higher + BCB3_UP Defined when compiling with C++ Builder 3 or higher + BCB4_UP Defined when compiling with C++ Builder 4 or higher + BCB5_UP Defined when compiling with C++ Builder 5 or higher + BCB6_UP Defined when compiling with C++ Builder 6 or higher + BCB7_UP Defined when compiling with C++ Builder 7 or higher + +- Compiler Versions + + The following directives are direct mappings from the VERXXX directives to a + friendly name of the associated compiler. Unlike the DELPHI_X and BCB_X + directives, these directives are indepedent of the development environment. + That is, they are defined regardless of whether compilation takes place using + Delphi or C++ Builder. + + Directive Description + ------------------------------------------------------------------------------ + COMPILER1 Defined when compiling with Delphi 1 + COMPILER2 Defined when compiling with Delphi 2 or C++ Builder 1 + COMPILER3 Defined when compiling with Delphi 3 + COMPILER35 Defined when compiling with C++ Builder 3 + COMPILER4 Defined when compiling with Delphi 4 or C++ Builder 4 + COMPILER5 Defined when compiling with Delphi 5 or C++ Builder 5 + COMPILER6 Defined when compiling with Delphi 6 or C++ Builder 6 + COMPILER1_UP Defined when compiling with Delphi 1 or higher + COMPILER2_UP Defined when compiling with Delphi 2 or C++ Builder 1 or higher + COMPILER3_UP Defined when compiling with Delphi 3 or higher + COMPILER35_UP Defined when compiling with C++ Builder 3 or higher + COMPILER4_UP Defined when compiling with Delphi 4 or C++ Builder 4 or higher + COMPILER5_UP Defined when compiling with Delphi 5 or C++ Builder 5 or higher + COMPILER6_UP Defined when compiling with Delphi 6 or C++ Builder 6 or higher + COMPILER7_UP Defined when compiling with Delphi 6 or C++ Builder 6 or higher + +- Feature Directives + + The features directives are used to test if the compiler supports specific + features, such as method overloading, and adjust the sources accordingly. Use + of these directives is preferred over the use of the DELPHI and COMPILER + directives. + + Directive Description + ------------------------------------------------------------------------------ + SUPPORTS_WIDESTRING Compiler supports the WideString type (D3/BCB3 up) + SUPPORTS_INTERFACE Compiler supports interfaces (D3/BCB3) + SUPPORTS_EXTSYM Compiler supports the $EXTERNALSYM directive (D4/BCB3) + SUPPORTS_NODEFINE Compiler supports the $NODEFINE directive (D4/BCB3) + SUPPORTS_INT64 Compiler supports the Int64 type (D4/BCB4) + SUPPORTS_DYNAMICARRAYS Compiler supports dynamic arrays (D4/BCB4) + SUPPORTS_DEFAULTPARAMS Compiler supports default parameters (D4/BCB4) + SUPPORTS_OVERLOAD Compiler supports overloading (D4/BCB4) + SUPPORTS_INLINE Compiler supports inline directive (D9) + +- Compiler Settings + + The compiler settings directives indicate whether a specific compiler setting + is in effect. This facilitates changing compiler settings locally in a more + compact and readible manner. + + Directive Description + ------------------------------------------------------------------------------ + ALIGN_ON Compiling in the A+ state (no alignment) + BOOLEVAL_ON Compiling in the B+ state (complete boolean evaluation) + ASSERTIONS_ON Compiling in the C+ state (assertions on) + DEBUGINFO_ON Compiling in the D+ state (debug info generation on) + IMPORTEDDATA_ON Compiling in the G+ state (creation of imported data references) + LONGSTRINGS_ON Compiling in the H+ state (string defined as AnsiString) + IOCHECKS_ON Compiling in the I+ state (I/O checking enabled) + WRITEABLECONST_ON Compiling in the J+ state (typed constants can be modified) + LOCALSYMBOLS Compiling in the L+ state (local symbol generation) + TYPEINFO_ON Compiling in the M+ state (RTTI generation on) + OPTIMIZATION_ON Compiling in the O+ state (code optimization on) + OPENSTRINGS_ON Compiling in the P+ state (variable string parameters are openstrings) + OVERFLOWCHECKS_ON Compiling in the Q+ state (overflow checing on) + RANGECHECKS_ON Compiling in the R+ state (range checking on) + TYPEDADDRESS_ON Compiling in the T+ state (pointers obtained using the @ operator are typed) + SAFEDIVIDE_ON Compiling in the U+ state (save FDIV instruction through RTL emulation) + VARSTRINGCHECKS_ON Compiling in the V+ state (type checking of shortstrings) + STACKFRAMES_ON Compiling in the W+ state (generation of stack frames) + EXTENDEDSYNTAX_ON Compiling in the X+ state (Delphi extended syntax enabled) + +*) + +//------------------------------------------------------------------------------ +// Compiler settings +//------------------------------------------------------------------------------ + +{$IFOPT A+} {$DEFINE ALIGN_ON} {$ENDIF} +{$IFOPT B+} {$DEFINE BOOLEVAL_ON} {$ENDIF} +{$IFOPT C+} {$DEFINE ASSERTIONS_ON} {$ENDIF} +{$IFOPT D+} {$DEFINE DEBUGINFO_ON} {$ENDIF} +{$IFOPT G+} {$DEFINE IMPORTEDDATA_ON} {$ENDIF} +{$IFOPT H+} {$DEFINE LONGSTRINGS_ON} {$ENDIF} +//HINTS +{$IFOPT I+} {$DEFINE IOCHECKS_ON} {$ENDIF} +{$IFOPT J+} {$DEFINE WRITEABLECONST_ON} {$ENDIF} +{$IFOPT L+} {$DEFINE LOCALSYMBOLS} {$ENDIF} +{$IFOPT M+} {$DEFINE TYPEINFO_ON} {$ENDIF} +{$IFOPT O+} {$DEFINE OPTIMIZATION_ON} {$ENDIF} +{$IFOPT P+} {$DEFINE OPENSTRINGS_ON} {$ENDIF} +{$IFOPT Q+} {$DEFINE OVERFLOWCHECKS_ON} {$ENDIF} +{$IFOPT R+} {$DEFINE RANGECHECKS_ON} {$ENDIF} +//REALCOMPATIBILITY +{$IFOPT T+} {$DEFINE TYPEDADDRESS_ON} {$ENDIF} +{$IFOPT U+} {$DEFINE SAFEDIVIDE_ON} {$ENDIF} +{$IFOPT V+} {$DEFINE VARSTRINGCHECKS_ON} {$ENDIF} +{$IFOPT W+} {$DEFINE STACKFRAMES_ON} {$ENDIF} +//WARNINGS +{$IFOPT X+} {$DEFINE EXTENDEDSYNTAX_ON} {$ENDIF} + +//------------------------------------------------------------------------------ +// VERXXX to COMPILERX, DELPHIX and BCBX mappings +//------------------------------------------------------------------------------ + +{$IFDEF VER170} + {$DEFINE COMPILER9} + {$IFDEF BCB} + {$DEFINE BCB9} + {$DEFINE CBUILDER} + {$ELSE} + {$DEFINE DELPHI9} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER160} + {$DEFINE COMPILER8} + {$IFDEF BCB} + {$DEFINE BCB8} + {$DEFINE CBUILDER} + {$ELSE} + {$DEFINE DELPHI8} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER150} + {$DEFINE COMPILER7} + {$IFDEF BCB} + {$DEFINE BCB7} + {$DEFINE CBUILDER} + {$ELSE} + {$DEFINE DELPHI7} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER140} + {$DEFINE COMPILER6} + {$IFDEF BCB} + {$DEFINE BCB6} + {$DEFINE CBUILDER} + {$ELSE} + {$DEFINE DELPHI6} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER130} + {$DEFINE COMPILER5} + {$IFDEF BCB} + {$DEFINE BCB5} + {$DEFINE CBUILDER} + {$ELSE} + {$DEFINE DELPHI5} + {$DEFINE DELPHI} + {$ENDIF} +{$ENDIF} + +{$IFDEF VER125} + {$DEFINE COMPILER4} + {$DEFINE BCB4} + {$DEFINE CBUILDER} +{$ENDIF} + +{$IFDEF VER120} + {$DEFINE COMPILER4} + {$DEFINE DELPHI4} + {$DEFINE DELPHI} +{$ENDIF} + +{$IFDEF VER110} + {$DEFINE COMPILER35} + {$DEFINE BCB3} + {$DEFINE CBUILDER} +{$ENDIF} + +{$IFDEF VER100} + {$DEFINE COMPILER3} + {$DEFINE DELPHI3} + {$DEFINE DELPHI} +{$ENDIF} + +{$IFDEF VER93} + {$DEFINE COMPILER2} + {$DEFINE BCB1} + {$DEFINE CBUILDER} +{$ENDIF} + +{$IFDEF VER90} + {$DEFINE COMPILER2} + {$DEFINE DELPHI2} + {$DEFINE DELPHI} +{$ENDIF} + +{$IFDEF VER80} + {$DEFINE COMPILER1} + {$DEFINE DELPHI1} + {$DEFINE DELPHI} +{$ENDIF} + +//------------------------------------------------------------------------------ +// DELPHIX_UP from DELPHIX mappings +//------------------------------------------------------------------------------ + +{$IFDEF DELPHI9} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI4_UP} + {$DEFINE DELPHI3_UP} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI8} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI4_UP} + {$DEFINE DELPHI3_UP} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI7} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI4_UP} + {$DEFINE DELPHI3_UP} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI6} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI4_UP} + {$DEFINE DELPHI3_UP} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI5} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI4_UP} + {$DEFINE DELPHI3_UP} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI4} + {$DEFINE DELPHI4_UP} + {$DEFINE DELPHI3_UP} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI3} + {$DEFINE DELPHI3_UP} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI2} + {$DEFINE DELPHI2_UP} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +{$IFDEF DELPHI1} + {$DEFINE DELPHI1_UP} +{$ENDIF} + +//------------------------------------------------------------------------------ +// BCBX_UP from BCBX mappings +//------------------------------------------------------------------------------ + +{$IFDEF BCB9} + {$DEFINE BCB9_UP} + {$DEFINE BCB8_UP} + {$DEFINE BCB7_UP} + {$DEFINE BCB6_UP} + {$DEFINE BCB5_UP} + {$DEFINE BCB4_UP} + {$DEFINE BCB3_UP} + {$DEFINE BCB1_UP} +{$ENDIF} + +{$IFDEF BCB8} + {$DEFINE BCB8_UP} + {$DEFINE BCB7_UP} + {$DEFINE BCB6_UP} + {$DEFINE BCB5_UP} + {$DEFINE BCB4_UP} + {$DEFINE BCB3_UP} + {$DEFINE BCB1_UP} +{$ENDIF} + +{$IFDEF BCB7} + {$DEFINE BCB7_UP} + {$DEFINE BCB6_UP} + {$DEFINE BCB5_UP} + {$DEFINE BCB4_UP} + {$DEFINE BCB3_UP} + {$DEFINE BCB1_UP} +{$ENDIF} + +{$IFDEF BCB6} + {$DEFINE BCB6_UP} + {$DEFINE BCB5_UP} + {$DEFINE BCB4_UP} + {$DEFINE BCB3_UP} + {$DEFINE BCB1_UP} +{$ENDIF} + +{$IFDEF BCB5} + {$DEFINE BCB5_UP} + {$DEFINE BCB4_UP} + {$DEFINE BCB3_UP} + {$DEFINE BCB1_UP} +{$ENDIF} + +{$IFDEF BCB4} + {$DEFINE BCB4_UP} + {$DEFINE BCB3_UP} + {$DEFINE BCB1_UP} +{$ENDIF} + +{$IFDEF BCB3} + {$DEFINE BCB3_UP} + {$DEFINE BCB1_UP} +{$ENDIF} + +{$IFDEF BCB1} + {$DEFINE BCB1_UP} +{$ENDIF} + +//------------------------------------------------------------------------------ +// COMPILERX_UP from COMPILERX mappings +//------------------------------------------------------------------------------ + + +{$IFDEF COMPILER9} + {$DEFINE COMPILER9_UP} + {$DEFINE COMPILER8_UP} + {$DEFINE COMPILER7_UP} + {$DEFINE COMPILER6_UP} + {$DEFINE COMPILER5_UP} + {$DEFINE COMPILER4_UP} + {$DEFINE COMPILER35_UP} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER8} + {$DEFINE COMPILER8_UP} + {$DEFINE COMPILER7_UP} + {$DEFINE COMPILER6_UP} + {$DEFINE COMPILER5_UP} + {$DEFINE COMPILER4_UP} + {$DEFINE COMPILER35_UP} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER7} + {$DEFINE COMPILER7_UP} + {$DEFINE COMPILER6_UP} + {$DEFINE COMPILER5_UP} + {$DEFINE COMPILER4_UP} + {$DEFINE COMPILER35_UP} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER6} + {$DEFINE COMPILER6_UP} + {$DEFINE COMPILER5_UP} + {$DEFINE COMPILER4_UP} + {$DEFINE COMPILER35_UP} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER5} + {$DEFINE COMPILER5_UP} + {$DEFINE COMPILER4_UP} + {$DEFINE COMPILER35_UP} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER4} + {$DEFINE COMPILER4_UP} + {$DEFINE COMPILER35_UP} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER35} + {$DEFINE COMPILER35_UP} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER3} + {$DEFINE COMPILER3_UP} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER2} + {$DEFINE COMPILER2_UP} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +{$IFDEF COMPILER1} + {$DEFINE COMPILER1_UP} +{$ENDIF} + +//------------------------------------------------------------------------------ +// Map COMPILERX_UP to friendly feature names +//------------------------------------------------------------------------------ + +{$IFDEF COMPILER3_UP} + {$DEFINE SUPPORTS_WIDESTRING} + {$DEFINE SUPPORTS_INTERFACE} +{$ENDIF} + +{$IFDEF COMPILER35_UP} + {$DEFINE SUPPORTS_EXTSYM} + {$DEFINE SUPPORTS_NODEFINE} +{$ENDIF} + +{$IFDEF COMPILER4_UP} + {$DEFINE SUPPORTS_INT64} + {$DEFINE SUPPORTS_DYNAMICARRAYS} + {$DEFINE SUPPORTS_DEFAULTPARAMS} + {$DEFINE SUPPORTS_OVERLOAD} +{$ENDIF} + +{$IFDEF COMPILER9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + +//------------------------------------------------------------------------------ +// Cross-platform related defines +//------------------------------------------------------------------------------ + +{$IFDEF WIN32} + {$DEFINE MSWINDOWS} +{$ENDIF} + +{$IFDEF LINUX} + {$DEFINE UNIX} + {$DEFINE COMPLIB_CLX} +{$ENDIF} + +{$IFNDEF COMPLIB_CLX} + {$DEFINE COMPLIB_VCL} +{$ENDIF} diff --git a/components/acs/Src/fileformats/windows/macdll.pas b/components/acs/Src/fileformats/windows/macdll.pas new file mode 100644 index 000000000..6d89c2a47 --- /dev/null +++ b/components/acs/Src/fileformats/windows/macdll.pas @@ -0,0 +1,1200 @@ +{ + delphi interface to macdll.dll 3.97 + by thomas la cour 30-04-2003 + http://www.top-house.dk/~nr161/delphi/ + + still missing: + StartEx for TAPECompress + + Slightly modified by Andrei Borovsky for better ACS complience. +} + +{ +$Log: macdll.pas,v $ +Revision 1.1 2005/12/19 18:36:49 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:53 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:02 z0m3ie +changed Headers to log +changed mail adress + +} + +unit macdll; + +interface + +uses classes, sysutils, windows, mmsystem; + +const + MACPath = 'MACDll.dll'; + +var + MACLoaded : Boolean = False; + +type + {$IFDEF FPC} + TWaveFormatEx = MMSystem.WaveFormatEx; + {$ELSE} + TWaveFormatEx = MMSystem.TWaveFormatEx; + {$ENDIF} + +//////////////////////////////////////////////////////////////////////////////// +// MAC Error Codes +//////////////////////////////////////////////////////////////////////////////// +const + // file and i/o errors (1000's) + MAC_ERROR_IO_READ = 1000; + MAC_ERROR_IO_WRITE = 1001; + MAC_ERROR_INVALID_INPUT_FILE = 1002; + MAC_ERROR_INVALID_OUTPUT_FILE = 1003; + MAC_ERROR_INPUT_FILE_TOO_LARGE = 1004; + MAC_ERROR_INPUT_FILE_UNSUPPORTED_BIT_DEPTH = 1005; + MAC_ERROR_INPUT_FILE_UNSUPPORTED_SAMPLE_RATE = 1006; + MAC_ERROR_INPUT_FILE_UNSUPPORTED_CHANNEL_COUNT = 1007; + MAC_ERROR_INPUT_FILE_TOO_SMALL = 1008; + MAC_ERROR_INVALID_CHECKSUM = 1009; + MAC_ERROR_DECOMPRESSING_FRAME = 1010; + MAC_ERROR_INITIALIZING_UNMAC = 1011; + MAC_ERROR_INVALID_FUNCTION_PARAMETER = 1012; + MAC_ERROR_UNSUPPORTED_FILE_TYPE = 1013; + MAC_ERROR_UPSUPPORTED_FILE_VERSION = 1014; + + // memory errors (2000's) + MAC_ERROR_INSUFFICIENT_MEMORY = 2000; + + // dll errors (3000's) + MAC_ERROR_LOADINGAPE_DLL = 3000; + MAC_ERROR_LOADINGAPE_INFO_DLL = 3001; + MAC_ERROR_LOADING_UNMAC_DLL = 3002; + + // general and misc errors + MAC_ERROR_USER_STOPPED_PROCESSING = 4000; + MAC_ERROR_SKIPPED = 4001; + + // programmer errors + MAC_ERROR_BAD_PARAMETER = 5000; + + // IAPECompress errors + MAC_ERROR_APE_COMPRESS_TOO_MUCH_DATA = 6000; + + // unknown error + MAC_ERROR_UNDEFINED = -1; + +//////////////////////////////////////////////////////////////////////////////// +// MAC compression codes +//////////////////////////////////////////////////////////////////////////////// +const + COMPRESSION_LEVEL_FAST = 1000; + COMPRESSION_LEVEL_NORMAL = 2000; + COMPRESSION_LEVEL_HIGH = 3000; + COMPRESSION_LEVEL_EXTRA_HIGH = 4000; + + MAC_FORMAT_FLAG_8_BIT = 1; // is 8-bit + mac_format_flag_crc = 2; // uses the new crc32 error detection + mac_format_flag_has_peak_level = 4; // unsigned __int32 peak_level after the header + mac_format_flag_24_bit = 8; // is 24-bit + mac_format_flag_has_seek_elements = 16; // has the number of seek elements after the peak level + mac_format_flag_create_wav_header = 32; // create the wave header on decompression (not stored) + + CREATE_WAV_HEADER_ON_DECOMPRESSION = -1; + MAX_AUDIO_BYTES_UNKNOWN = -1; + +type + macProgressCallback_t = procedure(PercentageDone: LongInt); stdcall; + +var + + macProgressCallback : macProgressCallback_t; + +//////////////////////////////////////////////////////////////////////////////// +// WAV header structure +//////////////////////////////////////////////////////////////////////////////// +type + TWaveHeader = packed record + // RIFF header + cRIFFHeader: array[0..3] of char; //unsigned int nRIFFBytes; + nRIFFBytes: Longword; + // data type + cDataTypeID: array[0..3] of char; //char cDataTypeID[4]; + // wave format + cFormatHeader: array[0..3] of char; //char cFormatHeader[4]; + nFormatBytes: Longword; //unsigned int nFormatBytes; + nFormatTag: Word; //unsigned short nFormatTag; + nChannels: Word; //unsigned short nChannels; + nSamplesPerSec: Longword; //unsigned int nSamplesPerSec; + nAvgBytesPerSec: Longword; //unsigned int nAvgBytesPerSec; + nBlockAlign: Word; //unsigned short nBlockAlign; + nBitsPerSample: Word; //unsigned short nBitsPerSample; + // data chunk header + cDataHeader: array[0..3] of char; //char cDataHeader[4]; + nDataBytes: Longword; //unsigned int nDataBytes; + end; + PWaveHeader = ^TWaveHeader; + +{***************************************************************************************** +APE header structure (what's at the front of an APE file) +*****************************************************************************************} +type + TAPEHeader = packed record + cID: array[0..3] of char; // should equal 'MAC ' + nVersion: SmallInt; // version number * 1000 (3.81 = 3810) + nCompressionLevel: SmallInt; // the compression level + nFormatFlags: SmallInt; // any format flags (for future use) + nChannels: SmallInt; // the number of channels (1 or 2) + nSampleRate: LongInt; // the sample rate (typically 44100) + nHeaderBytes: LongInt; // the bytes after the MAC header that compose the WAV header + nTerminatingBytes: LongInt; // the bytes after that raw data (for extended info) + nTotalFrames: LongInt; // the number of frames in the file + nFinalFrameBlocks: LongInt; // the number of samples in the final frame + end; + PAPEHeader = ^TAPEHeader; + +{******************************************************************************* +TAPEDecompress fields - used when querying for information + +Note(s): +-the distinction between APE_INFO_XXXX and APE_DECOMPRESS_XXXX is that the +first is querying the APE information engine, and the other is querying the +decompressor, and since the decompressor can be a range of an APE file (for +APL), differences will arise. Typically, use the APE_DECOMPRESS_XXXX fields +when querying for info about the length, etc. so APL will work properly. +(i.e. (APE_INFO_TOTAL_BLOCKS != APE_DECOMPRESS_TOTAL_BLOCKS) for APL files) +*******************************************************************************} +type + APE_DECOMPRESS_FIELDS = Integer; +const + APE_INFO_FILE_VERSION = 1000; // version of the APE file * 1000 (3.93 = 3930) [ignored, ignored] + APE_INFO_COMPRESSION_LEVEL = 1001; // compression level of the APE file [ignored, ignored] + APE_INFO_FORMAT_FLAGS = 1002; // format flags of the APE file [ignored, ignored] + APE_INFO_SAMPLE_RATE = 1003; // sample rate (Hz) [ignored, ignored] + APE_INFO_BITS_PER_SAMPLE = 1004; // bits per sample [ignored, ignored] + APE_INFO_BYTES_PER_SAMPLE = 1005; // number of bytes per sample [ignored, ignored] + APE_INFO_CHANNELS = 1006; // channels [ignored, ignored] + APE_INFO_BLOCK_ALIGN = 1007; // block alignment [ignored, ignored] + APE_INFO_BLOCKS_PER_FRAME = 1008; // number of blocks in a frame (frames are used internally) [ignored, ignored] + APE_INFO_FINAL_FRAME_BLOCKS = 1009; // blocks in the final frame (frames are used internally) [ignored, ignored] + APE_INFO_TOTAL_FRAMES = 1010; // total number frames (frames are used internally) [ignored, ignored] + APE_INFO_WAV_HEADER_BYTES = 1011; // header bytes of the decompressed WAV [ignored, ignored] + APE_INFO_WAV_TERMINATING_BYTES = 1012; // terminating bytes of the decompressed WAV [ignored, ignored] + APE_INFO_WAV_DATA_BYTES = 1013; // data bytes of the decompressed WAV [ignored, ignored] + APE_INFO_WAV_TOTAL_BYTES = 1014; // total bytes of the decompressed WAV [ignored, ignored] + APE_INFO_APE_TOTAL_BYTES = 1015; // total bytes of the APE file [ignored, ignored] + APE_INFO_TOTAL_BLOCKS = 1016; // total blocks of audio data [ignored, ignored] + APE_INFO_LENGTH_MS = 1017; // length in ms (1 sec = 1000 ms) [ignored, ignored] + APE_INFO_AVERAGE_BITRATE = 1018; // average bitrate of the APE [ignored, ignored] + APE_INFO_FRAME_BITRATE = 1019; // bitrate of specified APE frame [frame index, ignored] + APE_INFO_DECOMPRESSED_BITRATE = 1020; // bitrate of the decompressed WAV [ignored, ignored] + APE_INFO_PEAK_LEVEL = 1021; // peak audio level (-1 is unknown) [ignored, ignored] + APE_INFO_SEEK_BIT = 1022; // bit offset [frame index, ignored] + APE_INFO_SEEK_BYTE = 1023; // byte offset [frame index, ignored] + APE_INFO_WAV_HEADER_DATA = 1024; // error code [buffer *, max bytes] + APE_INFO_WAV_TERMINATING_DATA = 1025; // error code [buffer *, max bytes] + APE_INFO_WAVEFORMATEX = 1026; // error code [waveformatex *, ignored] + APE_INFO_IO_SOURCE = 1027; // I/O source (CIO *) [ignored, ignored] + APE_INFO_FRAME_BYTES = 1028; // bytes (compressed) of the frame [frame index, ignored] + APE_INFO_FRAME_BLOCKS = 1029; // blocks in a given frame [frame index, ignored] + APE_INFO_TAG = 1030; // point to tag (CAPETag *) [ignored, ignored] + + APE_DECOMPRESS_CURRENT_BLOCK = 2000; // current block location [ignored, ignored] + APE_DECOMPRESS_CURRENT_MS = 2001; // current millisecond location [ignored, ignored] + APE_DECOMPRESS_TOTAL_BLOCKS = 2002; // total blocks in the decompressors range [ignored, ignored] + APE_DECOMPRESS_LENGTH_MS = 2003; // total blocks in the decompressors range [ignored, ignored] + APE_DECOMPRESS_CURRENT_BITRATE = 2004; // current bitrate [ignored, ignored] + APE_DECOMPRESS_AVERAGE_BITRATE = 2005; // average bitrate (works with ranges) [ignored, ignored] + +//////////////////////////////////////////////////////////////////////////////// +// misc types +//////////////////////////////////////////////////////////////////////////////// +type + ID3_TAG = record + TagHeader: array[1..3] of Char; // should equal 'TAG' + Title: array[1..30] of Char; // title + Artist: array[1..30] of Char; // artist + Album: array[1..30] of Char; // album + Year: array[1..4] of Char; // year + Comment: array[1..30] of Char; // comment + Track: Byte; // track + Genre: Byte; // genre + end; + pID3_TAG = ^ID3_TAG; + +type + APE_DECOMPRESS_HANDLE = LongWord;//Pointer; + APE_COMPRESS_HANDLE = LongWord;//Pointer; + +//////////////////////////////////////////////////////////////////////////////// +// Simple functions - see the SDK sample projects for usage examples +//////////////////////////////////////////////////////////////////////////////// + +type + + macRemoveTag_t = function(pFilename: PChar): LongInt; stdcall; + + macCompressFile_t = function ( + InputFile: PChar; + OutputFile: PChar; + CompressionLevel: LongInt; + PercentageDone: PInteger; + ProgressCalllback: macProgressCallback_t; + KillFlag: PInteger + ): LongInt; stdcall; + + macConvertFile_t = function( + InputFile: PChar; + OutputFile: PChar; + CompressionLevel: LongInt; + var PercentageDone: Integer; + ProgressCalllback: macProgressCallback_t; + var KillFlag: Integer + ): LongInt; stdcall; + + macDecompressFile_t = function( + InputFile: PChar; + OutputFile: PChar; + var PercentageDone: Integer; //Pointer; + ProgressCalllback: macProgressCallback_t; + var KillFlag: Integer + ): LongInt; stdcall; + + macFillWaveFormatEx_t = function( + var WaveFormatEx: TWaveFormatEx; + SampleRate: Integer = 44100; + BitsPerSample: Integer = 16; + Channels: Integer = 2 + ): LongInt; stdcall; + + macFillWaveHeader_t = function( + var WaveHeader: TWaveHeader; + AudioBytes: Integer; + var WaveFormatEx: TWaveFormatEx; + TerminatingBytes: Integer = 0 + ): LongInt; stdcall; + + macGetID3Tag_t = function( + pFilename: PChar; + pID3Tag: pID3_TAG + ): LongInt; stdcall; + + macGetInterfaceCompatibility_t = function( + nVersion: Integer; + bDisplayWarningsOnFailure: Boolean; + hwndParent: HWND + ): LongInt; stdcall; + + macGetVersionNumber_t = function(): LongInt; stdcall; + + macShowFileInfoDialog_t = function( + Filename: PChar; + HWndWindow: HWND + ): LongInt; stdcall; + + macTagFileSimple_t = function( + pFilename: PChar; + pArtist: PChar; + pAlbum: PChar; + pTitle: PChar; + pComment: PChar; + pGenre: PChar; + pYear: PChar; + pTrack: PChar; + bClearFirst: boolean; + bUseOldID3: boolean + ): LongInt; stdcall; + + macVerifyFile_t = function( + InputFile: PChar; + var PercentageDone: Integer; + ProgressCalllback: macProgressCallback_t; + var KillFlag: Integer + ): LongInt; stdcall; + +// +// Utility functions +// + +function macErrorExplanation(MacErrorCode: LongInt): string; + +function macMSToTime(MilliSeconds: LongInt): Double; + +var + + macRemoveTag : macRemoveTag_t; + macCompressFile : macCompressFile_t; + macConvertFile : macConvertFile_t; + macDecompressFile : macDecompressFile_t; + macFillWaveFormatEx : macFillWaveFormatEx_t; + macFillWaveHeader : macFillWaveHeader_t; + macGetID3Tag : macGetID3Tag_t; + macGetInterfaceCompatibility : macGetInterfaceCompatibility_t; + macGetVersionNumber : macGetVersionNumber_t; + macShowFileInfoDialog : macShowFileInfoDialog_t; + macTagFileSimple : macTagFileSimple_t; + macVerifyFile : macVerifyFile_t; + +// +// EAPEException +// +type + EAPEException = class(Exception) + public + constructor Create(MacErrorCode: LongInt); overload; + end; + +{************************************************************************************************* +TAPECompress - class for creating APE files + +Usage: + + To create an APE file, you Start(...), then add data (in a variety of ways), then Finish(...) +*************************************************************************************************} + TAPECompress = class + private + FHandle: APE_COMPRESS_HANDLE; + //FFilename: string; + public + ErrorCode: Integer; + constructor Create; + destructor Destroy; override; + + {********************************************************************************************* + * Start + *********************************************************************************************} + + ////////////////////////////////////////////////////////////////////////////////////////////// + // Start(...) / StartEx(...) - starts encoding + // + // Parameters: + // CIO * pioOutput / const char * pFilename + // the output... either a filename or an I/O source + // WAVEFORMATEX * pwfeInput + // format of the audio to encode (use FillWaveFormatEx() if necessary) + // int nMaxAudioBytes + // the absolute maximum audio bytes that will be encoded... encoding fails with a + // ERROR_APE_COMPRESS_TOO_MUCH_DATA if you attempt to encode more than specified here + // (if unknown, use MAX_AUDIO_BYTES_UNKNOWN to allocate as much storage in the seek table as + // possible... limit is then 2 GB of data (~4 hours of CD music)... this wastes around + // 30kb, so only do it if completely necessary) + // int nCompressionLevel + // the compression level for the APE file (fast - extra high) + // (note: extra-high is much slower for little gain) + // const unsigned char * pHeaderData + // a pointer to a buffer containing the WAV header (data before the data block in the WAV) + // (note: use NULL for on-the-fly encoding... see next parameter) + // int nHeaderBytes + // number of bytes in the header data buffer (use CREATE_WAV_HEADER_ON_DECOMPRESSION and + // NULL for the pHeaderData and MAC will automatically create the appropriate WAV header + // on decompression) + ////////////////////////////////////////////////////////////////////////////////////////////// + + {virtual int Start(const char * pOutputFilename, const WAVEFORMATEX * pwfeInput, + int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, + const unsigned char * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION) = 0;} + function Start( + pOutputFilename: PChar; + pwfeInput: PWaveFormatEx; + nMaxAudioBytes: Integer = MAX_AUDIO_BYTES_UNKNOWN; + nCompressionLevel: Integer = COMPRESSION_LEVEL_NORMAL; + pHeaderData: Pointer = nil; + nHeaderBytes: Integer = CREATE_WAV_HEADER_ON_DECOMPRESSION + ): LongInt; + + {virtual int StartEx(CIO * pioOutput, const WAVEFORMATEX * pwfeInput, + int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, + const unsigned char * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION) = 0;} + + {********************************************************************************************* + * Add / Compress Data + * - there are 3 ways to add data: + * 1) simple call AddData(...) + * 2) lock MAC's buffer, copy into it, and unlock (LockBuffer(...) / UnlockBuffer(...)) + * 3) from an I/O source (AddDataFromInputSource(...)) + *********************************************************************************************} + + ////////////////////////////////////////////////////////////////////////////////////////////// + // AddData(...) - adds data to the encoder + // + // Parameters: + // unsigned char * pData + // a pointer to a buffer containing the raw audio data + // int nBytes + // the number of bytes in the buffer + ////////////////////////////////////////////////////////////////////////////////////////////// + //virtual int AddData(unsigned char * pData, int nBytes) = 0; + function AddData( + pData: Pointer; + nBytes: Integer + ): LongInt; + + + ////////////////////////////////////////////////////////////////////////////////////////////// + // GetBufferBytesAvailable(...) - returns the number of bytes available in the buffer + // (helpful when locking) + ////////////////////////////////////////////////////////////////////////////////////////////// + //virtual int GetBufferBytesAvailable() = 0; + function GetBufferBytesAvailable( + ): LongInt; stdcall; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // LockBuffer(...) - locks MAC's buffer so we can copy into it + // + // Parameters: + // int * pBytesAvailable + // returns the number of bytes available in the buffer (DO NOT COPY MORE THAN THIS IN) + // + // Return: + // pointer to the buffer (add at that location) + ////////////////////////////////////////////////////////////////////////////////////////////// + //virtual unsigned char * LockBuffer(int * pBytesAvailable) = 0; + function LockBuffer( + var pBytesAvailable: Integer + ): Pointer; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // UnlockBuffer(...) - releases the buffer + // + // Parameters: + // int nBytesAdded + // the number of bytes copied into the buffer + // BOOL bProcess + // whether MAC should process as much as possible of the buffer + ////////////////////////////////////////////////////////////////////////////////////////////// + //virtual int UnlockBuffer(int nBytesAdded, BOOL bProcess = TRUE) = 0; + function UnlockBuffer( + nBytesAdded: Integer; + bProcess: Boolean = True + ): LongInt; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // AddDataFromInputSource(...) - use a CInputSource (input source) to add data + // + // Parameters: + // CInputSource * pInputSource + // a pointer to the input source + // int nMaxBytes + // the maximum number of bytes to let MAC add (-1 if MAC can add any amount) + // int * pBytesAdded + // returns the number of bytes added from the I/O source + ////////////////////////////////////////////////////////////////////////////////////////////// + //virtual int AddDataFromInputSource(CInputSource * pInputSource, int nMaxBytes = -1, int * pBytesAdded = NULL) = 0; + + {********************************************************************************************* + * Finish / Kill + *********************************************************************************************} + + ////////////////////////////////////////////////////////////////////////////////////////////// + // Finish(...) - ends encoding and finalizes the file + // + // Parameters: + // unsigned char * pTerminatingData + // a pointer to a buffer containing the information to place at the end of the APE file + // (comprised of the WAV terminating data (data after the data block in the WAV) followed + // by any tag information) + // int nTerminatingBytes + // number of bytes in the terminating data buffer + // int nWAVTerminatingBytes + // the number of bytes of the terminating data buffer that should be appended to a decoded + // WAV file (it's basically nTerminatingBytes - the bytes that make up the tag) + ////////////////////////////////////////////////////////////////////////////////////////////// + //virtual int Finish(unsigned char * pTerminatingData, int nTerminatingBytes, int nWAVTerminatingBytes) = 0; + function Finish( + pTerminatingData: Pointer; + nTerminatingBytes: Integer; + nWAVTerminatingBytes: Integer + ): LongInt; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // Kill(...) - stops encoding and deletes the output file + // --- NOT CURRENTLY IMPLEMENTED --- + ////////////////////////////////////////////////////////////////////////////////////////////// + //virtual int Kill() = 0; + function Kill( + ): LongInt; + published + property Handle: APE_DECOMPRESS_HANDLE read FHandle; + end; + +{************************************************************************************************* +TAPEDecompress - class for working with existing APE files (decoding, seeking, analyzing, etc.) +*************************************************************************************************} + TAPEDecompress = class + private + FHandle: APE_DECOMPRESS_HANDLE; + FFilename: string; + public + ErrorCode: Integer; + constructor Create(Filename: string); + destructor Destroy; override; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // GetData(...) - gets raw decompressed audio + // + // Parameters: + // char * pBuffer + // a pointer to a buffer to put the data into + // int nBlocks + // the number of audio blocks desired (see note at intro about blocks vs. samples) + // int * pBlocksRetrieved + // the number of blocks actually retrieved (could be less at end of file or on critical failure) + ////////////////////////////////////////////////////////////////////////////////////////////// + //virtual int GetData(char * pBuffer, int nBlocks, int * pBlocksRetrieved) = 0; + function GetData(pBuffer: Pointer; nBlocks: Integer; var pBlocksRetrieved: Integer): LongInt; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // Seek(...) - seeks + // + // Parameters: + // int nBlockOffset + // the block to seek to (see note at intro about blocks vs. samples) + ////////////////////////////////////////////////////////////////////////////////////////////// + //virtual int Seek(int nBlockOffset) = 0; + function Seek(nBlockOffset: Integer): LongInt; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // GetInfo(...) - get information about the APE file or the state of the decompressor + // + // Parameters: + // APE_DECOMPRESS_FIELDS Field + // the field we're querying (see APE_DECOMPRESS_FIELDS above for more info) + // int nParam1 + // generic parameter... usage is listed in APE_DECOMPRESS_FIELDS + // int nParam2 + // generic parameter... usage is listed in APE_DECOMPRESS_FIELDS + ////////////////////////////////////////////////////////////////////////////////////////////// + //virtual int GetInfo(APE_DECOMPRESS_FIELDS Field, int nParam1 = 0, int nParam2 = 0) = 0; + function GetInfo(Field: APE_DECOMPRESS_FIELDS; nParam1: Integer = 0; nParam2: Integer = 0): LongInt; + + function AverageBitrate: LongWord; + function CurrentBitrate: LongWord; + function CurrentBlock: LongWord; + function CurrentMS: LongWord; + function LengthMS: LongWord; + function TotalBlocks: LongWord; + function InfoApeTotalBytes: LongInt; + function InfoAverageBitrage: LongInt; + function InfoBitsPerSample: LongInt; + function InfoBlockAlign: LongInt; + function InfoBlocksPerFrame: LongInt; + function InfoBytesPerSample: LongInt; + function InfoChannels: LongInt; + function InfoCompressionLevel: LongInt; + function InfoDecompressedBitrate: LongInt; + function InfoFileVersion: LongInt; + function InfoFinalFrameBlocks: LongInt; + function InfoFormatFlags: LongInt; + function InfoFrameBitrate(FrameIndex: Integer): LongInt; + function InfoFrameBlocks(FrameIndex: Integer): LongInt; + function InfoFrameBytes(FrameIndex: Integer): LongInt; + function InfoIOSource: LongInt; + function InfoLengthMS: LongInt; + function InfoPeakLevel: LongInt; + function InfoSampleRate: LongInt; + function InfoSeekBit(FrameIndex: Integer): LongInt; + function InfoSeekByte(FrameIndex: Integer): LongInt; + function InfoTag: Pointer; + function InfoTerminatingData(Buffer: Pointer; + MaxBytes: Integer): LongInt; + function InfoTotalBlocks: LongInt; + function InfoTotalFrames: LongInt; + function InfoWavDataBytes: LongInt; + function InfoWaveFormatEx(var WaveFormatEx: TWaveFormatEx): LongInt; + function InfoWavHeaderBytes: LongInt; + function InfoWavHeaderData(Buffer: Pointer; + MaxBytes: Integer): LongInt; + function InfoWavTerminatingBytes: LongInt; + function InfoWavTotalBytes: LongInt; + published + property Handle: APE_DECOMPRESS_HANDLE read FHandle; + property Filename: string read FFilename; + end; + +implementation + +function macErrorExplanation(MACErrorCode: LongInt): string; +begin + case MACErrorCode of + 0: Result := 'OK'; + MAC_ERROR_IO_READ: Result := 'I/O read error'; + MAC_ERROR_IO_WRITE: Result := 'I/O write error'; + MAC_ERROR_INVALID_INPUT_FILE: Result := 'invalid input file'; + MAC_ERROR_INVALID_OUTPUT_FILE: Result := 'invalid output file'; + MAC_ERROR_INPUT_FILE_TOO_LARGE: Result := 'input file file too large'; + MAC_ERROR_INPUT_FILE_UNSUPPORTED_BIT_DEPTH: Result := 'input file unsupported bit depth'; + MAC_ERROR_INPUT_FILE_UNSUPPORTED_SAMPLE_RATE: Result := 'input file unsupported sample rate'; + MAC_ERROR_INPUT_FILE_UNSUPPORTED_CHANNEL_COUNT: Result := 'input file unsupported channel count'; + MAC_ERROR_INPUT_FILE_TOO_SMALL: Result := 'input file too small'; + MAC_ERROR_INVALID_CHECKSUM: Result := 'invalid checksum'; + MAC_ERROR_DECOMPRESSING_FRAME: Result := 'decompressing frame'; + MAC_ERROR_INITIALIZING_UNMAC: Result := 'initializing unmac'; + MAC_ERROR_INVALID_FUNCTION_PARAMETER: Result := 'invalid function parameter'; + MAC_ERROR_UNSUPPORTED_FILE_TYPE: Result := 'unsupported file type'; + MAC_ERROR_INSUFFICIENT_MEMORY: Result := 'insufficient memory'; + MAC_ERROR_LOADINGAPE_DLL: Result := 'loading MAC.dll'; + MAC_ERROR_LOADINGAPE_INFO_DLL: Result := 'loading MACinfo.dll'; + MAC_ERROR_LOADING_UNMAC_DLL: Result := 'loading UnMAC.dll'; + MAC_ERROR_USER_STOPPED_PROCESSING: Result := 'user stopped processing'; + MAC_ERROR_SKIPPED: Result := 'skipped...'; + MAC_ERROR_BAD_PARAMETER: Result := 'bad parameter'; + MAC_ERROR_APE_COMPRESS_TOO_MUCH_DATA: Result := 'APE compress too much data'; + else + Result := 'undefined (' + inttostr(MACErrorCode) + ')'; //MAC_ERROR_UNDEFINED + end; +end; + +function macMSToTime(MilliSeconds: LongInt): Double; +const + MS_PER_DAY = 24 * 60 * 60 * 1000; +begin + Result := MilliSeconds / MS_PER_DAY; +end; + +{ EAPEException } + +constructor EAPEException.Create(MacErrorCode: Integer); +begin + inherited Create('MACDll error: '+macErrorExplanation(MacErrorCode)); +end; + +//////////////////////////////////////////////////////////////////////////////// +// TAPECompress wrapper(s) +//////////////////////////////////////////////////////////////////////////////// + +{int __stdcall c_APECompress_AddData( +APE_COMPRESS_HANDLE hAPECompress, unsigned char * pData, int nBytes);} + +type + + c_APECompress_AddData_t = function( + hAPECompress: APE_COMPRESS_HANDLE; + pData: Pointer; + nBytes: Integer + ): LongInt; stdcall; + +// c_APECompress_Create; Index 14; Information not available +{APE_COMPRESS_HANDLE __stdcall c_APECompress_Create( +int * pErrorCode = NULL);} + + c_APECompress_Create_t = function( + var pErrorCode: Integer + ): APE_COMPRESS_HANDLE; stdcall; + +// c_APECompress_Destroy; Index 15; Information not available +{void __stdcall c_APECompress_Destroy( +APE_COMPRESS_HANDLE hAPECompress);} + + c_APECompress_Destroy_t = procedure( + hAPECompress: APE_COMPRESS_HANDLE + ); stdcall; + +// c_APECompress_Finish; Index 16; Information not available +{int __stdcall c_APECompress_Finish( +APE_COMPRESS_HANDLE hAPECompress, +unsigned char * pTerminatingData, +int nTerminatingBytes, +int nWAVTerminatingBytes);} + + c_APECompress_Finish_t = function( + hAPECompress: APE_COMPRESS_HANDLE; + pTerminatingData: Pointer; + nTerminatingBytes: Integer; + nWAVTerminatingBytes: Integer + ): LongInt; stdcall; + +// c_APECompress_GetBufferBytesAvailable; Index 17; Information not available +{int __stdcall c_APECompress_GetBufferBytesAvailable( +APE_COMPRESS_HANDLE hAPECompress);} + + c_APECompress_GetBufferBytesAvailable_t = function( + hAPECompress: APE_COMPRESS_HANDLE + ): LongInt; stdcall; + +// c_APECompress_Kill; Index 18; Information not available +{int __stdcall c_APECompress_Kill(APE_COMPRESS_HANDLE hAPECompress);} + + c_APECompress_Kill_t = function( + hAPECompress: APE_COMPRESS_HANDLE + ): LongInt; stdcall; + +// c_APECompress_LockBuffer; Index 19; Information not available +{unsigned char * __stdcall c_APECompress_LockBuffer( +APE_COMPRESS_HANDLE hAPECompress, int * pBytesAvailable);} + + c_APECompress_LockBuffer_t = function( + hAPECompress: APE_COMPRESS_HANDLE; + var BytesAvailable: Integer + ): Pointer; stdcall; + +// c_APECompress_Start; Index 20; Information not available +{int __stdcall c_APECompress_Start( +APE_COMPRESS_HANDLE hAPECompress, +const char * pOutputFilename, +const WAVEFORMATEX * pwfeInput, +int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, +int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, +const unsigned char * pHeaderData = NULL, +int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION);} + + c_APECompress_Start_t = function( + hAPECompress: APE_COMPRESS_HANDLE; + pOutputFilename: PChar; + pwfeInput: PWaveFormatEx; + nMaxAudioBytes: Integer = MAX_AUDIO_BYTES_UNKNOWN; + nCompressionLevel: Integer = COMPRESSION_LEVEL_NORMAL; + pHeaderData: Pointer = nil; + nHeaderBytes: Integer = CREATE_WAV_HEADER_ON_DECOMPRESSION + ): LongInt; stdcall; + +// c_APECompress_UnlockBuffer; Index 21; Information not available +{int __stdcall c_APECompress_UnlockBuffer( +APE_COMPRESS_HANDLE hAPECompress, +int nBytesAdded, +BOOL bProcess = TRUE);} + + c_APECompress_UnlockBuffer_t = function( + hAPECompress: APE_COMPRESS_HANDLE; + nBytesAdded: Integer; + bProcess: Boolean = True + ): LongInt; stdcall; + +var + + c_APECompress_AddData : c_APECompress_AddData_t; + c_APECompress_Create : c_APECompress_Create_t; + c_APECompress_Destroy : c_APECompress_Destroy_t; + c_APECompress_Finish : c_APECompress_Finish_t; + c_APECompress_GetBufferBytesAvailable : c_APECompress_GetBufferBytesAvailable_t; + c_APECompress_Kill : c_APECompress_Kill_t; + c_APECompress_LockBuffer : c_APECompress_LockBuffer_t; + c_APECompress_Start : c_APECompress_Start_t; + c_APECompress_UnlockBuffer : c_APECompress_UnlockBuffer_t; + + +//////////////////////////////////////////////////////////////////////////////// +// TAPECompress +//////////////////////////////////////////////////////////////////////////////// + +function TAPECompress.AddData(pData: Pointer; nBytes: Integer): LongInt; +begin + Result := c_APECompress_AddData(FHandle, pData, nBytes); +end; + +function TAPECompress.Kill: LongInt; +begin + Result := c_APECompress_Kill(FHandle); +end; + +function TAPECompress.Start(pOutputFilename: PChar; + pwfeInput: PWaveFormatEx; nMaxAudioBytes, nCompressionLevel: Integer; + pHeaderData: Pointer; nHeaderBytes: Integer): LongInt; +begin + Result := c_APECompress_Start(FHandle, pOutputFilename, + pwfeInput, nMaxAudioBytes, nCompressionLevel, + pHeaderData, nHeaderBytes); +end; + +constructor TAPECompress.Create; +begin + FHandle := c_APECompress_Create(ErrorCode); + if ErrorCode<>0 then + raise EAPEException.Create(ErrorCode); +end; + +destructor TAPECompress.Destroy; +begin + if FHandle<>0 then + c_APECompress_Destroy(FHandle); + inherited; +end; + +function TAPECompress.Finish(pTerminatingData: Pointer; nTerminatingBytes, + nWAVTerminatingBytes: Integer): LongInt; +begin + Result := c_APECompress_Finish(FHandle, pTerminatingData, + nTerminatingBytes, nWAVTerminatingBytes); +end; + +function TAPECompress.GetBufferBytesAvailable: LongInt; +begin + Result := c_APECompress_GetBufferBytesAvailable(FHandle); +end; + +function TAPECompress.LockBuffer(var pBytesAvailable: Integer): Pointer; +begin + Result := c_APECompress_LockBuffer(FHandle, pBytesAvailable); +end; + +function TAPECompress.UnlockBuffer(nBytesAdded: Integer; + bProcess: Boolean): LongInt; +begin + Result := c_APECompress_UnlockBuffer(FHandle, nBytesAdded); +end; + +//////////////////////////////////////////////////////////////////////////////// +// TAPEDecompress wrapper(s) +//////////////////////////////////////////////////////////////////////////////// + +// c_APEDecompress_Create; Index 22; Information not available + +type + c_APEDecompress_Create_t = function( + pFilename: PChar; + var pErrorCode: Integer + ): APE_DECOMPRESS_HANDLE; stdcall; + +// c_APEDecompress_Destroy; Index 23; Information not available + + c_APEDecompress_Destroy_t = procedure( + hAPEDecompress: APE_DECOMPRESS_HANDLE + ); stdcall; + +// c_APEDecompress_GetData; Index 24; Information not available +{ __declspec( dllexport ) int __stdcall c_APEDecompress_GetData( +APE_DECOMPRESS_HANDLE hAPEDecompress, char * pBuffer, int nBlocks, int * pBlocksRetrieved);} + + c_APEDecompress_GetData_t = function( + hAPEDecompress: APE_DECOMPRESS_HANDLE; + pBuffer: Pointer; + nBlocks: Integer; + var pBlocksRetrieved: Integer + ): LongInt; stdcall; + +// c_APEDecompress_GetInfo; Index 25; Information not available + + c_APEDecompress_GetInfo_t = function( + hAPEDecompress: APE_DECOMPRESS_HANDLE; + Field: APE_DECOMPRESS_FIELDS; + nParam1: Integer = 0; + nParam2: Integer = 0 + ): LongInt; stdcall; + +// c_APEDecompress_Seek; Index 26; Information not available +{__declspec(dllexport)int __stdcall c_APEDecompress_Seek( +APE_DECOMPRESS_HANDLE hAPEDecompress, int nBlockOffset);} + + c_APEDecompress_Seek_t = function( + hAPEDecompress: APE_DECOMPRESS_HANDLE; + nBlockOffset: Integer + ): LongInt; stdcall; + +var + + c_APEDecompress_Create : c_APEDecompress_Create_t; + c_APEDecompress_Destroy : c_APEDecompress_Destroy_t; + c_APEDecompress_GetData : c_APEDecompress_GetData_t; + c_APEDecompress_GetInfo : c_APEDecompress_GetInfo_t; + c_APEDecompress_Seek : c_APEDecompress_Seek_t; + +//////////////////////////////////////////////////////////////////////////////// +// TAPEDecompress +//////////////////////////////////////////////////////////////////////////////// + +constructor TAPEDecompress.Create(Filename: string); +begin + FFilename := Filename; + FHandle := c_APEDecompress_Create(PChar(FFilename), ErrorCode); + if ErrorCode<>0 then + raise EAPEException.Create(ErrorCode); +end; + +destructor TAPEDecompress.Destroy; +begin + if FHandle<>0 then + c_APEDecompress_Destroy(FHandle); + inherited; +end; + +function TAPEDecompress.GetData(pBuffer: Pointer; nBlocks: LongInt; + var pBlocksRetrieved: Integer): LongInt; +begin + Result := c_APEDecompress_GetData(FHandle, pBuffer, nBlocks, pBlocksRetrieved); +end; + +function TAPEDecompress.GetInfo(Field: APE_DECOMPRESS_FIELDS; nParam1, + nParam2: Integer): LongInt; +begin + Result := c_APEDecompress_GetInfo(FHandle, Field, nParam1, nParam2); +end; + +function TAPEDecompress.Seek(nBlockOffset: Integer): LongInt; +begin + Result := c_APEDecompress_Seek(FHandle, nBlockOffset); +end; + +// querying the information engine + +function TAPEDecompress.InfoFileVersion: LongInt; +// version of the APE file * 1000 (3.93 = 3930) [ignored, ignored] +begin // APE_INFO_FILE_VERSION = 1000; + Result := GetInfo(APE_INFO_FILE_VERSION); +end; + +function TAPEDecompress.InfoCompressionLevel: LongInt; +// compression level of the APE file [ignored, ignored] +begin // APE_INFO_COMPRESSION_LEVEL = 1001; + Result := GetInfo(APE_INFO_COMPRESSION_LEVEL); +end; + +function TAPEDecompress.InfoFormatFlags: LongInt; +// format flags of the APE file [ignored, ignored] +begin // APE_INFO_FORMAT_FLAGS = 1002; + Result := GetInfo(APE_INFO_FORMAT_FLAGS); +end; + +function TAPEDecompress.InfoSampleRate: LongInt; +// sample rate (Hz) [ignored, ignored] +begin // APE_INFO_SAMPLE_RATE = 1003; + Result := GetInfo(APE_INFO_SAMPLE_RATE); +end; + +function TAPEDecompress.InfoBitsPerSample: LongInt; +// bits per sample [ignored, ignored] +begin // APE_INFO_BITS_PER_SAMPLE = 1004; + Result := GetInfo(APE_INFO_BITS_PER_SAMPLE); +end; + +function TAPEDecompress.InfoBytesPerSample: LongInt; +// number of bytes per sample [ignored, ignored] +begin // APE_INFO_BYTES_PER_SAMPLE = 1005; + Result := GetInfo(APE_INFO_BYTES_PER_SAMPLE); +end; + +function TAPEDecompress.InfoChannels: LongInt; +// channels [ignored, ignored] +begin // APE_INFO_CHANNELS = 1006; + Result := GetInfo(APE_INFO_CHANNELS); +end; + +function TAPEDecompress.InfoBlockAlign: LongInt; +// block alignment [ignored, ignored] +begin // APE_INFO_BLOCK_ALIGN = 1007; + Result := GetInfo(APE_INFO_BLOCK_ALIGN); +end; + +function TAPEDecompress.InfoBlocksPerFrame: LongInt; +// number of blocks in a frame (frames are used internally) [ignored, ignored] +begin // APE_INFO_BLOCKS_PER_FRAME = 1008; + Result := GetInfo(APE_INFO_BLOCKS_PER_FRAME); +end; + +function TAPEDecompress.InfoFinalFrameBlocks: LongInt; +// blocks in the final frame (frames are used internally) [ignored, ignored] +begin // APE_INFO_FINAL_FRAME_BLOCKS = 1009; + Result := GetInfo(APE_INFO_FINAL_FRAME_BLOCKS); +end; + +function TAPEDecompress.InfoTotalFrames: LongInt; +begin // APE_INFO_TOTAL_FRAMES = 1010; +// total number frames (frames are used internally) [ignored, ignored] + Result := GetInfo(APE_INFO_TOTAL_FRAMES); +end; + +function TAPEDecompress.InfoWavHeaderBytes: LongInt; +// header bytes of the decompressed WAV [ignored, ignored] +begin // APE_INFO_WAV_HEADER_BYTES = 1011; + Result := GetInfo(APE_INFO_WAV_HEADER_BYTES); +end; + +function TAPEDecompress.InfoWavTerminatingBytes: LongInt; +// terminating bytes of the decompressed WAV [ignored, ignored] +begin // APE_INFO_WAV_TERMINATING_BYTES = 1012; + Result := GetInfo(APE_INFO_WAV_TERMINATING_BYTES); +end; + +function TAPEDecompress.InfoWavDataBytes: LongInt; +// data bytes of the decompressed WAV [ignored, ignored] +begin // APE_INFO_WAV_DATA_BYTES = 1013; + Result := GetInfo(APE_INFO_WAV_DATA_BYTES); +end; + +function TAPEDecompress.InfoWavTotalBytes: LongInt; +// total bytes of the decompressed WAV [ignored, ignored] +begin // APE_INFO_WAV_TOTAL_BYTES = 1014; + Result := GetInfo(APE_INFO_WAV_TOTAL_BYTES); +end; + +function TAPEDecompress.InfoApeTotalBytes: LongInt; +// total bytes of the APE file [ignored, ignored] +begin // APE_INFO_APE_TOTAL_BYTES = 1015; + Result := GetInfo(APE_INFO_APE_TOTAL_BYTES); +end; + +function TAPEDecompress.InfoTotalBlocks: LongInt; +// total blocks of audio data [ignored, ignored] +begin // APE_INFO_TOTAL_BLOCKS = 1016; + Result := GetInfo(APE_INFO_TOTAL_BLOCKS); +end; + +function TAPEDecompress.InfoLengthMS: LongInt; +// length in ms (1 sec = 1000 ms) [ignored, ignored] +begin // APE_INFO_LENGTH_MS = 1017; + Result := GetInfo(APE_INFO_LENGTH_MS); +end; + +function TAPEDecompress.InfoAverageBitrage: LongInt; +// average bitrate of the APE [ignored, ignored] +begin // APE_INFO_AVERAGE_BITRATE = 1018; + Result := GetInfo(APE_INFO_AVERAGE_BITRATE); +end; + +function TAPEDecompress.InfoFrameBitrate(FrameIndex: Integer): LongInt; +// bitrate of specified APE frame [frame index, ignored] +begin // APE_INFO_FRAME_BITRATE = 1019; + Result := GetInfo(APE_INFO_FRAME_BITRATE, FrameIndex); +end; + +function TAPEDecompress.InfoDecompressedBitrate: LongInt; +// bitrate of the decompressed WAV [ignored, ignored] +begin // APE_INFO_DECOMPRESSED_BITRATE = 1020; + Result := GetInfo(APE_INFO_DECOMPRESSED_BITRATE); +end; + +function TAPEDecompress.InfoPeakLevel: LongInt; +// peak audio level (-1 is unknown) [ignored, ignored] +begin // APE_INFO_PEAK_LEVEL = 1021; + Result := GetInfo(APE_INFO_PEAK_LEVEL); +end; + +function TAPEDecompress.InfoSeekBit(FrameIndex: Integer): LongInt; +// bit offset [frame index, ignored] +begin // APE_INFO_SEEK_BIT = 1022; + Result := GetInfo(APE_INFO_SEEK_BIT, FrameIndex); +end; + +function TAPEDecompress.InfoSeekByte(FrameIndex: Integer): LongInt; +// byte offset [frame index, ignored] +begin // APE_INFO_SEEK_BYTE = 1023; + Result := GetInfo(APE_INFO_SEEK_BYTE, FrameIndex); +end; + +function TAPEDecompress.InfoWavHeaderData(Buffer: Pointer; MaxBytes: Integer): LongInt; +// error code [buffer *, max bytes] +begin // APE_INFO_WAV_HEADER_DATA = 1024; + Result := GetInfo(APE_INFO_WAV_HEADER_DATA, Integer(Buffer), MaxBytes); +end; + +function TAPEDecompress.InfoTerminatingData(Buffer: Pointer; MaxBytes: Integer): LongInt; +// error code [buffer *, max bytes] +begin // APE_INFO_WAV_TERMINATING_DATA = 1025; + Result := GetInfo(APE_INFO_WAV_TERMINATING_DATA, Integer(Buffer), MaxBytes); +end; + +function TAPEDecompress.InfoWaveFormatEx(var WaveFormatEx: TWaveFormatEx): LongInt; +// error code [waveformatex *, ignored] +begin // APE_INFO_WAVEFORMATEX = 1026; + Result := GetInfo(APE_INFO_WAVEFORMATEX, Integer(@WaveFormatEx)); +end; + +function TAPEDecompress.InfoIOSource: LongInt; +// I/O source (CIO *) [ignored, ignored] +begin // APE_INFO_IO_SOURCE = 1027; + Result := GetInfo(APE_INFO_IO_SOURCE); +end; + +function TAPEDecompress.InfoFrameBytes(FrameIndex: Integer): LongInt; +// bytes (compressed) of the frame [frame index, ignored] +begin // APE_INFO_FRAME_BYTES = 1028; + Result := GetInfo(APE_INFO_SEEK_BYTE, FrameIndex); +end; + +function TAPEDecompress.InfoFrameBlocks(FrameIndex: Integer): LongInt; +// blocks in a given frame [frame index, ignored] +begin // APE_INFO_FRAME_BLOCKS = 1029; + Result := GetInfo(APE_INFO_FRAME_BLOCKS, FrameIndex); +end; + +function TAPEDecompress.InfoTag: Pointer; +// point to tag (CAPETag *) [ignored, ignored] +begin // APE_INFO_TAG = 1030; + Result := Pointer(GetInfo(APE_INFO_TAG)); +end; + +// querying the decompressor + +function TAPEDecompress.CurrentBlock: LongWord; +// current block location [ignored, ignored] +begin + Result := GetInfo(APE_DECOMPRESS_CURRENT_BLOCK); +end; + +function TAPEDecompress.CurrentMS: LongWord; +// current millisecond location [ignored, ignored] +begin + Result := GetInfo(APE_DECOMPRESS_CURRENT_MS); +end; + +function TAPEDecompress.TotalBlocks: LongWord; +// total blocks in the decompressors range [ignored, ignored] +begin + Result := GetInfo(APE_DECOMPRESS_TOTAL_BLOCKS); +end; + +function TAPEDecompress.LengthMS: LongWord; +// total blocks in the decompressors range [ignored, ignored] +begin + Result := GetInfo(APE_DECOMPRESS_LENGTH_MS); +end; + +function TAPEDecompress.CurrentBitrate: LongWord; +// current bitrate [ignored, ignored] +begin + Result := GetInfo(APE_DECOMPRESS_CURRENT_BITRATE); +end; + +function TAPEDecompress.AverageBitrate: LongWord; +// average bitrate (works with ranges) [ignored, ignored] +begin + Result := GetInfo(APE_DECOMPRESS_AVERAGE_BITRATE); +end; + +var + Libhandle : HMODULE; + +initialization + + Libhandle := LoadLibraryEx(MACPath, 0, 0); + if Libhandle <> 0 then + begin + MACLoaded := True; + macProgressCallback := GetProcAddress(Libhandle, 'ProgressCallback'); + macRemoveTag := GetProcAddress(Libhandle, 'RemoveTag'); + macCompressFile := GetProcAddress(Libhandle, 'CompressFile'); + macConvertFile := GetProcAddress(Libhandle, 'ConvertFile'); + macDecompressFile := GetProcAddress(Libhandle, 'DecompressFile'); + macFillWaveFormatEx := GetProcAddress(Libhandle, 'FillWaveFormatEx'); + macFillWaveHeader := GetProcAddress(Libhandle, 'FillWaveHeader'); + macGetID3Tag := GetProcAddress(Libhandle, 'GetID3Tag'); + macGetInterfaceCompatibility := GetProcAddress(Libhandle, 'GetInterfaceCompatibility'); + macGetVersionNumber := GetProcAddress(Libhandle, 'GetVersionNumber'); + macShowFileInfoDialog := GetProcAddress(Libhandle, 'ShowFileInfoDialog'); + macTagFileSimple := GetProcAddress(Libhandle, 'TagFileSimple'); + macVerifyFile := GetProcAddress(Libhandle, 'VerifyFile'); + c_APECompress_AddData := GetProcAddress(Libhandle, 'c_APECompress_AddData'); + c_APECompress_Create := GetProcAddress(Libhandle, 'c_APECompress_Create'); + c_APECompress_Destroy := GetProcAddress(Libhandle, 'c_APECompress_Destroy'); + c_APECompress_Finish := GetProcAddress(Libhandle, 'c_APECompress_Finish'); + c_APECompress_GetBufferBytesAvailable := GetProcAddress(Libhandle, 'c_APECompress_GetBufferBytesAvailable'); + c_APECompress_Kill := GetProcAddress(Libhandle, 'c_APECompress_Kill'); + c_APECompress_LockBuffer := GetProcAddress(Libhandle, 'c_APECompress_LockBuffer'); + c_APECompress_Start := GetProcAddress(Libhandle, 'c_APECompress_Start'); + c_APECompress_UnlockBuffer := GetProcAddress(Libhandle, 'c_APECompress_UnlockBuffer'); + c_APEDecompress_Create := GetProcAddress(Libhandle, 'c_APEDecompress_Create'); + c_APEDecompress_Destroy := GetProcAddress(Libhandle, 'c_APEDecompress_Destroy'); + c_APEDecompress_GetData := GetProcAddress(Libhandle, 'c_APEDecompress_GetData'); + c_APEDecompress_GetInfo := GetProcAddress(Libhandle, 'c_APEDecompress_GetInfo'); + c_APEDecompress_Seek := GetProcAddress(Libhandle, 'c_APEDecompress_Seek'); + end; + + finalization + if Libhandle <> 0 then FreeLibrary(Libhandle); + +end. + diff --git a/components/acs/Src/fileformats/windows/mad.pas b/components/acs/Src/fileformats/windows/mad.pas new file mode 100644 index 000000000..b918a32eb --- /dev/null +++ b/components/acs/Src/fileformats/windows/mad.pas @@ -0,0 +1,290 @@ +(* + this file is a part of audio components suite v 2.3 (delphi version). + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at acs@compiler4.net + this is the acs for delphi (windows) version of the unit. +*) + +{ +$Log: mad.pas,v $ +Revision 1.1 2005/12/19 18:36:49 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:53 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:02 z0m3ie +changed Headers to log +changed mail adress + +} + +unit mad; + +interface + +uses + +{$IFDEF WIN32} + Windows; +{$ENDIF} + +{$IFDEF LINUX} + Libc, ACS_Procs; +{$ENDIF} + + +const + +{$IFDEF WIN32} + MADLibPath = 'MADLib.dll'; +{$ENDIF} + +{$IFDEF LINUX} + MADLibPath = 'libmad.so*'; // libmad.so + {$DEFINE SEARCH_LIBS} +{$ENDIF} + + +var + + MADLibLoaded : Boolean = False; + +type + + mad_bitptr = packed record + b : PChar; + Cache, Left : Word; + end; + + mad_stream = packed record + buffer : Pointer; + bufend : Pointer; + skiplen : LongWord; + sync : Integer; + freerate : LongWord; + this_frame : Pointer; + next_frame : Pointer; + ptr : mad_bitptr; + anc_ptr : mad_bitptr; + anc_bitlen : LongWord; + main_data : Pointer; + md_len : LongWord; + options : Integer; + error : Integer; + end; + + p_mad_stream = ^mad_stream; + + mad_timer_t = packed record + seconds : Integer; + fraction : LongWord; + end; + + mad_header = packed record + layer : Integer; + mode : Integer; + mode_extension : Integer; + emphasis : Integer; + bitrate : LongWord; + samplerate : LongWord; + crc_check : Word; + crc_target : Word; + flags : Integer; + private_bits : Integer; + duration : mad_timer_t; + end; + + p_mad_header = ^mad_header; + + mad_frame = packed record + header : mad_header; + options : Integer; + sbsample : packed array[0..1, 0..35, 0..31] of Integer; + overlap : Pointer; + end; + + p_mad_frame = ^mad_frame; + + mad_pcm = packed record + samplerate : LongWord; + channels : Word; + length : Word; + samples : packed array [0..1, 0..1151] of Integer; + end; + + p_mad_pcm = ^mad_pcm; + + mad_synth = packed record + filter : array[0..1, 0..1, 0..1, 0..15, 0..7] of Integer; + phase : LongWord; + pcm : mad_pcm; + end; + + async_struct = packed record + pid : LongWord; + _in : Integer; + _out : Integer; + end; + + sync_struct = packed record + stream : mad_stream; + frame : mad_frame; + synth : mad_synth; + end; + + p_sync_struct = ^sync_struct; + + TInputFunc = function(CData : Pointer; Stream : p_mad_stream) : Integer; cdecl; + THeaderFunc = function(CData : Pointer; Header : p_mad_header) : Integer; cdecl; + TFilterFunc = function(CData : Pointer; Frame : p_mad_frame) : Integer; cdecl; + TOutputFunc = function(CData : Pointer; Header : p_mad_header; pcm : p_mad_pcm) : Integer; cdecl; + TErrorFunc = function(CData : Pointer; Stream : p_mad_stream; Frame : p_mad_frame) : Integer; cdecl; + TMessageFunc = function(P1, P2 : Pointer; var l : LongWord) : Integer; cdecl; + + mad_decoder = packed record + mode : Integer; + options : Integer; + async : async_struct; + sync : p_sync_struct; + data : Pointer; + InputFunc : TInputFunc; + HeaderFunc : THeaderFunc; + FilterFunc : TFilterFunc; + OutputFunc : TOutputFunc; + ErrorFunc : TErrorFunc; + MessageFunc : TMessageFunc; + end; + + p_mad_decoder = ^mad_decoder; + +const + + MAD_F_FRACBITS = 28; + MAD_F_ONE = $10000000; + + MAD_FLOW_CONTINUE = $0; + MAD_FLOW_STOP = $10; + MAD_FLOW_BREAK = $11; + MAD_FLOW_IGNORE = $20; + + MAD_DECODER_MODE_SYNC = 0; + MAD_DECODER_MODE_ASYNC = 1; + +type + + mad_decoder_init_t = procedure(mad_decoder : p_mad_decoder; CData : Pointer; + InputFunc : TInputFunc; + HeaderFunc : THeaderFunc; + FilterFunc : TFilterFunc; + OutputFunc : TOutputFunc; + ErrorFunc : TErrorFunc; + MessageFunc : TMessageFunc); cdecl; + + mad_decoder_finish_t = function(mad_decoder : p_mad_decoder) : Integer; cdecl; + + mad_decoder_run_t = function(mad_decoder : p_mad_decoder; mad_decoder_mode : Integer) : Integer; cdecl; + + mad_decoder_message_t = function(mad_decoder : p_mad_decoder; P : Pointer; var l : LongWord) : Integer; cdecl; + + mad_stream_buffer_t = procedure(MadStream : p_mad_stream; Data : Pointer; l : LongWord); cdecl; + + mad_stream_skip_t = procedure(MadStream : p_mad_stream; Skip : LongWord); cdecl; + + mad_stream_sync_t = function(MadStream : p_mad_stream) : Integer; cdecl; + +var + + mad_decoder_init: mad_decoder_init_t; + mad_decoder_finish : mad_decoder_finish_t; + mad_decoder_run : mad_decoder_run_t; + mad_decoder_message : mad_decoder_message_t; + mad_stream_buffer : mad_stream_buffer_t; + mad_stream_skip : mad_stream_skip_t; + mad_stream_sync : mad_stream_sync_t; + +implementation + + +{$IFDEF WIN32} + +var + Libhandle : HMODULE; + +initialization + + Libhandle := LoadLibraryEx(MADLibPath, 0, 0); + + if Libhandle <> 0 then + begin + MADLibLoaded := True; + + mad_decoder_init := GetProcAddress(Libhandle, 'mad_decoder_init'); + mad_decoder_finish := GetProcAddress(Libhandle, 'mad_decoder_finish'); + mad_decoder_run := GetProcAddress(Libhandle, 'mad_decoder_run'); + mad_decoder_message := GetProcAddress(Libhandle, 'mad_decoder_message'); + mad_stream_buffer := GetProcAddress(Libhandle, 'mad_stream_buffer'); + mad_stream_skip := GetProcAddress(Libhandle, 'mad_stream_skip'); + mad_stream_sync := GetProcAddress(Libhandle, 'mad_stream_sync'); + + end; + +finalization + + if Libhandle <> 0 then FreeLibrary(Libhandle); + + {$ENDIF} + + {$IFDEF LINUX} + +var + Libhandle : Pointer; + +{$IFDEF SEARCH_LIBS} + Path : String; +{$ENDIF} + +initialization + +{$IFDEF SEARCH_LIBS} + + Libhandle := nil; + Path := FindLibs(MADLibPath); + if Path <> '' then Libhandle := dlopen(@Path[1], RTLD_NOW or RTLD_GLOBAL); + +{$ELSE} + + Libhandle := dlopen(MADLibPath, RTLD_NOW or RTLD_GLOBAL); + +{$ENDIF} + + if Libhandle <> nil then + begin + + MADLibLoaded := True; + + mad_decoder_init := dlsym(Libhandle, 'mad_decoder_init'); + mad_decoder_finish := dlsym(Libhandle, 'mad_decoder_finish'); + mad_decoder_run := dlsym(Libhandle, 'mad_decoder_run'); + mad_decoder_message := dlsym(Libhandle, 'mad_decoder_message'); + mad_stream_buffer := dlsym(Libhandle, 'mad_stream_buffer'); + mad_stream_skip := dlsym(Libhandle, 'mad_stream_skip'); + mad_stream_sync := dlsym(Libhandle, 'mad_stream_sync'); + + end; + +finalization + + if Libhandle <> nil then dlclose(Libhandle); + + {$ENDIF} + + +end. diff --git a/components/acs/Src/fileformats/windows/msacm.pas b/components/acs/Src/fileformats/windows/msacm.pas new file mode 100644 index 000000000..be9178d62 --- /dev/null +++ b/components/acs/Src/fileformats/windows/msacm.pas @@ -0,0 +1,1411 @@ +{******************************************************************} +{ } +{ borland delphi runtime library } +{ microsoft audio compression manager interface unit } +{ } +{ portions created by microsoft are } +{ copyright (c) 1995-1999 microsoft corporation. } +{ all rights reserved. } +{ } +{ the original file is: msacm.h, released 9 march 1999. } +{ the original pascal code is: msacm.pas, released 21 july 1999. } +{ the initial developer of the pascal code is francois piette } +{ francois.piette@swing.be, http://www.rtfm.be/fpiette/indexuk.htm } +{ rue de grady 24, 4053 embourg, belgium } +{ } +{ portions created by francois piette are } +{ copyright (c) 1999 francois piette. } +{ } +{ contributor(s): marcel van brakel (brakelm@bart.nl) } +{ } +{ obtained through: } +{ joint endeavour of delphi innovators (project jedi) } +{ } +{ you may retrieve the latest version of this file at the project } +{ jedi home page, located at http://delphi-jedi.org } +{ } +{ the contents of this file are used with permission, subject to } +{ the mozilla public license version 1.1 (the "license"); you may } +{ not use this file except in compliance with the license. you may } +{ obtain a copy of the license at } +{ http://www.mozilla.org/npl/npl-1_1final.html } +{ } +{ software distributed under the license is distributed on an } +{ "as is" basis, without warranty of any kind, either express or } +{ implied. see the license for the specific language governing } +{ rights and limitations under the license. } +{ } +{******************************************************************} + +unit msacm; + +{$WEAKPACKAGEUNIT} + +interface + +{$HPPEMIT ''} +{$HPPEMIT '#include "MSAcm.h"'} +{$HPPEMIT ''} + +uses + Windows, MMSystem; + +type + PWaveFilter = ^TWaveFilter; + // Defined in mmreg.h + WAVEFILTER = packed record + cbStruct: DWORD; // Size of the filter in bytes + dwFilterTag: DWORD; // filter type + fdwFilter: DWORD; // Flags for the filter (Universal Dfns) + dwReserved: array [0..4] of DWORD; // Reserved for system use + end; + TWaveFilter = WAVEFILTER; + +const + DRV_MAPPER_PREFERRED_INPUT_GET = DRV_USER + 0; + {$EXTERNALSYM DRV_MAPPER_PREFERRED_INPUT_GET} + DRV_MAPPER_PREFERRED_OUTPUT_GET = DRV_USER + 2; + {$EXTERNALSYM DRV_MAPPER_PREFERRED_OUTPUT_GET} + DRVM_MAPPER_STATUS = $2000; + {$EXTERNALSYM DRVM_MAPPER_STATUS} + WIDM_MAPPER_STATUS = DRVM_MAPPER_STATUS + 0; + {$EXTERNALSYM WIDM_MAPPER_STATUS} + WAVEIN_MAPPER_STATUS_DEVICE = 0; + {$EXTERNALSYM WAVEIN_MAPPER_STATUS_DEVICE} + WAVEIN_MAPPER_STATUS_MAPPED = 1; + {$EXTERNALSYM WAVEIN_MAPPER_STATUS_MAPPED} + WAVEIN_MAPPER_STATUS_FORMAT = 2; + {$EXTERNALSYM WAVEIN_MAPPER_STATUS_FORMAT} + WODM_MAPPER_STATUS = DRVM_MAPPER_STATUS + 0; + {$EXTERNALSYM WODM_MAPPER_STATUS} + WAVEOUT_MAPPER_STATUS_DEVICE = 0; + {$EXTERNALSYM WAVEOUT_MAPPER_STATUS_DEVICE} + WAVEOUT_MAPPER_STATUS_MAPPED = 1; + {$EXTERNALSYM WAVEOUT_MAPPER_STATUS_MAPPED} + WAVEOUT_MAPPER_STATUS_FORMAT = 2; + {$EXTERNALSYM WAVEOUT_MAPPER_STATUS_FORMAT} + +//-------------------------------------------------------------------------- +// +// ACM General API's and Defines +// +//-------------------------------------------------------------------------- + +// there are four types of 'handles' used by the ACM. the first three +// are unique types that define specific objects: +// +// HACMDRIVERID: used to _identify_ an ACM driver. this identifier can be +// used to _open_ the driver for querying details, etc about the driver. +// +// HACMDRIVER: used to manage a driver (codec, filter, etc). this handle +// is much like a handle to other media drivers--you use it to send +// messages to the converter, query for capabilities, etc. +// +// HACMSTREAM: used to manage a 'stream' (conversion channel) with the +// ACM. you use a stream handle to convert data from one format/type +// to another--much like dealing with a file handle. +// +// +// the fourth handle type is a generic type used on ACM functions that +// can accept two or more of the above handle types (for example the +// acmMetrics and acmDriverID functions). +// +// HACMOBJ: used to identify ACM objects. this handle is used on functions +// that can accept two or more ACM handle types. + +type + HACMDRIVERID__ = record + Unused: Integer; + end; + {$EXTERNALSYM HACMDRIVERID__} + HACMDRIVERID = ^HACMDRIVERID__; + {$EXTERNALSYM HACMDRIVERID} + PHACMDRIVERID = ^HACMDRIVERID; + {$EXTERNALSYM PHACMDRIVERID} + LPHACMDRIVERID = ^HACMDRIVERID; + {$EXTERNALSYM LPHACMDRIVERID} + + HACMDRIVER__ = record + Unused: Integer; + end; + {$EXTERNALSYM HACMDRIVER__} + HACMDRIVER = ^HACMDRIVER__; + {$EXTERNALSYM HACMDRIVER} + PHACMDRIVER = ^HACMDRIVER; + {$EXTERNALSYM PHACMDRIVER} + LPHACMDRIVER = ^HACMDRIVER; + {$EXTERNALSYM LPHACMDRIVER} + + HACMSTREAM__ = record + Unused: Integer; + end; + {$EXTERNALSYM HACMSTREAM__} + HACMSTREAM = ^HACMSTREAM__; + {$EXTERNALSYM HACMSTREAM} + PHACMSTREAM = ^HACMSTREAM; + {$EXTERNALSYM PHACMSTREAM} + LPHACMSTREAM = ^HACMSTREAM; + {$EXTERNALSYM LPHACMSTREAM} + + HACMOBJ__ = record + Unused: Integer; + end; + {$EXTERNALSYM HACMOBJ__} + HACMOBJ = ^HACMOBJ__; + {$EXTERNALSYM HACMOBJ} + PHACMOBJ = ^HACMOBJ; + {$EXTERNALSYM PHACMOBJ} + LPHACMOBJ = ^HACMOBJ; + {$EXTERNALSYM LPHACMOBJ} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// +// ACM Error Codes +// +// Note that these error codes are specific errors that apply to the ACM +// directly--general errors are defined as MMSYSERR_*. +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +type + MMRESULT = UINT; + {$EXTERNALSYM MMRESULT} + +const + ACMERR_BASE = 512; + {$EXTERNALSYM ACMERR_BASE} + ACMERR_NOTPOSSIBLE = (ACMERR_BASE + 0); + {$EXTERNALSYM ACMERR_NOTPOSSIBLE} + ACMERR_BUSY = (ACMERR_BASE + 1); + {$EXTERNALSYM ACMERR_BUSY} + ACMERR_UNPREPARED = (ACMERR_BASE + 2); + {$EXTERNALSYM ACMERR_UNPREPARED} + ACMERR_CANCELED = (ACMERR_BASE + 3); + {$EXTERNALSYM ACMERR_CANCELED} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// +// ACM Window Messages +// +// These window messages are sent by the ACM or ACM drivers to notify +// applications of events. +// +// Note that these window message numbers will also be defined in +// mmsystem. +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +const + MM_ACM_OPEN = MM_STREAM_OPEN; // conversion callback messages + {$EXTERNALSYM MM_ACM_OPEN} + MM_ACM_CLOSE = MM_STREAM_CLOSE; + {$EXTERNALSYM MM_ACM_CLOSE} + MM_ACM_DONE = MM_STREAM_DONE; + {$EXTERNALSYM MM_ACM_DONE} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// +// acmGetVersion() +// +// the ACM version is a 32 bit number that is broken into three parts as +// follows: +// +// bits 24 - 31: 8 bit _major_ version number +// bits 16 - 23: 8 bit _minor_ version number +// bits 0 - 15: 16 bit build number +// +// this is then displayed as follows: +// +// bMajor = (BYTE)(dwVersion >> 24) +// bMinor = (BYTE)(dwVersion >> 16) & +// wBuild = LOWORD(dwVersion) +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +function acmGetVersion: DWORD; stdcall; +{$EXTERNALSYM acmGetVersion} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmMetrics() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +function acmMetrics(hao: HACMOBJ; uMetric: UINT; var pMetric): MMRESULT; stdcall; +{$EXTERNALSYM acmMetrics} + +const + ACM_METRIC_COUNT_DRIVERS = 1; + {$EXTERNALSYM ACM_METRIC_COUNT_DRIVERS} + ACM_METRIC_COUNT_CODECS = 2; + {$EXTERNALSYM ACM_METRIC_COUNT_CODECS} + ACM_METRIC_COUNT_CONVERTERS = 3; + {$EXTERNALSYM ACM_METRIC_COUNT_CONVERTERS} + ACM_METRIC_COUNT_FILTERS = 4; + {$EXTERNALSYM ACM_METRIC_COUNT_FILTERS} + ACM_METRIC_COUNT_DISABLED = 5; + {$EXTERNALSYM ACM_METRIC_COUNT_DISABLED} + ACM_METRIC_COUNT_HARDWARE = 6; + {$EXTERNALSYM ACM_METRIC_COUNT_HARDWARE} + ACM_METRIC_COUNT_LOCAL_DRIVERS = 20; + {$EXTERNALSYM ACM_METRIC_COUNT_LOCAL_DRIVERS} + ACM_METRIC_COUNT_LOCAL_CODECS = 21; + {$EXTERNALSYM ACM_METRIC_COUNT_LOCAL_CODECS} + ACM_METRIC_COUNT_LOCAL_CONVERTERS = 22; + {$EXTERNALSYM ACM_METRIC_COUNT_LOCAL_CONVERTERS} + ACM_METRIC_COUNT_LOCAL_FILTERS = 23; + {$EXTERNALSYM ACM_METRIC_COUNT_LOCAL_FILTERS} + ACM_METRIC_COUNT_LOCAL_DISABLED = 24; + {$EXTERNALSYM ACM_METRIC_COUNT_LOCAL_DISABLED} + ACM_METRIC_HARDWARE_WAVE_INPUT = 30; + {$EXTERNALSYM ACM_METRIC_HARDWARE_WAVE_INPUT} + ACM_METRIC_HARDWARE_WAVE_OUTPUT = 31; + {$EXTERNALSYM ACM_METRIC_HARDWARE_WAVE_OUTPUT} + ACM_METRIC_MAX_SIZE_FORMAT = 50; + {$EXTERNALSYM ACM_METRIC_MAX_SIZE_FORMAT} + ACM_METRIC_MAX_SIZE_FILTER = 51; + {$EXTERNALSYM ACM_METRIC_MAX_SIZE_FILTER} + ACM_METRIC_DRIVER_SUPPORT = 100; + {$EXTERNALSYM ACM_METRIC_DRIVER_SUPPORT} + ACM_METRIC_DRIVER_PRIORITY = 101; + {$EXTERNALSYM ACM_METRIC_DRIVER_PRIORITY} + +//--------------------------------------------------------------------------; +// +// ACM Drivers +// +//--------------------------------------------------------------------------; + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmDriverEnum() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +type + ACMDRIVERENUMCB = function (hadif: HACMDRIVERID; dwInstance, fdwSupport: DWORD): BOOL; stdcall; + {$EXTERNALSYM ACMDRIVERENUMCB} + +function acmDriverEnum(fnCallback: ACMDRIVERENUMCB; dwInstance: DWORD; + fdwEnum: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmDriverEnum} + +const + ACM_DRIVERENUMF_NOLOCAL = $40000000; + {$EXTERNALSYM ACM_DRIVERENUMF_NOLOCAL} + ACM_DRIVERENUMF_DISABLED = $80000000; + {$EXTERNALSYM ACM_DRIVERENUMF_DISABLED} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmDriverID() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +function acmDriverID(hao: HACMOBJ; var phadid: HACMDRIVERID; fdwDriverID: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmDriverID} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmDriverAdd() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +function acmDriverAddA(var phadid: HACMDRIVERID; hinstModule: HINST; Param: LPARAM; + dwPriority: DWORD; fdwAdd: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmDriverAddA} +function acmDriverAddW(var phadid: HACMDRIVERID; hinstModule: HINST; Param: LPARAM; + dwPriority: DWORD; fdwAdd: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmDriverAddW} +function acmDriverAdd(var phadid: HACMDRIVERID; hinstModule: HINST; Param: LPARAM; + dwPriority: DWORD; fdwAdd: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmDriverAdd} + +const + ACM_DRIVERADDF_FUNCTION = $00000003; // lParam is a procedure + {$EXTERNALSYM ACM_DRIVERADDF_FUNCTION} + ACM_DRIVERADDF_NOTIFYHWND = $00000004; // lParam is notify hwnd + {$EXTERNALSYM ACM_DRIVERADDF_NOTIFYHWND} + ACM_DRIVERADDF_TYPEMASK = $00000007; // driver type mask + {$EXTERNALSYM ACM_DRIVERADDF_TYPEMASK} + ACM_DRIVERADDF_LOCAL = $00000000; // is local to current task + {$EXTERNALSYM ACM_DRIVERADDF_LOCAL} + ACM_DRIVERADDF_GLOBAL = $00000008; // is global + {$EXTERNALSYM ACM_DRIVERADDF_GLOBAL} + +// +// prototype for ACM driver procedures that are installed as _functions_ +// or _notifations_ instead of as a standalone installable driver. +// +type + ACMDRIVERPROC = function (dwID: DWORD; hdrvr: HACMDRIVERID; uMsg: UINT; + lParam1: LPARAM; lParam2: LPARAM) : LRESULT; stdcall; + {$EXTERNALSYM ACMDRIVERPROC} + LPACMDRIVERPROC = ^ACMDRIVERPROC; + {$EXTERNALSYM LPACMDRIVERPROC} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmDriverRemove() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +function acmDriverRemove(hadid: HACMDRIVERID; fdwRemove: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmDriverRemove} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmDriverOpen() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +function acmDriverOpen(var phad: HACMDRIVER; hadid: HACMDRIVERID; fdwOpen: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmDriverOpen} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmDriverClose() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +function acmDriverClose(had: HACMDRIVER; fdwClose: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmDriverClose} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmDriverMessage() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +function acmDriverMessage(had: HACMDRIVER; uMsg: UINT; Param1, Param2: LPARAM): LRESULT; stdcall; +{$EXTERNALSYM acmDriverMessage} + +const + ACMDM_USER = DRV_USER + $0000; + {$EXTERNALSYM ACMDM_USER} + ACMDM_RESERVED_LOW = DRV_USER + $2000; + {$EXTERNALSYM ACMDM_RESERVED_LOW} + ACMDM_RESERVED_HIGH = DRV_USER + $2FFF; + {$EXTERNALSYM ACMDM_RESERVED_HIGH} + + ACMDM_BASE = ACMDM_RESERVED_LOW; + {$EXTERNALSYM ACMDM_BASE} + + ACMDM_DRIVER_ABOUT = ACMDM_BASE + 11; + {$EXTERNALSYM ACMDM_DRIVER_ABOUT} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmDriverPriority +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +function acmDriverPriority(hadid: HACMDRIVERID; dwPriority, fdwPriority: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmDriverPriority} + +const + ACM_DRIVERPRIORITYF_ENABLE = $00000001; + {$EXTERNALSYM ACM_DRIVERPRIORITYF_ENABLE} + ACM_DRIVERPRIORITYF_DISABLE = $00000002; + {$EXTERNALSYM ACM_DRIVERPRIORITYF_DISABLE} + ACM_DRIVERPRIORITYF_ABLEMASK = $00000003; + {$EXTERNALSYM ACM_DRIVERPRIORITYF_ABLEMASK} + ACM_DRIVERPRIORITYF_BEGIN = $00010000; + {$EXTERNALSYM ACM_DRIVERPRIORITYF_BEGIN} + ACM_DRIVERPRIORITYF_END = $00020000; + {$EXTERNALSYM ACM_DRIVERPRIORITYF_END} + ACM_DRIVERPRIORITYF_DEFERMASK = $00030000; + {$EXTERNALSYM ACM_DRIVERPRIORITYF_DEFERMASK} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmDriverDetails() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +// +// ACMDRIVERDETAILS +// +// the ACMDRIVERDETAILS structure is used to get various capabilities from +// an ACM driver (codec, converter, filter). +// + +const + ACMDRIVERDETAILS_SHORTNAME_CHARS = 32; + {$EXTERNALSYM ACMDRIVERDETAILS_SHORTNAME_CHARS} + ACMDRIVERDETAILS_LONGNAME_CHARS = 128; + {$EXTERNALSYM ACMDRIVERDETAILS_LONGNAME_CHARS} + ACMDRIVERDETAILS_COPYRIGHT_CHARS = 80; + {$EXTERNALSYM ACMDRIVERDETAILS_COPYRIGHT_CHARS} + ACMDRIVERDETAILS_LICENSING_CHARS = 128; + {$EXTERNALSYM ACMDRIVERDETAILS_LICENSING_CHARS} + ACMDRIVERDETAILS_FEATURES_CHARS = 512; + {$EXTERNALSYM ACMDRIVERDETAILS_FEATURES_CHARS} + +type + PAcmDriverDetailsA = ^TAcmDriverDetailsA; + PAcmDriverDetailsW = ^TAcmDriverDetailsW; + PAcmDriverDetails = PAcmDriverDetailsA; + _ACMDRIVERDETAILSA = packed record + cbStruct: DWORD; + fccType: FOURCC; + fccComp: FOURCC; + wMid: Word; + wPid: Word; + vdwACM: DWORD; + vdwDriver: DWORD; + fdwSupport: DWORD; + cFormatTags: DWORD; + cFilterTags: DWORD; + hicon: HICON; + szShortName: array [0..ACMDRIVERDETAILS_SHORTNAME_CHARS - 1] of AnsiChar; + szLongName: array [0..ACMDRIVERDETAILS_LONGNAME_CHARS - 1] of AnsiChar; + szCopyright: array [0..ACMDRIVERDETAILS_COPYRIGHT_CHARS - 1] of AnsiChar; + szLicensing: array [0..ACMDRIVERDETAILS_LICENSING_CHARS - 1] of AnsiChar; + szFeatures: array [0..ACMDRIVERDETAILS_FEATURES_CHARS - 1] of AnsiChar; + end; + {$EXTERNALSYM _ACMDRIVERDETAILSA} + _ACMDRIVERDETAILSW = packed record + cbStruct: DWORD; + fccType: FOURCC; + fccComp: FOURCC; + wMid: Word; + wPid: Word; + vdwACM: DWORD; + vdwDriver: DWORD; + fdwSupport: DWORD; + cFormatTags: DWORD; + cFilterTags: DWORD; + hicon: HICON; + szShortName: array [0..ACMDRIVERDETAILS_SHORTNAME_CHARS - 1] of WideChar; + szLongName: array [0..ACMDRIVERDETAILS_LONGNAME_CHARS - 1] of WideChar; + szCopyright: array [0..ACMDRIVERDETAILS_COPYRIGHT_CHARS - 1] of WideChar; + szLicensing: array [0..ACMDRIVERDETAILS_LICENSING_CHARS - 1] of WideChar; + szFeatures: array [0..ACMDRIVERDETAILS_FEATURES_CHARS - 1] of WideChar; + end; + {$EXTERNALSYM _ACMDRIVERDETAILSW} + _ACMDRIVERDETAILS = _ACMDRIVERDETAILSA; + TAcmDriverDetailsA = _ACMDRIVERDETAILSA; + TAcmDriverDetailsW = _ACMDRIVERDETAILSW; + TAcmDriverDetails = TAcmDriverDetailsA; + +// +// ACMDRIVERDETAILS.fccType +// +// ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC: the FOURCC used in the fccType +// field of the ACMDRIVERDETAILS structure to specify that this is an ACM +// codec designed for audio. +// +// +// ACMDRIVERDETAILS.fccComp +// +// ACMDRIVERDETAILS_FCCCOMP_UNDEFINED: the FOURCC used in the fccComp +// field of the ACMDRIVERDETAILS structure. this is currently an unused +// field. +// + +const + ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC = $63647561; // 'audc'; + {$EXTERNALSYM ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC} + ACMDRIVERDETAILS_FCCCOMP_UNDEFINED = 0; // '0000'; + {$EXTERNALSYM ACMDRIVERDETAILS_FCCCOMP_UNDEFINED} + +// +// the following flags are used to specify the type of conversion(s) that +// the converter/codec/filter supports. these are placed in the fdwSupport +// field of the ACMDRIVERDETAILS structure. note that a converter can +// support one or more of these flags in any combination. +// +// ACMDRIVERDETAILS_SUPPORTF_CODEC: this flag is set if the driver supports +// conversions from one format tag to another format tag. for example, if a +// converter compresses WAVE_FORMAT_PCM to WAVE_FORMAT_ADPCM, then this bit +// should be set. +// +// ACMDRIVERDETAILS_SUPPORTF_CONVERTER: this flags is set if the driver +// supports conversions on the same format tag. as an example, the PCM +// converter that is built into the ACM sets this bit (and only this bit) +// because it converts only PCM formats (bits, sample rate). +// +// ACMDRIVERDETAILS_SUPPORTF_FILTER: this flag is set if the driver supports +// transformations on a single format. for example, a converter that changed +// the 'volume' of PCM data would set this bit. 'echo' and 'reverb' are +// also filter types. +// +// ACMDRIVERDETAILS_SUPPORTF_HARDWARE: this flag is set if the driver supports +// hardware input and/or output through a waveform device. +// +// ACMDRIVERDETAILS_SUPPORTF_ASYNC: this flag is set if the driver supports +// async conversions. +// +// +// ACMDRIVERDETAILS_SUPPORTF_LOCAL: this flag is set _by the ACM_ if a +// driver has been installed local to the current task. this flag is also +// set in the fdwSupport argument to the enumeration callback function +// for drivers. +// +// ACMDRIVERDETAILS_SUPPORTF_DISABLED: this flag is set _by the ACM_ if a +// driver has been disabled. this flag is also passed set in the fdwSupport +// argument to the enumeration callback function for drivers. +// + +const + ACMDRIVERDETAILS_SUPPORTF_CODEC = $00000001; + {$EXTERNALSYM ACMDRIVERDETAILS_SUPPORTF_CODEC} + ACMDRIVERDETAILS_SUPPORTF_CONVERTER = $00000002; + {$EXTERNALSYM ACMDRIVERDETAILS_SUPPORTF_CONVERTER} + ACMDRIVERDETAILS_SUPPORTF_FILTER = $00000004; + {$EXTERNALSYM ACMDRIVERDETAILS_SUPPORTF_FILTER} + ACMDRIVERDETAILS_SUPPORTF_HARDWARE = $00000008; + {$EXTERNALSYM ACMDRIVERDETAILS_SUPPORTF_HARDWARE} + ACMDRIVERDETAILS_SUPPORTF_ASYNC = $00000010; + {$EXTERNALSYM ACMDRIVERDETAILS_SUPPORTF_ASYNC} + ACMDRIVERDETAILS_SUPPORTF_LOCAL = $40000000; + {$EXTERNALSYM ACMDRIVERDETAILS_SUPPORTF_LOCAL} + ACMDRIVERDETAILS_SUPPORTF_DISABLED = $80000000; + {$EXTERNALSYM ACMDRIVERDETAILS_SUPPORTF_DISABLED} + +function acmDriverDetailsA(hadid: HACMDRIVERID; var padd: TAcmDriverDetailsA; + fdwDetails: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmDriverDetailsA} +function acmDriverDetailsW(hadid: HACMDRIVERID; var padd: TAcmDriverDetailsW; + fdwDetails: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmDriverDetailsW} +function acmDriverDetails(hadid: HACMDRIVERID; var padd: TAcmDriverDetails; + fdwDetails: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmDriverDetails} + +//--------------------------------------------------------------------------; +// +// ACM Format Tags +// +//--------------------------------------------------------------------------; + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmFormatTagDetails() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +const + ACMFORMATTAGDETAILS_FORMATTAG_CHARS = 48; + {$EXTERNALSYM ACMFORMATTAGDETAILS_FORMATTAG_CHARS} + +type + PAcmFormatTagDetailsA = ^TAcmFormatTagDetailsA; + PAcmFormatTagDetailsW = ^TAcmFormatTagDetailsW; + PAcmFormatTagDetails = PAcmFormatTagDetailsA; + _ACMFORMATTAGDETAILSA = packed record + cbStruct: DWORD; + dwFormatTagIndex: DWORD; + dwFormatTag: DWORD; + cbFormatSize: DWORD; + fdwSupport: DWORD; + cStandardFormats: DWORD; + szFormatTag: array [0..ACMFORMATTAGDETAILS_FORMATTAG_CHARS - 1] of AnsiChar; + end; + {$EXTERNALSYM _ACMFORMATTAGDETAILSA} + _ACMFORMATTAGDETAILSW = packed record + cbStruct: DWORD; + dwFormatTagIndex: DWORD; + dwFormatTag: DWORD; + cbFormatSize: DWORD; + fdwSupport: DWORD; + cStandardFormats: DWORD; + szFormatTag: array [0..ACMFORMATTAGDETAILS_FORMATTAG_CHARS - 1] of WideChar; + end; + {$EXTERNALSYM _ACMFORMATTAGDETAILSW} + _ACMFORMATTAGDETAILS = _ACMFORMATTAGDETAILSA; + TAcmFormatTagDetailsA = _ACMFORMATTAGDETAILSA; + TAcmFormatTagDetailsW = _ACMFORMATTAGDETAILSW; + TAcmFormatTagDetails = TAcmFormatTagDetailsA; + +function acmFormatTagDetailsA(had: HACMDRIVER; var paftd: TAcmFormatTagDetailsA; + fdwDetails: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFormatTagDetailsA} +function acmFormatTagDetailsW(had: HACMDRIVER; var paftd: TAcmFormatTagDetailsW; + fdwDetails: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFormatTagDetailsW} +function acmFormatTagDetails(had: HACMDRIVER; var paftd: TAcmFormatTagDetails; + fdwDetails: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFormatTagDetails} + +const + ACM_FORMATTAGDETAILSF_INDEX = $00000000; + {$EXTERNALSYM ACM_FORMATTAGDETAILSF_INDEX} + ACM_FORMATTAGDETAILSF_FORMATTAG = $00000001; + {$EXTERNALSYM ACM_FORMATTAGDETAILSF_FORMATTAG} + ACM_FORMATTAGDETAILSF_LARGESTSIZE = $00000002; + {$EXTERNALSYM ACM_FORMATTAGDETAILSF_LARGESTSIZE} + ACM_FORMATTAGDETAILSF_QUERYMASK = $0000000F; + {$EXTERNALSYM ACM_FORMATTAGDETAILSF_QUERYMASK} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmFormatTagEnum() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +type + ACMFORMATTAGENUMCBA = function (hadid: HACMDRIVERID; paftd: PAcmFormatTagDetailsA; + dwInstance: DWORD; fdwSupport: DWORD): BOOL; stdcall; + {$EXTERNALSYM ACMFORMATTAGENUMCBA} + ACMFORMATTAGENUMCBW = function (hadid: HACMDRIVERID; paftd: PAcmFormatTagDetailsW; + dwInstance: DWORD; fdwSupport: DWORD): BOOL; stdcall; + {$EXTERNALSYM ACMFORMATTAGENUMCBW} + ACMFORMATTAGENUMCB = ACMFORMATTAGENUMCBA; + +function acmFormatTagEnumA(had: HACMDRIVER; var paftd: TAcmFormatTagDetailsA; + fnCallback: ACMFORMATTAGENUMCBA; dwInstance: DWORD; fdwEnum: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFormatTagEnumA} +function acmFormatTagEnumW(had: HACMDRIVER; var paftd: TAcmFormatTagDetailsW; + fnCallback: ACMFORMATTAGENUMCBW; dwInstance: DWORD; fdwEnum: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFormatTagEnumW} +function acmFormatTagEnum(had: HACMDRIVER; var paftd: TAcmFormatTagDetails; + fnCallback: ACMFORMATTAGENUMCB; dwInstance: DWORD; fdwEnum: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFormatTagEnum} + +//--------------------------------------------------------------------------; +// +// ACM Formats +// +//--------------------------------------------------------------------------; + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmFormatDetails() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +const + ACMFORMATDETAILS_FORMAT_CHARS = 128; + {$EXTERNALSYM ACMFORMATDETAILS_FORMAT_CHARS} + +type + PAcmFormatDetailsA = ^TAcmFormatDetailsA; + PAcmFormatDetailsW = ^TAcmFormatDetailsW; + PAcmFormatDetails = PAcmFormatDetailsA; + _ACMFORMATDETAILSA = packed record + cbStruct: DWORD; + dwFormatIndex: DWORD; + dwFormatTag: DWORD; + fdwSupport: DWORD; + pwfx: PWAVEFORMATEX; + cbwfx: DWORD; + szFormat: array [0..ACMFORMATDETAILS_FORMAT_CHARS - 1] of AnsiChar; + end; + {$EXTERNALSYM _ACMFORMATDETAILSA} + _ACMFORMATDETAILSW = packed record + cbStruct: DWORD; + dwFormatIndex: DWORD; + dwFormatTag: DWORD; + fdwSupport: DWORD; + pwfx: PWAVEFORMATEX; + cbwfx: DWORD; + szFormat: array [0..ACMFORMATDETAILS_FORMAT_CHARS - 1] of WideChar; + end; + {$EXTERNALSYM _ACMFORMATDETAILSW} + _ACMFORMATDETAILS = _ACMFORMATDETAILSA; + TAcmFormatDetailsA = _ACMFORMATDETAILSA; + TAcmFormatDetailsW = _ACMFORMATDETAILSW; + TAcmFormatDetails = TAcmFormatDetailsA; + +function acmFormatDetailsA(had: HACMDRIVER; var pafd: TAcmFormatDetailsA; + fdwDetails: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFormatDetailsA} +function acmFormatDetailsW(had: HACMDRIVER; var pafd: TAcmFormatDetailsW; + fdwDetails: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFormatDetailsW} +function acmFormatDetails(had: HACMDRIVER; var pafd: TAcmFormatDetails; + fdwDetails: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFormatDetails} + +const + ACM_FORMATDETAILSF_INDEX = $00000000; + {$EXTERNALSYM ACM_FORMATDETAILSF_INDEX} + ACM_FORMATDETAILSF_FORMAT = $00000001; + {$EXTERNALSYM ACM_FORMATDETAILSF_FORMAT} + ACM_FORMATDETAILSF_QUERYMASK = $0000000F; + {$EXTERNALSYM ACM_FORMATDETAILSF_QUERYMASK} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmFormatEnum() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +type + ACMFORMATENUMCBA = function (hadid:HACMDRIVERID; pafd: PAcmFormatDetailsA; + dwInstance: DWORD; fdwSupport: DWORD): BOOL; stdcall; + {$EXTERNALSYM ACMFORMATENUMCBA} + ACMFORMATENUMCBW = function (hadid:HACMDRIVERID; pafd: PAcmFormatDetailsW; + dwInstance: DWORD; fdwSupport: DWORD): BOOL; stdcall; + {$EXTERNALSYM ACMFORMATENUMCBW} + ACMFORMATENUMCB = ACMFORMATENUMCBA; + +function acmFormatEnumA(had: HACMDRIVER; var pafd: TAcmFormatDetailsA; + fnCallback: ACMFORMATENUMCBA; dwInstance, fdwEnum: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFormatEnumA} +function acmFormatEnumW(had: HACMDRIVER; var pafd: TAcmFormatDetailsW; + fnCallback: ACMFORMATENUMCBW; dwInstance, fdwEnum: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFormatEnumW} +function acmFormatEnum(had: HACMDRIVER; var pafd: TAcmFormatDetails; + fnCallback: ACMFORMATENUMCB; dwInstance, fdwEnum: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFormatEnum} + +const + ACM_FORMATENUMF_WFORMATTAG = $00010000; + {$EXTERNALSYM ACM_FORMATENUMF_WFORMATTAG} + ACM_FORMATENUMF_NCHANNELS = $00020000; + {$EXTERNALSYM ACM_FORMATENUMF_NCHANNELS} + ACM_FORMATENUMF_NSAMPLESPERSEC = $00040000; + {$EXTERNALSYM ACM_FORMATENUMF_NSAMPLESPERSEC} + ACM_FORMATENUMF_WBITSPERSAMPLE = $00080000; + {$EXTERNALSYM ACM_FORMATENUMF_WBITSPERSAMPLE} + ACM_FORMATENUMF_CONVERT = $00100000; + {$EXTERNALSYM ACM_FORMATENUMF_CONVERT} + ACM_FORMATENUMF_SUGGEST = $00200000; + {$EXTERNALSYM ACM_FORMATENUMF_SUGGEST} + ACM_FORMATENUMF_HARDWARE = $00400000; + {$EXTERNALSYM ACM_FORMATENUMF_HARDWARE} + ACM_FORMATENUMF_INPUT = $00800000; + {$EXTERNALSYM ACM_FORMATENUMF_INPUT} + ACM_FORMATENUMF_OUTPUT = $01000000; + {$EXTERNALSYM ACM_FORMATENUMF_OUTPUT} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmFormatSuggest() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +function acmFormatSuggest(had: HACMDRIVER; var pwfxSrc: TWAVEFORMATEX; + var pwfxDst: TWAVEFORMATEX; cbwfxDst: DWORD; fdwSuggest: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFormatSuggest} + +const + ACM_FORMATSUGGESTF_WFORMATTAG = $00010000; + {$EXTERNALSYM ACM_FORMATSUGGESTF_WFORMATTAG} + ACM_FORMATSUGGESTF_NCHANNELS = $00020000; + {$EXTERNALSYM ACM_FORMATSUGGESTF_NCHANNELS} + ACM_FORMATSUGGESTF_NSAMPLESPERSEC = $00040000; + {$EXTERNALSYM ACM_FORMATSUGGESTF_NSAMPLESPERSEC} + ACM_FORMATSUGGESTF_WBITSPERSAMPLE = $00080000; + {$EXTERNALSYM ACM_FORMATSUGGESTF_WBITSPERSAMPLE} + + ACM_FORMATSUGGESTF_TYPEMASK = $00FF0000; + {$EXTERNALSYM ACM_FORMATSUGGESTF_TYPEMASK} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmFormatChoose() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +const + ACMHELPMSGSTRINGA = 'acmchoose_help'; + {$EXTERNALSYM ACMHELPMSGSTRINGA} + ACMHELPMSGSTRINGW = 'acmchoose_help'; + {$EXTERNALSYM ACMHELPMSGSTRINGW} + ACMHELPMSGSTRING = ACMHELPMSGSTRINGA; + ACMHELPMSGCONTEXTMENUA = 'acmchoose_contextmenu'; + {$EXTERNALSYM ACMHELPMSGCONTEXTMENUA} + ACMHELPMSGCONTEXTMENUW = 'acmchoose_contextmenu'; + {$EXTERNALSYM ACMHELPMSGCONTEXTMENUW} + ACMHELPMSGCONTEXTMENU = ACMHELPMSGCONTEXTMENUA; + ACMHELPMSGCONTEXTHELPA = 'acmchoose_contexthelp'; + {$EXTERNALSYM ACMHELPMSGCONTEXTHELPA} + ACMHELPMSGCONTEXTHELPW = 'acmchoose_contexthelp'; + {$EXTERNALSYM ACMHELPMSGCONTEXTHELPW} + ACMHELPMSGCONTEXTHELP = ACMHELPMSGCONTEXTHELPA; + +// +// MM_ACM_FORMATCHOOSE is sent to hook callbacks by the Format Chooser +// Dialog... +// + +const + MM_ACM_FORMATCHOOSE = $8000; + {$EXTERNALSYM MM_ACM_FORMATCHOOSE} + + FORMATCHOOSE_MESSAGE = 0; + {$EXTERNALSYM FORMATCHOOSE_MESSAGE} + FORMATCHOOSE_FORMATTAG_VERIFY = FORMATCHOOSE_MESSAGE + 0; + {$EXTERNALSYM FORMATCHOOSE_FORMATTAG_VERIFY} + FORMATCHOOSE_FORMAT_VERIFY = FORMATCHOOSE_MESSAGE + 1; + {$EXTERNALSYM FORMATCHOOSE_FORMAT_VERIFY} + FORMATCHOOSE_CUSTOM_VERIFY = FORMATCHOOSE_MESSAGE + 2; + {$EXTERNALSYM FORMATCHOOSE_CUSTOM_VERIFY} + +type + ACMFORMATCHOOSEHOOKPROCA = function (hwnd: HWND; uMsg: UINT; wParam: WPARAM; + lParam: LPARAM): UINT; stdcall; + {$EXTERNALSYM ACMFORMATCHOOSEHOOKPROCA} + ACMFORMATCHOOSEHOOKPROCW = function (hwnd: HWND; uMsg: UINT; wParam: WPARAM; + lParam: LPARAM): UINT; stdcall; + {$EXTERNALSYM ACMFORMATCHOOSEHOOKPROCW} + ACMFORMATCHOOSEHOOKPROC = ACMFORMATCHOOSEHOOKPROCA; + + PAcmFormatChooseA = ^TAcmFormatChooseA; + PAcmFormatChooseW = ^TAcmFormatChooseW; + PAcmFormatChoose = PAcmFormatChooseA; + _ACMFORMATCHOOSEA = packed record + cbStruct: DWORD; + fdwStyle: DWORD; + hwndOwner: HWND; + pwfx: PWAVEFORMATEX; + cbwfx: DWORD; + pszTitle: PAnsiChar; + szFormatTag: array [0..ACMFORMATTAGDETAILS_FORMATTAG_CHARS-1] of AnsiChar; + szFormat: array [0..ACMFORMATDETAILS_FORMAT_CHARS-1] of AnsiChar; + pszName: PAnsiChar; + cchName: DWORD; + fdwEnum: DWORD; + pwfxEnum: PWAVEFORMATEX; + hInstance: HINST; + pszTemplateName: PAnsiChar; + lCustData: LPARAM; + pfnHook: ACMFORMATCHOOSEHOOKPROCA; + end; + {$EXTERNALSYM _ACMFORMATCHOOSEA} + _ACMFORMATCHOOSEW = packed record + cbStruct: DWORD; + fdwStyle: DWORD; + hwndOwner: HWND; + pwfx: PWAVEFORMATEX; + cbwfx: DWORD; + pszTitle: PWideChar; + szFormatTag: array [0..ACMFORMATTAGDETAILS_FORMATTAG_CHARS-1] of WideChar; + szFormat: array [0..ACMFORMATDETAILS_FORMAT_CHARS-1] of WideChar; + pszName: PWideChar; + cchName: DWORD; + fdwEnum: DWORD; + pwfxEnum: PWAVEFORMATEX; + hInstance: HINST; + pszTemplateName: PWideChar; + lCustData: LPARAM; + pfnHook: ACMFORMATCHOOSEHOOKPROCW; + end; + {$EXTERNALSYM _ACMFORMATCHOOSEW} + _ACMFORMATCHOOSE = _ACMFORMATCHOOSEA; + TAcmFormatChooseA = _ACMFORMATCHOOSEA; + TAcmFormatChooseW = _ACMFORMATCHOOSEW; + TAcmFormatChoose = TAcmFormatChooseA; + +// +// ACMFORMATCHOOSE.fdwStyle +// + +const + ACMFORMATCHOOSE_STYLEF_SHOWHELP = $00000004; + {$EXTERNALSYM ACMFORMATCHOOSE_STYLEF_SHOWHELP} + ACMFORMATCHOOSE_STYLEF_ENABLEHOOK = $00000008; + {$EXTERNALSYM ACMFORMATCHOOSE_STYLEF_ENABLEHOOK} + ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE = $00000010; + {$EXTERNALSYM ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE} + ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE = $00000020; + {$EXTERNALSYM ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE} + ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT = $00000040; + {$EXTERNALSYM ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT} + ACMFORMATCHOOSE_STYLEF_CONTEXTHELP = $00000080; + {$EXTERNALSYM ACMFORMATCHOOSE_STYLEF_CONTEXTHELP} + +function acmFormatChooseA(var pafmtc: TAcmFormatChooseA): MMRESULT; stdcall; +{$EXTERNALSYM acmFormatChooseA} +function acmFormatChooseW(var pafmtc: TAcmFormatChooseW): MMRESULT; stdcall; +{$EXTERNALSYM acmFormatChooseW} +function acmFormatChoose(var pafmtc: TAcmFormatChoose): MMRESULT; stdcall; +{$EXTERNALSYM acmFormatChoose} + +//--------------------------------------------------------------------------; +// +// ACM Filter Tags +// +//--------------------------------------------------------------------------; + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmFilterTagDetails() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +const + ACMFILTERTAGDETAILS_FILTERTAG_CHARS = 48; + {$EXTERNALSYM ACMFILTERTAGDETAILS_FILTERTAG_CHARS} + +type + PAcmFilterTagDetailsA = ^TAcmFilterTagDetailsA; + PAcmFilterTagDetailsW = ^TAcmFilterTagDetailsW; + PAcmFilterTagDetails = PAcmFilterTagDetailsA; + _ACMFILTERTAGDETAILSA = packed record + cbStruct: DWORD; + dwFilterTagIndex: DWORD; + dwFilterTag: DWORD; + cbFilterSize: DWORD; + fdwSupport: DWORD; + cStandardFilters: DWORD; + szFilterTag: array [0..ACMFILTERTAGDETAILS_FILTERTAG_CHARS-1] of AnsiChar; + end; + {$EXTERNALSYM _ACMFILTERTAGDETAILSA} + _ACMFILTERTAGDETAILSW = packed record + cbStruct: DWORD; + dwFilterTagIndex: DWORD; + dwFilterTag: DWORD; + cbFilterSize: DWORD; + fdwSupport: DWORD; + cStandardFilters: DWORD; + szFilterTag: array [0..ACMFILTERTAGDETAILS_FILTERTAG_CHARS-1] of WideChar; + end; + {$EXTERNALSYM _ACMFILTERTAGDETAILSW} + _ACMFILTERTAGDETAILS = _ACMFILTERTAGDETAILSA; + TAcmFilterTagDetailsA = _ACMFILTERTAGDETAILSA; + TAcmFilterTagDetailsW = _ACMFILTERTAGDETAILSW; + TAcmFilterTagDetails = TAcmFilterTagDetailsA; + +function acmFilterTagDetailsA(had: HACMDRIVER; var paftd: TAcmFilterTagDetailsA; + fdwDetails: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFilterTagDetailsA} +function acmFilterTagDetailsW(had: HACMDRIVER; var paftd: TAcmFilterTagDetailsW; + fdwDetails: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFilterTagDetailsW} +function acmFilterTagDetails(had: HACMDRIVER; var paftd: TAcmFilterTagDetails; + fdwDetails: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFilterTagDetails} + +const + ACM_FILTERTAGDETAILSF_INDEX = $00000000; + {$EXTERNALSYM ACM_FILTERTAGDETAILSF_INDEX} + ACM_FILTERTAGDETAILSF_FILTERTAG = $00000001; + {$EXTERNALSYM ACM_FILTERTAGDETAILSF_FILTERTAG} + ACM_FILTERTAGDETAILSF_LARGESTSIZE = $00000002; + {$EXTERNALSYM ACM_FILTERTAGDETAILSF_LARGESTSIZE} + ACM_FILTERTAGDETAILSF_QUERYMASK = $0000000F; + {$EXTERNALSYM ACM_FILTERTAGDETAILSF_QUERYMASK} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmFilterTagEnum() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +type + ACMFILTERTAGENUMCBA = function (hadid: HACMDRIVERID; paftd: PAcmFilterTagDetailsA; + dwInstance: DWORD; fdwSupport: DWORD) : BOOL; stdcall; + {$EXTERNALSYM ACMFILTERTAGENUMCBA} + ACMFILTERTAGENUMCBW = function (hadid: HACMDRIVERID; paftd: PAcmFilterTagDetailsW; + dwInstance: DWORD; fdwSupport: DWORD) : BOOL; stdcall; + {$EXTERNALSYM ACMFILTERTAGENUMCBW} + ACMFILTERTAGENUMCB = ACMFILTERTAGENUMCBA; + +function acmFilterTagEnumA(had: HACMDRIVER; var paftd: TAcmFilterTagDetailsA; + fnCallback: ACMFILTERTAGENUMCBA; dwInstance: DWORD; fdwEnum: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFilterTagEnumA} +function acmFilterTagEnumW(had: HACMDRIVER; var paftd: TAcmFilterTagDetailsW; + fnCallback: ACMFILTERTAGENUMCBW; dwInstance: DWORD; fdwEnum: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFilterTagEnumW} +function acmFilterTagEnum(had: HACMDRIVER; var paftd: TAcmFilterTagDetails; + fnCallback: ACMFILTERTAGENUMCB; dwInstance: DWORD; fdwEnum: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFilterTagEnum} + +//--------------------------------------------------------------------------; +// +// ACM Filters +// +//--------------------------------------------------------------------------; + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmFilterDetails() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +const + ACMFILTERDETAILS_FILTER_CHARS = 128; + {$EXTERNALSYM ACMFILTERDETAILS_FILTER_CHARS} + +type + PAcmFilterDetailsA = ^TAcmFilterDetailsA; + PAcmFilterDetailsW = ^TAcmFilterDetailsW; + PAcmFilterDetails = PAcmFilterDetailsA; + _ACMFILTERDETAILSA = packed record + cbStruct: DWORD; + dwFilterIndex: DWORD; + dwFilterTag: DWORD; + fdwSupport: DWORD; + pwfltr: PWAVEFILTER; + cbwfltr: DWORD; + szFilter: array [0..ACMFILTERDETAILS_FILTER_CHARS - 1] of AnsiChar; + end; + {$EXTERNALSYM _ACMFILTERDETAILSA} + _ACMFILTERDETAILSW = packed record + cbStruct: DWORD; + dwFilterIndex: DWORD; + dwFilterTag: DWORD; + fdwSupport: DWORD; + pwfltr: PWAVEFILTER; + cbwfltr: DWORD; + szFilter: array [0..ACMFILTERDETAILS_FILTER_CHARS - 1] of WideChar; + end; + {$EXTERNALSYM _ACMFILTERDETAILSW} + _ACMFILTERDETAILS = _ACMFILTERDETAILSA; + TAcmFilterDetailsA = _ACMFILTERDETAILSA; + TAcmFilterDetailsW = _ACMFILTERDETAILSW; + TAcmFilterDetails = TAcmFilterDetailsA; + +function acmFilterDetailsA(had: HACMDRIVER; var pafd: TAcmFilterDetailsA; + fdwDetails: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFilterDetailsA} +function acmFilterDetailsW(had: HACMDRIVER; var pafd: TAcmFilterDetailsW; + fdwDetails: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFilterDetailsW} +function acmFilterDetails(had: HACMDRIVER; var pafd: TAcmFilterDetails; + fdwDetails: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFilterDetails} + +const + ACM_FILTERDETAILSF_INDEX = $00000000; + {$EXTERNALSYM ACM_FILTERDETAILSF_INDEX} + ACM_FILTERDETAILSF_FILTER = $00000001; + {$EXTERNALSYM ACM_FILTERDETAILSF_FILTER} + ACM_FILTERDETAILSF_QUERYMASK = $0000000F; + {$EXTERNALSYM ACM_FILTERDETAILSF_QUERYMASK} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmFilterEnum() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +type + ACMFILTERENUMCBA = function (hadid: HACMDRIVERID; pafd: PAcmFilterDetailsA; + dwInstance: DWORD; fdwSupport: DWORD) : BOOL; stdcall; + ACMFILTERENUMCBW = function (hadid: HACMDRIVERID; pafd: PAcmFilterDetailsW; + dwInstance: DWORD; fdwSupport: DWORD) : BOOL; stdcall; + ACMFILTERENUMCB = ACMFILTERENUMCBA; + +function acmFilterEnumA(had: HACMDRIVER; var pafd: TAcmFilterDetailsA; + fnCallback: ACMFILTERENUMCBA; dwInstance: DWORD; fdwEnum: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFilterEnumA} +function acmFilterEnumW(had: HACMDRIVER; var pafd: TAcmFilterDetailsW; + fnCallback: ACMFILTERENUMCBW; dwInstance: DWORD; fdwEnum: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFilterEnumW} +function acmFilterEnum(had: HACMDRIVER; var pafd: TAcmFilterDetails; + fnCallback: ACMFILTERENUMCB; dwInstance: DWORD; fdwEnum: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmFilterEnum} + +const + ACM_FILTERENUMF_DWFILTERTAG = $00010000; + {$EXTERNALSYM ACM_FILTERENUMF_DWFILTERTAG} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmFilterChoose() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +// +// MM_ACM_FILTERCHOOSE is sent to hook callbacks by the Filter Chooser +// Dialog... +// + +const + MM_ACM_FILTERCHOOSE = $8000; + {$EXTERNALSYM MM_ACM_FILTERCHOOSE} + + FILTERCHOOSE_MESSAGE = 0; + {$EXTERNALSYM FILTERCHOOSE_MESSAGE} + FILTERCHOOSE_FILTERTAG_VERIFY = FILTERCHOOSE_MESSAGE + 0; + {$EXTERNALSYM FILTERCHOOSE_FILTERTAG_VERIFY} + FILTERCHOOSE_FILTER_VERIFY = FILTERCHOOSE_MESSAGE + 1; + {$EXTERNALSYM FILTERCHOOSE_FILTER_VERIFY} + FILTERCHOOSE_CUSTOM_VERIFY = FILTERCHOOSE_MESSAGE + 2; + {$EXTERNALSYM FILTERCHOOSE_CUSTOM_VERIFY} + +type + ACMFILTERCHOOSEHOOKPROCA = function (hwd: HWND; uMsg: UINT; wParam: WPARAM; + lParam: LPARAM): UINT; stdcall; + {$EXTERNALSYM ACMFILTERCHOOSEHOOKPROCA} + ACMFILTERCHOOSEHOOKPROCW = function (hwd: HWND; uMsg: UINT; wParam: WPARAM; + lParam: LPARAM): UINT; stdcall; + {$EXTERNALSYM ACMFILTERCHOOSEHOOKPROCW} + ACMFILTERCHOOSEHOOKPROC = ACMFILTERCHOOSEHOOKPROCA; + +// +// ACMFILTERCHOOSE +// +// + +type + PAcmFilterChooseA = ^TAcmFilterChooseA; + PAcmFilterChooseW = ^TAcmFilterChooseW; + PAcmFilterChoose = PAcmFilterChooseA; + _ACMFILTERCHOOSEA = packed record + cbStruct: DWORD; + fdwStyle: DWORD; + hwndOwner: HWND; + pwfltr: PWAVEFILTER; + cbwfltr: DWORD; + pszTitle: PAnsiChar; + szFilterTag: array [0..ACMFILTERTAGDETAILS_FILTERTAG_CHARS - 1] of AnsiChar; + szFilter: array [0..ACMFILTERDETAILS_FILTER_CHARS - 1] of AnsiChar; + pszName: PAnsiChar; + cchName: DWORD; + fdwEnum: DWORD; + pwfltrEnum: PWAVEFILTER; + hInstance: HINST; + pszTemplateName: PAnsiChar; + lCustData: LPARAM; + pfnHook: ACMFILTERCHOOSEHOOKPROCA; + end; + {$EXTERNALSYM _ACMFILTERCHOOSEA} + _ACMFILTERCHOOSEW = packed record + cbStruct: DWORD; + fdwStyle: DWORD; + hwndOwner: HWND; + pwfltr: PWAVEFILTER; + cbwfltr: DWORD; + pszTitle: PWideChar; + szFilterTag: array [0..ACMFILTERTAGDETAILS_FILTERTAG_CHARS - 1] of WideChar; + szFilter: array [0..ACMFILTERDETAILS_FILTER_CHARS - 1] of WideChar; + pszName: PWideChar; + cchName: DWORD; + fdwEnum: DWORD; + pwfltrEnum: PWAVEFILTER; + hInstance: HINST; + pszTemplateName: PWideChar; + lCustData: LPARAM; + pfnHook: ACMFILTERCHOOSEHOOKPROCW; + end; + {$EXTERNALSYM _ACMFILTERCHOOSEW} + _ACMFILTERCHOOSE = _ACMFILTERCHOOSEA; + TAcmFilterChooseA = _ACMFILTERCHOOSEA; + TAcmFilterChooseW = _ACMFILTERCHOOSEW; + TAcmFilterChoose = TAcmFilterChooseA; + +// +// ACMFILTERCHOOSE.fdwStyle +// + +const + ACMFILTERCHOOSE_STYLEF_SHOWHELP = $00000004; + {$EXTERNALSYM ACMFILTERCHOOSE_STYLEF_SHOWHELP} + ACMFILTERCHOOSE_STYLEF_ENABLEHOOK = $00000008; + {$EXTERNALSYM ACMFILTERCHOOSE_STYLEF_ENABLEHOOK} + ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATE = $00000010; + {$EXTERNALSYM ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATE} + ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATEHANDLE = $00000020; + {$EXTERNALSYM ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATEHANDLE} + ACMFILTERCHOOSE_STYLEF_INITTOFILTERSTRUCT = $00000040; + {$EXTERNALSYM ACMFILTERCHOOSE_STYLEF_INITTOFILTERSTRUCT} + ACMFILTERCHOOSE_STYLEF_CONTEXTHELP = $00000080; + {$EXTERNALSYM ACMFILTERCHOOSE_STYLEF_CONTEXTHELP} + +function acmFilterChooseA(var pafltrc: TAcmFilterChooseA): MMRESULT; stdcall; +{$EXTERNALSYM acmFilterChooseA} +function acmFilterChooseW(var pafltrc: TAcmFilterChooseW): MMRESULT; stdcall; +{$EXTERNALSYM acmFilterChooseW} +function acmFilterChoose(var pafltrc: TAcmFilterChoose): MMRESULT; stdcall; +{$EXTERNALSYM acmFilterChoose} + +//--------------------------------------------------------------------------; +// +// ACM Stream API's +// +//--------------------------------------------------------------------------; + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmStreamOpen() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +type + PAcmStreamHeader = ^TAcmStreamHeader; + ACMSTREAMHEADER = packed record + cbStruct: DWORD; + fdwStatus: DWORD; + dwUser: DWORD; + pbSrc: PBYTE; + cbSrcLength: DWORD; + cbSrcLengthUsed: DWORD; + dwSrcUser: DWORD; + pbDst: PBYTE; + cbDstLength: DWORD; + cbDstLengthUsed: DWORD; + dwDstUser: DWORD; + dwReservedDriver: array [0..10 - 1] of DWORD; + end; + {$EXTERNALSYM tACMSTREAMHEADER} + TAcmStreamHeader = ACMSTREAMHEADER; + +// +// ACMSTREAMHEADER.fdwStatus +// +// ACMSTREAMHEADER_STATUSF_DONE: done bit for async conversions. +// + +const + ACMSTREAMHEADER_STATUSF_DONE = $00010000; + {$EXTERNALSYM ACMSTREAMHEADER_STATUSF_DONE} + ACMSTREAMHEADER_STATUSF_PREPARED = $00020000; + {$EXTERNALSYM ACMSTREAMHEADER_STATUSF_PREPARED} + ACMSTREAMHEADER_STATUSF_INQUEUE = $00100000; + {$EXTERNALSYM ACMSTREAMHEADER_STATUSF_INQUEUE} + +function acmStreamOpen(var phas: HACMSTREAM; had: HACMDRIVER; var pwfxSrc: TWAVEFORMATEX; + var pwfxDst: TWAVEFORMATEX; pwfltr: PWAVEFILTER; dwCallback: DWORD; dwInstance: DWORD; + fdwOpen: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmStreamOpen} + +const + ACM_STREAMOPENF_QUERY = $00000001; + {$EXTERNALSYM ACM_STREAMOPENF_QUERY} + ACM_STREAMOPENF_ASYNC = $00000002; + {$EXTERNALSYM ACM_STREAMOPENF_ASYNC} + ACM_STREAMOPENF_NONREALTIME = $00000004; + {$EXTERNALSYM ACM_STREAMOPENF_NONREALTIME} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmStreamClose() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +function acmStreamClose(has: HACMSTREAM; fdwClose: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmStreamClose} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmStreamSize() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +function acmStreamSize(has: HACMSTREAM; cbInput: DWORD; var pdwOutputBytes: DWORD; + fdwSize: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmStreamSize} + +const + ACM_STREAMSIZEF_SOURCE = $00000000; + {$EXTERNALSYM ACM_STREAMSIZEF_SOURCE} + ACM_STREAMSIZEF_DESTINATION = $00000001; + {$EXTERNALSYM ACM_STREAMSIZEF_DESTINATION} + ACM_STREAMSIZEF_QUERYMASK = $0000000F; + {$EXTERNALSYM ACM_STREAMSIZEF_QUERYMASK} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmStreamReset() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +function acmStreamReset(has: HACMSTREAM; fdwReset: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmStreamReset} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmStreamMessage() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +function acmStreamMessage(has: HACMSTREAM; uMsg: UINT; var lParam1: LPARAM; + var lParam2: LPARAM): MMRESULT; stdcall; +{$EXTERNALSYM acmStreamMessage} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmStreamConvert() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +function acmStreamConvert(has: HACMSTREAM; var pash: TAcmStreamHeader; + fdwConvert: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmStreamConvert} + +const + ACM_STREAMCONVERTF_BLOCKALIGN = $00000004; + {$EXTERNALSYM ACM_STREAMCONVERTF_BLOCKALIGN} + ACM_STREAMCONVERTF_START = $00000010; + {$EXTERNALSYM ACM_STREAMCONVERTF_START} + ACM_STREAMCONVERTF_END = $00000020; + {$EXTERNALSYM ACM_STREAMCONVERTF_END} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmStreamPrepareHeader() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +function acmStreamPrepareHeader(has: HACMSTREAM; var pash: TAcmStreamHeader; + fdwPrepare: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmStreamPrepareHeader} + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +// +// acmStreamUnprepareHeader() +// +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; + +function acmStreamUnprepareHeader(has: HACMSTREAM; var pash: TAcmStreamHeader; + fdwUnprepare: DWORD): MMRESULT; stdcall; +{$EXTERNALSYM acmStreamUnprepareHeader} + +implementation + +const + msacm32 = 'msacm32.dll'; + +function acmGetVersion; external msacm32 name 'acmGetVersion'; +function acmMetrics; external msacm32 name 'acmMetrics'; +function acmDriverEnum; external msacm32 name 'acmDriverEnum'; +function acmDriverID; external msacm32 name 'acmDriverID'; +function acmDriverAddA; external msacm32 name 'acmDriverAddA'; +function acmDriverAddW; external msacm32 name 'acmDriverAddW'; +function acmDriverAdd; external msacm32 name 'acmDriverAddA'; +function acmDriverRemove; external msacm32 name 'acmDriverRemove'; +function acmDriverOpen; external msacm32 name 'acmDriverOpen'; +function acmDriverClose; external msacm32 name 'acmDriverClose'; +function acmDriverMessage; external msacm32 name 'acmDriverMessage'; +function acmDriverPriority; external msacm32 name 'acmDriverPriority'; +function acmDriverDetailsA; external msacm32 name 'acmDriverDetailsA'; +function acmDriverDetailsW; external msacm32 name 'acmDriverDetailsW'; +function acmDriverDetails; external msacm32 name 'acmDriverDetailsA'; +function acmFormatTagDetailsA; external msacm32 name 'acmFormatTagDetailsA'; +function acmFormatTagDetailsW; external msacm32 name 'acmFormatTagDetailsW'; +function acmFormatTagDetails; external msacm32 name 'acmFormatTagDetailsA'; +function acmFormatDetailsA; external msacm32 name 'acmFormatDetailsA'; +function acmFormatDetailsW; external msacm32 name 'acmFormatDetailsW'; +function acmFormatDetails; external msacm32 name 'acmFormatDetailsA'; +function acmFormatChooseA; external msacm32 name 'acmFormatChooseA'; +function acmFormatChooseW; external msacm32 name 'acmFormatChooseW'; +function acmFormatChoose; external msacm32 name 'acmFormatChooseA'; +function acmFormatEnumA; external msacm32 name 'acmFormatEnumA'; +function acmFormatEnumW; external msacm32 name 'acmFormatEnumW'; +function acmFormatEnum; external msacm32 name 'acmFormatEnumA'; +function acmFormatTagEnumA; external msacm32 name 'acmFormatTagEnumA'; +function acmFormatTagEnumW; external msacm32 name 'acmFormatTagEnumW'; +function acmFormatTagEnum; external msacm32 name 'acmFormatTagEnumA'; +function acmFormatSuggest; external msacm32 name 'acmFormatSuggest'; +function acmFilterTagDetailsA; external msacm32 name 'acmFilterTagDetailsA'; +function acmFilterTagDetailsW; external msacm32 name 'acmFilterTagDetailsW'; +function acmFilterTagDetails; external msacm32 name 'acmFilterTagDetailsA'; +function acmFilterTagEnumA; external msacm32 name 'acmFilterTagEnumA'; +function acmFilterTagEnumW; external msacm32 name 'acmFilterTagEnumW'; +function acmFilterTagEnum; external msacm32 name 'acmFilterTagEnumA'; +function acmFilterDetailsA; external msacm32 name 'acmFilterDetailsA'; +function acmFilterDetailsW; external msacm32 name 'acmFilterDetailsW'; +function acmFilterDetails; external msacm32 name 'acmFilterDetailsA'; +function acmFilterEnumA; external msacm32 name 'acmFilterEnumA'; +function acmFilterEnumW; external msacm32 name 'acmFilterEnumW'; +function acmFilterEnum; external msacm32 name 'acmFilterEnumA'; +function acmFilterChooseA; external msacm32 name 'acmFilterChooseA'; +function acmFilterChooseW; external msacm32 name 'acmFilterChooseW'; +function acmFilterChoose; external msacm32 name 'acmFilterChooseA'; +function acmStreamOpen; external msacm32 name 'acmStreamOpen'; +function acmStreamClose; external msacm32 name 'acmStreamClose'; +function acmStreamSize; external msacm32 name 'acmStreamSize'; +function acmStreamReset; external msacm32 name 'acmStreamReset'; +function acmStreamMessage; external msacm32 name 'acmStreamMessage'; +function acmStreamConvert; external msacm32 name 'acmStreamConvert'; +function acmStreamPrepareHeader; external msacm32 name 'acmStreamPrepareHeader'; +function acmStreamUnprepareHeader; external msacm32 name 'acmStreamUnprepareHeader'; + +end. diff --git a/components/acs/Src/fileformats/windows/waveconverter.pas b/components/acs/Src/fileformats/windows/waveconverter.pas new file mode 100644 index 000000000..a9dcf6654 --- /dev/null +++ b/components/acs/Src/fileformats/windows/waveconverter.pas @@ -0,0 +1,334 @@ +(* + this file is a part of audio components suite v 2.3 (delphi version). + copyright (c) 2002-2005 andrei borovsky. all rights reserved. + see the license file for more details. + you can contact me at acs@compiler4.net + this is the acs for delphi (windows) version of the unit. +*) + +{ +$Log: waveconverter.pas,v $ +Revision 1.1 2005/12/19 18:36:49 z0m3ie +*** empty log message *** + +Revision 1.1 2005/09/12 22:04:53 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.1 2005/08/25 20:18:00 z0m3ie +Version 2.4 restructure +TCDPlayer removed (fits not in component structure) +TMP3ToWavConverter removed (fits not in component structure) + +Revision 1.2 2005/08/22 20:17:02 z0m3ie +changed Headers to log +changed mail adress + +} + +unit waveconverter; + +interface + +uses + SysUtils, + Windows, Classes, MMSystem, MSAcm; + +type + {$IFDEF FPC} + TWaveFormat = WAVEFORMAT; + {$ENDIF} + + TRiffID = array[0..3] of char; + TRiffHeader = packed record + ID: TRiffID; + BytesFollowing: DWord; + end; + + + TACMWaveFormat = packed record + case integer of + 0 : (Format : TWaveFormatEx); + 1 : (RawData : Array[0..128] of byte); + end; + + TWaveConverter = class(TMemoryStream) + private + FMaxFmtSize: DWord; + public + CurrentFormat: TACMWaveFormat; + NewFormat: TACMWaveFormat; + function LoadStream(Stream : TStream): integer; + function Convert: integer; + function SaveWavToStream(MS: TStream): Integer; + constructor Create; + destructor Destroy; override; + end; + +implementation + +{ TWaveConverter } + +function TWaveConverter.Convert: integer; +var + FStreamHandle: HACMStream; + OutputBufferSize: DWord; + FStreamHeader: TACMStreamHeader; + OutPut: Pointer; +begin + FStreamHandle := nil; + + // + // Open the stream we're going to use to convert from the current to the + // new format + // + Result := acmStreamOpen(FStreamhandle, nil, CurrentFormat.Format, + NewFormat.Format, nil, 0, 0, ACM_STREAMOPENF_NONREALTIME); + if Result <> 0 then + begin + //SetError('acmStreamOpen', Result); + Exit; + end; + + // + // Calculate the size of the converted data + // + Result := acmStreamSize(FStreamHandle, self. Size, OutputBufferSize, + ACM_STREAMSIZEF_SOURCE); + + if Result <> 0 then + begin +// SetError('acmStreamSize', Result); + Exit; + end; + + // + // Allocate memory for the converted data + // + GetMem(OutPut, OutputBufferSize); + FillChar(OutPut^,OutputBufferSize,#0); + + Self.Seek(0,0); + + // + // Initialize and prepare a header + // + with FStreamHeader do + begin + cbStruct := SizeOf(TACMStreamHeader); + fdwStatus := 0; + dwUser := 0; + pbSrc := self.Memory; + cbSrcLength := self.Size; + cbSrcLengthUsed := 0; + dwSrcUser := 0; + pbDst := OutPut; + cbDstLength := OutputBufferSize; + cbDstLengthUsed := 0; + dwDstUser := 0; + end; + Result := acmStreamPrepareHeader(FStreamHandle,FStreamHeader, 0); + if Result <> 0 then + begin +// SetError('acmStreamPrepareHeader', Result); + Exit; + end; + + // + // Tell acm to convert the stream + // + Result := acmStreamConvert(FStreamHandle,FStreamHeader, + ACM_STREAMCONVERTF_BLOCKALIGN); + if Result <> 0 then + begin +// SetError('acmStreamConvert', Result); + Exit; + end; + + // + // Set the format eqaul to the newformat and copy the + // data over to the streams memory + // + Move(NewFormat.RawData, CurrentFormat.RawData, FMaxFmtSize); + Self.SetSize(OutputBufferSize); + Self.Seek(0,0); + Self.Write(Output^, OutputBufferSize); + + // + // Unprepeare the header + // + Result := acmStreamUnprepareHeader(FStreamHandle,FStreamHeader, 0); + if Result <> 0 then + begin +// SetError('acmStreamUnprepareHeader', Result); + Exit; + end; + + // + // Close the stream + // + Result := acmStreamClose(FStreamHandle, 0); + if Result <> 0 then + begin +// SetError('acmStreamClose', Result); + Exit; + end; + + FreeMem(OutPut); +end; + +constructor TWaveConverter.Create; +begin + inherited; + + acmMetrics(nil, ACM_METRIC_MAX_SIZE_FORMAT, FMaxFmtSize); + + FillChar(CurrentFormat.Format, FMaxFmtSize, 0); + FillChar(NewFormat.Format, FMaxFmtSize, 0); +end; + +destructor TWaveConverter.Destroy; +begin + inherited; +end; + +function TWaveConverter.LoadStream(Stream : TStream): integer; +var + Header: TRiffHeader; + ID: TRiffID; + Mem: Pointer; + Data: PByteArray; + + + NumRead: Integer; + Pos: Integer; + +begin + Result := 0; + try + //read the header + NumRead := Stream.Read(Header, SizeOf(Header)); + Pos := NumRead; + + NumRead := Stream.Read(ID, SizeOf(ID)); + Pos := Pos + NumRead; + + if (Header.ID <> 'RIFF') or (ID <> 'WAVE') then + begin + Exit; + end; + + while Pos < Stream.Size -1 do + begin + Dec(Pos,7); + Stream.Seek(Pos, soFromBeginning); + + NumRead := Stream.Read(Header, SizeOf(Header)); + Pos := Pos + NumRead; + + + if Header.ID = 'fmt ' then + begin + GetMem(Mem, Header.BytesFollowing); + try + NumRead := Stream.Read(Mem^, Header.BytesFollowing); + Pos := Pos + NumRead; + + if Header.BytesFollowing < SizeOf(TWaveFormatEx) then + Move(Mem^, CurrentFormat.Format , SizeOf(TWaveFormatEx)) + else + Move(Mem^, CurrentFormat.Format, Header.BytesFollowing); + finally + FreeMem(Mem); + end; + end + else + if Header.ID = 'fact' then + begin + GetMem(Data, Header.BytesFollowing); + try + NumRead := Stream.Read(Data^, Header.BytesFollowing); + Pos := Pos + NumRead; + finally + FreeMem(Data); + end; + end + else + if Header.ID = 'data' then + begin + if Header.BytesFollowing > 0 then + begin + GetMem(Data, Header.BytesFollowing); + try + NumRead := Stream.Read(Data^, Header.BytesFollowing); + Pos := Pos + NumRead; + + Self.SetSize(Header.BytesFollowing); + Self.Seek(0,0); + Self.Write(Data^, (*Header.BytesFollowing*)self.Size); + finally + FreeMem(Data); + end; + end; + end; + end; + + Seek(0,0); + finally + // FileStream.Free; + end; +end; + + +function TWaveConverter.SaveWavToStream(MS: TStream): Integer; +var + CurrentPos : Integer; + H : TRiffHeader; + ID : TRiffID; +begin + Result := 0; + try + CurrentPos := Position; + + H.ID := 'RIFF'; + H.BytesFollowing := 0; + MS.Write(H, SizeOf(H)); + + ID := 'WAVE'; + MS.Write(ID, SizeOf(ID)); + + H.ID := 'fmt '; + H.BytesFollowing := SizeOf(TWaveFormat) + 2; + MS.Write(H, SizeOf(H)); + MS.Write(CurrentFormat.Format, SizeOf(TWaveFormat) + 2); + + H.ID := 'data'; + H.BytesFollowing := Size; + MS.Write(H, SizeOf(H)); + Seek(0,0); +// MS.CopyFrom(Self, Size); +// ms.Write( Self, Size); + self.SaveToStream(MS); + + + MS.Seek(0,0); + H.ID := 'RIFF'; + H.BytesFollowing := MS.Size - SizeOf(H) +1; + MS.Write(H,SizeOf(H)); + + Position := CurrentPos; +// MS.Free; + except + on E: Exception do + begin + Result := MCIERR_FILE_NOT_SAVED; +// SetError('SaveFile', MCIERR_FILE_NOT_SAVED); + end; + end; +end; + +end. + + + + diff --git a/components/acs/Src/linux/ACS.conf b/components/acs/Src/linux/ACS.conf new file mode 100644 index 000000000..d2aaab36c --- /dev/null +++ b/components/acs/Src/linux/ACS.conf @@ -0,0 +1,33 @@ +-$A8 +-$B- +-$C+ +-$D- +-$E- +-$F- +-$G+ +-$H+ +-$I+ +-$J- +-$K- +-$L- +-$M- +-$N+ +-$O+ +-$P+ +-$Q- +-$R- +-$S- +-$T- +-$U- +-$V+ +-$W- +-$X+ +-$Y- +-$Z1 +-cg +-H+ +-W+ +-M +-$M1048576 +-K$00400000 +-Z diff --git a/components/acs/Src/linux/ACS.dof b/components/acs/Src/linux/ACS.dof new file mode 100644 index 000000000..c178efffc --- /dev/null +++ b/components/acs/Src/linux/ACS.dof @@ -0,0 +1,112 @@ +[FileVersion] +Version=6.0 +[Compiler] +A=8 +B=0 +C=1 +D=1 +E=0 +F=0 +G=1 +H=1 +I=1 +J=0 +K=0 +L=1 +M=0 +N=1 +O=0 +P=1 +Q=0 +R=0 +S=0 +T=0 +U=0 +V=1 +W=0 +X=1 +Y=1 +Z=1 +ShowHints=1 +ShowWarnings=1 +UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +[Linker] +MapFile=0 +OutputObjs=0 +ConsoleApp=1 +DebugInfo=0 +RemoteSymbols=0 +MinStackSize=16384 +MaxStackSize=1048576 +ImageBase=4194304 +ExeDescription=Audio Components Suite v 2.4 +[Directories] +OutputDir= +UnitOutputDir=lib +PackageDLLOutputDir= +PackageDCPOutputDir= +SearchPath=..\classes;..\classes\linux;..\drivers;..\drivers\linux;..\fileformats;..\fileformats\general;..\fileformats\linux +Packages=vcl;rtl;dbrtl;adortl;vcldb;vclx;bdertl;vcldbx;ibxpress;dsnap;cds;bdecds;qrpt;teeui;teedb;tee;dss;teeqr;visualclx;visualdbclx;dsnapcrba;dsnapcon;VclSmp;vclshlctrls;vclie;xmlrtl;inet;inetdbbde;inetdbxpress;inetdb;nmfast;webdsnap;websnap;dbexpress;dbxcds +Conditionals= +DebugSourceDirs= +UsePackages=0 +[Parameters] +RunParams= +HostApplication= +Launcher= +UseLauncher=0 +DebugCWD= +[Language] +ActiveLang= +ProjectLang= +RootDir= +[Version Info] +IncludeVerInfo=1 +AutoIncBuild=1 +MajorVer=2 +MinorVer=4 +Release=0 +Build=2 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 +[Version Info Keys] +CompanyName= +FileDescription=Audio Components Suite (Delphi Edition) +FileVersion=2.4.0.2 +InternalName=ACS +LegalCopyright=Copyright (c) 2002, 2003 by Andrei Borovsky +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=2.4.0.0 +[HistoryLists\hlDebugSourcePath] +Count=1 +Item0=D:\Program Files\Borland\Delphi6\Lib +[HistoryLists\hlUnitAliases] +Count=1 +Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +[HistoryLists\hlSearchPath] +Count=8 +Item0=..\classes;..\classes\linux;..\drivers;..\drivers\linux;..\fileformats;..\fileformats\general;..\fileformats\linux +Item1=..\classes;..\classes\windows;..\drivers;..\drivers\windows;..\fileformats;..\fileformats\general;..\fileformats\windows +Item2=..\classes;..\classes\windows;D:\LKomponenten\acs\Src\classes;D:\LKomponenten\acs\Src\classes\windows +Item3=..\classes;..\classes\include\general;..\classes\windows +Item4=..\classes;..\classes\include\general;..\classes\include\windows +Item5=..\Common;..\Common\include\general;..\Common\include\windows +Item6=..\Common +Item7=D:\Program Files\Borland\Delphi6\Lib +[HistoryLists\hlUnitOutputDirectory] +Count=2 +Item0=lib +Item1=D:\Program Files\Borland\Delphi6\Lib +[HistoryLists\hlBPLOutput] +Count=1 +Item0=D:\Program Files\Borland\Delphi6\Lib +[HistoryLists\hlDCPOutput] +Count=1 +Item0=D:\Program Files\Borland\Delphi6\Lib diff --git a/components/acs/Src/linux/ACS.dpk b/components/acs/Src/linux/ACS.dpk new file mode 100644 index 000000000..1b659f095 --- /dev/null +++ b/components/acs/Src/linux/ACS.dpk @@ -0,0 +1,50 @@ +package ACS; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION OFF} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'Audio Components Suite v 2.4'} +{$IMPLICITBUILD OFF} + +contains + ACS_Types in '..\classes\ACS_Types.pas', + ACS_Audio in '..\classes\ACS_Audio.pas', + ACS_AudioMix in '..\classes\ACS_AudioMix.pas', + ACS_CDROM in '..\classes\ACS_CDROM.pas', + ACS_Classes in '..\classes\ACS_Classes.pas', + ACS_Converters in '..\classes\ACS_Converters.pas', + ACS_File in '..\classes\ACS_File.pas', + ACS_Filters in '..\classes\ACS_Filters.pas', + ACS_Indicator in '..\classes\ACS_Indicator.pas', + ACS_Misc in '..\classes\ACS_Misc.pas', + ACS_Mixer in '..\classes\ACS_Mixer.pas', + ACS_MultiMix in '..\classes\ACS_MultiMix.pas', + ACS_Procs in '..\classes\ACS_Procs.pas', + ACS_Streams in '..\classes\ACS_Streams.pas', + ACS_Strings in '..\classes\ACS_Strings.pas', + akrip32 in '..\classes\windows\akrip32.pas', + acs_reg in 'acs_reg.pas', + ACS_AllFormats in '..\fileformats\ACS_Allformats.pas', + ACS_StdAudio in '..\drivers\ACS_StdAudio.pas', + ACS_DXAudio in '..\drivers\ACS_DXAudio.pas'; + +end. diff --git a/components/acs/Src/linux/acs_reg.lrs b/components/acs/Src/linux/acs_reg.lrs new file mode 100644 index 000000000..fbeee637b --- /dev/null +++ b/components/acs/Src/linux/acs_reg.lrs @@ -0,0 +1,360 @@ +LazarusResources.Add('TACSAudioIn','XPM',[ + '/* XPM */'#13#10'static char * TAudioIn_xpm[] = {'#13#10'"24 24 6 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #0000FF",'#13#10'"+'#9'c #00FFFF",'#13#10'"@' + +#9'c #000080",'#13#10'"#'#9'c #000000",'#13#10'"$'#9'c #808000",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" .' + +'+.+.@ ",'#13#10'" +.+...@.@ ",'#13#10'" ....@..@' + +'.@ ",'#13#10'" +.....@@.@@ ",'#13#10'" .....@..@.@ ' + +' ",'#13#10'" +....@.@@.@@ ",'#13#10'" ....@.@..@.@ ",' + +#13#10'" +@.@.@.@@.@@ ",'#13#10'" . @.@.@.@@@ ",'#13#10 + +'" # $@@.@@@@@ ",'#13#10'" # $$$@@@@@ ",'#13#10'" ' + +' # $$$@@@@ ",'#13#10'" # $$$# ",'#13#10'" # $$#' + +'# ",'#13#10'" # $$$# ",'#13#10'" # $### ' + +' ",'#13#10'" # $$### ",'#13#10'" #$$$#### ' + +' ",'#13#10'" $## ### ",'#13#10'" ### ' + +'"};'#13#10 +]); +LazarusResources.Add('TACSAudioOut','XPM',[ + '/* XPM */'#13#10'static char * TAudioOut_xpm[] = {'#13#10'"24 24 6 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #000000",'#13#10'"+'#9'c #000080",'#13#10'"@' + +#9'c #800000",'#13#10'"#'#9'c #00FFFF",'#13#10'"$'#9'c #0000FF",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" .. ' + +' ",'#13#10'" ++.. @ @ @ ",'#13#10'" +#. . @ ' + +'@ ",'#13#10'" +#.. . ",'#13#10'" +# . . @ @ @ ' + +' ",'#13#10'" .++# #.+ . @ @ ",'#13#10'" .+ $ # ..+ . ",' + +#13#10'" . #$# #. . . @ @ @ ",'#13#10'" .##$ # ... . @ @ ",'#13#10 + +'" .$$.# #..+ . ",'#13#10'" ...$# .+ . @ @ @ ",'#13#10'" ' + +' .$#. . @ @ ",'#13#10'" .$.. . ",'#13#10'" .$' + +'. . @ @ @ ",'#13#10'" .$.. @ @ ",'#13#10'" .. ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +'"};'#13#10 +]); +LazarusResources.Add('TACSCDIn','XPM',[ + '/* XPM */'#13#10'static char * TCDIn_xpm[] = {'#13#10'"24 24 7 1",'#13#10'" ' + +#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #000000",'#13#10'"@'#9'c' + +' #00FFFF",'#13#10'"#'#9'c #00FF00",'#13#10'"$'#9'c #FF0000",'#13#10'"%'#9'c' + +' #FFFF00",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" . ",' + +#13#10'" +++++ .. ",'#13#10'" ++@@###+ .$. ",'#13#10 + +'" + @@#### ....$$. ",'#13#10'" + @@####.$$$$$$$. ",'#13#10'" + ' + +' @@##%.$$$$$$$$. ",'#13#10'" + @@#%%.$$$$$$$$$. ",'#13#10'"+ ++' + +'+%%.$$$$$$$$. ",'#13#10'"+ + + .$$$$$$$. ",'#13#10'"+ + + .' + +'...$$. ",'#13#10'"+ + + .$. ",'#13#10'"+ %%+++ .. ' + +' ",'#13#10'" + %%%#@@ +. ",'#13#10'" + %%%##@@ + ' + +'",'#13#10'" +%%###@@@ + ",'#13#10'" +%####@@ + ",'#13 + +#10'" ++###@@++ ",'#13#10'" +++++ ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSAudioMixer','XPM',[ + '/* XPM */'#13#10'static char * TAudioMixer_xpm[] = {'#13#10'"24 24 5 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #0000FF",'#13#10'"+'#9'c #000080",'#13#10 + +'"@'#9'c #800000",'#13#10'"#'#9'c #00FFFF",'#13#10'" ' + +'",'#13#10'" .+ ",'#13#10'" @@@@@.+@@@@@ ",'#13 + +#10'" @@@ .+ @@@ ",'#13#10'" @ .+ #@ ",'#13#10'" ' + +'@ .+ # #@ ",'#13#10'" @ .+ # @ ",'#13#10'" @@ ' + +' .+ # @@ ",'#13#10'" @#@@@ .+ @@@ @ ",'#13#10'" @ # @@@@@' + +'@@@@@@@ . @ ",'#13#10'" @# .+ @ ",'#13#10'" @ # .+ ' + +' @ ",'#13#10'" @# .+ @ ",'#13#10'" @ # +++++ .+ +++++ ' + +' @ ",'#13#10'" @ +.....+.++++++++ @ ",'#13#10'" @ +.......+++......+ @ ",' + +#13#10'" @ +......+++.......+ @ ",'#13#10'" @@ +++++++.++.....+ @@ ",'#13#10 + +'" @ +++++ .+ +++++ @ ",'#13#10'" @ @ ",'#13#10'" @ ' + +' @ ",'#13#10'" @@@ @@@ ",'#13#10'" @@@' + +'@@@@@@@@@ ",'#13#10'" "};'#13#10 +]); +LazarusResources.Add('TACSRateConverter','XPM',[ + '/* XPM */'#13#10'static char * TRateConverter_xpm[] = {'#13#10'"24 24 4 1",' + +#13#10'" '#9'c None",'#13#10'".'#9'c #FF0000",'#13#10'"+'#9'c #000000",'#13 + +#10'"@'#9'c #0000FF",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'".. .. ' + +'.. ",'#13#10'" . . . . . .",'#13#10'" . . . . . ' + +' .",'#13#10'" . . . . . . ",'#13#10'" . . . . . . ",' + +#13#10'" .. .. .. ",'#13#10'" ",'#13#10 + +'" + + ",'#13#10'" + + +++ ",'#13#10'" ' + +' +++ + + ",'#13#10'" + + ",'#13#10'" ' + +' ",'#13#10'" @ @ @ @ @ ",'#13#10'" @ @ @ ' + +' @ @ ",'#13#10'"@ @ @ @ @ @ @ @ @ @ @ @ ",'#13#10'"@ @ @ @ @ @ @ @ @ @' + +' @ @ ",'#13#10'" @ @ @ @ @ @ ",'#13#10'" @ @ @ @ @ @ ' + +'",'#13#10'" ",'#13#10'" ",'#13 + +#10'" "};'#13#10 +]); +LazarusResources.Add('TACSMSConverter','XPM',[ + '/* XPM */'#13#10'static char * TMSConverter_xpm[] = {'#13#10'"24 24 3 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #808000",'#13#10'"+'#9'c #FF0000",'#13#10 + +'" ....... ",'#13#10'" . . ",'#13#10'" ' + +' . ... . ",'#13#10'" . ..... . ",'#13#10'" . ' + +'..... . ",'#13#10'" . ..... . ",'#13#10'" . ... ' + +' . ",'#13#10'" . . ",'#13#10'" . . ' + +' ",'#13#10'" ....... ",'#13#10'" + + ' + +'",'#13#10'" ++ + ",'#13#10'" + + + + ",'#13 + +#10'" + ++ ",'#13#10'" ....... + + ....... ",'#13#10'" ' + +'. . . . ",'#13#10'" . ... . . ... . ",'#13#10'" . ...' + +'.. . . ..... . ",'#13#10'" . ..... . . ..... . ",'#13#10'" . ..... . ' + +' . ..... . ",'#13#10'" . ... . . ... . ",'#13#10'" . . . ' + +' . ",'#13#10'" . . . . ",'#13#10'" ....... .......' + +' "};'#13#10 +]); +LazarusResources.Add('TACSSampleConverter','XPM',[ + '/* XPM */'#13#10'static char * TSampleConverter_xpm[] = {'#13#10'"24 24 4 1"' + +','#13#10'" '#9'c None",'#13#10'".'#9'c #0000FF",'#13#10'"+'#9'c #000080",' + +#13#10'"@'#9'c #000000",'#13#10'" ",'#13#10'"........' + +'................",'#13#10'" . . ",'#13#10'" . + + + ' + +'+ . + + +",'#13#10'" . + + + + . + + ",'#13#10'" . + + . ' + +' + ",'#13#10'" . + + + + . + + ",'#13#10'" . + + + + . + + ' + +'+",'#13#10'" . . ",'#13#10'"........................",' + +#13#10'" @ @ ",'#13#10'" @ @ @@@ ",'#13#10 + +'" @@@ @ @ ",'#13#10'" @ @ ",'#13#10'"....' + +'....................",'#13#10'" . . . ",'#13#10'" . + + ' + +'. + + . + +",'#13#10'" . + + . + + . + + ",'#13#10'" . + . +' + +' . + ",'#13#10'" . + + . + + . + + ",'#13#10'" . + + . + + . ' + +'+ +",'#13#10'" . . . ",'#13#10'"........................' + +'",'#13#10'" "};'#13#10 +]); +LazarusResources.Add('TACSFixedResampler','XPM',[ + '/* XPM */'#13#10'static char * TFixedResampler_xpm[] = {'#13#10'"24 24 4 1",' + +#13#10'" '#9'c None",'#13#10'".'#9'c #0000FF",'#13#10'"+'#9'c #FF0000",'#13 + +#10'"@'#9'c #000000",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" . . ",'#13#10'" ..' + +' . ",'#13#10'" . . ",'#13#10'" . . ",' + +#13#10'" ..... +++ ",'#13#10'" .. ++ ++ ",'#13#10 + +'" .. ++ ++ ",'#13#10'" ....... ++ ++ ",'#13#10'" .' + +'. ++ ",'#13#10'" .. @@@ ++ ",'#13#10'" .. ' + +'@@@ ++ ",'#13#10'" .. @@@ ++ ",'#13#10'" .. +' + +'+ ",'#13#10'" ....... +++++++ ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +'",'#13#10'" ",'#13#10'" ",'#13 + +#10'" "};'#13#10 +]); +LazarusResources.Add('TACSStereoBalance','XPM',[ + '/* XPM */'#13#10'static char * TStereoBalance_xpm[] = {'#13#10'"24 24 3 1",' + +#13#10'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #000000",'#13 + +#10'" ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" . . ",'#13#10'" .. ' + +' .. ",'#13#10'" ... ... ",'#13#10'" ...... ' + +'...... ",'#13#10'" ...... ...... ",'#13#10'" ...... .....' + +'. ",'#13#10'" ...... ...... ",'#13#10'" ... ... ",' + +#13#10'" .. .. ",'#13#10'" . . ",'#13#10 + +'" ++ ",'#13#10'" ++ ",'#13#10'" ' + +' ++ ",'#13#10'" +++++++ +++++++++ ",'#13#10'" ++++++' + +'+ +++++++++ ",'#13#10'" +++ ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSBWFilter','XPM',[ + '/* XPM */'#13#10'static char * TBWFilter_xpm[] = {'#13#10'"24 24 5 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #FFFF00",'#13#10'"+'#9'c #0000FF",'#13#10'"@' + +#9'c #FF0000",'#13#10'"#'#9'c #000000",'#13#10'" . ",' + +#13#10'" . . ",'#13#10'" ++ ++ ++ ",'#13#10 + +'" + + + + + + ",'#13#10'" ++++ + + ++++ ",'#13#10'" @' + +' @ ",'#13#10'" @ ### @ ",'#13#10'" @ # ' + +' # + @ ",'#13#10'" @ # # + @ ",'#13#10'" @ ### ' + +'++ @ ",'#13#10'" @ # # @ ",'#13#10'" @@@@@ # # @' + +'@@@@ ",'#13#10'" ### ",'#13#10'" @@@@@ # # @@@@@ ' + +'",'#13#10'" @ # # @ ",'#13#10'" @ # # # @ ",'#13 + +#10'" @ @@ # # # @ ",'#13#10'" @ @ # # # @ ",'#13#10'" ' + +' @ @@ # # @ ",'#13#10'" @ @ ",'#13#10'" @ ' + +' @ ",'#13#10'" ++++++++++++++++++++++ ",'#13#10'" ' + +' ",'#13#10'" "};'#13#10 +]); +LazarusResources.Add('TACSSINCFilter','XPM',[ + '/* XPM */'#13#10'static char * TSINCFilter_xpm[] = {'#13#10'"24 24 7 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #000000",'#13#10 + +'"@'#9'c #0000FF",'#13#10'"#'#9'c #008080",'#13#10'"$'#9'c #00FFFF",'#13#10 + +'"%'#9'c #000080",'#13#10'" ",'#13#10'" ... . . .' + +' ... ",'#13#10'" . . .. . . ",'#13#10'" .. . . . . ' + +' ",'#13#10'" . . . . . ",'#13#10'" ... . . . ... ' + +'",'#13#10'" ",'#13#10'" +++++++ ",'#13 + +#10'" +++@#@#@#@+++ ",'#13#10'" +@#@#@#@#@#@#$+ ",'#13#10'" ' + +' +%#@#@#@#@#@#@$%+ ",'#13#10'" +%%#@#@#@#@#@$$%+ ",'#13#10'" +' + +'+++@#@#@#@++++ ",'#13#10'" +$@+++++++@@+ ",'#13#10'" %$@@' + +'@@@@@@+ ",'#13#10'" %$@@@@@@+ ",'#13#10'" %$@@@@+' + +' ",'#13#10'" %@+++ ",'#13#10'" %$@@+ ' + +' ",'#13#10'" %$@@+ ",'#13#10'" %$@@+ ",' + +#13#10'" %$@@+ ",'#13#10'" %%% ",'#13#10 + +'" "};'#13#10 +]); +LazarusResources.Add('TACSConvolver','XPM',[ + '/* XPM */'#13#10'static char * TConvolver_xpm[] = {'#13#10'"24 24 4 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #FF0000",'#13#10'"+'#9'c #0000FF",'#13#10 + +'"@'#9'c #000000",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +'",'#13#10'" ",'#13#10'" ",'#13 + +#10'" .. ",'#13#10'" . ",'#13#10'" ' + +' . ",'#13#10'" ++ + @ . .. ",'#13#10'" ++' + +' @ @ @ . . . ",'#13#10'" + @@@ .. . ",'#13#10'" + @ ' + +'@ @ . . ",'#13#10'" + + @ . . ",'#13#10'" + + ' + +'. .. ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ",' + +#13#10'" ",'#13#10'" ",'#13#10 + +'" "};'#13#10 +]); +LazarusResources.Add('TACSSoundIndicator','XPM',[ + '/* XPM */'#13#10'static char * TSoundIndicator_xpm[] = {'#13#10'"24 24 3 1",' + +#13#10'" '#9'c None",'#13#10'".'#9'c #000000",'#13#10'"+'#9'c #00FF00",'#13 + +#10'" ",'#13#10'" ",'#13#10'" ' + +' .................... ",'#13#10'" .................... ",'#13#10'" ....' + +'................ ",'#13#10'" .................... ",'#13#10'" .........' + +'........... ",'#13#10'" ....++.............. ",'#13#10'" ....++........' + +'...... ",'#13#10'" .................... ",'#13#10'" .++.++.++..........' + +'. ",'#13#10'" .++.++.++........... ",'#13#10'" .................... ",' + +#13#10'" .++.++.++.......++.. ",'#13#10'" .++.++.++.......++.. ",'#13#10 + +'" .................... ",'#13#10'" .++.++.++.++....++.. ",'#13#10'" .+' + +'+.++.++.++....++.. ",'#13#10'" .................... ",'#13#10'" .++.++.' + +'++.++.++.++.. ",'#13#10'" .++.++.++.++.++.++.. ",'#13#10'" ............' + +'........ ",'#13#10'" ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSMemoryIn','XPM',[ + '/* XPM */'#13#10'static char * TMemoryIn_xpm[] = {'#13#10'"24 24 7 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #FF0000",'#13#10'"@' + +#9'c #808000",'#13#10'"#'#9'c #800080",'#13#10'"$'#9'c #FFFF00",'#13#10'"%'#9 + +'c #000000",'#13#10'" . ",'#13#10'" .. ' + +' ",'#13#10'" .+. ",'#13#10'" ....++. "' + +','#13#10'" .+++++++. ",'#13#10'" .++++++++. ",'#13 + +#10'" .+++++++++. ",'#13#10'" @# @$ .++++++++. ",'#13#10'" ' + +' @%%% .+++++++. ",'#13#10'" @%%%%% @$ ....++. ",'#13#10'" @%%%' + +'%%%% .+. ",'#13#10'" @%%%%%%%%% @$ .. ",'#13#10'" %%%%%% %%%' + +'% . ",'#13#10'" $%%%%%% %%%% @$ ",'#13#10'" @ %%%%%%%%%%% ' + +' ",'#13#10'" $%%%%%%%%%%% @$ ",'#13#10'" @ %%%%%% %%% ' + +' ",'#13#10'" $%%%%% %%%% ",'#13#10'" @ %%%%%%%%% ",' + +#13#10'" $%%%%%%% ",'#13#10'" @ %%%%% ",'#13#10 + +'" $%%% ",'#13#10'" @ ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSAudioProcessor','XPM',[ + '/* XPM */'#13#10'static char * TAudioProcessor_xpm[] = {'#13#10'"24 24 9 1",' + +#13#10'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #FF0000",'#13 + +#10'"@'#9'c #808000",'#13#10'"#'#9'c #800080",'#13#10'"$'#9'c #FFFF00",'#13 + +#10'"%'#9'c #000000",'#13#10'"&'#9'c #000080",'#13#10'"*'#9'c #0000FF",'#13 + +#10'" ",'#13#10'" . ",'#13#10'" ' + +' .. ",'#13#10'" ..++. ",'#13#10'" ' + +' .+++++. ",'#13#10'" @# @$ .++++++.",'#13#10'" @%%%' + +' .+++++. ",'#13#10'" @%%%%% @$ ..++. ",'#13#10'" @%%%%%%% ' + +' .. ",'#13#10'" @%%%%%%%%% @$ . ",'#13#10'" %%%%%% %%%% ' + +' ",'#13#10'" $%%%%%% %%%% @$ ",'#13#10'" @ %%%%%%%%%%% ",' + +#13#10'" $%%%%%%%%%%% @$ ",'#13#10'" & %%%%%% %%% ",'#13#10 + +'" && $%%%%% %%%% ",'#13#10'" &&**& @ %%%%%%%%% ",'#13#10'"&***' + +'**& $%%%%%%% ",'#13#10'"&******& @ %%%%% ",'#13#10'"&*****& ' + +' $%%% ",'#13#10'" &&**& @ ",'#13#10'" && ' + +' ",'#13#10'" & ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSNULLOut','XPM',[ + '/* XPM */'#13#10'static char * TNULLOut_xpm[] = {'#13#10'"24 24 5 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #000080",'#13#10'"+'#9'c #0000FF",'#13#10'"@' + +#9'c #00FFFF",'#13#10'"#'#9'c #000000",'#13#10'" ",' + +#13#10'" . ",'#13#10'" .. ",'#13#10 + +'" .+. ",'#13#10'" ....++. ",'#13#10'" .++' + +'+++++. ",'#13#10'" .++++++++. ",'#13#10'" .+++++++' + +'++. ..... ",'#13#10'" .++++++++. +.+++++.+ ",'#13#10'" .+++++++. .' + +'.+++++@. ",'#13#10'" ....++. ...+++++@.. ",'#13#10'" .+. ...++++' + +'+@.# ",'#13#10'" .. ....+++.... ",'#13#10'" . .@+.....++. ' + +'",'#13#10'" .@++++++++. ",'#13#10'" .@++++++++# ",'#13 + +#10'" ...+++++... ",'#13#10'" .@+.....++. ",'#13#10'" ' + +' .@++++++++. ",'#13#10'" ...+++++... ",'#13#10'" ' + +' .@+.....++. ",'#13#10'" +.@++++++.+ ",'#13#10'" ' + +' +.+++++.+ ",'#13#10'" ..... "};'#13#10 +]); +LazarusResources.Add('TACSInputList','XPM',[ + '/* XPM */'#13#10'static char * TInputList_xpm[] = {'#13#10'"24 24 5 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #FFFF00",'#13#10 + +'"@'#9'c #000000",'#13#10'"#'#9'c #FF0000",'#13#10'" ' + +'",'#13#10'" ... ",'#13#10'" . . ",'#13 + +#10'" . . ",'#13#10'" . +.@ ",'#13#10'" ' + +' . ++.@ ",'#13#10'" .....@ . ",'#13#10'" @@@' + +'@@ .. ",'#13#10'" .#. ",'#13#10'" ... ' + +'....##. ",'#13#10'" . . .#######. ",'#13#10'" . . .#####' + +'###. ",'#13#10'" . +.@ .#########. ",'#13#10'" . ++.@ .########. ' + +' ",'#13#10'" .....@ .#######. ",'#13#10'" @@@@@ ....##. ",' + +#13#10'" .#. ",'#13#10'" ... .. ",'#13#10 + +'" . . . ",'#13#10'" . . ",'#13#10'" . ' + +' +.@ ",'#13#10'" . ++.@ ",'#13#10'" .....@ ' + +' ",'#13#10'" @@@@@ "};'#13#10 +]); +LazarusResources.Add('TACSStreamIn','XPM',[ + '/* XPM */'#13#10'static char * TStreamIn_xpm[] = {'#13#10'"24 24 8 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #FF0000",'#13#10'"@' + +#9'c #0000FF",'#13#10'"#'#9'c #000080",'#13#10'"$'#9'c #00FFFF",'#13#10'"%'#9 + +'c #008080",'#13#10'"&'#9'c #000000",'#13#10'" . ",'#13 + +#10'" .. ",'#13#10'" .+. ",'#13#10'" ' + +' ....++. ",'#13#10'" .+++++++. ",'#13#10'" ' + +' .++++++++. ",'#13#10'" .+++++++++. ",'#13#10'" @# @$ ' + +' .++++++++. ",'#13#10'" @### .+++++++. ",'#13#10'" @##### @$ ...' + +'.++. ",'#13#10'" @####### .+. ",'#13#10'" @####%#### @$ .. ' + +' ",'#13#10'" &@####$#### . ",'#13#10'" $&@####$#### @$ ",' + +#13#10'" & &@######### ",'#13#10'" $&@####%#### @$ ",'#13#10 + +'" & &@####$$### ",'#13#10'" $&####$$#### ",'#13#10'" ' + +' & &#######& ",'#13#10'" $&#####& ",'#13#10'" & ' + +'&###& ",'#13#10'" $&#& ",'#13#10'" & ' + +' ",'#13#10'" "};'#13#10 +]); +LazarusResources.Add('TACSStreamOut','XPM',[ + '/* XPM */'#13#10'static char * TStreamOut_xpm[] = {'#13#10'"24 24 6 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #0000FF",'#13#10'"+'#9'c #000080",'#13#10 + +'"@'#9'c #00FFFF",'#13#10'"#'#9'c #008080",'#13#10'"$'#9'c #000000",'#13#10 + +'" .+ .@ ",'#13#10'" .+++ ",'#13#10'" ' + +' .+++++ .@ ",'#13#10'" .+++++++ ",'#13#10'" .+' + +'+++#++++ .@ ",'#13#10'" $.++++@++++ ",'#13#10'" @$.++++' + +'@++++ .@ ",'#13#10'" $ $.+++++++++ ",'#13#10'" @$.++++#++' + +'++ .@",'#13#10'" $ $.++++@@+++ ",'#13#10'" + @$++++@@++++ ' + +'",'#13#10'" ++ $ $+++++++$ ",'#13#10'" +.+ @$+++++$ ",'#13 + +#10'" ++++..+ $ $+++$ ",'#13#10'"+.......+ @$+$ ",'#13#10'"+' + +'........+ $ ",'#13#10'"+.........+ ",'#13#10'"+.....' + +'...+ ",'#13#10'"+.......+ ",'#13#10'" ++++..+ ' + +' ",'#13#10'" +.+ ",'#13#10'" ++ ' + +' ",'#13#10'" + ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSFileIn','XPM',[ + '/* XPM */'#13#10'static char * TFileIn_xpm[] = {'#13#10'"24 24 4 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #FFFFFF",'#13#10'"+'#9'c #FF0000",'#13#10'"@' + +#9'c #FFFF00",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ........... ",'#13#10'" ............. ' + +' ",'#13#10'" .............. ",'#13#10'" ............... ",' + +#13#10'" ................ ",'#13#10'" ................+ ",'#13#10 + +'" ................++ ",'#13#10'" ................+++ ",'#13#10'" ...' + +'..........+++++++ ",'#13#10'" ............+++++++++ ",'#13#10'" ........' + +'....++++++++++ ",'#13#10'" ............+++++++++++",'#13#10'" ............+' + +'+++++++++ ",'#13#10'" ............+++++++++ ",'#13#10'" .............+++++' + +'++ ",'#13#10'" ..............@.+++ ",'#13#10'" ...........@.@.@++ ' + +'",'#13#10'" ....@.@..@@.@.@.+ ",'#13#10'" ..@.@.@.@@.@.@.@. ",'#13 + +#10'" ............... ",'#13#10'" ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSFileOut','XPM',[ + '/* XPM */'#13#10'static char * TFileOut_xpm[] = {'#13#10'"24 24 4 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #FFFFFF",'#13#10'"+'#9'c #0000FF",'#13#10'"@' + +#9'c #FFFF00",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ........... ",'#13#10'" ............. ' + +' ",'#13#10'" .............. ",'#13#10'" ............... ",' + +#13#10'" ................ ",'#13#10'" + ................. ",'#13#10 + +'" ++................. ",'#13#10'" +++................ ",'#13#10'" +++' + +'++++............... ",'#13#10'"+++++++++.............. ",'#13#10'"+++++++++' + +'+...........@. ",'#13#10'"+++++++++++............ ",'#13#10'"++++++++++....' + +'.......@. ",'#13#10'"+++++++++...........@.. ",'#13#10'" +++++++...........' + +'..@. ",'#13#10'" +++............@@.. ",'#13#10'" ++............@@.@. ' + +'",'#13#10'" + .....@.@..@...@.. ",'#13#10'" ..@.@.@.@@.@.@.@. ",'#13 + +#10'" ............... ",'#13#10'" ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSMixer','XPM',[ + '/* XPM */'#13#10'static char * TMixer_xpm[] = {'#13#10'"24 24 2 1",'#13#10'"' + +' '#9'c None",'#13#10'".'#9'c #000000",'#13#10'" ",' + +#13#10'" ",'#13#10'" . ",'#13#10 + +'" . . . . ",'#13#10'" . . . . ",'#13#10'" ' + +' . . . . ",'#13#10'" . . .. . ",'#13#10'" . ' + +' . ...... . ",'#13#10'" . . .. . ",'#13#10'" .. . ' + +' . . ",'#13#10'" ...... . . . ",'#13#10'" .. . . ' + +' . ",'#13#10'" . . . . ",'#13#10'" . . . . ' + +'",'#13#10'" . .. . . ",'#13#10'" . ...... . . ",'#13 + +#10'" . .. . . ",'#13#10'" . . . . ",'#13#10'" ' + +' . . . . ",'#13#10'" . . . . ",'#13#10'" .' + +' . . . ",'#13#10'" . ",'#13#10'" ..........' + +'............ ",'#13#10'" "};'#13#10 +]); diff --git a/components/acs/Src/linux/acs_reg.pas b/components/acs/Src/linux/acs_reg.pas new file mode 100644 index 000000000..80e85e3a2 --- /dev/null +++ b/components/acs/Src/linux/acs_reg.pas @@ -0,0 +1,56 @@ +(* + This file is a part of Audio Components Suite v 2.2 (Kylix Edition). + Copyright (c) 2002, 2003 Andrei Borovsky. All rights reserved. + See the LICENSE file for more details. + You can contact me at aborovsky@mtu-net.ru + +$Log: acs_reg.pas,v $ +Revision 1.9 2006/07/04 17:12:44 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.7 2005/12/19 18:37:21 z0m3ie +*** empty log message *** + +Revision 1.5 2005/12/04 16:54:33 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.4 2005/11/27 16:50:33 z0m3ie +add ACS VolumeQuerry +make ACS_VolumeQuerry localizeable +some little errorfixes (buffersize for linuxdrivers was initially 0) +make TAudioIn workable + +*) + +unit acs_reg; + +interface + +uses + Classes, ACS_Audio, + ACS_CDROM, ACS_AudioMix, ACS_Converters, ACS_Misc, ACS_File, ACS_Filters, + ACS_Streams, ACS_Indicator, ACS_Mixer,ACS_MultiMix,ACS_VolumeQuery + {$IFDEF FPC} + ,LResources + {$ENDIF}; + + procedure Register; + +implementation + +procedure Register(); +begin + RegisterComponents('Audio I/O', [TACSAudioIn, TACSAudioOut,TACSMixer, + TACSCDIn,TACSInputList, TACSMemoryIn, TACSFileIn, TACSFileOut, TACSStreamIn, TACSStreamOut, TACSNULLOut]); + RegisterComponents('Audio Processing', [TACSAudioMixer,TACSMultiMixer, TACSSampleConverter, TACSRateConverter, + TACSMSConverter, TACSAudioProcessor, TACSBWFilter, TACSSincFilter, TACSSoundIndicator, TACSStereoBalance, TACSConvolver,TACSVolumeQuery]); +end; + +initialization +{$IFDEF FPC} +{$i ..\resources\acs_reg.lrs} +{$ELSE} +{$r ..\resources\resource.dcr} +{$ENDIF} + +end. diff --git a/components/acs/Src/linux/laz_acs.lpk b/components/acs/Src/linux/laz_acs.lpk new file mode 100644 index 000000000..25eeb53f3 --- /dev/null +++ b/components/acs/Src/linux/laz_acs.lpk @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/acs/Src/linux/laz_acs.pas b/components/acs/Src/linux/laz_acs.pas new file mode 100644 index 000000000..71de88044 --- /dev/null +++ b/components/acs/Src/linux/laz_acs.pas @@ -0,0 +1,24 @@ +{ Diese Datei wurde automatisch von Lazarus erzeugt. Sie darf nicht bearbeitet werden! +Dieser Quelltext dient nur dem Übersetzen und Installieren des Packages. + } + +unit laz_acs; + +interface + +uses + acs_audio, acs_audiomix, acs_cdrom, acs_classes, acs_converters, acs_file, + acs_filters, acs_indicator, acs_misc, acs_mixer, acs_multimix, acs_streams, + acs_strings, acs_types, acs_stdaudio, acs_reg, acs_allformats, + LazarusPackageIntf; + +implementation + +procedure Register; +begin + RegisterUnit('acs_reg', @acs_reg.Register); +end; + +initialization + RegisterPackage('laz_acs', @Register); +end. diff --git a/components/acs/Src/resources/TACSAudioIn.xpm b/components/acs/Src/resources/TACSAudioIn.xpm new file mode 100644 index 000000000..fc32eeb19 --- /dev/null +++ b/components/acs/Src/resources/TACSAudioIn.xpm @@ -0,0 +1,33 @@ +/* XPM */ +static char * TAudioIn_xpm[] = { +"24 24 6 1", +" c None", +". c #0000FF", +"+ c #00FFFF", +"@ c #000080", +"# c #000000", +"$ c #808000", +" ", +" ", +" ", +" ", +" .+.+.@ ", +" +.+...@.@ ", +" ....@..@.@ ", +" +.....@@.@@ ", +" .....@..@.@ ", +" +....@.@@.@@ ", +" ....@.@..@.@ ", +" +@.@.@.@@.@@ ", +" . @.@.@.@@@ ", +" # $@@.@@@@@ ", +" # $$$@@@@@ ", +" # $$$@@@@ ", +" # $$$# ", +" # $$## ", +" # $$$# ", +" # $### ", +" # $$### ", +" #$$$#### ", +" $## ### ", +" ### "}; diff --git a/components/acs/Src/resources/TACSAudioMixer.xpm b/components/acs/Src/resources/TACSAudioMixer.xpm new file mode 100644 index 000000000..524443d40 --- /dev/null +++ b/components/acs/Src/resources/TACSAudioMixer.xpm @@ -0,0 +1,32 @@ +/* XPM */ +static char * TAudioMixer_xpm[] = { +"24 24 5 1", +" c None", +". c #0000FF", +"+ c #000080", +"@ c #800000", +"# c #00FFFF", +" ", +" .+ ", +" @@@@@.+@@@@@ ", +" @@@ .+ @@@ ", +" @ .+ #@ ", +" @ .+ # #@ ", +" @ .+ # @ ", +" @@ .+ # @@ ", +" @#@@@ .+ @@@ @ ", +" @ # @@@@@@@@@@@@ . @ ", +" @# .+ @ ", +" @ # .+ @ ", +" @# .+ @ ", +" @ # +++++ .+ +++++ @ ", +" @ +.....+.++++++++ @ ", +" @ +.......+++......+ @ ", +" @ +......+++.......+ @ ", +" @@ +++++++.++.....+ @@ ", +" @ +++++ .+ +++++ @ ", +" @ @ ", +" @ @ ", +" @@@ @@@ ", +" @@@@@@@@@@@@ ", +" "}; diff --git a/components/acs/Src/resources/TACSAudioOut.xpm b/components/acs/Src/resources/TACSAudioOut.xpm new file mode 100644 index 000000000..84d757f0f --- /dev/null +++ b/components/acs/Src/resources/TACSAudioOut.xpm @@ -0,0 +1,33 @@ +/* XPM */ +static char * TAudioOut_xpm[] = { +"24 24 6 1", +" c None", +". c #000000", +"+ c #000080", +"@ c #800000", +"# c #00FFFF", +"$ c #0000FF", +" ", +" ", +" ", +" ", +" .. ", +" ++.. @ @ @ ", +" +#. . @ @ ", +" +#.. . ", +" +# . . @ @ @ ", +" .++# #.+ . @ @ ", +" .+ $ # ..+ . ", +" . #$# #. . . @ @ @ ", +" .##$ # ... . @ @ ", +" .$$.# #..+ . ", +" ...$# .+ . @ @ @ ", +" .$#. . @ @ ", +" .$.. . ", +" .$. . @ @ @ ", +" .$.. @ @ ", +" .. ", +" ", +" ", +" ", +" "}; diff --git a/components/acs/Src/resources/TACSAudioProcessor.xpm b/components/acs/Src/resources/TACSAudioProcessor.xpm new file mode 100644 index 000000000..ce65ef516 --- /dev/null +++ b/components/acs/Src/resources/TACSAudioProcessor.xpm @@ -0,0 +1,36 @@ +/* XPM */ +static char * TAudioProcessor_xpm[] = { +"24 24 9 1", +" c None", +". c #800000", +"+ c #FF0000", +"@ c #808000", +"# c #800080", +"$ c #FFFF00", +"% c #000000", +"& c #000080", +"* c #0000FF", +" ", +" . ", +" .. ", +" ..++. ", +" .+++++. ", +" @# @$ .++++++.", +" @%%% .+++++. ", +" @%%%%% @$ ..++. ", +" @%%%%%%% .. ", +" @%%%%%%%%% @$ . ", +" %%%%%% %%%% ", +" $%%%%%% %%%% @$ ", +" @ %%%%%%%%%%% ", +" $%%%%%%%%%%% @$ ", +" & %%%%%% %%% ", +" && $%%%%% %%%% ", +" &&**& @ %%%%%%%%% ", +"&*****& $%%%%%%% ", +"&******& @ %%%%% ", +"&*****& $%%% ", +" &&**& @ ", +" && ", +" & ", +" "}; diff --git a/components/acs/Src/resources/TACSBWFilter.xpm b/components/acs/Src/resources/TACSBWFilter.xpm new file mode 100644 index 000000000..107429fbd --- /dev/null +++ b/components/acs/Src/resources/TACSBWFilter.xpm @@ -0,0 +1,32 @@ +/* XPM */ +static char * TBWFilter_xpm[] = { +"24 24 5 1", +" c None", +". c #FFFF00", +"+ c #0000FF", +"@ c #FF0000", +"# c #000000", +" . ", +" . . ", +" ++ ++ ++ ", +" + + + + + + ", +" ++++ + + ++++ ", +" @ @ ", +" @ ### @ ", +" @ # # + @ ", +" @ # # + @ ", +" @ ### ++ @ ", +" @ # # @ ", +" @@@@@ # # @@@@@ ", +" ### ", +" @@@@@ # # @@@@@ ", +" @ # # @ ", +" @ # # # @ ", +" @ @@ # # # @ ", +" @ @ # # # @ ", +" @ @@ # # @ ", +" @ @ ", +" @ @ ", +" ++++++++++++++++++++++ ", +" ", +" "}; diff --git a/components/acs/Src/resources/TACSCDIn.xpm b/components/acs/Src/resources/TACSCDIn.xpm new file mode 100644 index 000000000..6457169c2 --- /dev/null +++ b/components/acs/Src/resources/TACSCDIn.xpm @@ -0,0 +1,34 @@ +/* XPM */ +static char * TCDIn_xpm[] = { +"24 24 7 1", +" c None", +". c #800000", +"+ c #000000", +"@ c #00FFFF", +"# c #00FF00", +"$ c #FF0000", +"% c #FFFF00", +" ", +" ", +" ", +" . ", +" +++++ .. ", +" ++@@###+ .$. ", +" + @@#### ....$$. ", +" + @@####.$$$$$$$. ", +" + @@##%.$$$$$$$$. ", +" + @@#%%.$$$$$$$$$. ", +"+ +++%%.$$$$$$$$. ", +"+ + + .$$$$$$$. ", +"+ + + ....$$. ", +"+ + + .$. ", +"+ %%+++ .. ", +" + %%%#@@ +. ", +" + %%%##@@ + ", +" +%%###@@@ + ", +" +%####@@ + ", +" ++###@@++ ", +" +++++ ", +" ", +" ", +" "}; diff --git a/components/acs/Src/resources/TACSCDPlayer.xpm b/components/acs/Src/resources/TACSCDPlayer.xpm new file mode 100644 index 000000000..c5beffa36 --- /dev/null +++ b/components/acs/Src/resources/TACSCDPlayer.xpm @@ -0,0 +1,34 @@ +/* XPM */ +static char * TCDPlayer_xpm[] = { +"24 24 7 1", +" c None", +". c #000000", +"+ c #000080", +"@ c #00FFFF", +"# c #0000FF", +"$ c #00FF00", +"% c #FFFF00", +" ", +" .. ", +" ++.. ", +" +@. . ", +" +@.. . ", +" +@ . . ", +" .++@ @.+ .", +" ......+ # @ ..+ .", +" ..@@$$$. @#@ @. . .", +" . @@$$$.@@# @ ... .", +" . @@$$$.##.@ @..+ .", +" . @@$$%...#@ .+ .", +" . @@$%%% .#@. . ", +". ...%% .#.. . ", +". . . ..#. . ", +". . . . .#.. ", +". . . . .. ", +". %%... . ", +" . %%%$@@ . ", +" . %%%$$@@ . ", +" .%%$$$@@@ . ", +" .%$$$$@@ . ", +" ..$$$@@.. ", +" ..... "}; diff --git a/components/acs/Src/resources/TACSConvolver.xpm b/components/acs/Src/resources/TACSConvolver.xpm new file mode 100644 index 000000000..24439ffbc --- /dev/null +++ b/components/acs/Src/resources/TACSConvolver.xpm @@ -0,0 +1,31 @@ +/* XPM */ +static char * TConvolver_xpm[] = { +"24 24 4 1", +" c None", +". c #FF0000", +"+ c #0000FF", +"@ c #000000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" .. ", +" . ", +" . ", +" ++ + @ . .. ", +" ++ @ @ @ . . . ", +" + @@@ .. . ", +" + @ @ @ . . ", +" + + @ . . ", +" + + . .. ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/components/acs/Src/resources/TACSFileIn.xpm b/components/acs/Src/resources/TACSFileIn.xpm new file mode 100644 index 000000000..68e78cf8f --- /dev/null +++ b/components/acs/Src/resources/TACSFileIn.xpm @@ -0,0 +1,31 @@ +/* XPM */ +static char * TFileIn_xpm[] = { +"24 24 4 1", +" c None", +". c #FFFFFF", +"+ c #FF0000", +"@ c #FFFF00", +" ", +" ", +" ........... ", +" ............. ", +" .............. ", +" ............... ", +" ................ ", +" ................+ ", +" ................++ ", +" ................+++ ", +" .............+++++++ ", +" ............+++++++++ ", +" ............++++++++++ ", +" ............+++++++++++", +" ............++++++++++ ", +" ............+++++++++ ", +" .............+++++++ ", +" ..............@.+++ ", +" ...........@.@.@++ ", +" ....@.@..@@.@.@.+ ", +" ..@.@.@.@@.@.@.@. ", +" ............... ", +" ", +" "}; diff --git a/components/acs/Src/resources/TACSFileOut.xpm b/components/acs/Src/resources/TACSFileOut.xpm new file mode 100644 index 000000000..cb74af740 --- /dev/null +++ b/components/acs/Src/resources/TACSFileOut.xpm @@ -0,0 +1,31 @@ +/* XPM */ +static char * TFileOut_xpm[] = { +"24 24 4 1", +" c None", +". c #FFFFFF", +"+ c #0000FF", +"@ c #FFFF00", +" ", +" ", +" ........... ", +" ............. ", +" .............. ", +" ............... ", +" ................ ", +" + ................. ", +" ++................. ", +" +++................ ", +" +++++++............... ", +"+++++++++.............. ", +"++++++++++...........@. ", +"+++++++++++............ ", +"++++++++++...........@. ", +"+++++++++...........@.. ", +" +++++++.............@. ", +" +++............@@.. ", +" ++............@@.@. ", +" + .....@.@..@...@.. ", +" ..@.@.@.@@.@.@.@. ", +" ............... ", +" ", +" "}; diff --git a/components/acs/Src/resources/TACSFixedResampler.xpm b/components/acs/Src/resources/TACSFixedResampler.xpm new file mode 100644 index 000000000..160bef56c --- /dev/null +++ b/components/acs/Src/resources/TACSFixedResampler.xpm @@ -0,0 +1,31 @@ +/* XPM */ +static char * TFixedResampler_xpm[] = { +"24 24 4 1", +" c None", +". c #0000FF", +"+ c #FF0000", +"@ c #000000", +" ", +" ", +" ", +" ", +" . . ", +" .. . ", +" . . ", +" . . ", +" ..... +++ ", +" .. ++ ++ ", +" .. ++ ++ ", +" ....... ++ ++ ", +" .. ++ ", +" .. @@@ ++ ", +" .. @@@ ++ ", +" .. @@@ ++ ", +" .. ++ ", +" ....... +++++++ ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/components/acs/Src/resources/TACSInputList.xpm b/components/acs/Src/resources/TACSInputList.xpm new file mode 100644 index 000000000..7a6f0541b --- /dev/null +++ b/components/acs/Src/resources/TACSInputList.xpm @@ -0,0 +1,32 @@ +/* XPM */ +static char * TInputList_xpm[] = { +"24 24 5 1", +" c None", +". c #800000", +"+ c #FFFF00", +"@ c #000000", +"# c #FF0000", +" ", +" ... ", +" . . ", +" . . ", +" . +.@ ", +" . ++.@ ", +" .....@ . ", +" @@@@@ .. ", +" .#. ", +" ... ....##. ", +" . . .#######. ", +" . . .########. ", +" . +.@ .#########. ", +" . ++.@ .########. ", +" .....@ .#######. ", +" @@@@@ ....##. ", +" .#. ", +" ... .. ", +" . . . ", +" . . ", +" . +.@ ", +" . ++.@ ", +" .....@ ", +" @@@@@ "}; diff --git a/components/acs/Src/resources/TACSMSConverter.xpm b/components/acs/Src/resources/TACSMSConverter.xpm new file mode 100644 index 000000000..60ae36e0c --- /dev/null +++ b/components/acs/Src/resources/TACSMSConverter.xpm @@ -0,0 +1,30 @@ +/* XPM */ +static char * TMSConverter_xpm[] = { +"24 24 3 1", +" c None", +". c #808000", +"+ c #FF0000", +" ....... ", +" . . ", +" . ... . ", +" . ..... . ", +" . ..... . ", +" . ..... . ", +" . ... . ", +" . . ", +" . . ", +" ....... ", +" + + ", +" ++ + ", +" + + + + ", +" + ++ ", +" ....... + + ....... ", +" . . . . ", +" . ... . . ... . ", +" . ..... . . ..... . ", +" . ..... . . ..... . ", +" . ..... . . ..... . ", +" . ... . . ... . ", +" . . . . ", +" . . . . ", +" ....... ....... "}; diff --git a/components/acs/Src/resources/TACSMemoryIn.xpm b/components/acs/Src/resources/TACSMemoryIn.xpm new file mode 100644 index 000000000..2891a86e6 --- /dev/null +++ b/components/acs/Src/resources/TACSMemoryIn.xpm @@ -0,0 +1,34 @@ +/* XPM */ +static char * TMemoryIn_xpm[] = { +"24 24 7 1", +" c None", +". c #800000", +"+ c #FF0000", +"@ c #808000", +"# c #800080", +"$ c #FFFF00", +"% c #000000", +" . ", +" .. ", +" .+. ", +" ....++. ", +" .+++++++. ", +" .++++++++. ", +" .+++++++++. ", +" @# @$ .++++++++. ", +" @%%% .+++++++. ", +" @%%%%% @$ ....++. ", +" @%%%%%%% .+. ", +" @%%%%%%%%% @$ .. ", +" %%%%%% %%%% . ", +" $%%%%%% %%%% @$ ", +" @ %%%%%%%%%%% ", +" $%%%%%%%%%%% @$ ", +" @ %%%%%% %%% ", +" $%%%%% %%%% ", +" @ %%%%%%%%% ", +" $%%%%%%% ", +" @ %%%%% ", +" $%%% ", +" @ ", +" "}; diff --git a/components/acs/Src/resources/TACSMixer.xpm b/components/acs/Src/resources/TACSMixer.xpm new file mode 100644 index 000000000..3856019a8 --- /dev/null +++ b/components/acs/Src/resources/TACSMixer.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * TMixer_xpm[] = { +"24 24 2 1", +" c None", +". c #000000", +" ", +" ", +" . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . .. . ", +" . . ...... . ", +" . . .. . ", +" .. . . . ", +" ...... . . . ", +" .. . . . ", +" . . . . ", +" . . . . ", +" . .. . . ", +" . ...... . . ", +" . .. . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . ", +" ...................... ", +" "}; diff --git a/components/acs/Src/resources/TACSNULLOut.xpm b/components/acs/Src/resources/TACSNULLOut.xpm new file mode 100644 index 000000000..3ce073281 --- /dev/null +++ b/components/acs/Src/resources/TACSNULLOut.xpm @@ -0,0 +1,32 @@ +/* XPM */ +static char * TNULLOut_xpm[] = { +"24 24 5 1", +" c None", +". c #000080", +"+ c #0000FF", +"@ c #00FFFF", +"# c #000000", +" ", +" . ", +" .. ", +" .+. ", +" ....++. ", +" .+++++++. ", +" .++++++++. ", +" .+++++++++. ..... ", +" .++++++++. +.+++++.+ ", +" .+++++++. ..+++++@. ", +" ....++. ...+++++@.. ", +" .+. ...+++++@.# ", +" .. ....+++.... ", +" . .@+.....++. ", +" .@++++++++. ", +" .@++++++++# ", +" ...+++++... ", +" .@+.....++. ", +" .@++++++++. ", +" ...+++++... ", +" .@+.....++. ", +" +.@++++++.+ ", +" +.+++++.+ ", +" ..... "}; diff --git a/components/acs/Src/resources/TACSRateConverter.xpm b/components/acs/Src/resources/TACSRateConverter.xpm new file mode 100644 index 000000000..1007781ff --- /dev/null +++ b/components/acs/Src/resources/TACSRateConverter.xpm @@ -0,0 +1,31 @@ +/* XPM */ +static char * TRateConverter_xpm[] = { +"24 24 4 1", +" c None", +". c #FF0000", +"+ c #000000", +"@ c #0000FF", +" ", +" ", +" ", +".. .. .. ", +" . . . . . .", +" . . . . . .", +" . . . . . . ", +" . . . . . . ", +" .. .. .. ", +" ", +" + + ", +" + + +++ ", +" +++ + + ", +" + + ", +" ", +" @ @ @ @ @ ", +" @ @ @ @ @ ", +"@ @ @ @ @ @ @ @ @ @ @ @ ", +"@ @ @ @ @ @ @ @ @ @ @ @ ", +" @ @ @ @ @ @ ", +" @ @ @ @ @ @ ", +" ", +" ", +" "}; diff --git a/components/acs/Src/resources/TACSSINCFilter.xpm b/components/acs/Src/resources/TACSSINCFilter.xpm new file mode 100644 index 000000000..4b214c924 --- /dev/null +++ b/components/acs/Src/resources/TACSSINCFilter.xpm @@ -0,0 +1,34 @@ +/* XPM */ +static char * TSINCFilter_xpm[] = { +"24 24 7 1", +" c None", +". c #800000", +"+ c #000000", +"@ c #0000FF", +"# c #008080", +"$ c #00FFFF", +"% c #000080", +" ", +" ... . . . ... ", +" . . .. . . ", +" .. . . . . ", +" . . . . . ", +" ... . . . ... ", +" ", +" +++++++ ", +" +++@#@#@#@+++ ", +" +@#@#@#@#@#@#$+ ", +" +%#@#@#@#@#@#@$%+ ", +" +%%#@#@#@#@#@$$%+ ", +" ++++@#@#@#@++++ ", +" +$@+++++++@@+ ", +" %$@@@@@@@@+ ", +" %$@@@@@@+ ", +" %$@@@@+ ", +" %@+++ ", +" %$@@+ ", +" %$@@+ ", +" %$@@+ ", +" %$@@+ ", +" %%% ", +" "}; diff --git a/components/acs/Src/resources/TACSSampleConverter.xpm b/components/acs/Src/resources/TACSSampleConverter.xpm new file mode 100644 index 000000000..26c010a6d --- /dev/null +++ b/components/acs/Src/resources/TACSSampleConverter.xpm @@ -0,0 +1,31 @@ +/* XPM */ +static char * TSampleConverter_xpm[] = { +"24 24 4 1", +" c None", +". c #0000FF", +"+ c #000080", +"@ c #000000", +" ", +"........................", +" . . ", +" . + + + + . + + +", +" . + + + + . + + ", +" . + + . + ", +" . + + + + . + + ", +" . + + + + . + + +", +" . . ", +"........................", +" @ @ ", +" @ @ @@@ ", +" @@@ @ @ ", +" @ @ ", +"........................", +" . . . ", +" . + + . + + . + +", +" . + + . + + . + + ", +" . + . + . + ", +" . + + . + + . + + ", +" . + + . + + . + +", +" . . . ", +"........................", +" "}; diff --git a/components/acs/Src/resources/TACSSoundIndicator.xpm b/components/acs/Src/resources/TACSSoundIndicator.xpm new file mode 100644 index 000000000..e27408b37 --- /dev/null +++ b/components/acs/Src/resources/TACSSoundIndicator.xpm @@ -0,0 +1,30 @@ +/* XPM */ +static char * TSoundIndicator_xpm[] = { +"24 24 3 1", +" c None", +". c #000000", +"+ c #00FF00", +" ", +" ", +" .................... ", +" .................... ", +" .................... ", +" .................... ", +" .................... ", +" ....++.............. ", +" ....++.............. ", +" .................... ", +" .++.++.++........... ", +" .++.++.++........... ", +" .................... ", +" .++.++.++.......++.. ", +" .++.++.++.......++.. ", +" .................... ", +" .++.++.++.++....++.. ", +" .++.++.++.++....++.. ", +" .................... ", +" .++.++.++.++.++.++.. ", +" .++.++.++.++.++.++.. ", +" .................... ", +" ", +" "}; diff --git a/components/acs/Src/resources/TACSStereoBalance.xpm b/components/acs/Src/resources/TACSStereoBalance.xpm new file mode 100644 index 000000000..d742fec95 --- /dev/null +++ b/components/acs/Src/resources/TACSStereoBalance.xpm @@ -0,0 +1,30 @@ +/* XPM */ +static char * TStereoBalance_xpm[] = { +"24 24 3 1", +" c None", +". c #800000", +"+ c #000000", +" ", +" ", +" ", +" ", +" ", +" . . ", +" .. .. ", +" ... ... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ... ... ", +" .. .. ", +" . . ", +" ++ ", +" ++ ", +" ++ ", +" +++++++ +++++++++ ", +" +++++++ +++++++++ ", +" +++ ", +" ", +" ", +" "}; diff --git a/components/acs/Src/resources/TACSStreamIn.xpm b/components/acs/Src/resources/TACSStreamIn.xpm new file mode 100644 index 000000000..e7ee1a081 --- /dev/null +++ b/components/acs/Src/resources/TACSStreamIn.xpm @@ -0,0 +1,35 @@ +/* XPM */ +static char * TStreamIn_xpm[] = { +"24 24 8 1", +" c None", +". c #800000", +"+ c #FF0000", +"@ c #0000FF", +"# c #000080", +"$ c #00FFFF", +"% c #008080", +"& c #000000", +" . ", +" .. ", +" .+. ", +" ....++. ", +" .+++++++. ", +" .++++++++. ", +" .+++++++++. ", +" @# @$ .++++++++. ", +" @### .+++++++. ", +" @##### @$ ....++. ", +" @####### .+. ", +" @####%#### @$ .. ", +" &@####$#### . ", +" $&@####$#### @$ ", +" & &@######### ", +" $&@####%#### @$ ", +" & &@####$$### ", +" $&####$$#### ", +" & &#######& ", +" $&#####& ", +" & &###& ", +" $&#& ", +" & ", +" "}; diff --git a/components/acs/Src/resources/TACSStreamOut.xpm b/components/acs/Src/resources/TACSStreamOut.xpm new file mode 100644 index 000000000..6c992b29b --- /dev/null +++ b/components/acs/Src/resources/TACSStreamOut.xpm @@ -0,0 +1,33 @@ +/* XPM */ +static char * TStreamOut_xpm[] = { +"24 24 6 1", +" c None", +". c #0000FF", +"+ c #000080", +"@ c #00FFFF", +"# c #008080", +"$ c #000000", +" .+ .@ ", +" .+++ ", +" .+++++ .@ ", +" .+++++++ ", +" .++++#++++ .@ ", +" $.++++@++++ ", +" @$.++++@++++ .@ ", +" $ $.+++++++++ ", +" @$.++++#++++ .@", +" $ $.++++@@+++ ", +" + @$++++@@++++ ", +" ++ $ $+++++++$ ", +" +.+ @$+++++$ ", +" ++++..+ $ $+++$ ", +"+.......+ @$+$ ", +"+........+ $ ", +"+.........+ ", +"+........+ ", +"+.......+ ", +" ++++..+ ", +" +.+ ", +" ++ ", +" + ", +" "}; diff --git a/components/acs/Src/resources/acs_reg.lrs b/components/acs/Src/resources/acs_reg.lrs new file mode 100644 index 000000000..fbeee637b --- /dev/null +++ b/components/acs/Src/resources/acs_reg.lrs @@ -0,0 +1,360 @@ +LazarusResources.Add('TACSAudioIn','XPM',[ + '/* XPM */'#13#10'static char * TAudioIn_xpm[] = {'#13#10'"24 24 6 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #0000FF",'#13#10'"+'#9'c #00FFFF",'#13#10'"@' + +#9'c #000080",'#13#10'"#'#9'c #000000",'#13#10'"$'#9'c #808000",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" .' + +'+.+.@ ",'#13#10'" +.+...@.@ ",'#13#10'" ....@..@' + +'.@ ",'#13#10'" +.....@@.@@ ",'#13#10'" .....@..@.@ ' + +' ",'#13#10'" +....@.@@.@@ ",'#13#10'" ....@.@..@.@ ",' + +#13#10'" +@.@.@.@@.@@ ",'#13#10'" . @.@.@.@@@ ",'#13#10 + +'" # $@@.@@@@@ ",'#13#10'" # $$$@@@@@ ",'#13#10'" ' + +' # $$$@@@@ ",'#13#10'" # $$$# ",'#13#10'" # $$#' + +'# ",'#13#10'" # $$$# ",'#13#10'" # $### ' + +' ",'#13#10'" # $$### ",'#13#10'" #$$$#### ' + +' ",'#13#10'" $## ### ",'#13#10'" ### ' + +'"};'#13#10 +]); +LazarusResources.Add('TACSAudioOut','XPM',[ + '/* XPM */'#13#10'static char * TAudioOut_xpm[] = {'#13#10'"24 24 6 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #000000",'#13#10'"+'#9'c #000080",'#13#10'"@' + +#9'c #800000",'#13#10'"#'#9'c #00FFFF",'#13#10'"$'#9'c #0000FF",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" .. ' + +' ",'#13#10'" ++.. @ @ @ ",'#13#10'" +#. . @ ' + +'@ ",'#13#10'" +#.. . ",'#13#10'" +# . . @ @ @ ' + +' ",'#13#10'" .++# #.+ . @ @ ",'#13#10'" .+ $ # ..+ . ",' + +#13#10'" . #$# #. . . @ @ @ ",'#13#10'" .##$ # ... . @ @ ",'#13#10 + +'" .$$.# #..+ . ",'#13#10'" ...$# .+ . @ @ @ ",'#13#10'" ' + +' .$#. . @ @ ",'#13#10'" .$.. . ",'#13#10'" .$' + +'. . @ @ @ ",'#13#10'" .$.. @ @ ",'#13#10'" .. ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +'"};'#13#10 +]); +LazarusResources.Add('TACSCDIn','XPM',[ + '/* XPM */'#13#10'static char * TCDIn_xpm[] = {'#13#10'"24 24 7 1",'#13#10'" ' + +#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #000000",'#13#10'"@'#9'c' + +' #00FFFF",'#13#10'"#'#9'c #00FF00",'#13#10'"$'#9'c #FF0000",'#13#10'"%'#9'c' + +' #FFFF00",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" . ",' + +#13#10'" +++++ .. ",'#13#10'" ++@@###+ .$. ",'#13#10 + +'" + @@#### ....$$. ",'#13#10'" + @@####.$$$$$$$. ",'#13#10'" + ' + +' @@##%.$$$$$$$$. ",'#13#10'" + @@#%%.$$$$$$$$$. ",'#13#10'"+ ++' + +'+%%.$$$$$$$$. ",'#13#10'"+ + + .$$$$$$$. ",'#13#10'"+ + + .' + +'...$$. ",'#13#10'"+ + + .$. ",'#13#10'"+ %%+++ .. ' + +' ",'#13#10'" + %%%#@@ +. ",'#13#10'" + %%%##@@ + ' + +'",'#13#10'" +%%###@@@ + ",'#13#10'" +%####@@ + ",'#13 + +#10'" ++###@@++ ",'#13#10'" +++++ ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSAudioMixer','XPM',[ + '/* XPM */'#13#10'static char * TAudioMixer_xpm[] = {'#13#10'"24 24 5 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #0000FF",'#13#10'"+'#9'c #000080",'#13#10 + +'"@'#9'c #800000",'#13#10'"#'#9'c #00FFFF",'#13#10'" ' + +'",'#13#10'" .+ ",'#13#10'" @@@@@.+@@@@@ ",'#13 + +#10'" @@@ .+ @@@ ",'#13#10'" @ .+ #@ ",'#13#10'" ' + +'@ .+ # #@ ",'#13#10'" @ .+ # @ ",'#13#10'" @@ ' + +' .+ # @@ ",'#13#10'" @#@@@ .+ @@@ @ ",'#13#10'" @ # @@@@@' + +'@@@@@@@ . @ ",'#13#10'" @# .+ @ ",'#13#10'" @ # .+ ' + +' @ ",'#13#10'" @# .+ @ ",'#13#10'" @ # +++++ .+ +++++ ' + +' @ ",'#13#10'" @ +.....+.++++++++ @ ",'#13#10'" @ +.......+++......+ @ ",' + +#13#10'" @ +......+++.......+ @ ",'#13#10'" @@ +++++++.++.....+ @@ ",'#13#10 + +'" @ +++++ .+ +++++ @ ",'#13#10'" @ @ ",'#13#10'" @ ' + +' @ ",'#13#10'" @@@ @@@ ",'#13#10'" @@@' + +'@@@@@@@@@ ",'#13#10'" "};'#13#10 +]); +LazarusResources.Add('TACSRateConverter','XPM',[ + '/* XPM */'#13#10'static char * TRateConverter_xpm[] = {'#13#10'"24 24 4 1",' + +#13#10'" '#9'c None",'#13#10'".'#9'c #FF0000",'#13#10'"+'#9'c #000000",'#13 + +#10'"@'#9'c #0000FF",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'".. .. ' + +'.. ",'#13#10'" . . . . . .",'#13#10'" . . . . . ' + +' .",'#13#10'" . . . . . . ",'#13#10'" . . . . . . ",' + +#13#10'" .. .. .. ",'#13#10'" ",'#13#10 + +'" + + ",'#13#10'" + + +++ ",'#13#10'" ' + +' +++ + + ",'#13#10'" + + ",'#13#10'" ' + +' ",'#13#10'" @ @ @ @ @ ",'#13#10'" @ @ @ ' + +' @ @ ",'#13#10'"@ @ @ @ @ @ @ @ @ @ @ @ ",'#13#10'"@ @ @ @ @ @ @ @ @ @' + +' @ @ ",'#13#10'" @ @ @ @ @ @ ",'#13#10'" @ @ @ @ @ @ ' + +'",'#13#10'" ",'#13#10'" ",'#13 + +#10'" "};'#13#10 +]); +LazarusResources.Add('TACSMSConverter','XPM',[ + '/* XPM */'#13#10'static char * TMSConverter_xpm[] = {'#13#10'"24 24 3 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #808000",'#13#10'"+'#9'c #FF0000",'#13#10 + +'" ....... ",'#13#10'" . . ",'#13#10'" ' + +' . ... . ",'#13#10'" . ..... . ",'#13#10'" . ' + +'..... . ",'#13#10'" . ..... . ",'#13#10'" . ... ' + +' . ",'#13#10'" . . ",'#13#10'" . . ' + +' ",'#13#10'" ....... ",'#13#10'" + + ' + +'",'#13#10'" ++ + ",'#13#10'" + + + + ",'#13 + +#10'" + ++ ",'#13#10'" ....... + + ....... ",'#13#10'" ' + +'. . . . ",'#13#10'" . ... . . ... . ",'#13#10'" . ...' + +'.. . . ..... . ",'#13#10'" . ..... . . ..... . ",'#13#10'" . ..... . ' + +' . ..... . ",'#13#10'" . ... . . ... . ",'#13#10'" . . . ' + +' . ",'#13#10'" . . . . ",'#13#10'" ....... .......' + +' "};'#13#10 +]); +LazarusResources.Add('TACSSampleConverter','XPM',[ + '/* XPM */'#13#10'static char * TSampleConverter_xpm[] = {'#13#10'"24 24 4 1"' + +','#13#10'" '#9'c None",'#13#10'".'#9'c #0000FF",'#13#10'"+'#9'c #000080",' + +#13#10'"@'#9'c #000000",'#13#10'" ",'#13#10'"........' + +'................",'#13#10'" . . ",'#13#10'" . + + + ' + +'+ . + + +",'#13#10'" . + + + + . + + ",'#13#10'" . + + . ' + +' + ",'#13#10'" . + + + + . + + ",'#13#10'" . + + + + . + + ' + +'+",'#13#10'" . . ",'#13#10'"........................",' + +#13#10'" @ @ ",'#13#10'" @ @ @@@ ",'#13#10 + +'" @@@ @ @ ",'#13#10'" @ @ ",'#13#10'"....' + +'....................",'#13#10'" . . . ",'#13#10'" . + + ' + +'. + + . + +",'#13#10'" . + + . + + . + + ",'#13#10'" . + . +' + +' . + ",'#13#10'" . + + . + + . + + ",'#13#10'" . + + . + + . ' + +'+ +",'#13#10'" . . . ",'#13#10'"........................' + +'",'#13#10'" "};'#13#10 +]); +LazarusResources.Add('TACSFixedResampler','XPM',[ + '/* XPM */'#13#10'static char * TFixedResampler_xpm[] = {'#13#10'"24 24 4 1",' + +#13#10'" '#9'c None",'#13#10'".'#9'c #0000FF",'#13#10'"+'#9'c #FF0000",'#13 + +#10'"@'#9'c #000000",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" . . ",'#13#10'" ..' + +' . ",'#13#10'" . . ",'#13#10'" . . ",' + +#13#10'" ..... +++ ",'#13#10'" .. ++ ++ ",'#13#10 + +'" .. ++ ++ ",'#13#10'" ....... ++ ++ ",'#13#10'" .' + +'. ++ ",'#13#10'" .. @@@ ++ ",'#13#10'" .. ' + +'@@@ ++ ",'#13#10'" .. @@@ ++ ",'#13#10'" .. +' + +'+ ",'#13#10'" ....... +++++++ ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +'",'#13#10'" ",'#13#10'" ",'#13 + +#10'" "};'#13#10 +]); +LazarusResources.Add('TACSStereoBalance','XPM',[ + '/* XPM */'#13#10'static char * TStereoBalance_xpm[] = {'#13#10'"24 24 3 1",' + +#13#10'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #000000",'#13 + +#10'" ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" . . ",'#13#10'" .. ' + +' .. ",'#13#10'" ... ... ",'#13#10'" ...... ' + +'...... ",'#13#10'" ...... ...... ",'#13#10'" ...... .....' + +'. ",'#13#10'" ...... ...... ",'#13#10'" ... ... ",' + +#13#10'" .. .. ",'#13#10'" . . ",'#13#10 + +'" ++ ",'#13#10'" ++ ",'#13#10'" ' + +' ++ ",'#13#10'" +++++++ +++++++++ ",'#13#10'" ++++++' + +'+ +++++++++ ",'#13#10'" +++ ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSBWFilter','XPM',[ + '/* XPM */'#13#10'static char * TBWFilter_xpm[] = {'#13#10'"24 24 5 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #FFFF00",'#13#10'"+'#9'c #0000FF",'#13#10'"@' + +#9'c #FF0000",'#13#10'"#'#9'c #000000",'#13#10'" . ",' + +#13#10'" . . ",'#13#10'" ++ ++ ++ ",'#13#10 + +'" + + + + + + ",'#13#10'" ++++ + + ++++ ",'#13#10'" @' + +' @ ",'#13#10'" @ ### @ ",'#13#10'" @ # ' + +' # + @ ",'#13#10'" @ # # + @ ",'#13#10'" @ ### ' + +'++ @ ",'#13#10'" @ # # @ ",'#13#10'" @@@@@ # # @' + +'@@@@ ",'#13#10'" ### ",'#13#10'" @@@@@ # # @@@@@ ' + +'",'#13#10'" @ # # @ ",'#13#10'" @ # # # @ ",'#13 + +#10'" @ @@ # # # @ ",'#13#10'" @ @ # # # @ ",'#13#10'" ' + +' @ @@ # # @ ",'#13#10'" @ @ ",'#13#10'" @ ' + +' @ ",'#13#10'" ++++++++++++++++++++++ ",'#13#10'" ' + +' ",'#13#10'" "};'#13#10 +]); +LazarusResources.Add('TACSSINCFilter','XPM',[ + '/* XPM */'#13#10'static char * TSINCFilter_xpm[] = {'#13#10'"24 24 7 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #000000",'#13#10 + +'"@'#9'c #0000FF",'#13#10'"#'#9'c #008080",'#13#10'"$'#9'c #00FFFF",'#13#10 + +'"%'#9'c #000080",'#13#10'" ",'#13#10'" ... . . .' + +' ... ",'#13#10'" . . .. . . ",'#13#10'" .. . . . . ' + +' ",'#13#10'" . . . . . ",'#13#10'" ... . . . ... ' + +'",'#13#10'" ",'#13#10'" +++++++ ",'#13 + +#10'" +++@#@#@#@+++ ",'#13#10'" +@#@#@#@#@#@#$+ ",'#13#10'" ' + +' +%#@#@#@#@#@#@$%+ ",'#13#10'" +%%#@#@#@#@#@$$%+ ",'#13#10'" +' + +'+++@#@#@#@++++ ",'#13#10'" +$@+++++++@@+ ",'#13#10'" %$@@' + +'@@@@@@+ ",'#13#10'" %$@@@@@@+ ",'#13#10'" %$@@@@+' + +' ",'#13#10'" %@+++ ",'#13#10'" %$@@+ ' + +' ",'#13#10'" %$@@+ ",'#13#10'" %$@@+ ",' + +#13#10'" %$@@+ ",'#13#10'" %%% ",'#13#10 + +'" "};'#13#10 +]); +LazarusResources.Add('TACSConvolver','XPM',[ + '/* XPM */'#13#10'static char * TConvolver_xpm[] = {'#13#10'"24 24 4 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #FF0000",'#13#10'"+'#9'c #0000FF",'#13#10 + +'"@'#9'c #000000",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +'",'#13#10'" ",'#13#10'" ",'#13 + +#10'" .. ",'#13#10'" . ",'#13#10'" ' + +' . ",'#13#10'" ++ + @ . .. ",'#13#10'" ++' + +' @ @ @ . . . ",'#13#10'" + @@@ .. . ",'#13#10'" + @ ' + +'@ @ . . ",'#13#10'" + + @ . . ",'#13#10'" + + ' + +'. .. ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ",' + +#13#10'" ",'#13#10'" ",'#13#10 + +'" "};'#13#10 +]); +LazarusResources.Add('TACSSoundIndicator','XPM',[ + '/* XPM */'#13#10'static char * TSoundIndicator_xpm[] = {'#13#10'"24 24 3 1",' + +#13#10'" '#9'c None",'#13#10'".'#9'c #000000",'#13#10'"+'#9'c #00FF00",'#13 + +#10'" ",'#13#10'" ",'#13#10'" ' + +' .................... ",'#13#10'" .................... ",'#13#10'" ....' + +'................ ",'#13#10'" .................... ",'#13#10'" .........' + +'........... ",'#13#10'" ....++.............. ",'#13#10'" ....++........' + +'...... ",'#13#10'" .................... ",'#13#10'" .++.++.++..........' + +'. ",'#13#10'" .++.++.++........... ",'#13#10'" .................... ",' + +#13#10'" .++.++.++.......++.. ",'#13#10'" .++.++.++.......++.. ",'#13#10 + +'" .................... ",'#13#10'" .++.++.++.++....++.. ",'#13#10'" .+' + +'+.++.++.++....++.. ",'#13#10'" .................... ",'#13#10'" .++.++.' + +'++.++.++.++.. ",'#13#10'" .++.++.++.++.++.++.. ",'#13#10'" ............' + +'........ ",'#13#10'" ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSMemoryIn','XPM',[ + '/* XPM */'#13#10'static char * TMemoryIn_xpm[] = {'#13#10'"24 24 7 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #FF0000",'#13#10'"@' + +#9'c #808000",'#13#10'"#'#9'c #800080",'#13#10'"$'#9'c #FFFF00",'#13#10'"%'#9 + +'c #000000",'#13#10'" . ",'#13#10'" .. ' + +' ",'#13#10'" .+. ",'#13#10'" ....++. "' + +','#13#10'" .+++++++. ",'#13#10'" .++++++++. ",'#13 + +#10'" .+++++++++. ",'#13#10'" @# @$ .++++++++. ",'#13#10'" ' + +' @%%% .+++++++. ",'#13#10'" @%%%%% @$ ....++. ",'#13#10'" @%%%' + +'%%%% .+. ",'#13#10'" @%%%%%%%%% @$ .. ",'#13#10'" %%%%%% %%%' + +'% . ",'#13#10'" $%%%%%% %%%% @$ ",'#13#10'" @ %%%%%%%%%%% ' + +' ",'#13#10'" $%%%%%%%%%%% @$ ",'#13#10'" @ %%%%%% %%% ' + +' ",'#13#10'" $%%%%% %%%% ",'#13#10'" @ %%%%%%%%% ",' + +#13#10'" $%%%%%%% ",'#13#10'" @ %%%%% ",'#13#10 + +'" $%%% ",'#13#10'" @ ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSAudioProcessor','XPM',[ + '/* XPM */'#13#10'static char * TAudioProcessor_xpm[] = {'#13#10'"24 24 9 1",' + +#13#10'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #FF0000",'#13 + +#10'"@'#9'c #808000",'#13#10'"#'#9'c #800080",'#13#10'"$'#9'c #FFFF00",'#13 + +#10'"%'#9'c #000000",'#13#10'"&'#9'c #000080",'#13#10'"*'#9'c #0000FF",'#13 + +#10'" ",'#13#10'" . ",'#13#10'" ' + +' .. ",'#13#10'" ..++. ",'#13#10'" ' + +' .+++++. ",'#13#10'" @# @$ .++++++.",'#13#10'" @%%%' + +' .+++++. ",'#13#10'" @%%%%% @$ ..++. ",'#13#10'" @%%%%%%% ' + +' .. ",'#13#10'" @%%%%%%%%% @$ . ",'#13#10'" %%%%%% %%%% ' + +' ",'#13#10'" $%%%%%% %%%% @$ ",'#13#10'" @ %%%%%%%%%%% ",' + +#13#10'" $%%%%%%%%%%% @$ ",'#13#10'" & %%%%%% %%% ",'#13#10 + +'" && $%%%%% %%%% ",'#13#10'" &&**& @ %%%%%%%%% ",'#13#10'"&***' + +'**& $%%%%%%% ",'#13#10'"&******& @ %%%%% ",'#13#10'"&*****& ' + +' $%%% ",'#13#10'" &&**& @ ",'#13#10'" && ' + +' ",'#13#10'" & ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSNULLOut','XPM',[ + '/* XPM */'#13#10'static char * TNULLOut_xpm[] = {'#13#10'"24 24 5 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #000080",'#13#10'"+'#9'c #0000FF",'#13#10'"@' + +#9'c #00FFFF",'#13#10'"#'#9'c #000000",'#13#10'" ",' + +#13#10'" . ",'#13#10'" .. ",'#13#10 + +'" .+. ",'#13#10'" ....++. ",'#13#10'" .++' + +'+++++. ",'#13#10'" .++++++++. ",'#13#10'" .+++++++' + +'++. ..... ",'#13#10'" .++++++++. +.+++++.+ ",'#13#10'" .+++++++. .' + +'.+++++@. ",'#13#10'" ....++. ...+++++@.. ",'#13#10'" .+. ...++++' + +'+@.# ",'#13#10'" .. ....+++.... ",'#13#10'" . .@+.....++. ' + +'",'#13#10'" .@++++++++. ",'#13#10'" .@++++++++# ",'#13 + +#10'" ...+++++... ",'#13#10'" .@+.....++. ",'#13#10'" ' + +' .@++++++++. ",'#13#10'" ...+++++... ",'#13#10'" ' + +' .@+.....++. ",'#13#10'" +.@++++++.+ ",'#13#10'" ' + +' +.+++++.+ ",'#13#10'" ..... "};'#13#10 +]); +LazarusResources.Add('TACSInputList','XPM',[ + '/* XPM */'#13#10'static char * TInputList_xpm[] = {'#13#10'"24 24 5 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #FFFF00",'#13#10 + +'"@'#9'c #000000",'#13#10'"#'#9'c #FF0000",'#13#10'" ' + +'",'#13#10'" ... ",'#13#10'" . . ",'#13 + +#10'" . . ",'#13#10'" . +.@ ",'#13#10'" ' + +' . ++.@ ",'#13#10'" .....@ . ",'#13#10'" @@@' + +'@@ .. ",'#13#10'" .#. ",'#13#10'" ... ' + +'....##. ",'#13#10'" . . .#######. ",'#13#10'" . . .#####' + +'###. ",'#13#10'" . +.@ .#########. ",'#13#10'" . ++.@ .########. ' + +' ",'#13#10'" .....@ .#######. ",'#13#10'" @@@@@ ....##. ",' + +#13#10'" .#. ",'#13#10'" ... .. ",'#13#10 + +'" . . . ",'#13#10'" . . ",'#13#10'" . ' + +' +.@ ",'#13#10'" . ++.@ ",'#13#10'" .....@ ' + +' ",'#13#10'" @@@@@ "};'#13#10 +]); +LazarusResources.Add('TACSStreamIn','XPM',[ + '/* XPM */'#13#10'static char * TStreamIn_xpm[] = {'#13#10'"24 24 8 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #FF0000",'#13#10'"@' + +#9'c #0000FF",'#13#10'"#'#9'c #000080",'#13#10'"$'#9'c #00FFFF",'#13#10'"%'#9 + +'c #008080",'#13#10'"&'#9'c #000000",'#13#10'" . ",'#13 + +#10'" .. ",'#13#10'" .+. ",'#13#10'" ' + +' ....++. ",'#13#10'" .+++++++. ",'#13#10'" ' + +' .++++++++. ",'#13#10'" .+++++++++. ",'#13#10'" @# @$ ' + +' .++++++++. ",'#13#10'" @### .+++++++. ",'#13#10'" @##### @$ ...' + +'.++. ",'#13#10'" @####### .+. ",'#13#10'" @####%#### @$ .. ' + +' ",'#13#10'" &@####$#### . ",'#13#10'" $&@####$#### @$ ",' + +#13#10'" & &@######### ",'#13#10'" $&@####%#### @$ ",'#13#10 + +'" & &@####$$### ",'#13#10'" $&####$$#### ",'#13#10'" ' + +' & &#######& ",'#13#10'" $&#####& ",'#13#10'" & ' + +'&###& ",'#13#10'" $&#& ",'#13#10'" & ' + +' ",'#13#10'" "};'#13#10 +]); +LazarusResources.Add('TACSStreamOut','XPM',[ + '/* XPM */'#13#10'static char * TStreamOut_xpm[] = {'#13#10'"24 24 6 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #0000FF",'#13#10'"+'#9'c #000080",'#13#10 + +'"@'#9'c #00FFFF",'#13#10'"#'#9'c #008080",'#13#10'"$'#9'c #000000",'#13#10 + +'" .+ .@ ",'#13#10'" .+++ ",'#13#10'" ' + +' .+++++ .@ ",'#13#10'" .+++++++ ",'#13#10'" .+' + +'+++#++++ .@ ",'#13#10'" $.++++@++++ ",'#13#10'" @$.++++' + +'@++++ .@ ",'#13#10'" $ $.+++++++++ ",'#13#10'" @$.++++#++' + +'++ .@",'#13#10'" $ $.++++@@+++ ",'#13#10'" + @$++++@@++++ ' + +'",'#13#10'" ++ $ $+++++++$ ",'#13#10'" +.+ @$+++++$ ",'#13 + +#10'" ++++..+ $ $+++$ ",'#13#10'"+.......+ @$+$ ",'#13#10'"+' + +'........+ $ ",'#13#10'"+.........+ ",'#13#10'"+.....' + +'...+ ",'#13#10'"+.......+ ",'#13#10'" ++++..+ ' + +' ",'#13#10'" +.+ ",'#13#10'" ++ ' + +' ",'#13#10'" + ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSFileIn','XPM',[ + '/* XPM */'#13#10'static char * TFileIn_xpm[] = {'#13#10'"24 24 4 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #FFFFFF",'#13#10'"+'#9'c #FF0000",'#13#10'"@' + +#9'c #FFFF00",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ........... ",'#13#10'" ............. ' + +' ",'#13#10'" .............. ",'#13#10'" ............... ",' + +#13#10'" ................ ",'#13#10'" ................+ ",'#13#10 + +'" ................++ ",'#13#10'" ................+++ ",'#13#10'" ...' + +'..........+++++++ ",'#13#10'" ............+++++++++ ",'#13#10'" ........' + +'....++++++++++ ",'#13#10'" ............+++++++++++",'#13#10'" ............+' + +'+++++++++ ",'#13#10'" ............+++++++++ ",'#13#10'" .............+++++' + +'++ ",'#13#10'" ..............@.+++ ",'#13#10'" ...........@.@.@++ ' + +'",'#13#10'" ....@.@..@@.@.@.+ ",'#13#10'" ..@.@.@.@@.@.@.@. ",'#13 + +#10'" ............... ",'#13#10'" ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSFileOut','XPM',[ + '/* XPM */'#13#10'static char * TFileOut_xpm[] = {'#13#10'"24 24 4 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #FFFFFF",'#13#10'"+'#9'c #0000FF",'#13#10'"@' + +#9'c #FFFF00",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ........... ",'#13#10'" ............. ' + +' ",'#13#10'" .............. ",'#13#10'" ............... ",' + +#13#10'" ................ ",'#13#10'" + ................. ",'#13#10 + +'" ++................. ",'#13#10'" +++................ ",'#13#10'" +++' + +'++++............... ",'#13#10'"+++++++++.............. ",'#13#10'"+++++++++' + +'+...........@. ",'#13#10'"+++++++++++............ ",'#13#10'"++++++++++....' + +'.......@. ",'#13#10'"+++++++++...........@.. ",'#13#10'" +++++++...........' + +'..@. ",'#13#10'" +++............@@.. ",'#13#10'" ++............@@.@. ' + +'",'#13#10'" + .....@.@..@...@.. ",'#13#10'" ..@.@.@.@@.@.@.@. ",'#13 + +#10'" ............... ",'#13#10'" ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSMixer','XPM',[ + '/* XPM */'#13#10'static char * TMixer_xpm[] = {'#13#10'"24 24 2 1",'#13#10'"' + +' '#9'c None",'#13#10'".'#9'c #000000",'#13#10'" ",' + +#13#10'" ",'#13#10'" . ",'#13#10 + +'" . . . . ",'#13#10'" . . . . ",'#13#10'" ' + +' . . . . ",'#13#10'" . . .. . ",'#13#10'" . ' + +' . ...... . ",'#13#10'" . . .. . ",'#13#10'" .. . ' + +' . . ",'#13#10'" ...... . . . ",'#13#10'" .. . . ' + +' . ",'#13#10'" . . . . ",'#13#10'" . . . . ' + +'",'#13#10'" . .. . . ",'#13#10'" . ...... . . ",'#13 + +#10'" . .. . . ",'#13#10'" . . . . ",'#13#10'" ' + +' . . . . ",'#13#10'" . . . . ",'#13#10'" .' + +' . . . ",'#13#10'" . ",'#13#10'" ..........' + +'............ ",'#13#10'" "};'#13#10 +]); diff --git a/components/acs/Src/resources/makeres.bat b/components/acs/Src/resources/makeres.bat new file mode 100644 index 000000000..47177fc4e --- /dev/null +++ b/components/acs/Src/resources/makeres.bat @@ -0,0 +1 @@ +lazres.exe acs_reg.lrs TACSAudioIn.xpm TACSAudioOut.xpm TACSCDIn.xpm TACSAudioMixer.xpm TACSRateConverter.xpm TACSMSConverter.xpm TACSSampleConverter.xpm TACSFixedResampler.xpm TACSStereoBalance.xpm TACSBWFilter.xpm TACSSINCFilter.xpm TACSConvolver.xpm TACSSoundIndicator.xpm TACSMemoryIn.xpm TACSAudioProcessor.xpm TACSNULLOut.xpm TACSInputList.xpm TACSStreamIn.xpm TACSStreamOut.xpm TACSFileIn.xpm TACSFileOut.xpm TACSMixer.xpm diff --git a/components/acs/Src/resources/makeres.sh b/components/acs/Src/resources/makeres.sh new file mode 100644 index 000000000..c60418c3c --- /dev/null +++ b/components/acs/Src/resources/makeres.sh @@ -0,0 +1,2 @@ +lazres acs_reg.lrs TACSAudioIn.xpm TACSAudioOut.xpm TACSCDIn.xpm TACSAudioMixer.xpm TACSRateConverter.xpm TACSMSConverter.xpm TACSSampleConverter.xpm TACSFixedResampler.xpm TACSStereoBalance.xpm TACSBWFilter.xpm TACSSINCFilter.xpm TACSConvolver.xpm TACSSoundIndicator.xpm TACSMemoryIn.xpm TACSAudioProcessor.xpm TACSNULLOut.xpm TACSInputList.xpm TACSStreamIn.xpm TACSStreamOut.xpm TACSFileIn.xpm TACSFileOut.xpm TACSMixer.xpm + diff --git a/components/acs/Src/resources/resource.dcr b/components/acs/Src/resources/resource.dcr new file mode 100644 index 000000000..c3af85424 Binary files /dev/null and b/components/acs/Src/resources/resource.dcr differ diff --git a/components/acs/Src/samples/converter.pas b/components/acs/Src/samples/converter.pas new file mode 100644 index 000000000..f57549e3f --- /dev/null +++ b/components/acs/Src/samples/converter.pas @@ -0,0 +1,124 @@ +(* + this file is a part of audio components suite. + see the license file for more details. + you can contact me at mail@z0m3ie.de + + This is an sample unit for an converter +*) +unit converter; + +interface + +uses + Classes, SysUtils; + +type + + { TACSNewConverter } + + TACSNewConverter = class(TACSCustomConverter) + private + protected + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + published + end; + +implementation + +{ TACSNewConverter } + +function TACSNewConverter.GetBPS: Integer; +begin + Result:=FInput.GetBPS; +end; + +function TACSNewConverter.GetCh: Integer; +begin + Result:=FInput.GetCh; +end; + +function TACSNewConverter.GetSR: Integer; +begin + Result:=FInput.GetSR; +end; + +constructor TACSNewConverter.Create(AOwner: TComponent); +begin + inherited Create(AOwner); +end; + +destructor TACSNewConverter.Destroy; +begin + inherited Destroy; +end; + +function TACSNewConverter.GetData(Buffer: Pointer; BufferSize: Integer): Integer; + var + l : Integer; + begin + if not Busy then raise EACSException.Create(strStreamnotopen); + if BufStart > BufEnd then + begin + if EndOfInput then + begin + Result := 0; + Exit; + end; + BufStart := 1; + + + while InputLock do; + InputLock := True; + + l := Finput.GetData(@Yourbuffer[0], WantedSize); + + InputLock := False; + if l = 0 then + begin + Result := 0; + Exit; + end; + InSize := l; + while (l<>0) and (InSize < WantedSize) do + begin + while InputLock do; + InputLock := True; + l := Finput.GetData(@YourBuffer[InSize], WantedSize - InSize); + InputLock := False; + Inc(InSize, l); + end; + if l = 0 then EndOfInput := True; + + //Do Your DSP Stuff here + + end; + if BufferSize < (BufEnd - BufStart + 1) + then Result := BufferSize + else Result := BufEnd - BufStart + 1; + + Move(YourOutBuffer[BufStart-1], Buffer^, Result); + + Inc(BufStart, Result); + Inc(FPosition, Result); +end; + +procedure TACSNewConverter.Init; +begin + inherited Init; +end; + +procedure TACSNewConverter.Flush; +begin + inherited Flush; +end; + +end. + diff --git a/components/acs/Src/samples/driver.pas b/components/acs/Src/samples/driver.pas new file mode 100644 index 000000000..6899bbbc7 --- /dev/null +++ b/components/acs/Src/samples/driver.pas @@ -0,0 +1,303 @@ +(* + this file is a part of audio components suite + see the license file for more details. + you can contact me at mail@z0m3ie.de + + this is an sample unit for an driver +*) + +unit driver; + +interface + +uses + ACS_Audio,SysUtils, Classes, ACS_Types, ACS_Classes, ACS_Strings; + +const + LATENCY = 25; + +type + TOwnAudioOut = class(TACSBaseAudioOut) + private + EndOfInput, StartInput : Boolean; + FDeviceNumber : Integer; + FDeviceCount : Integer; + procedure SetDevice(Ch : Integer);override; + function GetDeviceInfo : TACSDeviceInfo;override; + function GetDeviceCount : Integer;override; + protected + procedure Done; override; + function DoOutput(Abort : Boolean):Boolean; override; + procedure Prepare; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Pause;override; + procedure Resume;override; + end; + + TOwnAudioIn = class(TACSBaseAudioIn) + private + FDeviceNumber : Integer; + FDeviceCount : Integer; + FBPS, FChan, FFreq : Integer; + FOpened : Integer; + FRecTime : Integer; + procedure SetDevice(i : Integer);override; + procedure OpenAudio; + procedure CloseAudio; + function GetBPS : Integer; override; + function GetCh : Integer; override; + function GetSR : Integer; override; + function GetTotalTime : real; override; + procedure SetRecTime(aRecTime : Integer); + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function GetData(Buffer : Pointer; BufferSize : Integer): Integer; override; + procedure Init; override; + procedure Flush; override; + end; + +implementation + +procedure TOwnAudioOut.Prepare; +begin + FInput.Init; + FBuffer := AllocMem(FBufferSize); + StartInput := True; + EndOfInput := False; + + //Init your output device here +end; + +procedure TOwnAudioOut.Done; +begin + //Flush your output device here + + Finput.Flush; + FreeMem(FBuffer); +end; + +function TOwnAudioOut.DoOutput(Abort : Boolean):Boolean; +var + Len, offs, lb : Integer; + Stat : LongWord; + Res : HRESULT; + PlayTime, CTime : LongWord; +begin + Result := True; + if not Busy then Exit; + if not CanOutput then + begin + Result := False; + Exit; + end; + if StartInput then + begin + Len := 0; + while Len < FBufferSize do + begin + offs := FInput.GetData(@FBuffer^[Len], FBufferSize-Len); + if offs = 0 then + begin + EndOfInput := True; + Break; + end; + Inc(Len, offs); + end; + //Do Output Len bytes from FBuffer^ + + StartInput := False; + end; + if Abort then + begin + //Stop your output device + + CanOutput := False; + Result := False; + Exit; + end; + if EndOfInput then + begin + CanOutput := False; + + //Stop your output device + + Result := False; + Exit; + end; +end; + +constructor TOwnAudioOut.Create; +begin + inherited Create(AOwner); + FBufferSize := $40000; + + //enumerate devices and set Devicecount + FDeviceCount := 0; +end; + +destructor TOwnAudioOut.Destroy; +begin + //Wahtever +end; + +procedure TOwnAudioOut.Pause; +begin + if EndOfInput then Exit; + //Pause +end; + +procedure TOwnAudioOut.Resume; +begin + if EndOfInput then Exit; + //waht schoud i say ? +end; + +procedure TOwnAudioOut.SetDevice(Ch: Integer); +begin + FBaseChannel := Ch; +end; + +function TOwnAudioOut.GetDeviceInfo: TACSDeviceInfo; +begin + if (FBaseChannel >= FDeviceCount) then + exit; + //return an Deviceinfo +end; + +function TOwnAudioOut.GetDeviceCount: Integer; +begin + Result := FDeviceCount; +end; + +constructor TOwnAudioIn.Create; +begin + inherited Create(AOwner); + FBPS := 8; + FChan := 1; + FFreq := 8000; + FSize := -1; + BufferSize := $2000; + //enumerate devices and set Devicecount + FDeviceCount := 0; +end; + +destructor TOwnAudioIn.Destroy; +begin + //whatever + inherited Destroy; +end; + +procedure TOwnAudioIn.OpenAudio; +var + Res : HResult; + BufSize : Integer; +begin + BufSize := BufferSize; + if FOpened = 0 then + begin + //Init your In put device + end; + Inc(FOpened); +end; + +procedure TOwnAudioIn.CloseAudio; +begin + if FOpened = 1 then + begin + //Flush your Input device + end; + if FOpened > 0 then Dec(FOpened); +end; + +function TOwnAudioIn.GetBPS : Integer; +begin + Result := FBPS; +end; + +function TOwnAudioIn.GetCh : Integer; +begin + Result := FChan; +end; + +function TOwnAudioIn.GetSR : Integer; +begin + Result := FFreq; +end; + +procedure TOwnAudioIn.Init; +begin + if Busy then raise EACSException.Create(strBusy); + if (FDeviceNumber >= FDeviceCount) then raise EACSException.Create(Format(strChannelnotavailable,[FDeviceNumber])); + if FRecTime > 0 then FBytesToRead := FRecTime*FFreq*FChan*(FBPS div 8); + BufEnd := 0; + BufStart := 1; + FPosition := 0; + Busy := True; + FSize := FBytesToRead; + OpenAudio; +end; + +procedure TOwnAudioIn.Flush; +begin + CloseAudio; + Busy := False; +end; + +function TOwnAudioIn.GetData(Buffer : Pointer; BufferSize : Integer): Integer; +var + l : Integer; +begin + if not Busy then raise EACSException.Create(strStreamnotopen); + if (FBytesToRead >=0) and (FPosition >= FBytesToRead) then + begin + Result := 0; + Exit; + end; + if BufStart >= BufEnd then + begin + BufStart := 0; + + //Read Buffersize bytes from your input device and convert to PCM + //l is the real readed size maybe you cant ead the full buffer jet + BufEnd := l; + end; + if BufferSize < (BufEnd - BufStart) + then Result := BufferSize + else Result := BufEnd - BufStart; + Move(FBuffer[BufStart], Buffer^, Result); + Inc(BufStart, Result); + Inc(FPosition, Result); +end; + +procedure TOwnAudioIn.SetRecTime; +begin + FRecTime := aRecTime; + if FRecTime > 0 then + FBytesToRead := FRecTime*FFreq*FChan*(FBPS div 8) + else + FBytesToRead := -1; +end; + +procedure TOwnAudioIn.SetDevice(i : Integer); +begin + FDeviceNumber := i +end; + +function TOwnAudioIn.GetTotalTime : real; +var + BytesPerSec : Integer; +begin + BytesPerSec := FFreq*FChan*(FBPS div 8); + Result := FBytesToRead/BytesPerSec; +end; + +initialization + RegisterAudioOut('My Drivers Name',TOwnAudioOut,LATENCY); + RegisterAudioIn('My Drivers Name',TOwnAudioIn,LATENCY); + +finalization + +end. diff --git a/components/acs/Src/win32/ACS.dpk b/components/acs/Src/win32/ACS.dpk new file mode 100644 index 000000000..5a5bf960c --- /dev/null +++ b/components/acs/Src/win32/ACS.dpk @@ -0,0 +1,74 @@ +package ACS; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION OFF} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST ON} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'Audio Components Suite v 2.4'} +{$IMPLICITBUILD OFF} + +requires + vcl, + rtl; + +contains + ACS_Types in '..\classes\ACS_Types.pas', + ACS_Audio in '..\classes\ACS_Audio.pas', + ACS_AudioMix in '..\classes\ACS_AudioMix.pas', + ACS_CDROM in '..\classes\ACS_CDROM.pas', + ACS_Classes in '..\classes\ACS_Classes.pas', + ACS_Converters in '..\classes\ACS_Converters.pas', + ACS_File in '..\classes\ACS_File.pas', + ACS_Filters in '..\classes\ACS_Filters.pas', + ACS_Indicator in '..\classes\ACS_Indicator.pas', + ACS_Misc in '..\classes\ACS_Misc.pas', + ACS_Mixer in '..\classes\ACS_Mixer.pas', + ACS_MultiMix in '..\classes\ACS_MultiMix.pas', + ACS_Procs in '..\classes\ACS_Procs.pas', + ACS_Streams in '..\classes\ACS_Streams.pas', + ACS_Strings in '..\classes\ACS_Strings.pas', + akrip32 in '..\classes\windows\akrip32.pas', + acs_reg in 'acs_reg.pas', + ACS_AllFormats in '..\fileformats\ACS_Allformats.pas', + ACS_StdAudio in '..\drivers\ACS_StdAudio.pas', + ACS_DXAudio in '..\drivers\ACS_DXAudio.pas', + ogg in '..\fileformats\general\ogg.pas', + DirectShow9 in '..\fileformats\windows\DirectShow9.pas', + vorbisfile in '..\fileformats\general\vorbisfile.pas', + vorbisenc in '..\fileformats\general\vorbisenc.pas', + codec in '..\fileformats\general\codec.pas', + acs_dsfiles in '..\fileformats\ACS_DSFiles.pas', + directdraw in '..\fileformats\windows\directdraw.pas', + directsound in '..\fileformats\windows\directsound.pas', + direct3d9 in '..\fileformats\windows\direct3d9.pas', + acs_vorbis in '..\fileformats\ACS_Vorbis.pas', + dxtypes in '..\fileformats\windows\dxtypes.pas', + acs_mac in '..\fileformats\acs_mac.pas', + acs_flac in '..\fileformats\acs_flac.pas', + macdll in '..\fileformats\windows\macdll.pas', + lame in '..\fileformats\general\lame.pas', + acs_lame in '..\fileformats\acs_lame.pas', + flac in '..\fileformats\general\flac.pas', + acs_wave in '..\fileformats\acs_wave.pas', + waveconverter in '..\fileformats\windows\waveconverter.pas', + acs_volumequery in '..\classes\acs_volumequery.pas'; + +end. diff --git a/components/acs/Src/win32/acs_reg.lrs b/components/acs/Src/win32/acs_reg.lrs new file mode 100644 index 000000000..fbeee637b --- /dev/null +++ b/components/acs/Src/win32/acs_reg.lrs @@ -0,0 +1,360 @@ +LazarusResources.Add('TACSAudioIn','XPM',[ + '/* XPM */'#13#10'static char * TAudioIn_xpm[] = {'#13#10'"24 24 6 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #0000FF",'#13#10'"+'#9'c #00FFFF",'#13#10'"@' + +#9'c #000080",'#13#10'"#'#9'c #000000",'#13#10'"$'#9'c #808000",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" .' + +'+.+.@ ",'#13#10'" +.+...@.@ ",'#13#10'" ....@..@' + +'.@ ",'#13#10'" +.....@@.@@ ",'#13#10'" .....@..@.@ ' + +' ",'#13#10'" +....@.@@.@@ ",'#13#10'" ....@.@..@.@ ",' + +#13#10'" +@.@.@.@@.@@ ",'#13#10'" . @.@.@.@@@ ",'#13#10 + +'" # $@@.@@@@@ ",'#13#10'" # $$$@@@@@ ",'#13#10'" ' + +' # $$$@@@@ ",'#13#10'" # $$$# ",'#13#10'" # $$#' + +'# ",'#13#10'" # $$$# ",'#13#10'" # $### ' + +' ",'#13#10'" # $$### ",'#13#10'" #$$$#### ' + +' ",'#13#10'" $## ### ",'#13#10'" ### ' + +'"};'#13#10 +]); +LazarusResources.Add('TACSAudioOut','XPM',[ + '/* XPM */'#13#10'static char * TAudioOut_xpm[] = {'#13#10'"24 24 6 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #000000",'#13#10'"+'#9'c #000080",'#13#10'"@' + +#9'c #800000",'#13#10'"#'#9'c #00FFFF",'#13#10'"$'#9'c #0000FF",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" .. ' + +' ",'#13#10'" ++.. @ @ @ ",'#13#10'" +#. . @ ' + +'@ ",'#13#10'" +#.. . ",'#13#10'" +# . . @ @ @ ' + +' ",'#13#10'" .++# #.+ . @ @ ",'#13#10'" .+ $ # ..+ . ",' + +#13#10'" . #$# #. . . @ @ @ ",'#13#10'" .##$ # ... . @ @ ",'#13#10 + +'" .$$.# #..+ . ",'#13#10'" ...$# .+ . @ @ @ ",'#13#10'" ' + +' .$#. . @ @ ",'#13#10'" .$.. . ",'#13#10'" .$' + +'. . @ @ @ ",'#13#10'" .$.. @ @ ",'#13#10'" .. ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +'"};'#13#10 +]); +LazarusResources.Add('TACSCDIn','XPM',[ + '/* XPM */'#13#10'static char * TCDIn_xpm[] = {'#13#10'"24 24 7 1",'#13#10'" ' + +#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #000000",'#13#10'"@'#9'c' + +' #00FFFF",'#13#10'"#'#9'c #00FF00",'#13#10'"$'#9'c #FF0000",'#13#10'"%'#9'c' + +' #FFFF00",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" . ",' + +#13#10'" +++++ .. ",'#13#10'" ++@@###+ .$. ",'#13#10 + +'" + @@#### ....$$. ",'#13#10'" + @@####.$$$$$$$. ",'#13#10'" + ' + +' @@##%.$$$$$$$$. ",'#13#10'" + @@#%%.$$$$$$$$$. ",'#13#10'"+ ++' + +'+%%.$$$$$$$$. ",'#13#10'"+ + + .$$$$$$$. ",'#13#10'"+ + + .' + +'...$$. ",'#13#10'"+ + + .$. ",'#13#10'"+ %%+++ .. ' + +' ",'#13#10'" + %%%#@@ +. ",'#13#10'" + %%%##@@ + ' + +'",'#13#10'" +%%###@@@ + ",'#13#10'" +%####@@ + ",'#13 + +#10'" ++###@@++ ",'#13#10'" +++++ ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSAudioMixer','XPM',[ + '/* XPM */'#13#10'static char * TAudioMixer_xpm[] = {'#13#10'"24 24 5 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #0000FF",'#13#10'"+'#9'c #000080",'#13#10 + +'"@'#9'c #800000",'#13#10'"#'#9'c #00FFFF",'#13#10'" ' + +'",'#13#10'" .+ ",'#13#10'" @@@@@.+@@@@@ ",'#13 + +#10'" @@@ .+ @@@ ",'#13#10'" @ .+ #@ ",'#13#10'" ' + +'@ .+ # #@ ",'#13#10'" @ .+ # @ ",'#13#10'" @@ ' + +' .+ # @@ ",'#13#10'" @#@@@ .+ @@@ @ ",'#13#10'" @ # @@@@@' + +'@@@@@@@ . @ ",'#13#10'" @# .+ @ ",'#13#10'" @ # .+ ' + +' @ ",'#13#10'" @# .+ @ ",'#13#10'" @ # +++++ .+ +++++ ' + +' @ ",'#13#10'" @ +.....+.++++++++ @ ",'#13#10'" @ +.......+++......+ @ ",' + +#13#10'" @ +......+++.......+ @ ",'#13#10'" @@ +++++++.++.....+ @@ ",'#13#10 + +'" @ +++++ .+ +++++ @ ",'#13#10'" @ @ ",'#13#10'" @ ' + +' @ ",'#13#10'" @@@ @@@ ",'#13#10'" @@@' + +'@@@@@@@@@ ",'#13#10'" "};'#13#10 +]); +LazarusResources.Add('TACSRateConverter','XPM',[ + '/* XPM */'#13#10'static char * TRateConverter_xpm[] = {'#13#10'"24 24 4 1",' + +#13#10'" '#9'c None",'#13#10'".'#9'c #FF0000",'#13#10'"+'#9'c #000000",'#13 + +#10'"@'#9'c #0000FF",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'".. .. ' + +'.. ",'#13#10'" . . . . . .",'#13#10'" . . . . . ' + +' .",'#13#10'" . . . . . . ",'#13#10'" . . . . . . ",' + +#13#10'" .. .. .. ",'#13#10'" ",'#13#10 + +'" + + ",'#13#10'" + + +++ ",'#13#10'" ' + +' +++ + + ",'#13#10'" + + ",'#13#10'" ' + +' ",'#13#10'" @ @ @ @ @ ",'#13#10'" @ @ @ ' + +' @ @ ",'#13#10'"@ @ @ @ @ @ @ @ @ @ @ @ ",'#13#10'"@ @ @ @ @ @ @ @ @ @' + +' @ @ ",'#13#10'" @ @ @ @ @ @ ",'#13#10'" @ @ @ @ @ @ ' + +'",'#13#10'" ",'#13#10'" ",'#13 + +#10'" "};'#13#10 +]); +LazarusResources.Add('TACSMSConverter','XPM',[ + '/* XPM */'#13#10'static char * TMSConverter_xpm[] = {'#13#10'"24 24 3 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #808000",'#13#10'"+'#9'c #FF0000",'#13#10 + +'" ....... ",'#13#10'" . . ",'#13#10'" ' + +' . ... . ",'#13#10'" . ..... . ",'#13#10'" . ' + +'..... . ",'#13#10'" . ..... . ",'#13#10'" . ... ' + +' . ",'#13#10'" . . ",'#13#10'" . . ' + +' ",'#13#10'" ....... ",'#13#10'" + + ' + +'",'#13#10'" ++ + ",'#13#10'" + + + + ",'#13 + +#10'" + ++ ",'#13#10'" ....... + + ....... ",'#13#10'" ' + +'. . . . ",'#13#10'" . ... . . ... . ",'#13#10'" . ...' + +'.. . . ..... . ",'#13#10'" . ..... . . ..... . ",'#13#10'" . ..... . ' + +' . ..... . ",'#13#10'" . ... . . ... . ",'#13#10'" . . . ' + +' . ",'#13#10'" . . . . ",'#13#10'" ....... .......' + +' "};'#13#10 +]); +LazarusResources.Add('TACSSampleConverter','XPM',[ + '/* XPM */'#13#10'static char * TSampleConverter_xpm[] = {'#13#10'"24 24 4 1"' + +','#13#10'" '#9'c None",'#13#10'".'#9'c #0000FF",'#13#10'"+'#9'c #000080",' + +#13#10'"@'#9'c #000000",'#13#10'" ",'#13#10'"........' + +'................",'#13#10'" . . ",'#13#10'" . + + + ' + +'+ . + + +",'#13#10'" . + + + + . + + ",'#13#10'" . + + . ' + +' + ",'#13#10'" . + + + + . + + ",'#13#10'" . + + + + . + + ' + +'+",'#13#10'" . . ",'#13#10'"........................",' + +#13#10'" @ @ ",'#13#10'" @ @ @@@ ",'#13#10 + +'" @@@ @ @ ",'#13#10'" @ @ ",'#13#10'"....' + +'....................",'#13#10'" . . . ",'#13#10'" . + + ' + +'. + + . + +",'#13#10'" . + + . + + . + + ",'#13#10'" . + . +' + +' . + ",'#13#10'" . + + . + + . + + ",'#13#10'" . + + . + + . ' + +'+ +",'#13#10'" . . . ",'#13#10'"........................' + +'",'#13#10'" "};'#13#10 +]); +LazarusResources.Add('TACSFixedResampler','XPM',[ + '/* XPM */'#13#10'static char * TFixedResampler_xpm[] = {'#13#10'"24 24 4 1",' + +#13#10'" '#9'c None",'#13#10'".'#9'c #0000FF",'#13#10'"+'#9'c #FF0000",'#13 + +#10'"@'#9'c #000000",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" . . ",'#13#10'" ..' + +' . ",'#13#10'" . . ",'#13#10'" . . ",' + +#13#10'" ..... +++ ",'#13#10'" .. ++ ++ ",'#13#10 + +'" .. ++ ++ ",'#13#10'" ....... ++ ++ ",'#13#10'" .' + +'. ++ ",'#13#10'" .. @@@ ++ ",'#13#10'" .. ' + +'@@@ ++ ",'#13#10'" .. @@@ ++ ",'#13#10'" .. +' + +'+ ",'#13#10'" ....... +++++++ ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +'",'#13#10'" ",'#13#10'" ",'#13 + +#10'" "};'#13#10 +]); +LazarusResources.Add('TACSStereoBalance','XPM',[ + '/* XPM */'#13#10'static char * TStereoBalance_xpm[] = {'#13#10'"24 24 3 1",' + +#13#10'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #000000",'#13 + +#10'" ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" . . ",'#13#10'" .. ' + +' .. ",'#13#10'" ... ... ",'#13#10'" ...... ' + +'...... ",'#13#10'" ...... ...... ",'#13#10'" ...... .....' + +'. ",'#13#10'" ...... ...... ",'#13#10'" ... ... ",' + +#13#10'" .. .. ",'#13#10'" . . ",'#13#10 + +'" ++ ",'#13#10'" ++ ",'#13#10'" ' + +' ++ ",'#13#10'" +++++++ +++++++++ ",'#13#10'" ++++++' + +'+ +++++++++ ",'#13#10'" +++ ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSBWFilter','XPM',[ + '/* XPM */'#13#10'static char * TBWFilter_xpm[] = {'#13#10'"24 24 5 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #FFFF00",'#13#10'"+'#9'c #0000FF",'#13#10'"@' + +#9'c #FF0000",'#13#10'"#'#9'c #000000",'#13#10'" . ",' + +#13#10'" . . ",'#13#10'" ++ ++ ++ ",'#13#10 + +'" + + + + + + ",'#13#10'" ++++ + + ++++ ",'#13#10'" @' + +' @ ",'#13#10'" @ ### @ ",'#13#10'" @ # ' + +' # + @ ",'#13#10'" @ # # + @ ",'#13#10'" @ ### ' + +'++ @ ",'#13#10'" @ # # @ ",'#13#10'" @@@@@ # # @' + +'@@@@ ",'#13#10'" ### ",'#13#10'" @@@@@ # # @@@@@ ' + +'",'#13#10'" @ # # @ ",'#13#10'" @ # # # @ ",'#13 + +#10'" @ @@ # # # @ ",'#13#10'" @ @ # # # @ ",'#13#10'" ' + +' @ @@ # # @ ",'#13#10'" @ @ ",'#13#10'" @ ' + +' @ ",'#13#10'" ++++++++++++++++++++++ ",'#13#10'" ' + +' ",'#13#10'" "};'#13#10 +]); +LazarusResources.Add('TACSSINCFilter','XPM',[ + '/* XPM */'#13#10'static char * TSINCFilter_xpm[] = {'#13#10'"24 24 7 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #000000",'#13#10 + +'"@'#9'c #0000FF",'#13#10'"#'#9'c #008080",'#13#10'"$'#9'c #00FFFF",'#13#10 + +'"%'#9'c #000080",'#13#10'" ",'#13#10'" ... . . .' + +' ... ",'#13#10'" . . .. . . ",'#13#10'" .. . . . . ' + +' ",'#13#10'" . . . . . ",'#13#10'" ... . . . ... ' + +'",'#13#10'" ",'#13#10'" +++++++ ",'#13 + +#10'" +++@#@#@#@+++ ",'#13#10'" +@#@#@#@#@#@#$+ ",'#13#10'" ' + +' +%#@#@#@#@#@#@$%+ ",'#13#10'" +%%#@#@#@#@#@$$%+ ",'#13#10'" +' + +'+++@#@#@#@++++ ",'#13#10'" +$@+++++++@@+ ",'#13#10'" %$@@' + +'@@@@@@+ ",'#13#10'" %$@@@@@@+ ",'#13#10'" %$@@@@+' + +' ",'#13#10'" %@+++ ",'#13#10'" %$@@+ ' + +' ",'#13#10'" %$@@+ ",'#13#10'" %$@@+ ",' + +#13#10'" %$@@+ ",'#13#10'" %%% ",'#13#10 + +'" "};'#13#10 +]); +LazarusResources.Add('TACSConvolver','XPM',[ + '/* XPM */'#13#10'static char * TConvolver_xpm[] = {'#13#10'"24 24 4 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #FF0000",'#13#10'"+'#9'c #0000FF",'#13#10 + +'"@'#9'c #000000",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ' + +'",'#13#10'" ",'#13#10'" ",'#13 + +#10'" .. ",'#13#10'" . ",'#13#10'" ' + +' . ",'#13#10'" ++ + @ . .. ",'#13#10'" ++' + +' @ @ @ . . . ",'#13#10'" + @@@ .. . ",'#13#10'" + @ ' + +'@ @ . . ",'#13#10'" + + @ . . ",'#13#10'" + + ' + +'. .. ",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ",'#13#10'" ",' + +#13#10'" ",'#13#10'" ",'#13#10 + +'" "};'#13#10 +]); +LazarusResources.Add('TACSSoundIndicator','XPM',[ + '/* XPM */'#13#10'static char * TSoundIndicator_xpm[] = {'#13#10'"24 24 3 1",' + +#13#10'" '#9'c None",'#13#10'".'#9'c #000000",'#13#10'"+'#9'c #00FF00",'#13 + +#10'" ",'#13#10'" ",'#13#10'" ' + +' .................... ",'#13#10'" .................... ",'#13#10'" ....' + +'................ ",'#13#10'" .................... ",'#13#10'" .........' + +'........... ",'#13#10'" ....++.............. ",'#13#10'" ....++........' + +'...... ",'#13#10'" .................... ",'#13#10'" .++.++.++..........' + +'. ",'#13#10'" .++.++.++........... ",'#13#10'" .................... ",' + +#13#10'" .++.++.++.......++.. ",'#13#10'" .++.++.++.......++.. ",'#13#10 + +'" .................... ",'#13#10'" .++.++.++.++....++.. ",'#13#10'" .+' + +'+.++.++.++....++.. ",'#13#10'" .................... ",'#13#10'" .++.++.' + +'++.++.++.++.. ",'#13#10'" .++.++.++.++.++.++.. ",'#13#10'" ............' + +'........ ",'#13#10'" ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSMemoryIn','XPM',[ + '/* XPM */'#13#10'static char * TMemoryIn_xpm[] = {'#13#10'"24 24 7 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #FF0000",'#13#10'"@' + +#9'c #808000",'#13#10'"#'#9'c #800080",'#13#10'"$'#9'c #FFFF00",'#13#10'"%'#9 + +'c #000000",'#13#10'" . ",'#13#10'" .. ' + +' ",'#13#10'" .+. ",'#13#10'" ....++. "' + +','#13#10'" .+++++++. ",'#13#10'" .++++++++. ",'#13 + +#10'" .+++++++++. ",'#13#10'" @# @$ .++++++++. ",'#13#10'" ' + +' @%%% .+++++++. ",'#13#10'" @%%%%% @$ ....++. ",'#13#10'" @%%%' + +'%%%% .+. ",'#13#10'" @%%%%%%%%% @$ .. ",'#13#10'" %%%%%% %%%' + +'% . ",'#13#10'" $%%%%%% %%%% @$ ",'#13#10'" @ %%%%%%%%%%% ' + +' ",'#13#10'" $%%%%%%%%%%% @$ ",'#13#10'" @ %%%%%% %%% ' + +' ",'#13#10'" $%%%%% %%%% ",'#13#10'" @ %%%%%%%%% ",' + +#13#10'" $%%%%%%% ",'#13#10'" @ %%%%% ",'#13#10 + +'" $%%% ",'#13#10'" @ ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSAudioProcessor','XPM',[ + '/* XPM */'#13#10'static char * TAudioProcessor_xpm[] = {'#13#10'"24 24 9 1",' + +#13#10'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #FF0000",'#13 + +#10'"@'#9'c #808000",'#13#10'"#'#9'c #800080",'#13#10'"$'#9'c #FFFF00",'#13 + +#10'"%'#9'c #000000",'#13#10'"&'#9'c #000080",'#13#10'"*'#9'c #0000FF",'#13 + +#10'" ",'#13#10'" . ",'#13#10'" ' + +' .. ",'#13#10'" ..++. ",'#13#10'" ' + +' .+++++. ",'#13#10'" @# @$ .++++++.",'#13#10'" @%%%' + +' .+++++. ",'#13#10'" @%%%%% @$ ..++. ",'#13#10'" @%%%%%%% ' + +' .. ",'#13#10'" @%%%%%%%%% @$ . ",'#13#10'" %%%%%% %%%% ' + +' ",'#13#10'" $%%%%%% %%%% @$ ",'#13#10'" @ %%%%%%%%%%% ",' + +#13#10'" $%%%%%%%%%%% @$ ",'#13#10'" & %%%%%% %%% ",'#13#10 + +'" && $%%%%% %%%% ",'#13#10'" &&**& @ %%%%%%%%% ",'#13#10'"&***' + +'**& $%%%%%%% ",'#13#10'"&******& @ %%%%% ",'#13#10'"&*****& ' + +' $%%% ",'#13#10'" &&**& @ ",'#13#10'" && ' + +' ",'#13#10'" & ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSNULLOut','XPM',[ + '/* XPM */'#13#10'static char * TNULLOut_xpm[] = {'#13#10'"24 24 5 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #000080",'#13#10'"+'#9'c #0000FF",'#13#10'"@' + +#9'c #00FFFF",'#13#10'"#'#9'c #000000",'#13#10'" ",' + +#13#10'" . ",'#13#10'" .. ",'#13#10 + +'" .+. ",'#13#10'" ....++. ",'#13#10'" .++' + +'+++++. ",'#13#10'" .++++++++. ",'#13#10'" .+++++++' + +'++. ..... ",'#13#10'" .++++++++. +.+++++.+ ",'#13#10'" .+++++++. .' + +'.+++++@. ",'#13#10'" ....++. ...+++++@.. ",'#13#10'" .+. ...++++' + +'+@.# ",'#13#10'" .. ....+++.... ",'#13#10'" . .@+.....++. ' + +'",'#13#10'" .@++++++++. ",'#13#10'" .@++++++++# ",'#13 + +#10'" ...+++++... ",'#13#10'" .@+.....++. ",'#13#10'" ' + +' .@++++++++. ",'#13#10'" ...+++++... ",'#13#10'" ' + +' .@+.....++. ",'#13#10'" +.@++++++.+ ",'#13#10'" ' + +' +.+++++.+ ",'#13#10'" ..... "};'#13#10 +]); +LazarusResources.Add('TACSInputList','XPM',[ + '/* XPM */'#13#10'static char * TInputList_xpm[] = {'#13#10'"24 24 5 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #FFFF00",'#13#10 + +'"@'#9'c #000000",'#13#10'"#'#9'c #FF0000",'#13#10'" ' + +'",'#13#10'" ... ",'#13#10'" . . ",'#13 + +#10'" . . ",'#13#10'" . +.@ ",'#13#10'" ' + +' . ++.@ ",'#13#10'" .....@ . ",'#13#10'" @@@' + +'@@ .. ",'#13#10'" .#. ",'#13#10'" ... ' + +'....##. ",'#13#10'" . . .#######. ",'#13#10'" . . .#####' + +'###. ",'#13#10'" . +.@ .#########. ",'#13#10'" . ++.@ .########. ' + +' ",'#13#10'" .....@ .#######. ",'#13#10'" @@@@@ ....##. ",' + +#13#10'" .#. ",'#13#10'" ... .. ",'#13#10 + +'" . . . ",'#13#10'" . . ",'#13#10'" . ' + +' +.@ ",'#13#10'" . ++.@ ",'#13#10'" .....@ ' + +' ",'#13#10'" @@@@@ "};'#13#10 +]); +LazarusResources.Add('TACSStreamIn','XPM',[ + '/* XPM */'#13#10'static char * TStreamIn_xpm[] = {'#13#10'"24 24 8 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #800000",'#13#10'"+'#9'c #FF0000",'#13#10'"@' + +#9'c #0000FF",'#13#10'"#'#9'c #000080",'#13#10'"$'#9'c #00FFFF",'#13#10'"%'#9 + +'c #008080",'#13#10'"&'#9'c #000000",'#13#10'" . ",'#13 + +#10'" .. ",'#13#10'" .+. ",'#13#10'" ' + +' ....++. ",'#13#10'" .+++++++. ",'#13#10'" ' + +' .++++++++. ",'#13#10'" .+++++++++. ",'#13#10'" @# @$ ' + +' .++++++++. ",'#13#10'" @### .+++++++. ",'#13#10'" @##### @$ ...' + +'.++. ",'#13#10'" @####### .+. ",'#13#10'" @####%#### @$ .. ' + +' ",'#13#10'" &@####$#### . ",'#13#10'" $&@####$#### @$ ",' + +#13#10'" & &@######### ",'#13#10'" $&@####%#### @$ ",'#13#10 + +'" & &@####$$### ",'#13#10'" $&####$$#### ",'#13#10'" ' + +' & &#######& ",'#13#10'" $&#####& ",'#13#10'" & ' + +'&###& ",'#13#10'" $&#& ",'#13#10'" & ' + +' ",'#13#10'" "};'#13#10 +]); +LazarusResources.Add('TACSStreamOut','XPM',[ + '/* XPM */'#13#10'static char * TStreamOut_xpm[] = {'#13#10'"24 24 6 1",'#13 + +#10'" '#9'c None",'#13#10'".'#9'c #0000FF",'#13#10'"+'#9'c #000080",'#13#10 + +'"@'#9'c #00FFFF",'#13#10'"#'#9'c #008080",'#13#10'"$'#9'c #000000",'#13#10 + +'" .+ .@ ",'#13#10'" .+++ ",'#13#10'" ' + +' .+++++ .@ ",'#13#10'" .+++++++ ",'#13#10'" .+' + +'+++#++++ .@ ",'#13#10'" $.++++@++++ ",'#13#10'" @$.++++' + +'@++++ .@ ",'#13#10'" $ $.+++++++++ ",'#13#10'" @$.++++#++' + +'++ .@",'#13#10'" $ $.++++@@+++ ",'#13#10'" + @$++++@@++++ ' + +'",'#13#10'" ++ $ $+++++++$ ",'#13#10'" +.+ @$+++++$ ",'#13 + +#10'" ++++..+ $ $+++$ ",'#13#10'"+.......+ @$+$ ",'#13#10'"+' + +'........+ $ ",'#13#10'"+.........+ ",'#13#10'"+.....' + +'...+ ",'#13#10'"+.......+ ",'#13#10'" ++++..+ ' + +' ",'#13#10'" +.+ ",'#13#10'" ++ ' + +' ",'#13#10'" + ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSFileIn','XPM',[ + '/* XPM */'#13#10'static char * TFileIn_xpm[] = {'#13#10'"24 24 4 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #FFFFFF",'#13#10'"+'#9'c #FF0000",'#13#10'"@' + +#9'c #FFFF00",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ........... ",'#13#10'" ............. ' + +' ",'#13#10'" .............. ",'#13#10'" ............... ",' + +#13#10'" ................ ",'#13#10'" ................+ ",'#13#10 + +'" ................++ ",'#13#10'" ................+++ ",'#13#10'" ...' + +'..........+++++++ ",'#13#10'" ............+++++++++ ",'#13#10'" ........' + +'....++++++++++ ",'#13#10'" ............+++++++++++",'#13#10'" ............+' + +'+++++++++ ",'#13#10'" ............+++++++++ ",'#13#10'" .............+++++' + +'++ ",'#13#10'" ..............@.+++ ",'#13#10'" ...........@.@.@++ ' + +'",'#13#10'" ....@.@..@@.@.@.+ ",'#13#10'" ..@.@.@.@@.@.@.@. ",'#13 + +#10'" ............... ",'#13#10'" ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSFileOut','XPM',[ + '/* XPM */'#13#10'static char * TFileOut_xpm[] = {'#13#10'"24 24 4 1",'#13#10 + +'" '#9'c None",'#13#10'".'#9'c #FFFFFF",'#13#10'"+'#9'c #0000FF",'#13#10'"@' + +#9'c #FFFF00",'#13#10'" ",'#13#10'" ' + +' ",'#13#10'" ........... ",'#13#10'" ............. ' + +' ",'#13#10'" .............. ",'#13#10'" ............... ",' + +#13#10'" ................ ",'#13#10'" + ................. ",'#13#10 + +'" ++................. ",'#13#10'" +++................ ",'#13#10'" +++' + +'++++............... ",'#13#10'"+++++++++.............. ",'#13#10'"+++++++++' + +'+...........@. ",'#13#10'"+++++++++++............ ",'#13#10'"++++++++++....' + +'.......@. ",'#13#10'"+++++++++...........@.. ",'#13#10'" +++++++...........' + +'..@. ",'#13#10'" +++............@@.. ",'#13#10'" ++............@@.@. ' + +'",'#13#10'" + .....@.@..@...@.. ",'#13#10'" ..@.@.@.@@.@.@.@. ",'#13 + +#10'" ............... ",'#13#10'" ",'#13#10'" ' + +' "};'#13#10 +]); +LazarusResources.Add('TACSMixer','XPM',[ + '/* XPM */'#13#10'static char * TMixer_xpm[] = {'#13#10'"24 24 2 1",'#13#10'"' + +' '#9'c None",'#13#10'".'#9'c #000000",'#13#10'" ",' + +#13#10'" ",'#13#10'" . ",'#13#10 + +'" . . . . ",'#13#10'" . . . . ",'#13#10'" ' + +' . . . . ",'#13#10'" . . .. . ",'#13#10'" . ' + +' . ...... . ",'#13#10'" . . .. . ",'#13#10'" .. . ' + +' . . ",'#13#10'" ...... . . . ",'#13#10'" .. . . ' + +' . ",'#13#10'" . . . . ",'#13#10'" . . . . ' + +'",'#13#10'" . .. . . ",'#13#10'" . ...... . . ",'#13 + +#10'" . .. . . ",'#13#10'" . . . . ",'#13#10'" ' + +' . . . . ",'#13#10'" . . . . ",'#13#10'" .' + +' . . . ",'#13#10'" . ",'#13#10'" ..........' + +'............ ",'#13#10'" "};'#13#10 +]); diff --git a/components/acs/Src/win32/acs_reg.pas b/components/acs/Src/win32/acs_reg.pas new file mode 100644 index 000000000..1e9b8b82f --- /dev/null +++ b/components/acs/Src/win32/acs_reg.pas @@ -0,0 +1,75 @@ +(* +$Log: acs_reg.pas,v $ +Revision 1.16 2006/07/04 17:12:45 z0m3ie +ACS 2.4 alt wiederhergestellt (unterschiedliche Sampleformate ...) + +Revision 1.13 2005/12/19 18:37:41 z0m3ie +*** empty log message *** + +Revision 1.11 2005/12/18 17:01:53 z0m3ie +delphi compatibility + +Revision 1.10 2005/12/04 16:54:33 z0m3ie +All classes are renamed, Style TACS... than T... to avoid conflicts with other components (eg TMixer is TACSMixer now) + +Revision 1.9 2005/11/27 16:50:33 z0m3ie +add ACS VolumeQuerry +make ACS_VolumeQuerry localizeable +some little errorfixes (buffersize for linuxdrivers was initially 0) +make TAudioIn workable + +Revision 1.8 2005/10/02 16:51:58 z0m3ie +*** empty log message *** + +Revision 1.7 2005/09/13 21:54:11 z0m3ie +acs is localizeable now (ACS_Strings) + +Revision 1.6 2005/09/12 22:04:52 z0m3ie +modified structure again, fileformats are now in an sperat folder. +all File In/Out classes are capsulated from TFileIn and TFileOut + +Revision 1.5 2005/08/26 17:03:20 z0m3ie +begon to make acs resourcestring aware +more advanced tmixer for windows +restructured tmixer its better handleable now + +Revision 1.4 2005/08/25 21:06:29 z0m3ie +Added TMultiMixer + +Revision 1.3 2005/08/25 20:15:37 z0m3ie +Version 2.4 restructure +*) + +unit acs_reg; + +interface + +uses + Classes, ACS_Audio, + ACS_CDROM, ACS_AudioMix, ACS_Converters, ACS_Misc, ACS_File, ACS_Filters, + ACS_Streams, ACS_Indicator, ACS_Mixer,ACS_MultiMix,ACS_VolumeQuery + {$IFDEF FPC} + ,LResources + {$ENDIF}; + + procedure Register(); + +implementation + +procedure Register(); +begin + RegisterComponents('Audio I/O', [TACSAudioIn, TACSAudioOut,TACSMixer, + TACSCDIn,TACSInputList, TACSMemoryIn, TACSFileIn, TACSFileOut, TACSStreamIn, TACSStreamOut, TACSNULLOut]); + RegisterComponents('Audio Processing', [TACSAudioMixer,TACSMultiMixer, TACSSampleConverter, TACSRateConverter, + TACSMSConverter, TACSAudioProcessor, TACSBWFilter, TACSSincFilter, TACSSoundIndicator, TACSStereoBalance, TACSConvolver,TACSVolumeQuery]); +end; + +initialization +{$IFDEF FPC} +{$i ..\resources\acs_reg.lrs} +{$ELSE} +{$R ..\resources\resource.dcr} +{$ENDIF} + + +end. diff --git a/components/acs/Src/win32/laz_acs.lpk b/components/acs/Src/win32/laz_acs.lpk new file mode 100644 index 000000000..fba45e111 --- /dev/null +++ b/components/acs/Src/win32/laz_acs.lpk @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +